Skip to content

Commit 262ce83

Browse files
authored
Merge pull request #454 from HarperDB/stage
v4.8.13
2 parents 9daa75f + d8463b5 commit 262ce83

File tree

10 files changed

+163
-135
lines changed

10 files changed

+163
-135
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "harperdb-studio",
3-
"version": "4.8.12",
3+
"version": "4.8.13",
44
"description": "A UI for HarperDB",
55
"deploymentUrl": "studio.harperdb.io",
66
"private": true,

src/components/auth/AuthLayout.jsx

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { Outlet } from 'react-router';
2+
import { Col, Container, Row } from 'reactstrap';
3+
4+
function AuthLayout({ children }) {
5+
return (
6+
<Container fluid="xs" className="h-100">
7+
<Row xs="1" sm="2" className="h-100">
8+
<Col className="p-5 auth-studio-info d-none d-sm-flex justify-content-center align-items-center">
9+
<div className="auth-studio-info-container">
10+
<h1 className="auth-title">HarperDB Studio</h1>
11+
<span className="mb-4 auth-subtitle d-inline-block">Manage all your HarperDB instances.</span>
12+
<ul className="auth-info-list-items">
13+
<li>
14+
<h3 className="item-title">Manage All Instances</h3>
15+
<span className="item-subtitle">Set access, cluster, monitor, and more.</span>
16+
</li>
17+
<li>
18+
<h3 className="item-title">Embedded API Server</h3>
19+
<span className="item-subtitle">HarperDB components give you unlimited application flexibility.</span>
20+
</li>
21+
<li>
22+
<h3 className="item-title">Fully Managed Cloud & 5G Instances</h3>
23+
<span className="item-subtitle">Go from zero to code in minutes.</span>
24+
</li>
25+
<li>
26+
<h3 className="item-title">Deploy Anywhere</h3>
27+
<div className="mt-3">
28+
<a
29+
href="https://hub.docker.com/r/harperdb/harperdb"
30+
target="_blank"
31+
rel="noreferrer"
32+
className="deploy-subitem"
33+
>
34+
Docker
35+
</a>
36+
<a
37+
href="https://www.npmjs.com/package/harperdb"
38+
target="_blank"
39+
rel="noreferrer"
40+
className="deploy-subitem"
41+
>
42+
npm
43+
</a>
44+
<a
45+
href="https://docs.harperdb.io/docs/deployments/install-harperdb"
46+
target="_blank"
47+
rel="noreferrer"
48+
className="deploy-subitem"
49+
>
50+
all options
51+
</a>
52+
</div>
53+
</li>
54+
</ul>
55+
</div>
56+
</Col>
57+
<Col className="p-5 d-flex justify-content-center align-items-center auth-form-container">
58+
<Outlet />
59+
</Col>
60+
</Row>
61+
</Container>
62+
);
63+
}
64+
65+
export default AuthLayout;

src/components/instance/browse/BrowseDatatable.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let controller;
1818
let controller2;
1919
let controller3;
2020

