ydb-embedded-ui 6.6.1 → 6.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/package.json +31 -30
- package/dist/src/components/InfoViewer/InfoViewer.d.ts +1 -1
- package/dist/src/components/InfoViewer/InfoViewer.js +2 -1
- package/dist/src/components/InfoViewer/i18n/en.json +2 -1
- package/dist/src/components/InfoViewer/i18n/index.d.ts +1 -1
- package/dist/src/components/InfoViewer/i18n/index.js +1 -2
- 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/AppWithClusters/AppWithClusters.js +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/Storage/StorageGroups/getStorageGroupsColumns.js +4 -3
- 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 +85 -69
- package/dist/src/containers/Tenant/Acl/Acl.scss +14 -9
- 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.js +3 -3
- 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/i18n/index.d.ts +1 -1
- 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/EntityTitle/EntityTitle.d.ts +6 -0
- package/dist/src/containers/Tenant/EntityTitle/EntityTitle.js +11 -0
- 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 +22 -1
- package/dist/src/containers/Tenant/i18n/index.d.ts +1 -1
- package/dist/src/containers/Tenant/utils/index.d.ts +1 -0
- package/dist/src/containers/Tenant/utils/index.js +6 -0
- package/dist/src/containers/Tenant/utils/queryTemplates.d.ts +4 -0
- package/dist/src/containers/Tenant/utils/queryTemplates.js +32 -0
- package/dist/src/containers/Tenant/utils/schemaActions.js +18 -2
- package/dist/src/containers/UserSettings/Setting.d.ts +7 -9
- package/dist/src/containers/UserSettings/Setting.js +13 -28
- package/dist/src/containers/UserSettings/UserSettings.d.ts +0 -2
- package/dist/src/containers/UserSettings/UserSettings.js +3 -6
- package/dist/src/containers/UserSettings/i18n/en.json +2 -2
- package/dist/src/containers/UserSettings/settings.js +3 -3
- 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 +24 -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/styles/mixins.scss +5 -0
- package/dist/src/styles/themes.scss +1 -1
- package/dist/src/types/api/acl.d.ts +2 -1
- package/dist/src/types/api/schema/schema.d.ts +5 -0
- 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 +31 -30
- package/dist/src/components/InfoViewer/i18n/ru.json +0 -4
- 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/containers/UserSettings/UserSettings.scss +0 -9
- 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
@@ -11,7 +11,7 @@ import { filterGroups, filterNodes, getUsageFilterOptions, } from '../../store/r
|
|
11
11
|
import { storageApi } from '../../store/reducers/storage/storage';
|
12
12
|
import { storageTypeSchema, visibleEntitiesSchema } from '../../store/reducers/storage/types';
|
13
13
|
import { DEFAULT_POLLING_INTERVAL, DEFAULT_TABLE_SETTINGS } from '../../utils/constants';
|
14
|
-
import { useNodesRequestParams, useStorageRequestParams, useTableSort, useTypedSelector, } from '../../utils/hooks';
|
14
|
+
import { useAutoRefreshInterval, useNodesRequestParams, useStorageRequestParams, useTableSort, useTypedSelector, } from '../../utils/hooks';
|
15
15
|
import { NodesUptimeFilterValues, nodesUptimeFilterValuesSchema } from '../../utils/nodes';
|
16
16
|
import { StorageControls } from './StorageControls/StorageControls';
|
17
17
|
import { StorageGroups } from './StorageGroups/StorageGroups';
|
@@ -33,7 +33,7 @@ const UsageFilterParam = withDefault({
|
|
33
33
|
}, []);
|
34
34
|
export const Storage = ({ additionalNodesProps, tenant, nodeId }) => {
|
35
35
|
var _a;
|
36
|
-
const
|
36
|
+
const [autorefresh] = useAutoRefreshInterval();
|
37
37
|
const [queryParams, setQueryParams] = useQueryParams({
|
38
38
|
type: StringParam,
|
39
39
|
visible: StringParam,
|
@@ -63,7 +63,8 @@ const erasureColumn = {
|
|
63
63
|
const degradedColumn = {
|
64
64
|
name: GROUPS_COLUMNS_IDS.Degraded,
|
65
65
|
header: 'Degraded',
|
66
|
-
width:
|
66
|
+
width: 110,
|
67
|
+
resizeMinWidth: 110,
|
67
68
|
render: ({ row }) => row.Degraded ? (_jsxs(Label, { theme: getDegradedSeverity(row), children: ["Degraded: ", row.Degraded] })) : ('-'),
|
68
69
|
align: DataTable.LEFT,
|
69
70
|
defaultOrder: DataTable.DESCENDING,
|
@@ -71,8 +72,8 @@ const degradedColumn = {
|
|
71
72
|
const usageColumn = {
|
72
73
|
name: GROUPS_COLUMNS_IDS.Usage,
|
73
74
|
header: 'Usage',
|
74
|
-
width:
|
75
|
-
resizeMinWidth:
|
75
|
+
width: 75,
|
76
|
+
resizeMinWidth: 75,
|
76
77
|
render: ({ row }) => {
|
77
78
|
// without a limit the usage can be evaluated as 0,
|
78
79
|
// but the absence of a value is more clear
|
@@ -14,7 +14,7 @@ import { ETabletState } from '../../types/api/tablet';
|
|
14
14
|
import { cn } from '../../utils/cn';
|
15
15
|
import { DEFAULT_TABLE_SETTINGS } from '../../utils/constants';
|
16
16
|
import { calcUptime } from '../../utils/dataFormatters/dataFormatters';
|
17
|
-
import { useTypedDispatch, useTypedSelector } from '../../utils/hooks';
|
17
|
+
import { useAutoRefreshInterval, useTypedDispatch, useTypedSelector } from '../../utils/hooks';
|
18
18
|
import { mapTabletStateToLabelTheme } from '../../utils/tablet';
|
19
19
|
import { getDefaultNodePath } from '../Node/NodePages';
|
20
20
|
import i18n from './i18n';
|
@@ -26,7 +26,7 @@ const columns = [
|
|
26
26
|
return i18n('Type');
|
27
27
|
},
|
28
28
|
render: ({ row }) => {
|
29
|
-
return (_jsxs("span", { children: [row.Type, " ", row.Leader ? _jsx(Text, { color: "secondary", children: "
|
29
|
+
return (_jsxs("span", { children: [row.Type, " ", row.Leader ? '' : _jsx(Text, { color: "secondary", children: "follower" })] }));
|
30
30
|
},
|
31
31
|
},
|
32
32
|
{
|
@@ -61,7 +61,7 @@ const columns = [
|
|
61
61
|
align: 'right',
|
62
62
|
},
|
63
63
|
{
|
64
|
-
name: '
|
64
|
+
name: 'fqdn',
|
65
65
|
get header() {
|
66
66
|
return i18n('Node FQDN');
|
67
67
|
},
|
@@ -111,8 +111,8 @@ function TabletActions(tablet) {
|
|
111
111
|
}, buttonDisabled: isDisabledRestart || !isUserAllowedToMakeChanges, withPopover: true, popoverContent: i18n('controls.kill-not-allowed'), popoverDisabled: isUserAllowedToMakeChanges, children: _jsx(Icon, { data: ArrowsRotateRight }) }));
|
112
112
|
}
|
113
113
|
export function Tablets({ nodeId, path, className }) {
|
114
|
-
const
|
115
|
-
let params =
|
114
|
+
const [autoRefreshInterval] = useAutoRefreshInterval();
|
115
|
+
let params = {};
|
116
116
|
const node = nodeId === undefined ? undefined : String(nodeId);
|
117
117
|
if (node !== undefined) {
|
118
118
|
params = { nodes: [String(node)] };
|
@@ -120,11 +120,11 @@ export function Tablets({ nodeId, path, className }) {
|
|
120
120
|
else if (path) {
|
121
121
|
params = { path };
|
122
122
|
}
|
123
|
-
const { currentData, isFetching, error } = tabletsApi.useGetTabletsInfoQuery(params, {
|
124
|
-
pollingInterval:
|
123
|
+
const { currentData, isFetching, error } = tabletsApi.useGetTabletsInfoQuery(Object.keys(params).length === 0 ? skipToken : params, {
|
124
|
+
pollingInterval: autoRefreshInterval,
|
125
125
|
});
|
126
126
|
const loading = isFetching && currentData === undefined;
|
127
|
-
const tablets = useTypedSelector((state) => selectTabletsWithFqdn(state,
|
127
|
+
const tablets = useTypedSelector((state) => selectTabletsWithFqdn(state, params));
|
128
128
|
if (loading) {
|
129
129
|
return _jsx(TableSkeleton, {});
|
130
130
|
}
|
@@ -1,57 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
wasLoaded: PropTypes.Requireable<boolean>;
|
4
|
-
loading: PropTypes.Requireable<boolean>;
|
5
|
-
getTabletsInfo: PropTypes.Requireable<(...args: any[]) => any>;
|
6
|
-
timeoutForRequest: PropTypes.Requireable<number>;
|
7
|
-
path: PropTypes.Requireable<string>;
|
8
|
-
clearWasLoadingFlag: PropTypes.Requireable<(...args: any[]) => any>;
|
9
|
-
nodes: PropTypes.Requireable<any[]>;
|
10
|
-
tablets: PropTypes.Requireable<any[]>;
|
11
|
-
filteredTablets: PropTypes.Requireable<any[]>;
|
12
|
-
setStateFilter: PropTypes.Requireable<(...args: any[]) => any>;
|
13
|
-
setTypeFilter: PropTypes.Requireable<(...args: any[]) => any>;
|
14
|
-
stateFilter: PropTypes.Requireable<any[]>;
|
15
|
-
typeFilter: PropTypes.Requireable<any[]>;
|
16
|
-
error: PropTypes.Requireable<PropTypes.Requireable<string> | PropTypes.Requireable<object>>;
|
17
|
-
setHeader: PropTypes.Requireable<(...args: any[]) => any>;
|
18
|
-
};
|
19
|
-
static renderLoader(): import("react/jsx-runtime").JSX.Element;
|
20
|
-
static parseNodes: (nodes: any) => number[] | undefined;
|
21
|
-
static getStateFiltersFromColor: (color: any) => any;
|
22
|
-
static CONTROL_WIDTH: number;
|
23
|
-
static POPUP_WIDTH: number;
|
24
|
-
constructor(props: any);
|
25
|
-
constructor(props: any, context: any);
|
26
|
-
state: {
|
27
|
-
nodeFilter: never[];
|
28
|
-
tenantPath: string;
|
29
|
-
clusterName: string;
|
30
|
-
};
|
31
|
-
reloadDescriptor: number;
|
32
|
-
componentDidMount(): void;
|
33
|
-
componentDidUpdate(prevProps: any): void;
|
34
|
-
componentWillUnmount(): void;
|
35
|
-
makeRequest: () => void;
|
36
|
-
getTablets: () => void;
|
37
|
-
handleNodeFilterChange: (nodeFilter: any) => void;
|
38
|
-
handleStateFilterChange: (stateFilter: any) => void;
|
39
|
-
handleTypeFilterChange: (typeFilter: any) => void;
|
40
|
-
renderTablet: (index: any, key: any) => import("react/jsx-runtime").JSX.Element;
|
41
|
-
renderContent: () => import("react/jsx-runtime").JSX.Element;
|
42
|
-
renderView: () => import("react/jsx-runtime").JSX.Element;
|
43
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
44
|
-
}
|
45
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof TabletsFilters, {
|
46
|
-
path?: string | null | undefined;
|
47
|
-
setHeader?: ((...args: any[]) => any) | null | undefined;
|
48
|
-
context?: React.Context<import("react-redux").ReactReduxContextValue<any, import("redux").UnknownAction> | null> | undefined;
|
49
|
-
store?: import("redux").Store<any, import("redux").UnknownAction, unknown> | undefined;
|
50
|
-
} | {
|
51
|
-
path?: string | null | undefined;
|
52
|
-
setHeader?: ((...args: any[]) => any) | null | undefined;
|
53
|
-
store?: import("redux").Store<any, import("redux").UnknownAction, unknown> | undefined;
|
54
|
-
}>;
|
55
|
-
export default _default;
|
56
|
-
import React from 'react';
|
57
|
-
import PropTypes from 'prop-types';
|
1
|
+
import './TabletsFilters.scss';
|
2
|
+
export declare function TabletsFilters(): import("react/jsx-runtime").JSX.Element;
|
@@ -1,200 +1,90 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import React from 'react';
|
3
3
|
import { Loader, Select } from '@gravity-ui/uikit';
|
4
|
-
import isEqual from 'lodash/isEqual';
|
5
4
|
import map from 'lodash/map';
|
6
|
-
import PropTypes from 'prop-types';
|
7
5
|
import { Helmet } from 'react-helmet-async';
|
8
6
|
import ReactList from 'react-list';
|
9
|
-
import {
|
7
|
+
import { ArrayParam, StringParam, useQueryParams } from 'use-query-params';
|
8
|
+
import { z } from 'zod';
|
10
9
|
import { AccessDenied } from '../../components/Errors/403';
|
10
|
+
import { ResponseError } from '../../components/Errors/ResponseError';
|
11
11
|
import { Tablet } from '../../components/Tablet';
|
12
|
-
import { parseQuery } from '../../routes';
|
13
12
|
import { setHeaderBreadcrumbs } from '../../store/reducers/header/header';
|
14
|
-
import {
|
13
|
+
import { nodesListApi } from '../../store/reducers/nodesList';
|
14
|
+
import { tabletsApi } from '../../store/reducers/tablets';
|
15
|
+
import { getFilteredTablets } from '../../store/reducers/tabletsFilters';
|
15
16
|
import { cn } from '../../utils/cn';
|
16
|
-
import { CLUSTER_DEFAULT_TITLE } from '../../utils/constants';
|
17
|
+
import { AUTO_RELOAD_INTERVAL, CLUSTER_DEFAULT_TITLE } from '../../utils/constants';
|
18
|
+
import { useTypedDispatch, useTypedSelector } from '../../utils/hooks';
|
17
19
|
import { tabletColorToTabletState, tabletStates } from '../../utils/tablet';
|
18
20
|
import i18n from './i18n';
|
19
21
|
import './TabletsFilters.scss';
|
20
22
|
const b = cn('tablets-filters');
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
this.state = {
|
25
|
-
nodeFilter: [],
|
26
|
-
tenantPath: '',
|
27
|
-
clusterName: '',
|
28
|
-
};
|
29
|
-
this.reloadDescriptor = -1;
|
30
|
-
this.makeRequest = () => {
|
31
|
-
const { nodeFilter, tenantPath } = this.state;
|
32
|
-
this.props.getTabletsInfo({ nodes: nodeFilter, path: [tenantPath] });
|
33
|
-
};
|
34
|
-
this.getTablets = () => {
|
35
|
-
const { timeoutForRequest } = this.props;
|
36
|
-
clearInterval(this.reloadDescriptor);
|
37
|
-
this.reloadDescriptor = setTimeout(() => {
|
38
|
-
this.makeRequest();
|
39
|
-
this.reloadDescriptor = -1;
|
40
|
-
}, timeoutForRequest);
|
41
|
-
};
|
42
|
-
this.handleNodeFilterChange = (nodeFilter) => {
|
43
|
-
this.setState({ nodeFilter }, () => {
|
44
|
-
this.props.clearWasLoadingFlag();
|
45
|
-
this.makeRequest();
|
46
|
-
});
|
47
|
-
};
|
48
|
-
this.handleStateFilterChange = (stateFilter) => {
|
49
|
-
const { setStateFilter } = this.props;
|
50
|
-
setStateFilter(stateFilter);
|
51
|
-
};
|
52
|
-
this.handleTypeFilterChange = (typeFilter) => {
|
53
|
-
const { setTypeFilter } = this.props;
|
54
|
-
setTypeFilter(typeFilter);
|
55
|
-
};
|
56
|
-
this.renderTablet = (index, key) => {
|
57
|
-
const { filteredTablets, size } = this.props;
|
58
|
-
return (_jsx(Tablet, { tablet: filteredTablets[index], tenantName: this.state.tenantPath, size: size, className: b('tablet') }, key));
|
59
|
-
};
|
60
|
-
this.renderContent = () => {
|
61
|
-
const { nodeFilter, tenantPath } = this.state;
|
62
|
-
const { tablets, filteredTablets, nodes, stateFilter, typeFilter, error } = this.props;
|
63
|
-
const states = tabletStates.map((item) => ({ value: item, content: item }));
|
64
|
-
const types = Array.from(new Set(...[map(tablets, (tblt) => tblt.Type)])).map((item) => ({
|
65
|
-
value: item,
|
66
|
-
content: item,
|
67
|
-
}));
|
68
|
-
const nodesForSelect = map(nodes, (node) => ({
|
69
|
-
content: node.Id,
|
70
|
-
value: node.Id,
|
71
|
-
meta: node.Host,
|
72
|
-
}));
|
73
|
-
return (_jsxs("div", { className: b(), children: [tenantPath ? (_jsx("div", { className: b('tenant'), children: _jsxs(React.Fragment, { children: [_jsx("span", { className: b('label'), children: "Database: " }), " ", tenantPath] }) })) : null, _jsx(MemoizedFilters, { nodesForSelect: nodesForSelect, nodeFilter: nodeFilter, onChangeNodes: this.handleNodeFilterChange, states: states, stateFilter: stateFilter, onChangeStates: this.handleStateFilterChange, types: types, typeFilter: typeFilter, onChangeTypes: this.handleTypeFilterChange }), error && _jsx("div", { className: "error", children: error }), filteredTablets.length > 0 ? (_jsx("div", { className: b('items'), children: _jsx(ReactList, { itemRenderer: this.renderTablet, length: filteredTablets.length, type: "uniform" }) })) : (!error && _jsx("div", { className: b('empty-message'), children: "no tablets" }))] }));
|
74
|
-
};
|
75
|
-
this.renderView = () => {
|
76
|
-
const { loading, wasLoaded, error } = this.props;
|
77
|
-
if (loading && !wasLoaded) {
|
78
|
-
return TabletsFilters.renderLoader();
|
79
|
-
}
|
80
|
-
else if (error && typeof error === 'object') {
|
81
|
-
if (error.status === 403) {
|
82
|
-
return _jsx(AccessDenied, {});
|
83
|
-
}
|
84
|
-
return _jsx("div", { children: error.statusText });
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
return this.renderContent();
|
88
|
-
}
|
89
|
-
};
|
23
|
+
const stringArrayParam = z.preprocess((arg) => {
|
24
|
+
if (Array.isArray(arg)) {
|
25
|
+
return arg.filter(Boolean).sort();
|
90
26
|
}
|
91
|
-
|
92
|
-
|
27
|
+
return [];
|
28
|
+
}, z.string().array());
|
29
|
+
const stateArrayParam = z.preprocess((arg) => {
|
30
|
+
if (Array.isArray(arg)) {
|
31
|
+
return arg
|
32
|
+
.flatMap((item) => tabletColorToTabletState[item] || item)
|
33
|
+
.filter(Boolean);
|
93
34
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
35
|
+
return [];
|
36
|
+
}, z.string().array());
|
37
|
+
const CONTROL_WIDTH = 220;
|
38
|
+
const POPUP_WIDTH = 300;
|
39
|
+
export function TabletsFilters() {
|
40
|
+
var _a;
|
41
|
+
const [params, setParams] = useQueryParams({
|
42
|
+
nodeIds: ArrayParam,
|
43
|
+
type: ArrayParam,
|
44
|
+
state: ArrayParam,
|
45
|
+
path: StringParam,
|
46
|
+
clusterName: StringParam,
|
47
|
+
});
|
48
|
+
const path = (_a = params.path) !== null && _a !== void 0 ? _a : undefined;
|
49
|
+
const dispatch = useTypedDispatch();
|
50
|
+
React.useEffect(() => {
|
51
|
+
dispatch(setHeaderBreadcrumbs('tablets', {
|
110
52
|
tenantName: path,
|
111
|
-
});
|
112
|
-
}
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
53
|
+
}));
|
54
|
+
}, [dispatch, path]);
|
55
|
+
const nodeIds = stringArrayParam.parse(params.nodeIds);
|
56
|
+
const { currentData, isFetching, error } = tabletsApi.useGetTabletsInfoQuery({ nodes: nodeIds, path }, {
|
57
|
+
pollingInterval: AUTO_RELOAD_INTERVAL,
|
58
|
+
});
|
59
|
+
const { data: nodes } = nodesListApi.useGetNodesListQuery({}, { pollingInterval: AUTO_RELOAD_INTERVAL });
|
60
|
+
const loading = isFetching && currentData === undefined;
|
61
|
+
const stateFilter = stateArrayParam.parse(params.state);
|
62
|
+
const states = tabletStates.map((item) => ({ value: item, content: item }));
|
63
|
+
const typeFilter = stringArrayParam.parse(params.type);
|
64
|
+
const types = Array.from(new Set(...[map(currentData === null || currentData === void 0 ? void 0 : currentData.TabletStateInfo, (tblt) => tblt.Type)])).map((item) => ({
|
65
|
+
value: String(item),
|
66
|
+
content: item,
|
67
|
+
}));
|
68
|
+
const filteredTablets = useTypedSelector((state) => getFilteredTablets(state, { nodes: nodeIds, path }, stateFilter, typeFilter));
|
69
|
+
const renderTablet = (index, key) => (_jsx(Tablet, { tablet: filteredTablets[index], tenantName: path }, key));
|
70
|
+
const nodesForSelect = map(nodes, (node) => ({
|
71
|
+
content: node.Id,
|
72
|
+
value: String(node.Id),
|
73
|
+
data: node.Host,
|
74
|
+
}));
|
75
|
+
const renderView = () => {
|
76
|
+
if (loading) {
|
77
|
+
return (_jsx("div", { className: 'loader', children: _jsx(Loader, { size: "l" }) }));
|
118
78
|
}
|
119
|
-
if (
|
120
|
-
|
79
|
+
if (error && typeof error === 'object' && 'status' in error && error.status === 403) {
|
80
|
+
return _jsx(AccessDenied, {});
|
121
81
|
}
|
122
|
-
|
123
|
-
componentWillUnmount() {
|
124
|
-
clearInterval(this.reloadDescriptor);
|
125
|
-
}
|
126
|
-
render() {
|
127
|
-
const { tenantPath, clusterName } = this.state;
|
128
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Helmet, { children: _jsx("title", { children: `${i18n('page.title')} — ${tenantPath || clusterName || CLUSTER_DEFAULT_TITLE}` }) }), this.renderView()] }));
|
129
|
-
}
|
130
|
-
}
|
131
|
-
TabletsFilters.propTypes = {
|
132
|
-
wasLoaded: PropTypes.bool,
|
133
|
-
loading: PropTypes.bool,
|
134
|
-
getTabletsInfo: PropTypes.func,
|
135
|
-
timeoutForRequest: PropTypes.number,
|
136
|
-
path: PropTypes.string,
|
137
|
-
clearWasLoadingFlag: PropTypes.func,
|
138
|
-
nodes: PropTypes.array,
|
139
|
-
tablets: PropTypes.array,
|
140
|
-
filteredTablets: PropTypes.array,
|
141
|
-
setStateFilter: PropTypes.func,
|
142
|
-
setTypeFilter: PropTypes.func,
|
143
|
-
stateFilter: PropTypes.array,
|
144
|
-
typeFilter: PropTypes.array,
|
145
|
-
error: PropTypes.oneOf([PropTypes.string, PropTypes.object]),
|
146
|
-
setHeader: PropTypes.func,
|
147
|
-
};
|
148
|
-
TabletsFilters.parseNodes = (nodes) => {
|
149
|
-
if (Array.isArray(nodes)) {
|
150
|
-
return nodes.map(Number).filter(Number.isInteger);
|
151
|
-
}
|
152
|
-
};
|
153
|
-
TabletsFilters.getStateFiltersFromColor = (color) => {
|
154
|
-
return tabletColorToTabletState[color] || [color];
|
155
|
-
};
|
156
|
-
TabletsFilters.CONTROL_WIDTH = 220;
|
157
|
-
TabletsFilters.POPUP_WIDTH = 300;
|
158
|
-
const Filters = ({ nodesForSelect, nodeFilter, onChangeNodes, states, stateFilter, onChangeStates, types, typeFilter, onChangeTypes, }) => {
|
159
|
-
return (_jsxs("div", { className: b('filters'), children: [_jsx("div", { className: b('filter-wrapper'), children: _jsx(Select, { multiple: true, label: "Node ID", width: TabletsFilters.CONTROL_WIDTH, popupWidth: TabletsFilters.POPUP_WIDTH, placeholder: "All", options: nodesForSelect, value: nodeFilter, onUpdate: onChangeNodes, renderOption: (option) => {
|
160
|
-
return (_jsxs("div", { className: b('node'), children: [_jsx("div", { children: option.content }), _jsx("div", { className: b('node-meta'), title: option.meta, children: option.meta })] }));
|
161
|
-
}, getOptionHeight: () => 40 }) }), _jsx("div", { className: b('filter-wrapper'), children: _jsx(Select, { multiple: true, label: "multiple", width: TabletsFilters.CONTROL_WIDTH, placeholder: "All", options: states, value: stateFilter, onUpdate: onChangeStates }) }), _jsx("div", { className: b('filter-wrapper'), children: _jsx(Select, { multiple: true, label: "Types", width: TabletsFilters.CONTROL_WIDTH, placeholder: "All", options: types, value: typeFilter, onUpdate: onChangeTypes }) })] }));
|
162
|
-
};
|
163
|
-
Filters.propTypes = {
|
164
|
-
nodesForSelect: PropTypes.array,
|
165
|
-
nodeFilter: PropTypes.array,
|
166
|
-
onChangeNodes: PropTypes.func,
|
167
|
-
states: PropTypes.array,
|
168
|
-
stateFilter: PropTypes.array,
|
169
|
-
onChangeStates: PropTypes.func,
|
170
|
-
types: PropTypes.array,
|
171
|
-
typeFilter: PropTypes.array,
|
172
|
-
onChangeTypes: PropTypes.func,
|
173
|
-
};
|
174
|
-
const MemoizedFilters = React.memo(Filters, (prevProps, nextProps) => {
|
175
|
-
return (isEqual(prevProps.nodeFilter, nextProps.nodeFilter) &&
|
176
|
-
isEqual(prevProps.stateFilter, nextProps.stateFilter) &&
|
177
|
-
isEqual(prevProps.typeFilter, nextProps.typeFilter));
|
178
|
-
});
|
179
|
-
const mapStateToProps = (state) => {
|
180
|
-
const { nodes, wasLoaded, loading, timeoutForRequest, stateFilter, typeFilter, error } = state.tabletsFilters;
|
181
|
-
return {
|
182
|
-
tablets: getTablets(state),
|
183
|
-
filteredTablets: getFilteredTablets(state),
|
184
|
-
nodes,
|
185
|
-
timeoutForRequest,
|
186
|
-
wasLoaded,
|
187
|
-
loading,
|
188
|
-
stateFilter,
|
189
|
-
typeFilter,
|
190
|
-
error,
|
82
|
+
return (_jsxs("div", { className: b(), children: [path ? (_jsxs("div", { className: b('tenant'), children: [_jsx("span", { className: b('label'), children: "Database: " }), " ", path] })) : null, _jsx(Filters, { nodesForSelect: nodesForSelect, nodeFilter: nodeIds, onChangeNodes: (n) => setParams({ nodeIds: n }), states: states, stateFilter: stateFilter, onChangeStates: (s) => setParams({ state: s }), types: types, typeFilter: typeFilter, onChangeTypes: (t) => setParams({ type: t }) }), error ? _jsx(ResponseError, { error: error }) : null, filteredTablets.length > 0 ? (_jsx("div", { className: b('items'), children: _jsx(ReactList, { itemRenderer: renderTablet, length: filteredTablets.length, type: "uniform" }) })) : (!error && _jsx("div", { className: b('empty-message'), children: "no tablets" }))] }));
|
191
83
|
};
|
192
|
-
};
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
};
|
200
|
-
export default connect(mapStateToProps, mapDispatchToProps)(TabletsFilters);
|
84
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Helmet, { children: _jsx("title", { children: `${i18n('page.title')} — ${path || params.clusterName || CLUSTER_DEFAULT_TITLE}` }) }), renderView()] }));
|
85
|
+
}
|
86
|
+
function Filters({ nodesForSelect, nodeFilter, onChangeNodes, states, stateFilter, onChangeStates, types, typeFilter, onChangeTypes, }) {
|
87
|
+
return (_jsxs("div", { className: b('filters'), children: [_jsx("div", { className: b('filter-wrapper'), children: _jsx(Select, { multiple: true, label: "Node ID", width: CONTROL_WIDTH, popupWidth: POPUP_WIDTH, placeholder: "All", options: nodesForSelect, value: nodeFilter, onUpdate: onChangeNodes, renderOption: (option) => {
|
88
|
+
return (_jsxs("div", { className: b('node'), children: [_jsx("div", { children: option.content }), _jsx("div", { className: b('node-meta'), title: option.data, children: option.data })] }));
|
89
|
+
}, getOptionHeight: () => 40 }) }), _jsx("div", { className: b('filter-wrapper'), children: _jsx(Select, { multiple: true, label: "multiple", width: CONTROL_WIDTH, placeholder: "All", options: states, value: stateFilter, onUpdate: onChangeStates }) }), _jsx("div", { className: b('filter-wrapper'), children: _jsx(Select, { multiple: true, label: "Types", width: CONTROL_WIDTH, placeholder: "All", options: types, value: typeFilter, onUpdate: onChangeTypes }) })] }));
|
90
|
+
}
|
@@ -1,17 +1,14 @@
|
|
1
|
+
import { __rest } from "tslib";
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
3
|
import React from 'react';
|
4
|
+
import { DefinitionList } from '@gravity-ui/components';
|
3
5
|
import { ResponseError } from '../../../components/Errors/ResponseError';
|
4
6
|
import { Loader } from '../../../components/Loader';
|
5
|
-
import {
|
6
|
-
import { getSchemaAcl, setAclWasNotLoaded } from '../../../store/reducers/schemaAcl/schemaAcl';
|
7
|
+
import { schemaAclApi } from '../../../store/reducers/schemaAcl/schemaAcl';
|
7
8
|
import { cn } from '../../../utils/cn';
|
8
|
-
import { DEFAULT_TABLE_SETTINGS } from '../../../utils/constants';
|
9
|
-
import { useTypedDispatch, useTypedSelector } from '../../../utils/hooks';
|
10
9
|
import i18n from '../i18n';
|
11
10
|
import './Acl.scss';
|
12
11
|
const b = cn('ydb-acl');
|
13
|
-
const ACL_COLUMNS_WIDTH_LS_KEY = 'aclTableColumnsWidth';
|
14
|
-
const TABLE_SETTINGS = Object.assign(Object.assign({}, DEFAULT_TABLE_SETTINGS), { dynamicRender: false, stickyTop: 36 });
|
15
12
|
const prepareLogin = (value) => {
|
16
13
|
if (value && value.endsWith('@staff') && !value.startsWith('svc_')) {
|
17
14
|
const login = value.split('@')[0];
|
@@ -19,77 +16,96 @@ const prepareLogin = (value) => {
|
|
19
16
|
}
|
20
17
|
return value;
|
21
18
|
};
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
sortable: false,
|
43
|
-
render: ({ row }) => {
|
44
|
-
return prepareLogin(row.Subject);
|
45
|
-
},
|
46
|
-
width: 140,
|
47
|
-
},
|
48
|
-
{
|
49
|
-
name: 'InheritanceType',
|
50
|
-
header: 'Inheritance Type',
|
51
|
-
render: ({ row }) => {
|
52
|
-
var _a;
|
53
|
-
return (_a = row.InheritanceType) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
|
54
|
-
return _jsx("div", { children: item }, index);
|
55
|
-
});
|
56
|
-
},
|
57
|
-
sortable: false,
|
58
|
-
},
|
59
|
-
];
|
60
|
-
export const Acl = () => {
|
61
|
-
const dispatch = useTypedDispatch();
|
62
|
-
const { currentSchemaPath } = useTypedSelector((state) => state.schema);
|
63
|
-
const { loading, error, acl, owner, wasLoaded } = useTypedSelector((state) => state.schemaAcl);
|
64
|
-
React.useEffect(() => {
|
65
|
-
if (currentSchemaPath) {
|
66
|
-
dispatch(getSchemaAcl({ path: currentSchemaPath }));
|
19
|
+
const aclParams = ['access', 'type', 'inheritance'];
|
20
|
+
const aclParamToName = {
|
21
|
+
access: 'Access',
|
22
|
+
type: 'Access type',
|
23
|
+
inheritance: 'Inheritance type',
|
24
|
+
};
|
25
|
+
const defaultInheritanceType = ['Object', 'Container'];
|
26
|
+
const defaultAccessType = 'Allow';
|
27
|
+
const defaultInheritanceTypeSet = new Set(defaultInheritanceType);
|
28
|
+
function normalizeAcl(acl) {
|
29
|
+
return acl.map((ace) => {
|
30
|
+
const { AccessRules = [], AccessRights = [], AccessType, InheritanceType, Subject } = ace;
|
31
|
+
const access = AccessRules.concat(AccessRights);
|
32
|
+
//"Allow" is default access type. We want to show it only if it isn't default
|
33
|
+
const type = AccessType === defaultAccessType ? undefined : AccessType;
|
34
|
+
let inheritance;
|
35
|
+
// ['Object', 'Container'] - is default inheritance type. We want to show it only if it isn't default
|
36
|
+
if ((InheritanceType === null || InheritanceType === void 0 ? void 0 : InheritanceType.length) !== defaultInheritanceTypeSet.size ||
|
37
|
+
InheritanceType.some((t) => !defaultInheritanceTypeSet.has(t))) {
|
38
|
+
inheritance = InheritanceType;
|
67
39
|
}
|
68
|
-
return
|
69
|
-
|
70
|
-
|
40
|
+
return {
|
41
|
+
access: access.length ? access : undefined,
|
42
|
+
type,
|
43
|
+
inheritance,
|
44
|
+
Subject,
|
71
45
|
};
|
72
|
-
}
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
46
|
+
});
|
47
|
+
}
|
48
|
+
function DefinitionValue({ value }) {
|
49
|
+
const normalizedValue = typeof value === 'string' ? [value] : value;
|
50
|
+
return (_jsx("div", { className: b('definition-content'), children: normalizedValue.map((el) => (_jsx("span", { children: el }, el))) }));
|
51
|
+
}
|
52
|
+
function getAclListItems(acl) {
|
53
|
+
if (!acl || !acl.length) {
|
54
|
+
return [];
|
55
|
+
}
|
56
|
+
const normalizedAcl = normalizeAcl(acl);
|
57
|
+
return normalizedAcl.map((_a) => {
|
58
|
+
var { Subject } = _a, data = __rest(_a, ["Subject"]);
|
59
|
+
const definedDataEntries = Object.entries(data).filter(([_key, value]) => Boolean(value));
|
60
|
+
if (definedDataEntries.length === 1 && definedDataEntries[0][0] === 'access') {
|
61
|
+
return {
|
62
|
+
name: Subject,
|
63
|
+
content: _jsx(DefinitionValue, { value: definedDataEntries[0][1] }),
|
64
|
+
};
|
82
65
|
}
|
83
|
-
return
|
84
|
-
|
85
|
-
|
66
|
+
return {
|
67
|
+
label: _jsx("span", { className: b('group-label'), children: Subject }),
|
68
|
+
items: aclParams
|
69
|
+
.map((key) => {
|
70
|
+
const value = data[key];
|
71
|
+
if (value) {
|
72
|
+
return {
|
73
|
+
name: aclParamToName[key],
|
74
|
+
content: _jsx(DefinitionValue, { value: value }),
|
75
|
+
};
|
76
|
+
}
|
77
|
+
return undefined;
|
78
|
+
})
|
79
|
+
.filter(Boolean),
|
80
|
+
};
|
81
|
+
});
|
82
|
+
}
|
83
|
+
function getOwnerItem(owner) {
|
84
|
+
const preparedOwner = prepareLogin(owner);
|
85
|
+
if (!preparedOwner) {
|
86
|
+
return [];
|
87
|
+
}
|
88
|
+
return [
|
89
|
+
{
|
90
|
+
name: _jsx("span", { className: b('owner'), children: preparedOwner }),
|
91
|
+
content: _jsx("span", { className: b('owner'), children: i18n('acl.owner') }),
|
92
|
+
},
|
93
|
+
];
|
94
|
+
}
|
95
|
+
export const Acl = ({ path }) => {
|
96
|
+
const { currentData, isFetching, error } = schemaAclApi.useGetSchemaAclQuery({ path });
|
97
|
+
const loading = isFetching && !currentData;
|
98
|
+
const { acl, owner } = currentData || {};
|
99
|
+
const aclListItems = getAclListItems(acl);
|
100
|
+
const ownerItem = getOwnerItem(owner);
|
101
|
+
if (loading) {
|
86
102
|
return _jsx(Loader, {});
|
87
103
|
}
|
88
104
|
if (error) {
|
89
105
|
return _jsx(ResponseError, { error: error });
|
90
106
|
}
|
91
|
-
if (!
|
107
|
+
if (!acl && !owner) {
|
92
108
|
return _jsx(React.Fragment, { children: i18n('acl.empty') });
|
93
109
|
}
|
94
|
-
return (
|
110
|
+
return (_jsxs("div", { className: b(), children: [ownerItem.length ? (_jsx(DefinitionList, { items: ownerItem, nameMaxWidth: 200, className: b('owner-container') })) : null, aclListItems.length ? (_jsx(DefinitionList, { items: aclListItems, nameMaxWidth: 200, className: b('result') })) : null] }));
|
95
111
|
};
|
@@ -1,17 +1,22 @@
|
|
1
1
|
@import '../../../styles/mixins.scss';
|
2
2
|
|
3
3
|
.ydb-acl {
|
4
|
-
|
5
|
-
align-self: flex-start;
|
6
|
-
}
|
7
|
-
|
4
|
+
width: 100%;
|
8
5
|
&__owner-container {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
padding-bottom: 25px;
|
7
|
+
}
|
8
|
+
&__result {
|
13
9
|
padding-bottom: 16px;
|
10
|
+
}
|
14
11
|
|
15
|
-
|
12
|
+
&__owner {
|
13
|
+
font-weight: 600;
|
14
|
+
}
|
15
|
+
&__definition-content {
|
16
|
+
display: flex;
|
17
|
+
flex-direction: column;
|
18
|
+
}
|
19
|
+
&__group-label {
|
20
|
+
@include subheader-2-typography();
|
16
21
|
}
|
17
22
|
}
|