ydb-embedded-ui 6.6.1 → 6.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/package.json +2 -1
- package/dist/src/containers/App/App.d.ts +1 -1
- package/dist/src/containers/App/Content.js +1 -1
- package/dist/src/containers/App/appSlots.d.ts +1 -1
- package/dist/src/containers/AsideNavigation/Navigation.js +1 -3
- package/dist/src/containers/AsideNavigation/i18n/en.json +0 -2
- package/dist/src/containers/AsideNavigation/i18n/index.d.ts +1 -1
- package/dist/src/containers/AsideNavigation/i18n/index.js +1 -2
- package/dist/src/containers/Cluster/i18n/index.d.ts +1 -1
- package/dist/src/containers/Clusters/constants.d.ts +1 -1
- package/dist/src/containers/Header/Header.js +17 -21
- package/dist/src/containers/Header/Header.scss +14 -5
- package/dist/src/containers/Header/breadcrumbs.js +65 -71
- package/dist/src/containers/Heatmap/Heatmap.js +3 -3
- package/dist/src/containers/Nodes/Nodes.js +4 -4
- package/dist/src/containers/Nodes/VirtualNodes.js +2 -2
- package/dist/src/containers/Storage/Storage.js +2 -2
- package/dist/src/containers/Tablets/Tablets.js +8 -8
- package/dist/src/containers/TabletsFilters/TabletsFilters.d.ts +2 -57
- package/dist/src/containers/TabletsFilters/TabletsFilters.js +70 -180
- package/dist/src/containers/Tenant/Acl/Acl.d.ts +3 -1
- package/dist/src/containers/Tenant/Acl/Acl.js +7 -17
- package/dist/src/containers/Tenant/Diagnostics/Autorefresh/AutorefreshControl.js +4 -5
- package/dist/src/containers/Tenant/Diagnostics/Consumers/Consumers.js +3 -3
- package/dist/src/containers/Tenant/Diagnostics/Describe/Describe.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/Describe/Describe.js +5 -6
- package/dist/src/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.d.ts +1 -0
- package/dist/src/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.js +3 -5
- package/dist/src/containers/Tenant/Diagnostics/Diagnostics.d.ts +2 -0
- package/dist/src/containers/Tenant/Diagnostics/Diagnostics.js +26 -50
- package/dist/src/containers/Tenant/Diagnostics/Diagnostics.scss +1 -1
- package/dist/src/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +19 -58
- package/dist/src/containers/Tenant/Diagnostics/Network/Network.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/Network/Network.js +5 -5
- package/dist/src/containers/Tenant/Diagnostics/Overview/AsyncReplicationInfo/AsyncReplicationInfo.js +1 -6
- package/dist/src/containers/Tenant/Diagnostics/Overview/ChangefeedInfo/ChangefeedInfo.d.ts +2 -1
- package/dist/src/containers/Tenant/Diagnostics/Overview/ChangefeedInfo/ChangefeedInfo.js +3 -8
- package/dist/src/containers/Tenant/Diagnostics/Overview/Overview.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/Overview/Overview.js +19 -21
- package/dist/src/containers/Tenant/Diagnostics/Overview/TableInfo/TableInfo.scss +0 -2
- package/dist/src/containers/Tenant/Diagnostics/Overview/TopicInfo/TopicInfo.d.ts +2 -1
- package/dist/src/containers/Tenant/Diagnostics/Overview/TopicInfo/TopicInfo.js +3 -8
- package/dist/src/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.d.ts +3 -1
- package/dist/src/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.js +5 -5
- package/dist/src/containers/Tenant/Diagnostics/Partitions/Partitions.js +4 -12
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/Healthcheck.scss +48 -57
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckDetails.d.ts +2 -5
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckDetails.js +7 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckPreview.d.ts +1 -6
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckPreview.js +22 -16
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.d.ts +2 -8
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.js +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TenantCpu.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TenantCpu.js +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopNodesByCpu.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopNodesByCpu.js +4 -4
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopNodesByLoad.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopNodesByLoad.js +4 -4
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.js +4 -4
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopShards.d.ts +2 -1
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopShards.js +5 -5
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantDashboard/TenantDashboard.js +3 -3
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TenantMemory.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TenantMemory.js +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TopNodesByMemory.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantMemory/TopNodesByMemory.js +4 -4
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +7 -9
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TopGroups.js +3 -3
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TopTables.js +3 -3
- package/dist/src/containers/Tenant/Diagnostics/TenantOverview/useHealthcheck.js +1 -1
- package/dist/src/containers/Tenant/Diagnostics/TopQueries/TopQueries.d.ts +2 -2
- package/dist/src/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +5 -5
- package/dist/src/containers/Tenant/Diagnostics/TopShards/TopShards.d.ts +3 -2
- package/dist/src/containers/Tenant/Diagnostics/TopShards/TopShards.js +8 -8
- package/dist/src/containers/Tenant/Info/ExternalDataSource/ExternalDataSource.js +0 -6
- package/dist/src/containers/Tenant/Info/ExternalTable/ExternalTable.js +0 -6
- package/dist/src/containers/Tenant/Info/View/View.js +0 -6
- package/dist/src/containers/Tenant/ObjectGeneral/ObjectGeneral.d.ts +2 -1
- package/dist/src/containers/Tenant/ObjectGeneral/ObjectGeneral.js +7 -13
- package/dist/src/containers/Tenant/ObjectSummary/ObjectSummary.d.ts +4 -4
- package/dist/src/containers/Tenant/ObjectSummary/ObjectSummary.js +159 -63
- package/dist/src/containers/Tenant/Query/Issues/Issues.js +6 -5
- package/dist/src/containers/Tenant/Query/Preview/Preview.d.ts +2 -1
- package/dist/src/containers/Tenant/Query/Preview/Preview.js +6 -6
- package/dist/src/containers/Tenant/Query/Query.d.ts +1 -0
- package/dist/src/containers/Tenant/Query/Query.scss +1 -1
- package/dist/src/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +2 -0
- package/dist/src/containers/Tenant/Query/QueryEditor/QueryEditor.js +9 -22
- package/dist/src/containers/Tenant/Query/i18n/en.json +1 -1
- package/dist/src/containers/Tenant/Schema/SchemaTree/SchemaTree.d.ts +1 -0
- package/dist/src/containers/Tenant/Schema/SchemaTree/SchemaTree.js +11 -19
- package/dist/src/containers/Tenant/Schema/SchemaViewer/SchemaViewer.d.ts +2 -2
- package/dist/src/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +13 -8
- package/dist/src/containers/Tenant/Schema/SchemaViewer/columns.d.ts +2 -1
- package/dist/src/containers/Tenant/Schema/SchemaViewer/columns.js +21 -2
- package/dist/src/containers/Tenant/Schema/SchemaViewer/i18n/en.json +1 -0
- package/dist/src/containers/Tenant/Schema/SchemaViewer/i18n/index.d.ts +1 -1
- package/dist/src/containers/Tenant/Schema/SchemaViewer/prepareData.js +2 -1
- package/dist/src/containers/Tenant/Schema/SchemaViewer/types.d.ts +1 -0
- package/dist/src/containers/Tenant/Tenant.js +20 -36
- package/dist/src/containers/Tenant/Tenant.scss +4 -0
- package/dist/src/containers/Tenant/TenantNavigation/TenantNavigation.d.ts +2 -0
- package/dist/src/containers/Tenant/TenantNavigation/TenantNavigation.js +19 -0
- package/dist/src/containers/Tenant/TenantNavigation/TenantNavigation.scss +18 -0
- package/dist/src/containers/Tenant/TenantNavigation/useTenantNavigation.d.ts +9 -0
- package/dist/src/containers/Tenant/TenantNavigation/useTenantNavigation.js +44 -0
- package/dist/src/containers/Tenant/i18n/en.json +17 -0
- package/dist/src/containers/Tenant/i18n/index.d.ts +1 -1
- package/dist/src/containers/Tenant/utils/queryTemplates.d.ts +1 -0
- package/dist/src/containers/Tenant/utils/queryTemplates.js +12 -0
- package/dist/src/containers/Tenant/utils/schemaActions.js +3 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.js +1 -1
- package/dist/src/routes.d.ts +1 -1
- package/dist/src/routes.js +3 -1
- package/dist/src/services/api.d.ts +6 -1
- package/dist/src/services/api.js +23 -3
- package/dist/src/services/settings.d.ts +1 -0
- package/dist/src/services/settings.js +3 -2
- package/dist/src/store/configureStore.d.ts +36 -134
- package/dist/src/store/configureStore.js +2 -15
- package/dist/src/store/defaultStore.d.ts +17 -81
- package/dist/src/store/reducers/api.js +0 -1
- package/dist/src/store/reducers/authentication/authentication.d.ts +51 -243
- package/dist/src/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +196 -849
- package/dist/src/store/reducers/healthcheckInfo/healthcheckInfo.js +3 -3
- package/dist/src/store/reducers/hotKeys/hotKeys.d.ts +6 -25
- package/dist/src/store/reducers/hotKeys/hotKeys.js +36 -49
- package/dist/src/store/reducers/index.d.ts +23 -100
- package/dist/src/store/reducers/index.js +0 -8
- package/dist/src/store/reducers/node/selectors.d.ts +0 -40
- package/dist/src/store/reducers/nodesList.d.ts +0 -40
- package/dist/src/store/reducers/schema/schema.d.ts +13 -149
- package/dist/src/store/reducers/schema/schema.js +45 -90
- package/dist/src/store/reducers/schema/types.d.ts +2 -21
- package/dist/src/store/reducers/schemaAcl/schemaAcl.d.ts +8 -135
- package/dist/src/store/reducers/schemaAcl/schemaAcl.js +18 -44
- package/dist/src/store/reducers/settings/settings.d.ts +17 -23
- package/dist/src/store/reducers/settings/settings.js +40 -33
- package/dist/src/store/reducers/settings/types.d.ts +1 -12
- package/dist/src/store/reducers/tablets.d.ts +288 -41
- package/dist/src/store/reducers/tablets.js +8 -4
- package/dist/src/store/reducers/tabletsFilters.d.ts +11 -164
- package/dist/src/store/reducers/tabletsFilters.js +14 -76
- package/dist/src/store/reducers/tenants/selectors.d.ts +8 -362
- package/dist/src/store/reducers/topic.d.ts +0 -600
- package/dist/src/store/state-url-mapping.js +0 -3
- package/dist/src/utils/constants.d.ts +1 -1
- package/dist/src/utils/constants.js +1 -1
- package/dist/src/utils/dataFormatters/dataFormatters.d.ts +2 -1
- package/dist/src/utils/dataFormatters/dataFormatters.js +7 -3
- package/dist/src/utils/hooks/index.d.ts +1 -0
- package/dist/src/utils/hooks/index.js +1 -0
- package/dist/src/utils/hooks/useAutoRefreshInterval.d.ts +1 -0
- package/dist/src/utils/hooks/useAutoRefreshInterval.js +5 -0
- package/dist/src/utils/utils.js +2 -1
- package/package.json +2 -1
- package/dist/src/components/InfoViewer/schemaOverview/CDCStreamOverview.d.ts +0 -6
- package/dist/src/components/InfoViewer/schemaOverview/CDCStreamOverview.js +0 -17
- package/dist/src/components/InfoViewer/schemaOverview/PersQueueGroupOverview.d.ts +0 -6
- package/dist/src/components/InfoViewer/schemaOverview/PersQueueGroupOverview.js +0 -20
- package/dist/src/components/InfoViewer/schemaOverview/index.d.ts +0 -2
- package/dist/src/components/InfoViewer/schemaOverview/index.js +0 -2
- package/dist/src/containers/AsideNavigation/i18n/ru.json +0 -10
- package/dist/src/containers/AsideNavigation/useNavigationMenuItems.d.ts +0 -2
- package/dist/src/containers/AsideNavigation/useNavigationMenuItems.js +0 -54
- package/dist/src/store/reducers/host.d.ts +0 -130
- package/dist/src/store/reducers/host.js +0 -26
- package/dist/src/store/reducers/hotKeys/types.d.ts +0 -10
- package/dist/src/store/reducers/hotKeys/types.js +0 -1
- package/dist/src/store/reducers/schemaAcl/types.d.ts +0 -12
- package/dist/src/store/reducers/schemaAcl/types.js +0 -1
- package/dist/src/types/store/host.d.ts +0 -15
- package/dist/src/types/store/host.js +0 -1
@@ -1,13 +1,11 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useLocation } from 'react-router';
|
3
3
|
import { EntityStatus } from '../../../../components/EntityStatus/EntityStatus';
|
4
|
-
import { ResponseError } from '../../../../components/Errors/ResponseError';
|
5
4
|
import { InfoViewer } from '../../../../components/InfoViewer';
|
6
5
|
import { formatCommonItem } from '../../../../components/InfoViewer/formatters';
|
7
6
|
import { LinkWithIcon } from '../../../../components/LinkWithIcon/LinkWithIcon';
|
8
7
|
import { createExternalUILink, parseQuery } from '../../../../routes';
|
9
8
|
import { cn } from '../../../../utils/cn';
|
10
|
-
import { useTypedSelector } from '../../../../utils/hooks';
|
11
9
|
import { getEntityName } from '../../utils';
|
12
10
|
import i18n from '../i18n';
|
13
11
|
import './ExternalTable.scss';
|
@@ -43,10 +41,6 @@ const ExternalTable = ({ data, prepareData }) => {
|
|
43
41
|
const query = parseQuery(location);
|
44
42
|
const pathToDataSource = createExternalUILink(Object.assign(Object.assign({}, query), { schema: (_b = (_a = data === null || data === void 0 ? void 0 : data.PathDescription) === null || _a === void 0 ? void 0 : _a.ExternalTableDescription) === null || _b === void 0 ? void 0 : _b.DataSourcePath }));
|
45
43
|
const entityName = getEntityName(data === null || data === void 0 ? void 0 : data.PathDescription);
|
46
|
-
const { error: schemaError } = useTypedSelector((state) => state.schema);
|
47
|
-
if (schemaError) {
|
48
|
-
return _jsx(ResponseError, { error: schemaError });
|
49
|
-
}
|
50
44
|
if (!data) {
|
51
45
|
return _jsxs("div", { className: "error", children: ["No ", entityName, " data"] });
|
52
46
|
}
|
@@ -1,9 +1,7 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { DefinitionList } from '@gravity-ui/components';
|
3
3
|
import { Text } from '@gravity-ui/uikit';
|
4
|
-
import { ResponseError } from '../../../../components/Errors/ResponseError';
|
5
4
|
import { cn } from '../../../../utils/cn';
|
6
|
-
import { useTypedSelector } from '../../../../utils/hooks';
|
7
5
|
import { getEntityName } from '../../utils';
|
8
6
|
import i18n from '../i18n';
|
9
7
|
const b = cn('ydb-view-info');
|
@@ -21,10 +19,6 @@ const prepareViewItems = (data) => {
|
|
21
19
|
};
|
22
20
|
export function ViewInfo({ data }) {
|
23
21
|
const entityName = getEntityName(data === null || data === void 0 ? void 0 : data.PathDescription);
|
24
|
-
const { error: schemaError } = useTypedSelector((state) => state.schema);
|
25
|
-
if (schemaError) {
|
26
|
-
return _jsx(ResponseError, { error: schemaError });
|
27
|
-
}
|
28
22
|
if (!data) {
|
29
23
|
return _jsxs("div", { className: "error", children: ["No ", entityName, " data"] });
|
30
24
|
}
|
@@ -4,8 +4,9 @@ import './ObjectGeneral.scss';
|
|
4
4
|
interface ObjectGeneralProps {
|
5
5
|
type?: EPathType;
|
6
6
|
tenantName: string;
|
7
|
+
path: string;
|
7
8
|
additionalTenantProps?: AdditionalTenantsProps;
|
8
9
|
additionalNodesProps?: AdditionalNodesProps;
|
9
10
|
}
|
10
|
-
declare function ObjectGeneral(props: ObjectGeneralProps): import("react/jsx-runtime").JSX.Element
|
11
|
+
declare function ObjectGeneral(props: ObjectGeneralProps): import("react/jsx-runtime").JSX.Element;
|
11
12
|
export default ObjectGeneral;
|
@@ -1,33 +1,27 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useThemeValue } from '@gravity-ui/uikit';
|
3
3
|
import { TENANT_PAGES_IDS } from '../../../store/reducers/tenant/constants';
|
4
4
|
import { cn } from '../../../utils/cn';
|
5
5
|
import { useTypedSelector } from '../../../utils/hooks';
|
6
6
|
import Diagnostics from '../Diagnostics/Diagnostics';
|
7
7
|
import { Query } from '../Query/Query';
|
8
|
+
import { TenantNavigation } from '../TenantNavigation/TenantNavigation';
|
8
9
|
import './ObjectGeneral.scss';
|
9
10
|
const b = cn('object-general');
|
10
11
|
function ObjectGeneral(props) {
|
11
12
|
const theme = useThemeValue();
|
12
13
|
const { tenantPage } = useTypedSelector((state) => state.tenant);
|
13
|
-
const
|
14
|
-
const { type, additionalTenantProps, additionalNodesProps, tenantName } = props;
|
14
|
+
const renderPageContent = () => {
|
15
|
+
const { type, additionalTenantProps, additionalNodesProps, tenantName, path } = props;
|
15
16
|
switch (tenantPage) {
|
16
17
|
case TENANT_PAGES_IDS.query: {
|
17
|
-
return _jsx(Query, {
|
18
|
+
return _jsx(Query, { tenantName: tenantName, path: path, theme: theme, type: type });
|
18
19
|
}
|
19
20
|
default: {
|
20
|
-
return (_jsx(Diagnostics, { type: type, additionalTenantProps: additionalTenantProps, additionalNodesProps: additionalNodesProps }));
|
21
|
+
return (_jsx(Diagnostics, { type: type, tenantName: tenantName, path: path, additionalTenantProps: additionalTenantProps, additionalNodesProps: additionalNodesProps }));
|
21
22
|
}
|
22
23
|
}
|
23
24
|
};
|
24
|
-
|
25
|
-
const { tenantName } = props;
|
26
|
-
if (!tenantName) {
|
27
|
-
return null;
|
28
|
-
}
|
29
|
-
return _jsx("div", { className: b(), children: renderTabContent() });
|
30
|
-
};
|
31
|
-
return renderContent();
|
25
|
+
return (_jsxs("div", { className: b(), children: [_jsx(TenantNavigation, {}), renderPageContent()] }));
|
32
26
|
}
|
33
27
|
export default ObjectGeneral;
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import { EPathType } from '../../../types/api/schema';
|
1
|
+
import { EPathSubType, EPathType } from '../../../types/api/schema';
|
3
2
|
import './ObjectSummary.scss';
|
4
3
|
interface ObjectSummaryProps {
|
5
4
|
type?: EPathType;
|
6
5
|
subType?: EPathSubType;
|
7
|
-
tenantName
|
6
|
+
tenantName: string;
|
7
|
+
path: string;
|
8
8
|
onCollapseSummary: VoidFunction;
|
9
9
|
onExpandSummary: VoidFunction;
|
10
10
|
isCollapsed: boolean;
|
11
11
|
}
|
12
|
-
export declare function ObjectSummary({ type, subType, tenantName, onCollapseSummary, onExpandSummary, isCollapsed, }: ObjectSummaryProps): import("react/jsx-runtime").JSX.Element
|
12
|
+
export declare function ObjectSummary({ type, subType, tenantName, path, onCollapseSummary, onExpandSummary, isCollapsed, }: ObjectSummaryProps): import("react/jsx-runtime").JSX.Element;
|
13
13
|
export {};
|
@@ -6,24 +6,24 @@ import { Button, Icon, Tabs } from '@gravity-ui/uikit';
|
|
6
6
|
import qs from 'qs';
|
7
7
|
import { useLocation } from 'react-router';
|
8
8
|
import { Link } from 'react-router-dom';
|
9
|
+
import { StringParam, useQueryParam } from 'use-query-params';
|
9
10
|
import { AsyncReplicationState } from '../../../components/AsyncReplicationState';
|
10
11
|
import { ClipboardButton } from '../../../components/ClipboardButton';
|
11
12
|
import InfoViewer from '../../../components/InfoViewer/InfoViewer';
|
12
|
-
import {
|
13
|
+
import { LinkWithIcon } from '../../../components/LinkWithIcon/LinkWithIcon';
|
13
14
|
import { Loader } from '../../../components/Loader';
|
14
15
|
import SplitPane from '../../../components/SplitPane';
|
15
|
-
import
|
16
|
-
import {
|
16
|
+
import { getEntityName } from '../../../containers/Tenant/utils';
|
17
|
+
import routes, { createExternalUILink, createHref } from '../../../routes';
|
18
|
+
import { schemaApi, setShowPreview } from '../../../store/reducers/schema/schema';
|
17
19
|
import { TENANT_PAGES_IDS, TENANT_QUERY_TABS_ID, TENANT_SUMMARY_TABS_IDS, } from '../../../store/reducers/tenant/constants';
|
18
20
|
import { setQueryTab, setSummaryTab, setTenantPage } from '../../../store/reducers/tenant/tenant';
|
19
|
-
import { EPathType } from '../../../types/api/schema';
|
21
|
+
import { EPathSubType, EPathType } from '../../../types/api/schema';
|
20
22
|
import { cn } from '../../../utils/cn';
|
21
23
|
import { DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED, DEFAULT_SIZE_TENANT_SUMMARY_KEY, } from '../../../utils/constants';
|
22
|
-
import { formatDateTime } from '../../../utils/dataFormatters/dataFormatters';
|
24
|
+
import { formatDateTime, formatSecondsToHours } from '../../../utils/dataFormatters/dataFormatters';
|
23
25
|
import { useTypedDispatch, useTypedSelector } from '../../../utils/hooks';
|
24
26
|
import { Acl } from '../Acl/Acl';
|
25
|
-
import { ExternalDataSourceSummary } from '../Info/ExternalDataSource/ExternalDataSource';
|
26
|
-
import { ExternalTableSummary } from '../Info/ExternalTable/ExternalTable';
|
27
27
|
import { SchemaTree } from '../Schema/SchemaTree/SchemaTree';
|
28
28
|
import { SchemaViewer } from '../Schema/SchemaViewer/SchemaViewer';
|
29
29
|
import { TENANT_INFO_TABS, TENANT_SCHEMA_TAB, TenantTabsGroups } from '../TenantPages';
|
@@ -40,19 +40,17 @@ const getTenantCommonInfoState = () => {
|
|
40
40
|
collapsed,
|
41
41
|
};
|
42
42
|
};
|
43
|
-
export function ObjectSummary({ type, subType, tenantName, onCollapseSummary, onExpandSummary, isCollapsed, }) {
|
44
|
-
var _a
|
43
|
+
export function ObjectSummary({ type, subType, tenantName, path, onCollapseSummary, onExpandSummary, isCollapsed, }) {
|
44
|
+
var _a;
|
45
45
|
const dispatch = useTypedDispatch();
|
46
46
|
const [commonInfoVisibilityState, dispatchCommonInfoVisibilityState] = React.useReducer(paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED), undefined, getTenantCommonInfoState);
|
47
|
-
const { data, currentSchemaPath, currentSchema: currentItem = {}, } = useTypedSelector((state) => state.schema);
|
48
47
|
const { summaryTab = TENANT_SUMMARY_TABS_IDS.overview } = useTypedSelector((state) => state.tenant);
|
49
48
|
const location = useLocation();
|
50
49
|
const queryParams = qs.parse(location.search, {
|
51
50
|
ignoreQueryPrefix: true,
|
52
51
|
});
|
53
|
-
const
|
54
|
-
const
|
55
|
-
const currentSchemaData = (_c = currentObjectData === null || currentObjectData === void 0 ? void 0 : currentObjectData.PathDescription) === null || _c === void 0 ? void 0 : _c.Self;
|
52
|
+
const { currentData: currentObjectData } = schemaApi.endpoints.getSchema.useQueryState({ path });
|
53
|
+
const currentSchemaData = (_a = currentObjectData === null || currentObjectData === void 0 ? void 0 : currentObjectData.PathDescription) === null || _a === void 0 ? void 0 : _a.Self;
|
56
54
|
React.useEffect(() => {
|
57
55
|
const isTable = isTableType(type);
|
58
56
|
if (type && !isTable && !TENANT_INFO_TABS.find((el) => el.id === summaryTab)) {
|
@@ -69,70 +67,155 @@ export function ObjectSummary({ type, subType, tenantName, onCollapseSummary, on
|
|
69
67
|
};
|
70
68
|
const renderObjectOverview = () => {
|
71
69
|
var _a;
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
const
|
77
|
-
|
78
|
-
|
79
|
-
|
70
|
+
if (!currentSchemaData) {
|
71
|
+
return undefined;
|
72
|
+
}
|
73
|
+
const { CreateStep, PathType, PathSubType, PathId, PathVersion } = currentSchemaData;
|
74
|
+
const overview = [];
|
75
|
+
overview.push({ label: i18n('summary.type'), value: PathType === null || PathType === void 0 ? void 0 : PathType.replace(/^EPathType/, '') });
|
76
|
+
if (PathSubType !== EPathSubType.EPathSubTypeEmpty) {
|
77
|
+
overview.push({
|
78
|
+
label: i18n('summary.subtype'),
|
79
|
+
value: PathSubType === null || PathSubType === void 0 ? void 0 : PathSubType.replace(/^EPathSubType/, ''),
|
80
|
+
});
|
81
|
+
}
|
82
|
+
overview.push({ label: i18n('summary.id'), value: PathId });
|
83
|
+
overview.push({ label: i18n('summary.version'), value: PathVersion });
|
84
|
+
overview.push({
|
85
|
+
label: i18n('summary.created'),
|
86
|
+
value: formatDateTime(CreateStep, ''),
|
87
|
+
});
|
88
|
+
const { PathDescription } = currentObjectData;
|
89
|
+
const title = getEntityName(PathDescription);
|
90
|
+
const getPathTypeOverview = {
|
80
91
|
[EPathType.EPathTypeInvalid]: undefined,
|
81
92
|
[EPathType.EPathTypeDir]: undefined,
|
82
|
-
[EPathType.EPathTypeTable]:
|
93
|
+
[EPathType.EPathTypeTable]: () => {
|
94
|
+
var _a;
|
95
|
+
return [
|
96
|
+
{
|
97
|
+
label: i18n('summary.partitions'),
|
98
|
+
value: (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.TablePartitions) === null || _a === void 0 ? void 0 : _a.length,
|
99
|
+
},
|
100
|
+
];
|
101
|
+
},
|
83
102
|
[EPathType.EPathTypeSubDomain]: undefined,
|
84
103
|
[EPathType.EPathTypeTableIndex]: undefined,
|
85
|
-
[EPathType.EPathTypeExtSubDomain]:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
104
|
+
[EPathType.EPathTypeExtSubDomain]: () => {
|
105
|
+
var _a, _b;
|
106
|
+
return [
|
107
|
+
{
|
108
|
+
label: i18n('summary.paths'),
|
109
|
+
value: (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.DomainDescription) === null || _a === void 0 ? void 0 : _a.PathsInside,
|
110
|
+
},
|
111
|
+
{
|
112
|
+
label: i18n('summary.shards'),
|
113
|
+
value: (_b = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.DomainDescription) === null || _b === void 0 ? void 0 : _b.ShardsInside,
|
114
|
+
},
|
115
|
+
];
|
116
|
+
},
|
117
|
+
[EPathType.EPathTypeColumnStore]: () => {
|
118
|
+
var _a, _b;
|
119
|
+
return [
|
120
|
+
{
|
121
|
+
label: i18n('summary.partitions'),
|
122
|
+
value: (_b = (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.ColumnStoreDescription) === null || _a === void 0 ? void 0 : _a.ColumnShards) === null || _b === void 0 ? void 0 : _b.length,
|
123
|
+
},
|
124
|
+
];
|
125
|
+
},
|
126
|
+
[EPathType.EPathTypeColumnTable]: () => {
|
127
|
+
var _a, _b, _c;
|
128
|
+
return [
|
129
|
+
{
|
130
|
+
label: i18n('summary.partitions'),
|
131
|
+
value: (_c = (_b = (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.ColumnTableDescription) === null || _a === void 0 ? void 0 : _a.Sharding) === null || _b === void 0 ? void 0 : _b.ColumnShards) === null || _c === void 0 ? void 0 : _c.length,
|
132
|
+
},
|
133
|
+
];
|
134
|
+
},
|
135
|
+
[EPathType.EPathTypeCdcStream]: () => {
|
136
|
+
const { Mode, Format } = (PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.CdcStreamDescription) || {};
|
137
|
+
return [
|
138
|
+
{
|
139
|
+
label: i18n('summary.mode'),
|
140
|
+
value: Mode === null || Mode === void 0 ? void 0 : Mode.replace(/^ECdcStreamMode/, ''),
|
141
|
+
},
|
142
|
+
{
|
143
|
+
label: i18n('summary.format'),
|
144
|
+
value: Format === null || Format === void 0 ? void 0 : Format.replace(/^ECdcStreamFormat/, ''),
|
145
|
+
},
|
146
|
+
];
|
147
|
+
},
|
148
|
+
[EPathType.EPathTypePersQueueGroup]: () => {
|
149
|
+
var _a, _b, _c;
|
150
|
+
const pqGroup = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.PersQueueGroup;
|
151
|
+
const value = (_b = (_a = pqGroup === null || pqGroup === void 0 ? void 0 : pqGroup.PQTabletConfig) === null || _a === void 0 ? void 0 : _a.PartitionConfig) === null || _b === void 0 ? void 0 : _b.LifetimeSeconds;
|
152
|
+
return [
|
153
|
+
{
|
154
|
+
label: i18n('summary.partitions'),
|
155
|
+
value: (_c = pqGroup === null || pqGroup === void 0 ? void 0 : pqGroup.Partitions) === null || _c === void 0 ? void 0 : _c.length,
|
156
|
+
},
|
157
|
+
{
|
158
|
+
label: i18n('summary.retention'),
|
159
|
+
value: value && formatSecondsToHours(value),
|
160
|
+
},
|
161
|
+
];
|
162
|
+
},
|
163
|
+
[EPathType.EPathTypeExternalTable]: () => {
|
164
|
+
var _a, _b;
|
165
|
+
const pathToDataSource = createExternalUILink(Object.assign(Object.assign({}, queryParams), { schema: (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.ExternalTableDescription) === null || _a === void 0 ? void 0 : _a.DataSourcePath }));
|
166
|
+
const { SourceType, DataSourcePath } = (PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.ExternalTableDescription) || {};
|
167
|
+
const dataSourceName = ((_b = DataSourcePath === null || DataSourcePath === void 0 ? void 0 : DataSourcePath.match(/([^/]*)\/*$/)) === null || _b === void 0 ? void 0 : _b[1]) || '';
|
168
|
+
return [
|
169
|
+
{ label: i18n('summary.source-type'), value: SourceType },
|
170
|
+
{
|
171
|
+
label: i18n('summary.data-source'),
|
172
|
+
value: DataSourcePath && (_jsx("span", { title: DataSourcePath, children: _jsx(LinkWithIcon, { title: dataSourceName || '', url: pathToDataSource }) })),
|
173
|
+
},
|
174
|
+
];
|
175
|
+
},
|
176
|
+
[EPathType.EPathTypeExternalDataSource]: () => {
|
177
|
+
var _a;
|
178
|
+
return [
|
179
|
+
{
|
180
|
+
label: i18n('summary.source-type'),
|
181
|
+
value: (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.ExternalDataSourceDescription) === null || _a === void 0 ? void 0 : _a.SourceType,
|
182
|
+
},
|
183
|
+
];
|
184
|
+
},
|
92
185
|
[EPathType.EPathTypeView]: undefined,
|
93
186
|
[EPathType.EPathTypeReplication]: () => {
|
94
|
-
var _a
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
187
|
+
var _a;
|
188
|
+
const state = (_a = PathDescription === null || PathDescription === void 0 ? void 0 : PathDescription.ReplicationDescription) === null || _a === void 0 ? void 0 : _a.State;
|
189
|
+
if (!state) {
|
190
|
+
return [];
|
191
|
+
}
|
192
|
+
return [
|
193
|
+
{
|
194
|
+
label: i18n('summary.state'),
|
195
|
+
value: _jsx(AsyncReplicationState, { state: state }),
|
196
|
+
},
|
197
|
+
];
|
105
198
|
},
|
106
199
|
};
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
return
|
112
|
-
};
|
113
|
-
const renderLoader = () => {
|
114
|
-
// If Loader isn't wrapped with div, SplitPane doesn't calculate panes height correctly
|
115
|
-
return (_jsx("div", { children: _jsx(Loader, {}) }));
|
200
|
+
const pathTypeOverview = (PathType && ((_a = getPathTypeOverview[PathType]) === null || _a === void 0 ? void 0 : _a.call(getPathTypeOverview))) || [];
|
201
|
+
overview.push(...pathTypeOverview);
|
202
|
+
// filter all empty values in according this requirement
|
203
|
+
// https://github.com/ydb-platform/ydb-embedded-ui/issues/906
|
204
|
+
return _jsx(InfoViewer, { title: title, info: overview.filter((i) => i.value) });
|
116
205
|
};
|
117
206
|
const renderTabContent = () => {
|
118
207
|
switch (summaryTab) {
|
119
208
|
case TENANT_SUMMARY_TABS_IDS.acl: {
|
120
|
-
return _jsx(Acl, {});
|
209
|
+
return _jsx(Acl, { path: path });
|
121
210
|
}
|
122
211
|
case TENANT_SUMMARY_TABS_IDS.schema: {
|
123
|
-
return
|
212
|
+
return _jsx(SchemaViewer, { type: type, path: path, tenantName: tenantName });
|
124
213
|
}
|
125
214
|
default: {
|
126
215
|
return renderObjectOverview();
|
127
216
|
}
|
128
217
|
}
|
129
218
|
};
|
130
|
-
const renderTree = () => {
|
131
|
-
return (_jsxs("div", { className: b('tree-wrapper'), children: [_jsx("div", { className: b('tree-header'), children: i18n('summary.navigation') }), _jsx("div", { className: b('tree'), children: pathData && (_jsx(SchemaTree, { rootPath: tenantName,
|
132
|
-
// for the root pathData.Name contains the same string as tenantName,
|
133
|
-
// but without the leading slash
|
134
|
-
rootName: pathData.Name || String(tenantName), rootType: pathData.PathType, currentPath: currentSchemaPath })) })] }));
|
135
|
-
};
|
136
219
|
const onCollapseInfoHandler = () => {
|
137
220
|
dispatchCommonInfoVisibilityState(PaneVisibilityActionTypes.triggerCollapse);
|
138
221
|
};
|
@@ -149,10 +232,10 @@ export function ObjectSummary({ type, subType, tenantName, onCollapseSummary, on
|
|
149
232
|
};
|
150
233
|
const renderCommonInfoControls = () => {
|
151
234
|
const showPreview = isTableType(type) && !isIndexTableType(subType);
|
152
|
-
return (_jsxs(React.Fragment, { children: [showPreview && (_jsx(Button, { view: "flat-secondary", onClick: onOpenPreview, title: i18n('summary.showPreview'), children: _jsx(Icon, { data: LayoutHeaderCellsLargeFill }) })),
|
235
|
+
return (_jsxs(React.Fragment, { children: [showPreview && (_jsx(Button, { view: "flat-secondary", onClick: onOpenPreview, title: i18n('summary.showPreview'), children: _jsx(Icon, { data: LayoutHeaderCellsLargeFill }) })), _jsx(ClipboardButton, { text: path, view: "flat-secondary", title: i18n('summary.copySchemaPath') }), _jsx(PaneVisibilityToggleButtons, { onCollapse: onCollapseInfoHandler, onExpand: onExpandInfoHandler, isCollapsed: commonInfoVisibilityState.collapsed, initialDirection: "bottom" })] }));
|
153
236
|
};
|
154
237
|
const renderEntityTypeBadge = () => {
|
155
|
-
const { Status, Reason } =
|
238
|
+
const { Status, Reason } = currentObjectData !== null && currentObjectData !== void 0 ? currentObjectData : {};
|
156
239
|
let message;
|
157
240
|
if (!type && Status && Reason) {
|
158
241
|
message = `${Status}: ${Reason}`;
|
@@ -160,10 +243,23 @@ export function ObjectSummary({ type, subType, tenantName, onCollapseSummary, on
|
|
160
243
|
return type ? (_jsx("div", { className: b('entity-type'), children: type.replace('EPathType', '') })) : (_jsx("div", { className: b('entity-type', { error: true }), children: _jsx(HelpPopover, { content: message, offset: { left: 0 } }) }));
|
161
244
|
};
|
162
245
|
const renderContent = () => {
|
163
|
-
|
164
|
-
return null;
|
165
|
-
}
|
166
|
-
return (_jsxs("div", { className: b(), children: [_jsx("div", { className: b({ hidden: isCollapsed }), children: _jsxs(SplitPane, { direction: "vertical", defaultSizePaneKey: DEFAULT_SIZE_TENANT_SUMMARY_KEY, onSplitStartDragAdditional: onSplitStartDragAdditional, triggerCollapse: commonInfoVisibilityState.triggerCollapse, triggerExpand: commonInfoVisibilityState.triggerExpand, minSize: [200, 52], collapsedSizes: [100, 0], children: [currentSchemaPath ? renderTree() : renderLoader(), _jsxs("div", { className: b('info'), children: [_jsxs("div", { className: b('sticky-top'), children: [_jsxs("div", { className: b('info-header'), children: [_jsxs("div", { className: b('info-title'), children: [renderEntityTypeBadge(), _jsx("div", { className: b('path-name'), children: currentSchemaPath })] }), _jsx("div", { className: b('info-controls'), children: renderCommonInfoControls() })] }), renderTabs()] }), _jsx("div", { className: b('overview-wrapper'), children: renderTabContent() })] })] }) }), _jsx(PaneVisibilityToggleButtons, { onCollapse: onCollapseSummary, onExpand: onExpandSummary, isCollapsed: isCollapsed, initialDirection: "left", className: b('action-button') })] }));
|
246
|
+
return (_jsxs("div", { className: b(), children: [_jsx("div", { className: b({ hidden: isCollapsed }), children: _jsxs(SplitPane, { direction: "vertical", defaultSizePaneKey: DEFAULT_SIZE_TENANT_SUMMARY_KEY, onSplitStartDragAdditional: onSplitStartDragAdditional, triggerCollapse: commonInfoVisibilityState.triggerCollapse, triggerExpand: commonInfoVisibilityState.triggerExpand, minSize: [200, 52], collapsedSizes: [100, 0], children: [_jsx(ObjectTree, { tenantName: tenantName, path: path }), _jsxs("div", { className: b('info'), children: [_jsxs("div", { className: b('sticky-top'), children: [_jsxs("div", { className: b('info-header'), children: [_jsxs("div", { className: b('info-title'), children: [renderEntityTypeBadge(), _jsx("div", { className: b('path-name'), children: path })] }), _jsx("div", { className: b('info-controls'), children: renderCommonInfoControls() })] }), renderTabs()] }), _jsx("div", { className: b('overview-wrapper'), children: renderTabContent() })] })] }) }), _jsx(PaneVisibilityToggleButtons, { onCollapse: onCollapseSummary, onExpand: onExpandSummary, isCollapsed: isCollapsed, initialDirection: "left", className: b('action-button') })] }));
|
167
247
|
};
|
168
248
|
return renderContent();
|
169
249
|
}
|
250
|
+
function ObjectTree({ tenantName, path }) {
|
251
|
+
var _a;
|
252
|
+
const { currentData: tenantData = {}, isFetching } = schemaApi.useGetSchemaQuery({
|
253
|
+
path: tenantName,
|
254
|
+
});
|
255
|
+
const pathData = (_a = tenantData === null || tenantData === void 0 ? void 0 : tenantData.PathDescription) === null || _a === void 0 ? void 0 : _a.Self;
|
256
|
+
const [, setCurrentPath] = useQueryParam('schema', StringParam);
|
257
|
+
if (!pathData && isFetching) {
|
258
|
+
// If Loader isn't wrapped with div, SplitPane doesn't calculate panes height correctly
|
259
|
+
return (_jsx("div", { children: _jsx(Loader, {}) }));
|
260
|
+
}
|
261
|
+
return (_jsxs("div", { className: b('tree-wrapper'), children: [_jsx("div", { className: b('tree-header'), children: i18n('summary.navigation') }), _jsx("div", { className: b('tree'), children: pathData ? (_jsx(SchemaTree, { rootPath: tenantName,
|
262
|
+
// for the root pathData.Name contains the same string as tenantName,
|
263
|
+
// but without the leading slash
|
264
|
+
rootName: pathData.Name || tenantName, rootType: pathData.PathType, currentPath: path, onActivePathUpdate: setCurrentPath })) : null })] }));
|
265
|
+
}
|
@@ -4,6 +4,7 @@ import { CircleExclamationFill, CircleInfoFill, CircleXmarkFill, TriangleExclama
|
|
4
4
|
import { ArrowToggle, Button, Icon } from '@gravity-ui/uikit';
|
5
5
|
import ShortyString from '../../../../components/ShortyString/ShortyString';
|
6
6
|
import { cn } from '../../../../utils/cn';
|
7
|
+
import { isNumeric } from '../../../../utils/utils';
|
7
8
|
import { getSeverity } from './models';
|
8
9
|
import './Issues.scss';
|
9
10
|
const blockWrapper = cn('kv-result-issues');
|
@@ -63,10 +64,10 @@ function IssueSeverity({ severity }) {
|
|
63
64
|
return (_jsxs("span", { className: blockIssueSeverity({ severity: shortenSeverity }), children: [_jsx(Icon, { className: blockIssueSeverity('icon'), data: severityIcons[severity] }), _jsx("span", { className: blockIssueSeverity('title'), children: shortenSeverity })] }));
|
64
65
|
}
|
65
66
|
function getIssuePosition(issue) {
|
66
|
-
const { position
|
67
|
-
if (!position) {
|
68
|
-
return
|
67
|
+
const { position } = issue;
|
68
|
+
if (typeof position !== 'object' || position === null || !isNumeric(position.row)) {
|
69
|
+
return '';
|
69
70
|
}
|
70
|
-
const {
|
71
|
-
return
|
71
|
+
const { row, column } = position;
|
72
|
+
return isNumeric(column) ? `${row}:${column}` : `line ${row}`;
|
72
73
|
}
|
@@ -2,7 +2,8 @@ import type { EPathType } from '../../../../types/api/schema';
|
|
2
2
|
import './Preview.scss';
|
3
3
|
interface PreviewProps {
|
4
4
|
database: string;
|
5
|
+
path: string;
|
5
6
|
type: EPathType | undefined;
|
6
7
|
}
|
7
|
-
export declare const Preview: ({ database, type }: PreviewProps) => import("react/jsx-runtime").JSX.Element;
|
8
|
+
export declare const Preview: ({ database, path, type }: PreviewProps) => import("react/jsx-runtime").JSX.Element;
|
8
9
|
export {};
|
@@ -7,26 +7,26 @@ import { QueryResultTable } from '../../../../components/QueryResultTable';
|
|
7
7
|
import { previewApi } from '../../../../store/reducers/preview';
|
8
8
|
import { setShowPreview } from '../../../../store/reducers/schema/schema';
|
9
9
|
import { cn } from '../../../../utils/cn';
|
10
|
-
import { useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
10
|
+
import { useAutoRefreshInterval, useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
11
11
|
import { parseQueryErrorToString } from '../../../../utils/query';
|
12
12
|
import { isExternalTableType, isTableType } from '../../utils/schema';
|
13
13
|
import i18n from '../i18n';
|
14
14
|
import './Preview.scss';
|
15
15
|
const b = cn('kv-preview');
|
16
|
-
export const Preview = ({ database, type }) => {
|
16
|
+
export const Preview = ({ database, path, type }) => {
|
17
17
|
const dispatch = useTypedDispatch();
|
18
18
|
const isPreviewAvailable = isTableType(type);
|
19
|
-
const
|
19
|
+
const [autoRefreshInterval] = useAutoRefreshInterval();
|
20
20
|
const isFullscreen = useTypedSelector((state) => state.fullscreen);
|
21
|
-
const query = `--!syntax_v1\nselect * from \`${
|
22
|
-
const { currentData, isFetching, error } = previewApi.useSendQueryQuery({ database, query, action: isExternalTableType(type) ? 'execute-query' : 'execute-scan' }, { pollingInterval:
|
21
|
+
const query = `--!syntax_v1\nselect * from \`${path}\` limit 32`;
|
22
|
+
const { currentData, isFetching, error } = previewApi.useSendQueryQuery({ database, query, action: isExternalTableType(type) ? 'execute-query' : 'execute-scan' }, { pollingInterval: autoRefreshInterval, skip: !isPreviewAvailable });
|
23
23
|
const loading = isFetching && currentData === undefined;
|
24
24
|
const data = currentData !== null && currentData !== void 0 ? currentData : {};
|
25
25
|
const handleClosePreview = () => {
|
26
26
|
dispatch(setShowPreview(false));
|
27
27
|
};
|
28
28
|
const renderHeader = () => {
|
29
|
-
return (_jsxs("div", { className: b('header'), children: [_jsxs("div", { className: b('title'), children: [i18n('preview.title'),
|
29
|
+
return (_jsxs("div", { className: b('header'), children: [_jsxs("div", { className: b('title'), children: [i18n('preview.title'), " ", _jsx("div", { className: b('table-name'), children: path })] }), _jsxs("div", { className: b('controls-left'), children: [_jsx(EnableFullscreenButton, { disabled: Boolean(error) }), _jsx(Button, { view: "flat-secondary", onClick: handleClosePreview, title: i18n('preview.close'), children: _jsx(Icon, { data: Xmark, size: 18 }) })] })] }));
|
30
30
|
};
|
31
31
|
if (loading) {
|
32
32
|
return (_jsx("div", { className: b('loader-container'), children: _jsx(Loader, { size: "m" }) }));
|
@@ -5,6 +5,7 @@ import type { EPathType } from '../../../../types/api/schema';
|
|
5
5
|
import type { ExecuteQueryState } from '../../../../types/store/executeQuery';
|
6
6
|
import './QueryEditor.scss';
|
7
7
|
interface QueryEditorProps {
|
8
|
+
tenantName: string;
|
8
9
|
path: string;
|
9
10
|
changeUserInput: (arg: {
|
10
11
|
input: string;
|
@@ -24,6 +25,7 @@ declare const _default: import("react-redux").ConnectedComponent<typeof QueryEdi
|
|
24
25
|
theme: string;
|
25
26
|
path: string;
|
26
27
|
type?: EPathType | undefined;
|
28
|
+
tenantName: string;
|
27
29
|
changeUserInput: (arg: {
|
28
30
|
input: string;
|
29
31
|
}) => void;
|
@@ -13,7 +13,6 @@ import { DEFAULT_IS_QUERY_RESULT_COLLAPSED, DEFAULT_SIZE_RESULT_PANE_KEY, LAST_U
|
|
13
13
|
import { useQueryModes, useSetting } from '../../../../utils/hooks';
|
14
14
|
import { LANGUAGE_YQL_ID } from '../../../../utils/monaco/yql/constants';
|
15
15
|
import { QUERY_ACTIONS } from '../../../../utils/query';
|
16
|
-
import { parseJson } from '../../../../utils/utils';
|
17
16
|
import { PaneVisibilityActionTypes, paneVisibilityToggleReducerCreator, } from '../../utils/paneVisibilityToggleHelpers';
|
18
17
|
import { ExecuteResult } from '../ExecuteResult/ExecuteResult';
|
19
18
|
import { ExplainResult } from '../ExplainResult/ExplainResult';
|
@@ -39,7 +38,7 @@ const initialTenantCommonInfoState = {
|
|
39
38
|
};
|
40
39
|
function QueryEditor(props) {
|
41
40
|
const editorOptions = useEditorOptions();
|
42
|
-
const { path, setTenantPath: setPath, executeQuery, type, theme, changeUserInput, showPreview, } = props;
|
41
|
+
const { tenantName, path, setTenantPath: setPath, executeQuery, type, theme, changeUserInput, showPreview, } = props;
|
43
42
|
const { tenantPath: savedPath } = executeQuery;
|
44
43
|
const [resultType, setResultType] = React.useState(RESULT_TYPES.EXECUTE);
|
45
44
|
const [isResultLoaded, setIsResultLoaded] = React.useState(false);
|
@@ -51,13 +50,13 @@ function QueryEditor(props) {
|
|
51
50
|
const [sendExecuteQuery, executeQueryResult] = executeQueryApi.useExecuteQueryMutation();
|
52
51
|
const [sendExplainQuery, explainQueryResult] = explainQueryApi.useExplainQueryMutation();
|
53
52
|
React.useEffect(() => {
|
54
|
-
if (savedPath !==
|
53
|
+
if (savedPath !== tenantName) {
|
55
54
|
if (savedPath) {
|
56
55
|
changeUserInput({ input: '' });
|
57
56
|
}
|
58
|
-
setPath(
|
57
|
+
setPath(tenantName);
|
59
58
|
}
|
60
|
-
}, [changeUserInput, setPath,
|
59
|
+
}, [changeUserInput, setPath, tenantName, savedPath]);
|
61
60
|
const [resultVisibilityState, dispatchResultVisibilityState] = React.useReducer(paneVisibilityToggleReducerCreator(DEFAULT_IS_QUERY_RESULT_COLLAPSED), initialTenantCommonInfoState);
|
62
61
|
const editorRef = React.useRef();
|
63
62
|
React.useEffect(() => {
|
@@ -75,18 +74,6 @@ function QueryEditor(props) {
|
|
75
74
|
window.removeEventListener('resize', onChangeWindow);
|
76
75
|
};
|
77
76
|
}, []);
|
78
|
-
React.useEffect(() => {
|
79
|
-
const storageEventHandler = (event) => {
|
80
|
-
if (event.key === SAVED_QUERIES_KEY) {
|
81
|
-
const v = parseJson(event.newValue);
|
82
|
-
setSavedQueries(v);
|
83
|
-
}
|
84
|
-
};
|
85
|
-
window.addEventListener('storage', storageEventHandler);
|
86
|
-
return () => {
|
87
|
-
window.removeEventListener('storage', storageEventHandler);
|
88
|
-
};
|
89
|
-
}, [setSavedQueries]);
|
90
77
|
React.useEffect(() => {
|
91
78
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerCollapse);
|
92
79
|
}, []);
|
@@ -130,7 +117,7 @@ function QueryEditor(props) {
|
|
130
117
|
setResultType(RESULT_TYPES.EXECUTE);
|
131
118
|
sendExecuteQuery({
|
132
119
|
query,
|
133
|
-
database:
|
120
|
+
database: tenantName,
|
134
121
|
mode,
|
135
122
|
schema,
|
136
123
|
});
|
@@ -151,7 +138,7 @@ function QueryEditor(props) {
|
|
151
138
|
setResultType(RESULT_TYPES.EXPLAIN);
|
152
139
|
sendExplainQuery({
|
153
140
|
query: input,
|
154
|
-
database:
|
141
|
+
database: tenantName,
|
155
142
|
mode: mode,
|
156
143
|
});
|
157
144
|
setIsResultLoaded(true);
|
@@ -287,7 +274,7 @@ function QueryEditor(props) {
|
|
287
274
|
};
|
288
275
|
return (_jsx("div", { className: b(), children: _jsxs(SplitPane, { direction: "vertical", defaultSizePaneKey: DEFAULT_SIZE_RESULT_PANE_KEY, triggerCollapse: resultVisibilityState.triggerCollapse, triggerExpand: resultVisibilityState.triggerExpand, minSize: [0, 52], collapsedSizes: [100, 0], onSplitStartDragAdditional: onSplitStartDragAdditional, children: [_jsxs("div", { className: b('pane-wrapper', {
|
289
276
|
top: true,
|
290
|
-
}), children: [_jsx("div", { className: b('monaco-wrapper'), children: _jsx("div", { className: b('monaco'), children: _jsx(MonacoEditor, { language: LANGUAGE_YQL_ID, value: executeQuery.input, options: editorOptions, onChange: onChange, editorDidMount: editorDidMount, theme: `vs-${theme}` }) }) }), renderControls()] }), _jsx("div", { className: b('pane-wrapper'), children: _jsx(Result, { executeQueryData: executeQueryResult.data, executeQueryError: executeQueryResult.error, explainQueryData: explainQueryResult.data, explainQueryError: explainQueryResult.error, explainQueryLoading: explainQueryResult.isLoading, resultVisibilityState: resultVisibilityState, onExpandResultHandler: onExpandResultHandler, onCollapseResultHandler: onCollapseResultHandler, type: type, theme: theme, resultType: resultType, path: path, showPreview: showPreview }) })] }) }));
|
277
|
+
}), children: [_jsx("div", { className: b('monaco-wrapper'), children: _jsx("div", { className: b('monaco'), children: _jsx(MonacoEditor, { language: LANGUAGE_YQL_ID, value: executeQuery.input, options: editorOptions, onChange: onChange, editorDidMount: editorDidMount, theme: `vs-${theme}` }) }) }), renderControls()] }), _jsx("div", { className: b('pane-wrapper'), children: _jsx(Result, { executeQueryData: executeQueryResult.data, executeQueryError: executeQueryResult.error, explainQueryData: explainQueryResult.data, explainQueryError: explainQueryResult.error, explainQueryLoading: explainQueryResult.isLoading, resultVisibilityState: resultVisibilityState, onExpandResultHandler: onExpandResultHandler, onCollapseResultHandler: onCollapseResultHandler, type: type, theme: theme, resultType: resultType, tenantName: tenantName, path: path, showPreview: showPreview }) })] }) }));
|
291
278
|
}
|
292
279
|
const mapStateToProps = (state) => {
|
293
280
|
return {
|
@@ -303,9 +290,9 @@ const mapDispatchToProps = {
|
|
303
290
|
setTenantPath,
|
304
291
|
};
|
305
292
|
export default connect(mapStateToProps, mapDispatchToProps)(QueryEditor);
|
306
|
-
function Result({ executeQueryData, executeQueryError, explainQueryData, explainQueryError, explainQueryLoading, resultVisibilityState, onExpandResultHandler, onCollapseResultHandler, type, theme, resultType, path, showPreview, }) {
|
293
|
+
function Result({ executeQueryData, executeQueryError, explainQueryData, explainQueryError, explainQueryLoading, resultVisibilityState, onExpandResultHandler, onCollapseResultHandler, type, theme, resultType, tenantName, path, showPreview, }) {
|
307
294
|
if (showPreview) {
|
308
|
-
return _jsx(Preview, { database: path, type: type });
|
295
|
+
return _jsx(Preview, { database: tenantName, path: path, type: type });
|
309
296
|
}
|
310
297
|
if (resultType === RESULT_TYPES.EXECUTE) {
|
311
298
|
if (executeQueryData || executeQueryError) {
|