21-
function BrowseDatatable({ tableState, setTableState, activeTable, tableDescriptionAttributes }) {
21+
function BrowseDatatable({ tableState, setTableState, activeTable }) {
2222
const navigate = useNavigate();
2323
const { compute_stack_id, schema, table, customer_id } = useParams();
2424
const auth = useStoreState(instanceState, (s) => s.auth);
@@ -74,6 +74,7 @@ function BrowseDatatable({ tableState, setTableState, activeTable, tableDescript
7474
hashAttribute,
7575
dynamicAttributesFromDataTable,
7676
dataTableColumns,
77+
schemaAttributes,
7778
error,
7879
} = await getTableData({
7980
schema,
@@ -114,6 +115,7 @@ function BrowseDatatable({ tableState, setTableState, activeTable, tableDescript
114115
hashAttribute,
115116
dataTableColumns,
116117
dynamicAttributesFromDataTable,
118+
schemaAttributes,
117119
error,
118120
});
119121
}
@@ -175,7 +177,7 @@ function BrowseDatatable({ tableState, setTableState, activeTable, tableDescript
175177
columns={tableState.dataTableColumns || []}
176178
data={tableState.tableData || []}
177179
error={tableState.error}
178-
tableDescriptionAttributes={tableDescriptionAttributes}
180+
tableDescriptionAttributes={tableState.schemaAttributes}
179181
dynamicAttributesFromDataTable={tableState.dynamicAttributesFromDataTable}
180182
currentPage={tableState.page}
181183
pageSize={tableState.pageSize}

src/components/instance/browse/EntityManagerRow.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ function EntityManagerRow({ item, itemType, baseUrl, isActive, toggleDropItem, i
5858
toggleConfirmDropItem(false);
5959
};
6060

61+
const syncInstanceStructure = () => {
62+
buildInstanceStructure({ auth, url });
63+
};
6164
const handleSetActive = () =>
6265
isActive || isDropping || isConfirmingDropItem ? false : navigate(`${baseUrl}/${item}`);
6366

@@ -66,7 +69,10 @@ function EntityManagerRow({ item, itemType, baseUrl, isActive, toggleDropItem, i
6669
key={item}
6770
title={`View${isActive ? 'ing' : ''} ${itemType} ${item}`}
6871
className={`item-row ${isActive ? 'active' : ''}`}
69-
onClick={handleSetActive}
72+
onClick={() => {
73+
handleSetActive();
74+
syncInstanceStructure();
75+
}}
7076
tabIndex="0"
7177
>
7278
<Col className={`item-label ${isConfirmingDropItem ? 'text-danger text-nowrap' : ''}`}>
@@ -86,7 +92,7 @@ function EntityManagerRow({ item, itemType, baseUrl, isActive, toggleDropItem, i
8692
title={`confirm drop ${itemType} ${item}`}
8793
onClick={confirmItemForDrop}
8894
>
89-
<i className="fa fa-check text-white" />
95+
<i className="text-white fa fa-check" />
9096
</Button>
9197
<Button
9298
id="cancelDropItem"
@@ -95,7 +101,7 @@ function EntityManagerRow({ item, itemType, baseUrl, isActive, toggleDropItem, i
95101
title={`Cancel drop ${itemType} ${item}`}
96102
onClick={cancelConfirmDrop}
97103
>
98-
<i className="fa fa-times text-white" />
104+
<i className="text-white fa fa-times" />
99105
</Button>
100106
</>
101107
) : isDropping ? (
@@ -106,7 +112,7 @@ function EntityManagerRow({ item, itemType, baseUrl, isActive, toggleDropItem, i
106112
title={`Drop ${itemType} ${item}`}
107113
onClick={selectItemForDrop}
108114
>
109-
<i className="fa fa-minus text-white" />
115+
<i className="text-white fa fa-minus" />
110116
</Button>
111117
) : isActive ? (
112118
<Button tabIndex="-1" color="purple" className="round">

src/components/instance/browse/index.js

+6-35
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ import { useStoreState } from 'pullstate';
55
import { ErrorBoundary } from 'react-error-boundary';
66

77
import instanceState from '../../../functions/state/instanceState';
8-
import describeTable from '../../../functions/api/instance/describeTable';
98

109
import ErrorFallback from '../../shared/ErrorFallback';
1110
import addError from '../../../functions/api/lms/addError';
1211
import useInstanceAuth from '../../../functions/state/instanceAuths';
1312
import EmptyPrompt from '../../shared/EmptyPrompt';
14-
import buildInstanceStructure from '../../../functions/instance/browse/buildInstanceStructure';
1513
import { clearTableDescriptionCache } from '../../../functions/instance/state/describeTableCache';
1614

17-
const DataTable = lazy(() => import(/* webpackChunkName: "browse-datatable" */ './BrowseDatatable'));
15+
const BrowseDatatable = lazy(() => import(/* webpackChunkName: "browse-datatable" */ './BrowseDatatable'));
1816
const EntityManager = lazy(() => import(/* webpackChunkName: "browse-entitymanager" */ './EntityManager'));
1917
const JSONEditor = lazy(() => import(/* webpackChunkName: "browse-jsonviewer" */ './JSONEditor'));
2018
const CSVUpload = lazy(() => import(/* webpackChunkName: "browse-csvupload" */ './CsvUpload'));
@@ -40,7 +38,7 @@ function NoPrimaryKeyMessage({ table }) {
4038
<Card className="my-3 missing-primary-key">
4139
<CardBody>
4240
<CardTitle>No Primary Key</CardTitle>
43-
<i className="fa fa-warning mt-3" />
41+
<i className="mt-3 fa fa-warning" />
4442
<span className="mt-3">
4543
The table {`'${table}'`} does not have a primary key. The HarperDB Studio does not currently support tables
4644
without a primary key defined. Please see the{' '}
@@ -59,16 +57,13 @@ function BrowseIndex() {
5957
const location = useLocation();
6058
const { schema, table, action, customer_id, compute_stack_id } = useParams();
6159
const [instanceAuths] = useInstanceAuth({});
62-
const auth = instanceAuths?.[compute_stack_id];
63-
const url = useStoreState(instanceState, (s) => s.url);
6460
const registration = useStoreState(instanceState, (s) => s.registration);
6561
const version = registration?.version;
6662
const [major, minor] = version?.split('.') || [];
6763
const versionAsFloat = `${major}.${minor}`;
6864
const structure = useStoreState(instanceState, (s) => s.structure);
6965
const [entities, setEntities] = useState({ schemas: [], tables: [], activeTable: false });
7066
const [tableState, setTableState] = useState(defaultTableState);
71-
const [tableDescription, setTableDescription] = useState(null);
7267
const baseUrl = `/o/${customer_id}/i/${compute_stack_id}/browse`;
7368
const showForm = instanceAuths[compute_stack_id]?.super || instanceAuths[compute_stack_id]?.structure === true;
7469
const showTableForm =
@@ -81,29 +76,11 @@ function BrowseIndex() {
8176
: "This user has not been granted access to any tables. A super-user must update this user's role.";
8277
const [hasHashAttr, setHasHashAttr] = useState(true);
8378

84-
const syncInstanceStructure = () => {
85-
buildInstanceStructure({ auth, url });
86-
};
87-
88-
useEffect(() => {
89-
const fetchDescribeTable = async () => {
90-
if (table) {
91-
try {
92-
const result = await describeTable({ auth, url, schema, table });
93-
setTableDescription(result);
94-
} catch (e) {
95-
addError(e);
96-
}
97-
}
98-
};
99-
fetchDescribeTable();
100-
}, [auth, url, schema, table]);
101-
10279
useEffect(() => {
103-
if (tableDescription) {
104-
setHasHashAttr(Boolean(tableDescription.hash_attribute));
80+
if (tableState) {
81+
setHasHashAttr(Boolean(tableState.hashAttribute));
10582
}
106-
}, [tableDescription]);
83+
}, [tableState]);
10784

10885
const validate = () => {
10986
if (structure) {
@@ -146,7 +123,6 @@ function BrowseIndex() {
146123

147124
// eslint-disable-next-line
148125
useEffect(validate, [structure, schema, table, compute_stack_id]);
149-
useEffect(syncInstanceStructure, [auth, url, schema, table]);
150126
useEffect(() => {
151127
const clearTableDescriptionCacheInterval = setInterval(() => {
152128
clearTableDescriptionCache();
@@ -198,12 +174,7 @@ function BrowseIndex() {
198174
) : schema && table && action && entities.activeTable ? (
199175
<JSONEditor newEntityAttributes={tableState.newEntityAttributes} hashAttribute={tableState.hashAttribute} />
200176
) : schema && table && entities.activeTable ? (
201-
<DataTable
202-
activeTable={entities.activeTable}
203-
tableDescriptionAttributes={tableDescription?.attributes}
204-
tableState={tableState}
205-
setTableState={setTableState}
206-
/>
177+
<BrowseDatatable activeTable={entities.activeTable} tableState={tableState} setTableState={setTableState} />
207178
) : schema && table && !hasHashAttr ? (
208179
<NoPrimaryKeyMessage />
209180
) : (

src/components/instance/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ function InstanceIndex() {
6868
if (thisInstance && instanceAuth) {
6969
instanceState.update(() => thisInstance);
7070
const { error } = await buildInstanceStructure({ auth: instanceAuth, url: thisInstance.url });
71-
await registrationInfo({ auth: instanceAuth, url: thisInstance.url });
7271
setLoadingInstance(false);
7372
if (error) {
7473
if (config.is_local_studio) {

0 commit comments

Comments
 (0)