From d1766bf999bc65ee80bd86e14afd8a305ff1e651 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Fri, 1 May 2020 19:58:33 +0200 Subject: [PATCH] loaders --- packages/api/src/controllers/metadata.js | 1 - packages/web/src/datagrid/DataGridCore.js | 10 +++++++++- packages/web/src/utility/metadataLoaders.js | 2 +- packages/web/src/widgets/DatabaseWidget.js | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/api/src/controllers/metadata.js b/packages/api/src/controllers/metadata.js index 5be4cea0..093914a7 100644 --- a/packages/api/src/controllers/metadata.js +++ b/packages/api/src/controllers/metadata.js @@ -22,7 +22,6 @@ module.exports = { (res, type) => ({ ...res, [type]: pickObjectNames(opened.structure[type]), - status: opened.status, }), {} ); diff --git a/packages/web/src/datagrid/DataGridCore.js b/packages/web/src/datagrid/DataGridCore.js index 189317ed..b41f1e0b 100644 --- a/packages/web/src/datagrid/DataGridCore.js +++ b/packages/web/src/datagrid/DataGridCore.js @@ -446,7 +446,15 @@ export default function DataGridCore(props) { } }, [display && display.focusedColumn]); - if (!loadedRows || !columns) return null; + if (!loadedRows || !columns || columns.length == 0) + return ( + + + + + + ); + const insertedRows = getChangeSetInsertedRows(changeSet, display.baseTable); const rowCountNewIncluded = loadedRows.length + insertedRows.length; diff --git a/packages/web/src/utility/metadataLoaders.js b/packages/web/src/utility/metadataLoaders.js index 57651931..0f19e236 100644 --- a/packages/web/src/utility/metadataLoaders.js +++ b/packages/web/src/utility/metadataLoaders.js @@ -24,7 +24,7 @@ const connectionInfoLoader = ({ conid }) => ({ const sqlObjectListLoader = ({ conid, database }) => ({ url: 'metadata/list-objects', params: { conid, database }, - reloadTrigger: [`database-structure-changed-${conid}-${database}`, `database-status-changed-${conid}-${database}`], + reloadTrigger: `database-structure-changed-${conid}-${database}`, }); const databaseStatusLoader = ({ conid, database }) => ({ diff --git a/packages/web/src/widgets/DatabaseWidget.js b/packages/web/src/widgets/DatabaseWidget.js index 992fe53c..74697a6b 100644 --- a/packages/web/src/widgets/DatabaseWidget.js +++ b/packages/web/src/widgets/DatabaseWidget.js @@ -7,7 +7,7 @@ import databaseAppObject from '../appobj/databaseAppObject'; import { useSetCurrentDatabase, useCurrentDatabase, useOpenedConnections } from '../utility/globalState'; import InlineButton from './InlineButton'; import databaseObjectAppObject from '../appobj/databaseObjectAppObject'; -import { useSqlObjectList, useDatabaseList, useConnectionList, useServerStatus } from '../utility/metadataLoaders'; +import { useSqlObjectList, useDatabaseList, useConnectionList, useServerStatus, useDatabaseStatus } from '../utility/metadataLoaders'; import { SearchBoxWrapper, InnerContainer, Input, MainContainer, OuterContainer, WidgetTitle } from './WidgetStyles'; import axios from '../utility/axios'; import LoadingInfo from './LoadingInfo'; @@ -69,7 +69,7 @@ function ConnectionList() { function SqlObjectList({ conid, database }) { const objects = useSqlObjectList({ conid, database }); - const { status } = objects || {}; + const status = useDatabaseStatus({ conid, database }); const handleRefreshDatabase = () => { axios.post('database-connections/refresh', { conid, database });