ydb-embedded-ui 22.5.0 → 22.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AutoRefreshControl/StickyAutoRefreshControl.d.ts +2 -0
- package/dist/components/AutoRefreshControl/StickyAutoRefreshControl.js +9 -0
- package/dist/components/AutoRefreshControl/StickyAutoRefreshControl.js.map +1 -0
- package/dist/components/AutoRefreshControl/StickyAutoRefreshControl.scss +18 -0
- package/dist/components/HideUnavailableNodesSwitch/HideUnavailableNodesSwitch.d.ts +3 -0
- package/dist/components/HideUnavailableNodesSwitch/HideUnavailableNodesSwitch.js +12 -0
- package/dist/components/HideUnavailableNodesSwitch/HideUnavailableNodesSwitch.js.map +1 -0
- package/dist/components/HideUnavailableNodesSwitch/i18n/en.json +3 -0
- package/dist/components/HideUnavailableNodesSwitch/i18n/index.d.ts +2 -0
- package/dist/components/HideUnavailableNodesSwitch/i18n/index.js +6 -0
- package/dist/components/HideUnavailableNodesSwitch/i18n/index.js.map +1 -0
- package/dist/components/HideUnavailableNodesSwitch/i18n/ru.json +3 -0
- package/dist/components/PageMeta/PageMeta.d.ts +0 -2
- package/dist/components/PageMeta/PageMeta.js +1 -6
- package/dist/components/PageMeta/PageMeta.js.map +1 -1
- package/dist/components/TenantNameWrapper/TenantNameWrapper.js +3 -1
- package/dist/components/TenantNameWrapper/TenantNameWrapper.js.map +1 -1
- package/dist/components/TenantNameWrapper/utils.d.ts +4 -1
- package/dist/components/TenantNameWrapper/utils.js +9 -2
- package/dist/components/TenantNameWrapper/utils.js.map +1 -1
- package/dist/containers/Header/hooks/useSharedDatabasePath.js +14 -6
- package/dist/containers/Header/hooks/useSharedDatabasePath.js.map +1 -1
- package/dist/containers/Node/Node.js +4 -3
- package/dist/containers/Node/Node.js.map +1 -1
- package/dist/containers/Node/Node.scss +14 -2
- package/dist/containers/Nodes/NodesControls/NodesControls.js +2 -1
- package/dist/containers/Nodes/NodesControls/NodesControls.js.map +1 -1
- package/dist/containers/Nodes/NodesTable.js +4 -0
- package/dist/containers/Nodes/NodesTable.js.map +1 -1
- package/dist/containers/Nodes/PaginatedNodes/GroupedNodesComponent.js +6 -5
- package/dist/containers/Nodes/PaginatedNodes/GroupedNodesComponent.js.map +1 -1
- package/dist/containers/Nodes/PaginatedNodes/NodesComponent.js +10 -4
- package/dist/containers/Nodes/PaginatedNodes/NodesComponent.js.map +1 -1
- package/dist/containers/Nodes/getNodes.js +2 -1
- package/dist/containers/Nodes/getNodes.js.map +1 -1
- package/dist/containers/PDiskPage/PDiskPage.js +5 -14
- package/dist/containers/PDiskPage/PDiskPage.js.map +1 -1
- package/dist/containers/PDiskPage/PDiskPage.scss +11 -4
- package/dist/containers/PDiskPage/i18n/en.json +0 -1
- package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
- package/dist/containers/Storage/PaginatedStorageNodes/GroupedStorageNodesComponent.js +3 -0
- package/dist/containers/Storage/PaginatedStorageNodes/GroupedStorageNodesComponent.js.map +1 -1
- package/dist/containers/Storage/PaginatedStorageNodes/StorageNodesComponent.js +8 -1
- package/dist/containers/Storage/PaginatedStorageNodes/StorageNodesComponent.js.map +1 -1
- package/dist/containers/Storage/PaginatedStorageNodes/StorageNodesControls.js +2 -1
- package/dist/containers/Storage/PaginatedStorageNodes/StorageNodesControls.js.map +1 -1
- package/dist/containers/Storage/PaginatedStorageNodesTable/PaginatedStorageNodesTable.js +4 -0
- package/dist/containers/Storage/PaginatedStorageNodesTable/PaginatedStorageNodesTable.js.map +1 -1
- package/dist/containers/Storage/PaginatedStorageNodesTable/getNodes.js +2 -1
- package/dist/containers/Storage/PaginatedStorageNodesTable/getNodes.js.map +1 -1
- package/dist/containers/Storage/Storage.scss +4 -0
- package/dist/containers/StorageGroupPage/StorageGroupPage.js +4 -15
- package/dist/containers/StorageGroupPage/StorageGroupPage.js.map +1 -1
- package/dist/containers/StorageGroupPage/StorageGroupPage.scss +14 -9
- package/dist/containers/StorageGroupPage/i18n/en.json +0 -1
- package/dist/containers/StorageGroupPage/i18n/index.d.ts +1 -1
- package/dist/containers/Tablet/Tablet.js +3 -2
- package/dist/containers/Tablet/Tablet.js.map +1 -1
- package/dist/containers/Tablet/Tablet.scss +15 -1
- package/dist/containers/Tenants/TenantsTable.js +20 -6
- package/dist/containers/Tenants/TenantsTable.js.map +1 -1
- package/dist/containers/VDiskPage/VDiskPage.js +5 -14
- package/dist/containers/VDiskPage/VDiskPage.js.map +1 -1
- package/dist/containers/VDiskPage/VDiskPage.scss +23 -4
- package/dist/containers/VDiskPage/i18n/en.json +0 -1
- package/dist/containers/VDiskPage/i18n/index.d.ts +1 -1
- package/dist/store/reducers/capabilities/hooks.d.ts +1 -0
- package/dist/store/reducers/capabilities/hooks.js +3 -0
- package/dist/store/reducers/capabilities/hooks.js.map +1 -1
- package/dist/store/reducers/cluster/cluster.js +2 -2
- package/dist/store/reducers/cluster/cluster.js.map +1 -1
- package/dist/store/reducers/cluster/parseFields.js +1 -0
- package/dist/store/reducers/cluster/parseFields.js.map +1 -1
- package/dist/store/reducers/nodes/types.d.ts +1 -0
- package/dist/store/reducers/storage/types.d.ts +1 -0
- package/dist/store/reducers/tenant/tenant.js +6 -1
- package/dist/store/reducers/tenant/tenant.js.map +1 -1
- package/dist/store/reducers/tenants/types.d.ts +2 -0
- package/dist/store/reducers/tenants/utils.js +3 -0
- package/dist/store/reducers/tenants/utils.js.map +1 -1
- package/dist/types/api/capabilities.d.ts +1 -1
- package/dist/types/api/meta.d.ts +1 -0
- package/dist/types/api/nodes.d.ts +2 -0
- package/dist/utils/databaseId.d.ts +8 -0
- package/dist/utils/databaseId.js +10 -0
- package/dist/utils/databaseId.js.map +1 -0
- package/dist/utils/hooks/useDebouncedValue.js +12 -0
- package/dist/utils/hooks/useDebouncedValue.js.map +1 -1
- package/dist/utils/hooks/useHideUnavailableNodes.d.ts +5 -0
- package/dist/utils/hooks/useHideUnavailableNodes.js +21 -0
- package/dist/utils/hooks/useHideUnavailableNodes.js.map +1 -0
- package/package.json +1 -1
- package/src/components/AutoRefreshControl/StickyAutoRefreshControl.scss +18 -0
- package/src/components/AutoRefreshControl/StickyAutoRefreshControl.tsx +15 -0
- package/src/components/HideUnavailableNodesSwitch/HideUnavailableNodesSwitch.tsx +24 -0
- package/src/components/HideUnavailableNodesSwitch/i18n/en.json +3 -0
- package/src/components/HideUnavailableNodesSwitch/i18n/index.ts +7 -0
- package/src/components/HideUnavailableNodesSwitch/i18n/ru.json +3 -0
- package/src/components/PageMeta/PageMeta.tsx +0 -18
- package/src/components/TenantNameWrapper/TenantNameWrapper.tsx +3 -1
- package/src/components/TenantNameWrapper/utils.ts +13 -1
- package/src/containers/Header/hooks/useSharedDatabasePath.ts +16 -7
- package/src/containers/Node/Node.scss +14 -2
- package/src/containers/Node/Node.tsx +6 -6
- package/src/containers/Nodes/NodesControls/NodesControls.tsx +2 -1
- package/src/containers/Nodes/NodesTable.tsx +4 -0
- package/src/containers/Nodes/PaginatedNodes/GroupedNodesComponent.tsx +6 -5
- package/src/containers/Nodes/PaginatedNodes/NodesComponent.tsx +10 -4
- package/src/containers/Nodes/getNodes.ts +2 -0
- package/src/containers/PDiskPage/PDiskPage.scss +11 -4
- package/src/containers/PDiskPage/PDiskPage.tsx +4 -30
- package/src/containers/PDiskPage/i18n/en.json +0 -1
- package/src/containers/Storage/PaginatedStorageNodes/GroupedStorageNodesComponent.tsx +3 -0
- package/src/containers/Storage/PaginatedStorageNodes/StorageNodesComponent.tsx +8 -1
- package/src/containers/Storage/PaginatedStorageNodes/StorageNodesControls.tsx +2 -0
- package/src/containers/Storage/PaginatedStorageNodesTable/PaginatedStorageNodesTable.tsx +4 -0
- package/src/containers/Storage/PaginatedStorageNodesTable/getNodes.ts +2 -0
- package/src/containers/Storage/Storage.scss +4 -0
- package/src/containers/StorageGroupPage/StorageGroupPage.scss +14 -9
- package/src/containers/StorageGroupPage/StorageGroupPage.tsx +3 -32
- package/src/containers/StorageGroupPage/i18n/en.json +0 -1
- package/src/containers/Tablet/Tablet.scss +15 -1
- package/src/containers/Tablet/Tablet.tsx +21 -15
- package/src/containers/Tenants/TenantsTable.tsx +20 -7
- package/src/containers/VDiskPage/VDiskPage.scss +23 -4
- package/src/containers/VDiskPage/VDiskPage.tsx +4 -31
- package/src/containers/VDiskPage/i18n/en.json +0 -1
- package/src/store/reducers/capabilities/hooks.ts +4 -0
- package/src/store/reducers/cluster/cluster.ts +4 -2
- package/src/store/reducers/cluster/parseFields.ts +1 -0
- package/src/store/reducers/nodes/types.ts +1 -0
- package/src/store/reducers/storage/types.ts +1 -0
- package/src/store/reducers/tenant/tenant.ts +4 -1
- package/src/store/reducers/tenants/types.ts +2 -0
- package/src/store/reducers/tenants/utils.ts +3 -0
- package/src/types/api/capabilities.ts +1 -0
- package/src/types/api/meta.ts +1 -0
- package/src/types/api/nodes.ts +2 -0
- package/src/utils/databaseId.ts +27 -0
- package/src/utils/hooks/useDebouncedValue.ts +16 -0
- package/src/utils/hooks/useHideUnavailableNodes.ts +33 -0
- package/dist/containers/Nodes/useDebouncedSearch.d.ts +0 -2
- package/dist/containers/Nodes/useDebouncedSearch.js +0 -11
- package/dist/containers/Nodes/useDebouncedSearch.js.map +0 -1
- package/src/containers/Nodes/useDebouncedSearch.ts +0 -13
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import {Wrench} from '@gravity-ui/icons';
|
|
4
|
+
import {Flex, Tab, TabList, TabProvider, Text} from '@gravity-ui/uikit';
|
|
5
5
|
import {skipToken} from '@reduxjs/toolkit/query';
|
|
6
6
|
import {isNil} from 'lodash';
|
|
7
7
|
import {Helmet} from 'react-helmet-async';
|
|
8
|
-
import {useHistory} from 'react-router-dom';
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import {StickyAutoRefreshControl} from '../../components/AutoRefreshControl/StickyAutoRefreshControl';
|
|
11
10
|
import {CopyableValue} from '../../components/CopyableValue/CopyableValue';
|
|
12
11
|
import {DiskTypeLabel} from '../../components/DiskStatus/DiskStatus';
|
|
13
12
|
import {ResponseError} from '../../components/Errors/ResponseError';
|
|
@@ -48,8 +47,6 @@ const vDiskPageCn = cn('ydb-vdisk-page');
|
|
|
48
47
|
|
|
49
48
|
export function VDiskPage() {
|
|
50
49
|
const dispatch = useTypedDispatch();
|
|
51
|
-
const history = useHistory();
|
|
52
|
-
const showBackButton = history.length > 1;
|
|
53
50
|
const getVDiskPagePath = useVDiskPagePath();
|
|
54
51
|
|
|
55
52
|
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
@@ -114,27 +111,6 @@ export function VDiskPage() {
|
|
|
114
111
|
);
|
|
115
112
|
};
|
|
116
113
|
|
|
117
|
-
const renderPageMeta = () => {
|
|
118
|
-
if (!showBackButton) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<Flex
|
|
124
|
-
className={vDiskPageCn('meta')}
|
|
125
|
-
alignItems="center"
|
|
126
|
-
justifyContent="space-between"
|
|
127
|
-
gap={1}
|
|
128
|
-
>
|
|
129
|
-
<Button size="m" view="outlined" onClick={() => history.goBack()}>
|
|
130
|
-
<Icon data={ArrowLeft} size={16} />
|
|
131
|
-
{vDiskPageKeyset('action_back')}
|
|
132
|
-
</Button>
|
|
133
|
-
<AutoRefreshControl className={vDiskPageCn('refresh-control')} />
|
|
134
|
-
</Flex>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
114
|
const renderTitleMeta = () => {
|
|
139
115
|
return (
|
|
140
116
|
<Flex gap={2} wrap="wrap" alignItems="center">
|
|
@@ -182,9 +158,6 @@ export function VDiskPage() {
|
|
|
182
158
|
</CopyableValue>
|
|
183
159
|
</Flex>
|
|
184
160
|
</Flex>
|
|
185
|
-
{!showBackButton && (
|
|
186
|
-
<AutoRefreshControl className={vDiskPageCn('refresh-control')} />
|
|
187
|
-
)}
|
|
188
161
|
</Flex>
|
|
189
162
|
);
|
|
190
163
|
};
|
|
@@ -334,7 +307,7 @@ export function VDiskPage() {
|
|
|
334
307
|
return (
|
|
335
308
|
<div className={vDiskPageCn(null)} ref={containerRef}>
|
|
336
309
|
{renderHelmet()}
|
|
337
|
-
|
|
310
|
+
<StickyAutoRefreshControl />
|
|
338
311
|
{renderPageTitle()}
|
|
339
312
|
{renderControls()}
|
|
340
313
|
{renderContent()}
|
|
@@ -106,6 +106,10 @@ export const useStorageGroupsHandlerHasGrouping = () => {
|
|
|
106
106
|
return useGetFeatureVersion('/storage/groups') > 4;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
export const useViewerNodesAliveFilterAvailable = () => {
|
|
110
|
+
return useGetFeatureVersion('/viewer/nodes/alive') >= 1;
|
|
111
|
+
};
|
|
112
|
+
|
|
109
113
|
export const useViewerNodesHandlerHasGrouping = () => {
|
|
110
114
|
return useGetFeatureVersion('/viewer/nodes') > 6;
|
|
111
115
|
};
|
|
@@ -142,11 +142,13 @@ export function useClusterBaseInfo() {
|
|
|
142
142
|
const clusterNameFromQuery = useClusterNameFromQuery();
|
|
143
143
|
const isViewerUser = useIsViewerUser();
|
|
144
144
|
|
|
145
|
-
const shouldFetchClusterBaseInfo = Boolean(
|
|
145
|
+
const shouldFetchClusterBaseInfo = Boolean(
|
|
146
|
+
window.api.meta && clusterNameFromQuery && isViewerUser,
|
|
147
|
+
);
|
|
146
148
|
const {currentData, isSuccess, isError} = clusterApi.useGetClusterBaseInfoQuery(
|
|
147
149
|
clusterNameFromQuery || skipToken,
|
|
148
150
|
{
|
|
149
|
-
skip: !
|
|
151
|
+
skip: !shouldFetchClusterBaseInfo,
|
|
150
152
|
},
|
|
151
153
|
);
|
|
152
154
|
|
|
@@ -120,6 +120,7 @@ export function parseLoggingUrls(
|
|
|
120
120
|
const settingsSchema = z.object({
|
|
121
121
|
unavailable: z.boolean().optional().catch(undefined),
|
|
122
122
|
use_meta_proxy: z.boolean().optional(),
|
|
123
|
+
use_database_id: z.boolean().optional(),
|
|
123
124
|
cluster_domain: z.string().optional(),
|
|
124
125
|
cluster_external_name: z.string().optional(),
|
|
125
126
|
});
|
|
@@ -81,7 +81,10 @@ export const tenantApi = api.injectEndpoints({
|
|
|
81
81
|
// previous meta versions do not support filtering databases by name
|
|
82
82
|
const data =
|
|
83
83
|
databases.find(
|
|
84
|
-
(tenant) =>
|
|
84
|
+
(tenant) =>
|
|
85
|
+
tenant.Name === database ||
|
|
86
|
+
tenant.Id === database ||
|
|
87
|
+
tenant.ControlPlane?.id === database,
|
|
85
88
|
) ?? databases[0];
|
|
86
89
|
if (!data) {
|
|
87
90
|
return {error: {code: 'EMPTY_TENANT_INFO'}};
|
|
@@ -6,6 +6,7 @@ import type {METRIC_STATUS} from './contants';
|
|
|
6
6
|
export interface PreparedTenant extends TTenant {
|
|
7
7
|
sharedTenantName: string | undefined;
|
|
8
8
|
sharedNodeIds: number[] | undefined;
|
|
9
|
+
sharedControlPlane?: TTenant['ControlPlane'];
|
|
9
10
|
controlPlaneName: string;
|
|
10
11
|
cpu: number | undefined;
|
|
11
12
|
memory: number | undefined;
|
|
@@ -17,6 +18,7 @@ export interface PreparedTenant extends TTenant {
|
|
|
17
18
|
export interface SharedDatabaseTarget {
|
|
18
19
|
name: string;
|
|
19
20
|
nodeIds?: number[];
|
|
21
|
+
controlPlane?: TTenant['ControlPlane'];
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export type MetricStatus = ValueOf<typeof METRIC_STATUS>;
|
|
@@ -377,6 +377,9 @@ export const prepareTenants = (tenants: TTenant[]): PreparedTenant[] => {
|
|
|
377
377
|
|
|
378
378
|
sharedTenantName,
|
|
379
379
|
sharedNodeIds,
|
|
380
|
+
...(sharedDatabase?.ControlPlane
|
|
381
|
+
? {sharedControlPlane: sharedDatabase.ControlPlane}
|
|
382
|
+
: {}),
|
|
380
383
|
controlPlaneName,
|
|
381
384
|
cpu,
|
|
382
385
|
memory,
|
package/src/types/api/meta.ts
CHANGED
|
@@ -107,6 +107,7 @@ export interface MetaClusterTraceCheck {
|
|
|
107
107
|
export interface MetaClusterSettings {
|
|
108
108
|
unavailable?: boolean;
|
|
109
109
|
use_meta_proxy?: boolean;
|
|
110
|
+
use_database_id?: boolean;
|
|
110
111
|
auth_service?: string;
|
|
111
112
|
cluster_domain?: string;
|
|
112
113
|
cluster_external_name?: string;
|
package/src/types/api/nodes.ts
CHANGED
|
@@ -363,6 +363,8 @@ export interface NodesRequestParams {
|
|
|
363
363
|
uptime?: number;
|
|
364
364
|
/** return nodes with SystemState !== EFlag.Green */
|
|
365
365
|
problems_only?: boolean;
|
|
366
|
+
/** exclude disconnected nodes; requires /viewer/nodes/alive capability */
|
|
367
|
+
alive?: boolean;
|
|
366
368
|
/** filter nodes by id or host */
|
|
367
369
|
filter?: string;
|
|
368
370
|
filter_peer_role?: NodesPeerRole; // v14
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type {MetaClusterSettings} from '../types/api/meta';
|
|
2
|
+
import type {TTenant} from '../types/api/tenant';
|
|
3
|
+
|
|
4
|
+
export function getDatabaseNavigationId(
|
|
5
|
+
database: Pick<TTenant, 'Name' | 'Id' | 'ControlPlane'>,
|
|
6
|
+
{
|
|
7
|
+
settings,
|
|
8
|
+
useDatabaseId,
|
|
9
|
+
isMetaDatabasesAvailable,
|
|
10
|
+
backend,
|
|
11
|
+
}: {
|
|
12
|
+
settings?: MetaClusterSettings;
|
|
13
|
+
useDatabaseId?: boolean;
|
|
14
|
+
isMetaDatabasesAvailable?: boolean;
|
|
15
|
+
backend?: string;
|
|
16
|
+
} = {},
|
|
17
|
+
) {
|
|
18
|
+
if (backend || settings?.use_database_id === false || settings?.use_meta_proxy === false) {
|
|
19
|
+
return database.Name;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
(isMetaDatabasesAvailable && database.ControlPlane?.id) ||
|
|
24
|
+
(useDatabaseId && database.Id) ||
|
|
25
|
+
database.Name
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -12,8 +12,20 @@ export function useDebouncedValue<T extends string | number | null>({
|
|
|
12
12
|
const [currentValue, setCurrentValue] = React.useState<T>(value);
|
|
13
13
|
|
|
14
14
|
const timer = React.useRef<number>();
|
|
15
|
+
const submittedValue = React.useRef<T>();
|
|
15
16
|
|
|
16
17
|
React.useEffect(() => {
|
|
18
|
+
const isAcknowledgement = submittedValue.current === value;
|
|
19
|
+
submittedValue.current = undefined;
|
|
20
|
+
|
|
21
|
+
// Preserve a newer pending edit when the parent acknowledges an earlier one.
|
|
22
|
+
if (isAcknowledgement && timer.current !== undefined) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
window.clearTimeout(timer.current);
|
|
27
|
+
timer.current = undefined;
|
|
28
|
+
|
|
17
29
|
setCurrentValue((prevValue) => {
|
|
18
30
|
if (prevValue !== value) {
|
|
19
31
|
return value;
|
|
@@ -23,11 +35,15 @@ export function useDebouncedValue<T extends string | number | null>({
|
|
|
23
35
|
});
|
|
24
36
|
}, [value]);
|
|
25
37
|
|
|
38
|
+
React.useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
39
|
+
|
|
26
40
|
const handleUpdate = (newValue: T) => {
|
|
27
41
|
setCurrentValue(newValue);
|
|
28
42
|
|
|
29
43
|
window.clearTimeout(timer.current);
|
|
30
44
|
timer.current = window.setTimeout(() => {
|
|
45
|
+
timer.current = undefined;
|
|
46
|
+
submittedValue.current = newValue;
|
|
31
47
|
onUpdate?.(newValue);
|
|
32
48
|
}, debounce);
|
|
33
49
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {BooleanParam, useQueryParam} from 'use-query-params';
|
|
4
|
+
import {z} from 'zod';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
useCapabilitiesLoaded,
|
|
8
|
+
useViewerNodesAliveFilterAvailable,
|
|
9
|
+
} from '../../store/reducers/capabilities/hooks';
|
|
10
|
+
|
|
11
|
+
const hideUnavailableSchema = z.boolean().catch(false);
|
|
12
|
+
|
|
13
|
+
export function useHideUnavailableNodes() {
|
|
14
|
+
const [value, setValue] = useQueryParam('hideUnavailable', BooleanParam);
|
|
15
|
+
const available = useViewerNodesAliveFilterAvailable();
|
|
16
|
+
const capabilitiesLoaded = useCapabilitiesLoaded();
|
|
17
|
+
const hideUnavailable = available && hideUnavailableSchema.parse(value);
|
|
18
|
+
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (capabilitiesLoaded && !available && value !== undefined) {
|
|
21
|
+
setValue(undefined, 'replaceIn');
|
|
22
|
+
}
|
|
23
|
+
}, [available, capabilitiesLoaded, setValue, value]);
|
|
24
|
+
|
|
25
|
+
const handleHideUnavailableChange = React.useCallback(
|
|
26
|
+
(checked: boolean) => {
|
|
27
|
+
setValue(checked || undefined, 'replaceIn');
|
|
28
|
+
},
|
|
29
|
+
[setValue],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return {available, hideUnavailable, handleHideUnavailableChange};
|
|
33
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/** Debounce the table filter, never the input or its URL value. */
|
|
3
|
-
export function useDebouncedSearch(searchValue) {
|
|
4
|
-
const [debouncedSearch, setDebouncedSearch] = React.useState(searchValue);
|
|
5
|
-
React.useEffect(() => {
|
|
6
|
-
const timer = window.setTimeout(() => setDebouncedSearch(searchValue), 200);
|
|
7
|
-
return () => window.clearTimeout(timer);
|
|
8
|
-
}, [searchValue]);
|
|
9
|
-
return debouncedSearch;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=useDebouncedSearch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedSearch.js","sourceRoot":"","sources":["../../../src/containers/Nodes/useDebouncedSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,mEAAmE;AACnE,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IAClD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE1E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5E,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,eAAe,CAAC;AAC3B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
/** Debounce the table filter, never the input or its URL value. */
|
|
4
|
-
export function useDebouncedSearch(searchValue: string) {
|
|
5
|
-
const [debouncedSearch, setDebouncedSearch] = React.useState(searchValue);
|
|
6
|
-
|
|
7
|
-
React.useEffect(() => {
|
|
8
|
-
const timer = window.setTimeout(() => setDebouncedSearch(searchValue), 200);
|
|
9
|
-
return () => window.clearTimeout(timer);
|
|
10
|
-
}, [searchValue]);
|
|
11
|
-
|
|
12
|
-
return debouncedSearch;
|
|
13
|
-
}
|