ydb-embedded-ui 1.14.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/assets/illustrations/dark/thumbsUp.svg +15 -0
  3. package/dist/assets/illustrations/light/thumbsUp.svg +15 -0
  4. package/dist/components/AsideNavigation/AsideHeader.tsx +1 -1
  5. package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.tsx +1 -1
  6. package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.tsx +1 -1
  7. package/dist/components/AsideNavigation/CompositeBar/CompositeBar.tsx +1 -1
  8. package/dist/components/AsideNavigation/Logo/Logo.tsx +1 -1
  9. package/dist/components/AsideNavigation/Settings/Settings.tsx +1 -1
  10. package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.tsx +1 -1
  11. package/dist/components/AsideNavigation/Settings/SettingsSearch/SettingsSearch.tsx +1 -1
  12. package/dist/components/AsideNavigation/Settings/collect-settings.ts +1 -1
  13. package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
  14. package/dist/components/ClusterInfo/ClusterInfo.tsx +1 -1
  15. package/dist/components/Collapse/Collapse.js +1 -1
  16. package/dist/components/CopyToClipboard/CopyToClipboard.tsx +1 -1
  17. package/dist/components/CriticalActionDialog/CriticalActionDialog.js +1 -1
  18. package/dist/components/EmptyState/EmptyState.scss +0 -1
  19. package/dist/components/EnableFullscreenButton/EnableFullscreenButton.tsx +1 -1
  20. package/dist/components/EntityStatus/EntityStatus.js +28 -3
  21. package/dist/components/EntityStatus/EntityStatus.scss +22 -1
  22. package/dist/components/Fullscreen/Fullscreen.tsx +1 -1
  23. package/dist/components/Icon/Icon.js +1 -1
  24. package/dist/components/Illustration/Illustration.tsx +3 -1
  25. package/dist/components/Loader/Loader.tsx +1 -1
  26. package/dist/components/NodesViewer/NodesViewer.js +5 -2
  27. package/dist/components/Pagination/Pagination.js +1 -1
  28. package/dist/components/ProblemFilter/ProblemFilter.js +1 -1
  29. package/dist/components/ShortyString/ShortyString.tsx +1 -1
  30. package/dist/components/TableSkeleton/TableSkeleton.tsx +1 -1
  31. package/dist/components/TabletsOverall/TabletsOverall.tsx +1 -1
  32. package/dist/containers/App/App.js +1 -1
  33. package/dist/containers/App/App.scss +0 -10
  34. package/dist/containers/App/Content.js +1 -1
  35. package/dist/containers/App/TipPopup/TipPopup.js +1 -1
  36. package/dist/containers/AsideNavigation/AsideNavigation.tsx +1 -1
  37. package/dist/containers/Authentication/Authentication.tsx +1 -1
  38. package/dist/containers/Group/Group.js +1 -1
  39. package/dist/containers/Header/Header.tsx +1 -1
  40. package/dist/containers/Header/Host/Host.js +1 -1
  41. package/dist/containers/Heatmap/Heatmap.js +1 -1
  42. package/dist/containers/Node/Node.tsx +1 -1
  43. package/dist/containers/Node/NodeStructure/Pdisk.tsx +1 -1
  44. package/dist/containers/Nodes/Nodes.js +4 -2
  45. package/dist/containers/Pdisk/Pdisk.js +1 -1
  46. package/dist/containers/Pool/Pool.js +3 -2
  47. package/dist/containers/ReduxTooltip/ReduxTooltip.js +1 -1
  48. package/dist/containers/Storage/EmptyFilter/EmptyFilter.tsx +34 -0
  49. package/dist/containers/Storage/EmptyFilter/i18n/en.json +4 -0
  50. package/dist/containers/Storage/EmptyFilter/i18n/index.ts +11 -0
  51. package/dist/containers/Storage/EmptyFilter/i18n/ru.json +4 -0
  52. package/dist/containers/Storage/Pdisk/Pdisk.tsx +1 -1
  53. package/dist/containers/Storage/Storage.js +3 -1
  54. package/dist/containers/Storage/StorageFilter/StorageFilter.tsx +2 -1
  55. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +27 -6
  56. package/dist/containers/Storage/StorageGroups/i18n/en.json +6 -0
  57. package/dist/containers/Storage/StorageGroups/i18n/index.ts +11 -0
  58. package/dist/containers/Storage/StorageGroups/i18n/ru.json +6 -0
  59. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +24 -7
  60. package/dist/containers/Storage/StorageNodes/i18n/en.json +6 -0
  61. package/dist/containers/Storage/StorageNodes/i18n/index.ts +11 -0
  62. package/dist/containers/Storage/StorageNodes/i18n/ru.json +6 -0
  63. package/dist/containers/Storage/UsageFilter/UsageFilter.tsx +1 -1
  64. package/dist/containers/Storage/Vdisk/Vdisk.js +1 -1
  65. package/dist/containers/Tablet/Tablet.js +1 -1
  66. package/dist/containers/Tablets/Tablets.js +1 -1
  67. package/dist/containers/TabletsFilters/TabletsFilters.js +1 -1
  68. package/dist/containers/Tenant/Acl/Acl.js +1 -1
  69. package/dist/containers/Tenant/Diagnostics/Compute/Compute.js +1 -1
  70. package/dist/containers/Tenant/Diagnostics/Describe/Describe.js +1 -1
  71. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +3 -4
  72. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +1 -1
  73. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +7 -1
  74. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.tsx +86 -0
  75. package/dist/containers/Tenant/Diagnostics/Healthcheck/IssuePreview/IssuePreview.tsx +34 -0
  76. package/dist/containers/Tenant/Diagnostics/Healthcheck/IssuePreview/index.ts +1 -0
  77. package/dist/containers/Tenant/Diagnostics/Healthcheck/IssuesList/IssuesList.tsx +69 -0
  78. package/dist/containers/Tenant/Diagnostics/Healthcheck/IssuesList/index.ts +1 -0
  79. package/dist/containers/Tenant/Diagnostics/Healthcheck/Preview/Preview.tsx +80 -0
  80. package/dist/containers/Tenant/Diagnostics/Healthcheck/Preview/index.ts +1 -0
  81. package/dist/containers/Tenant/Diagnostics/Healthcheck/i18n/en.json +11 -0
  82. package/dist/containers/Tenant/Diagnostics/Healthcheck/i18n/index.ts +11 -0
  83. package/dist/containers/Tenant/Diagnostics/Healthcheck/i18n/ru.json +11 -0
  84. package/dist/containers/Tenant/Diagnostics/Healthcheck/index.ts +1 -0
  85. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +1 -1
  86. package/dist/containers/Tenant/Diagnostics/Network/Network.js +3 -2
  87. package/dist/containers/Tenant/Diagnostics/Network/Network.scss +1 -1
  88. package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +17 -35
  89. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +1 -1
  90. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +3 -3
  91. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +3 -3
  92. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +1 -1
  93. package/dist/containers/Tenant/ObjectGeneralTabs/ObjectGeneralTabs.tsx +1 -1
  94. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +1 -1
  95. package/dist/containers/Tenant/Preview/Preview.js +1 -1
  96. package/dist/containers/Tenant/QueryEditor/Issues/Issues.scss +2 -3
  97. package/dist/containers/Tenant/QueryEditor/Issues/Issues.tsx +1 -1
  98. package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +1 -1
  99. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +2 -2
  100. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +63 -45
  101. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +8 -4
  102. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +1 -1
  103. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +1 -0
  104. package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +1 -1
  105. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +1 -1
  106. package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +2 -2
  107. package/dist/containers/Tenant/utils/paneVisibilityToggleHelpers.tsx +1 -1
  108. package/dist/containers/Tenants/Tenants.js +4 -2
  109. package/dist/containers/UserSettings/UserSettings.tsx +2 -2
  110. package/dist/containers/Vdisk/Vdisk.js +1 -1
  111. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +1 -1
  112. package/dist/index.js +1 -1
  113. package/dist/services/api.d.ts +9 -0
  114. package/dist/setupTests.js +1 -1
  115. package/dist/store/reducers/executeTopQueries.js +6 -9
  116. package/dist/store/reducers/explainQuery.js +27 -36
  117. package/dist/store/reducers/olapStats.js +6 -8
  118. package/dist/store/reducers/shardsWorkload.js +6 -8
  119. package/dist/types/api/healthcheck.ts +91 -0
  120. package/dist/types/api/query.ts +32 -21
  121. package/dist/types/assets.d.ts +1 -1
  122. package/dist/types/store/healthcheck.ts +3 -0
  123. package/dist/types/store/query.ts +1 -1
  124. package/dist/utils/createToast.tsx +1 -1
  125. package/dist/utils/getNodesColumns.js +1 -1
  126. package/dist/utils/hooks/index.ts +1 -0
  127. package/dist/utils/hooks/useAutofetcher.ts +29 -0
  128. package/dist/utils/i18n/i18n.ts +1 -1
  129. package/dist/utils/prepareQueryExplain.ts +0 -4
  130. package/dist/utils/query.test.ts +59 -1
  131. package/dist/utils/query.ts +38 -4
  132. package/package.json +9 -11
  133. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.js +0 -195
@@ -0,0 +1,86 @@
1
+ import {useCallback} from 'react';
2
+ import {useDispatch, useSelector} from 'react-redux';
3
+ import cn from 'bem-cn-lite';
4
+
5
+ import {Loader} from '@gravity-ui/uikit';
6
+
7
+ import {getHealthcheckInfo} from '../../../../store/reducers/healthcheckInfo';
8
+ import {useAutofetcher} from '../../../../utils/hooks';
9
+
10
+ import {IssuesList} from './IssuesList';
11
+ import {Preview} from './Preview';
12
+
13
+ import i18n from './i18n';
14
+ import './Healthcheck.scss';
15
+
16
+ interface HealthcheckProps {
17
+ tenant: string;
18
+ preview?: boolean;
19
+ fetchData?: boolean;
20
+ showMoreHandler?: VoidFunction;
21
+ }
22
+
23
+ const b = cn('healthcheck');
24
+
25
+ export const Healthcheck = (props: HealthcheckProps) => {
26
+ const {
27
+ tenant,
28
+ preview,
29
+ fetchData = true,
30
+ showMoreHandler,
31
+ } = props;
32
+
33
+ const dispatch = useDispatch();
34
+
35
+ const {data, loading, wasLoaded, error} = useSelector((state: any) => state.healthcheckInfo);
36
+ const {autorefresh} = useSelector((state: any) => state.schema);
37
+
38
+ const fetchHealthcheck = useCallback(() => {
39
+ if (fetchData) {
40
+ dispatch(getHealthcheckInfo(tenant));
41
+ }
42
+ }, [dispatch, fetchData, tenant]);
43
+
44
+ useAutofetcher(fetchHealthcheck, [fetchHealthcheck], autorefresh);
45
+
46
+ const renderContent = () => {
47
+ if (error) {
48
+ return error.statusText;
49
+ }
50
+
51
+ if (loading && !wasLoaded) {
52
+ return (
53
+ <div className={b('loader')}>
54
+ <Loader size="m" />
55
+ </div>
56
+ );
57
+ }
58
+
59
+ if (data && data['self_check_result']) {
60
+ return preview ? (
61
+ <Preview
62
+ data={data}
63
+ loading={loading}
64
+ onShowMore={showMoreHandler}
65
+ onUpdate={fetchHealthcheck}
66
+ />
67
+ ) : (
68
+ <IssuesList
69
+ data={data}
70
+ loading={loading}
71
+ onUpdate={fetchHealthcheck}
72
+ />
73
+ );
74
+ }
75
+
76
+ return (
77
+ <div className="error">{i18n('no-data')}</div>
78
+ );
79
+ };
80
+
81
+ return (
82
+ <div className={b()}>
83
+ {renderContent()}
84
+ </div>
85
+ );
86
+ };
@@ -0,0 +1,34 @@
1
+ import cn from 'bem-cn-lite';
2
+
3
+ import {Link, Text} from '@gravity-ui/uikit';
4
+
5
+ import EntityStatus from '../../../../../components/EntityStatus/EntityStatus';
6
+ import {IssueLog} from '../../../../../types/api/healthcheck';
7
+
8
+ import i18n from '../i18n';
9
+
10
+ const b = cn('healthcheck');
11
+
12
+ interface IssuePreviewProps {
13
+ data?: IssueLog;
14
+ onShowMore?: VoidFunction;
15
+ }
16
+
17
+ export const IssuePreview = (props: IssuePreviewProps) => {
18
+ const {
19
+ data,
20
+ onShowMore,
21
+ } = props;
22
+
23
+ if (!data) {
24
+ return null;
25
+ }
26
+
27
+ return (
28
+ <div className={b('issue-preview')}>
29
+ <EntityStatus mode="icons" status={data.status} name={data.type} />
30
+ <Text as="div" color="secondary" variant="body-2">{data.message}</Text>
31
+ <Link onClick={onShowMore}>{i18n('label.show-details')}</Link>
32
+ </div>
33
+ );
34
+ };
@@ -0,0 +1 @@
1
+ export * from './IssuePreview';
@@ -0,0 +1,69 @@
1
+ import cn from 'bem-cn-lite';
2
+
3
+ import {Button} from '@gravity-ui/uikit';
4
+
5
+ import type {IHealthCheck} from '../../../../../types/store/healthcheck';
6
+
7
+ import IssuesViewer from '../IssuesViewer/IssuesViewer';
8
+
9
+ import i18n from '../i18n';
10
+
11
+ const b = cn('healthcheck');
12
+
13
+ interface IssuesListProps {
14
+ data?: IHealthCheck;
15
+ loading?: boolean;
16
+ onUpdate: VoidFunction;
17
+ }
18
+
19
+ export const IssuesList = (props: IssuesListProps) => {
20
+ const {
21
+ data,
22
+ loading,
23
+ onUpdate,
24
+ } = props;
25
+
26
+ if (!data) {
27
+ return null;
28
+ }
29
+
30
+ const renderOverviewStatus = () => {
31
+ const {self_check_result: selfCheckResult} = data;
32
+ const modifier = selfCheckResult.toLowerCase();
33
+
34
+ return (
35
+ <div className={b('self-check-status')}>
36
+ <h3 className={b('self-check-status-label')}>{i18n('title.self-check-status')}</h3>
37
+ <div className={b('self-check-status-indicator', {[modifier]: true})} />
38
+ {selfCheckResult}
39
+ <div className={b('self-check-update')}>
40
+ <Button size="s" onClick={onUpdate} loading={loading}>
41
+ {i18n('label.update')}
42
+ </Button>
43
+ </div>
44
+ </div>
45
+ );
46
+ };
47
+
48
+ const renderHealthcheckIssues = () => {
49
+ const {issue_log: issueLog} = data;
50
+
51
+ if (!issueLog) {
52
+ return null;
53
+ }
54
+
55
+ return (
56
+ <div className={b('issues')}>
57
+ <h3>{i18n('title.issues')}</h3>
58
+ <IssuesViewer issues={issueLog} />
59
+ </div>
60
+ );
61
+ }
62
+
63
+ return (
64
+ <div className={b('issues-list')}>
65
+ {renderOverviewStatus()}
66
+ {renderHealthcheckIssues()}
67
+ </div>
68
+ );
69
+ };
@@ -0,0 +1 @@
1
+ export * from './IssuesList';
@@ -0,0 +1,80 @@
1
+ import {useMemo} from 'react';
2
+ import cn from 'bem-cn-lite';
3
+
4
+ import {Button} from '@gravity-ui/uikit';
5
+
6
+ import {SelfCheckResult} from '../../../../../types/api/healthcheck';
7
+ import type {IHealthCheck} from '../../../../../types/store/healthcheck';
8
+
9
+ import {IssuePreview} from '../IssuePreview';
10
+
11
+ import i18n from '../i18n';
12
+
13
+ const b = cn('healthcheck');
14
+
15
+ interface PreviewProps {
16
+ data?: IHealthCheck;
17
+ loading?: boolean;
18
+ onShowMore?: VoidFunction;
19
+ onUpdate: VoidFunction;
20
+ }
21
+
22
+ export const Preview = (props: PreviewProps) => {
23
+ const {
24
+ data,
25
+ loading,
26
+ onShowMore,
27
+ onUpdate,
28
+ } = props;
29
+
30
+ const selfCheckResult = data?.self_check_result || SelfCheckResult.UNSPECIFIED;
31
+ const isStatusOK = selfCheckResult === SelfCheckResult.GOOD;
32
+
33
+ const issuesLog = data?.issue_log;
34
+ const firstLevelIssues = useMemo(() => issuesLog?.filter(({level}) => level === 1), [issuesLog]);
35
+
36
+ if (!data) {
37
+ return null;
38
+ }
39
+
40
+ const renderStatus = () => {
41
+ const modifier = selfCheckResult.toLowerCase();
42
+
43
+ return (
44
+ <div className={b('status-wrapper')}>
45
+ <div className={b('preview-title')}>{i18n('title.healthcheck')}</div>
46
+ <div className={b('self-check-status-indicator', {[modifier]: true})}>
47
+ {isStatusOK ? i18n('ok') : i18n('error')}
48
+ </div>
49
+ <Button size="s" onClick={onUpdate} loading={loading}>
50
+ {i18n('label.update')}
51
+ </Button>
52
+ </div>
53
+ );
54
+ };
55
+
56
+ const renderFirstLevelIssues = () => {
57
+ return (
58
+ <div className={b('preview-content')}>
59
+ {
60
+ isStatusOK ?
61
+ i18n('status_massage.ok') :
62
+ firstLevelIssues?.map((issue) => (
63
+ <IssuePreview
64
+ key={issue.id}
65
+ data={issue}
66
+ onShowMore={onShowMore}
67
+ />
68
+ ))
69
+ }
70
+ </div>
71
+ );
72
+ };
73
+
74
+ return (
75
+ <div className={b('preview')}>
76
+ {renderStatus()}
77
+ {renderFirstLevelIssues()}
78
+ </div>
79
+ );
80
+ };
@@ -0,0 +1 @@
1
+ export * from './Preview';
@@ -0,0 +1,11 @@
1
+ {
2
+ "title.healthcheck": "Healthcheck",
3
+ "title.issues": "Issues",
4
+ "title.self-check-status": "Self check status",
5
+ "label.update": "Update",
6
+ "label.show-details": "Show details",
7
+ "status_massage.ok": "No issues have been found on this database",
8
+ "ok": "Ok",
9
+ "error": "Error",
10
+ "no-data": "no healthcheck data"
11
+ }
@@ -0,0 +1,11 @@
1
+ import {i18n, Lang} from '../../../../../utils/i18n';
2
+
3
+ import en from './en.json';
4
+ import ru from './ru.json';
5
+
6
+ const COMPONENT = 'ydb-diagnostics-healthcheck';
7
+
8
+ i18n.registerKeyset(Lang.En, COMPONENT, en);
9
+ i18n.registerKeyset(Lang.Ru, COMPONENT, ru);
10
+
11
+ export default i18n.keyset(COMPONENT);
@@ -0,0 +1,11 @@
1
+ {
2
+ "title.healthcheck": "Healthcheck",
3
+ "title.issues": "Проблемы",
4
+ "title.self-check-status": "Статус самопроверки",
5
+ "label.update": "Обновить",
6
+ "label.show-details": "Посмотреть подробности",
7
+ "status_massage.ok": "В базе данных нет проблем",
8
+ "ok": "Ok",
9
+ "error": "Ошибка",
10
+ "no-data": "нет данных healthcheck"
11
+ }
@@ -0,0 +1 @@
1
+ export * from './Healthcheck';
@@ -1,7 +1,7 @@
1
1
  import {useEffect, useMemo} from 'react';
2
2
  import cn from 'bem-cn-lite';
3
3
  import {connect} from 'react-redux';
4
- import {Loader} from '@yandex-cloud/uikit';
4
+ import {Loader} from '@gravity-ui/uikit';
5
5
  import DataTable from '@yandex-cloud/react-data-table';
6
6
 
7
7
  import Icon from '../../../../components/Icon/Icon';
@@ -5,11 +5,12 @@ import {connect} from 'react-redux';
5
5
  import _ from 'lodash';
6
6
 
7
7
  import {Link} from 'react-router-dom';
8
- import {Loader, Checkbox} from '@yandex-cloud/uikit';
8
+ import {Loader, Checkbox} from '@gravity-ui/uikit';
9
9
 
10
10
  import NodeNetwork from './NodeNetwork/NodeNetwork';
11
11
  import Icon from '../../../../components/Icon/Icon';
12
12
  import ProblemFilter, {problemFilterType} from '../../../../components/ProblemFilter/ProblemFilter';
13
+ import {Illustration} from '../../../../components/Illustration';
13
14
 
14
15
  import {getNetworkInfo} from '../../../../store/reducers/network';
15
16
  import {hideTooltip, showTooltip} from '../../../../store/reducers/tooltip';
@@ -242,7 +243,7 @@ class Network extends React.Component {
242
243
  });
243
244
 
244
245
  if (filter === PROBLEMS && problemNodesCount === 0) {
245
- return <div className="no-problem" />;
246
+ return <Illustration name="thumbsUp" width="200" />;
246
247
  } else {
247
248
  return result;
248
249
  }
@@ -111,7 +111,7 @@
111
111
  display: flex;
112
112
  gap: 12px;
113
113
 
114
- margin-bottom: 16px;
114
+ margin: 0 16px 16px 0;
115
115
  }
116
116
 
117
117
  &__controls-wrapper {
@@ -1,8 +1,8 @@
1
- import {ReactNode, useEffect, useMemo} from 'react';
1
+ import {ReactNode, useMemo} from 'react';
2
2
  import {useDispatch, useSelector} from 'react-redux';
3
3
  import cn from 'bem-cn-lite';
4
4
 
5
- import {Loader} from '@yandex-cloud/uikit';
5
+ import {Loader} from '@gravity-ui/uikit';
6
6
 
7
7
  //@ts-ignore
8
8
  import SchemaInfoViewer from '../../Schema/SchemaInfoViewer/SchemaInfoViewer';
@@ -14,22 +14,22 @@ import {
14
14
 
15
15
  import {EPathType} from '../../../../types/api/schema';
16
16
  import {isColumnEntityType, isTableType} from '../../utils/schema';
17
- import {AutoFetcher} from '../../../../utils/autofetcher';
18
17
  //@ts-ignore
19
18
  import {getSchema} from '../../../../store/reducers/schema';
20
19
  //@ts-ignore
21
20
  import {getOlapStats} from '../../../../store/reducers/olapStats';
21
+ import {useAutofetcher} from '../../../../utils/hooks';
22
22
 
23
23
  import './Overview.scss';
24
24
 
25
- function prepareOlapTableGeneral(tableData: any, olapStats: any[]) {
25
+ function prepareOlapTableGeneral(tableData: any, olapStats?: any[]) {
26
26
  const {ColumnShardCount} = tableData;
27
27
  const Bytes = olapStats?.reduce((acc, el) => {
28
- acc += parseInt(el.Bytes) ?? 0;
28
+ acc += parseInt(el.Bytes) || 0;
29
29
  return acc;
30
30
  }, 0);
31
31
  const Rows = olapStats?.reduce((acc, el) => {
32
- acc += parseInt(el.Rows) ?? 0;
32
+ acc += parseInt(el.Rows) || 0;
33
33
  return acc;
34
34
  }, 0);
35
35
  const tabletIds = olapStats?.reduce((acc, el) => {
@@ -57,10 +57,11 @@ interface OverviewProps {
57
57
 
58
58
  const b = cn('kv-tenant-overview');
59
59
 
60
- const autofetcher = new AutoFetcher();
61
-
62
60
  function Overview(props: OverviewProps) {
61
+ const {tenantName, type} = props;
62
+
63
63
  const dispatch = useDispatch();
64
+
64
65
  const {
65
66
  currentSchema: currentItem = {},
66
67
  loading,
@@ -69,46 +70,27 @@ function Overview(props: OverviewProps) {
69
70
  currentSchemaPath,
70
71
  } = useSelector((state: any) => state.schema);
71
72
 
72
- let {data: olapStats} = useSelector((state: any) => state.olapStats);
73
- olapStats = olapStats && olapStats.result ? olapStats.result : olapStats;
73
+ const {
74
+ data: { result: olapStats } = { result: undefined },
75
+ } = useSelector((state: any) => state.olapStats);
74
76
 
75
- const fetchOverviewData = () => {
76
- const {tenantName, type} = props;
77
+ useAutofetcher(() => {
77
78
  const schemaPath = currentSchemaPath || tenantName;
78
79
  dispatch(getSchema({path: schemaPath}));
79
80
 
80
81
  if (isTableType(type) && isColumnEntityType(type)) {
81
82
  dispatch(getOlapStats({path: schemaPath}));
82
83
  }
83
- };
84
-
85
- useEffect(() => {
86
- fetchOverviewData();
87
- return () => {
88
- autofetcher.stop();
89
- };
90
- }, []);
91
-
92
- useEffect(() => {
93
- if (autorefresh) {
94
- fetchOverviewData();
95
- autofetcher.stop();
96
- autofetcher.start();
97
- autofetcher.fetch(() => fetchOverviewData());
98
- }
99
- if (autorefresh === false) {
100
- autofetcher.stop();
101
- }
102
- }, [autorefresh]);
84
+ }, [currentSchemaPath, dispatch, tenantName, type], autorefresh);
103
85
 
104
86
  const tableSchema =
105
87
  currentItem?.PathDescription?.Table || currentItem?.PathDescription?.ColumnTableDescription;
106
88
 
107
89
  const schemaData = useMemo(() => {
108
- return isTableType(props.type) && isColumnEntityType(props.type)
90
+ return isTableType(type) && isColumnEntityType(type)
109
91
  ? prepareOlapTableGeneral(tableSchema, olapStats)
110
92
  : currentItem;
111
- }, [props.type, tableSchema, olapStats, currentItem]);
93
+ }, [type, tableSchema, olapStats, currentItem]);
112
94
 
113
95
  const renderLoader = () => {
114
96
  return (
@@ -134,7 +116,7 @@ function Overview(props: OverviewProps) {
134
116
  [EPathType.EPathTypePersQueueGroup]: () => <PersQueueGroupInfo data={schemaData} />,
135
117
  };
136
118
 
137
- return (props.type && pathTypeToComponent[props.type]?.()) || (
119
+ return (type && pathTypeToComponent[type]?.()) || (
138
120
  <SchemaInfoViewer fullPath={currentItem.Path} data={schemaData} />
139
121
  );
140
122
  }
@@ -17,7 +17,7 @@ import {TABLET_STATES} from '../../../../utils/constants';
17
17
 
18
18
  import './TenantOverview.scss';
19
19
  import {AutoFetcher} from '../../../../utils/autofetcher';
20
- import {Loader} from '@yandex-cloud/uikit';
20
+ import {Loader} from '@gravity-ui/uikit';
21
21
 
22
22
  const b = cn('tenant-overview');
23
23
 
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import cn from 'bem-cn-lite';
4
4
  import {connect} from 'react-redux';
5
5
  import DataTable from '@yandex-cloud/react-data-table';
6
- import {Loader} from '@yandex-cloud/uikit';
6
+ import {Loader} from '@gravity-ui/uikit';
7
7
 
8
8
  import {changeUserInput} from '../../../../store/reducers/executeQuery';
9
9
  import {sendQuery, setQueryOptions} from '../../../../store/reducers/executeTopQueries';
@@ -167,11 +167,11 @@ class TopQueries extends React.Component {
167
167
  }
168
168
  }
169
169
  const mapStateToProps = (state) => {
170
- const {loading, data, error, wasLoaded} = state.executeTopQueries;
170
+ const {loading, data = {}, error, wasLoaded} = state.executeTopQueries;
171
171
  const {autorefresh} = state.schema;
172
172
  return {
173
173
  loading,
174
- data: data && data.result ? data.result: data,
174
+ data: data.result,
175
175
  error,
176
176
  wasLoaded,
177
177
  autorefresh,
@@ -1,7 +1,7 @@
1
1
  import {useState, useContext, useEffect, useMemo} from 'react';
2
2
  import cn from 'bem-cn-lite';
3
3
  import {connect} from 'react-redux';
4
- import {Loader} from '@yandex-cloud/uikit';
4
+ import {Loader} from '@gravity-ui/uikit';
5
5
  import DataTable from '@yandex-cloud/react-data-table';
6
6
 
7
7
  import InternalLink from '../../../../components/InternalLink/InternalLink';
@@ -216,11 +216,11 @@ function TopShards({
216
216
  }
217
217
 
218
218
  const mapStateToProps = (state) => {
219
- const {loading, data, error, wasLoaded} = state.shardsWorkload;
219
+ const {loading, data = {}, error, wasLoaded} = state.shardsWorkload;
220
220
  const {autorefresh} = state.schema;
221
221
  return {
222
222
  loading,
223
- data: data && data.result ? data.result : data,
223
+ data: data.result,
224
224
  error,
225
225
  currentSchemaPath: state.schema?.currentSchema?.Path,
226
226
  autorefresh,
@@ -2,7 +2,7 @@ import qs from 'qs';
2
2
  import {useLocation} from 'react-router';
3
3
  import cn from 'bem-cn-lite';
4
4
 
5
- import {useThemeValue} from '@yandex-cloud/uikit';
5
+ import {useThemeValue} from '@gravity-ui/uikit';
6
6
 
7
7
  import type {EPathType} from '../../../types/api/schema';
8
8
 
@@ -4,7 +4,7 @@ import {useLocation} from 'react-router';
4
4
  import {Link} from 'react-router-dom';
5
5
  import cn from 'bem-cn-lite';
6
6
 
7
- import {Tabs} from '@yandex-cloud/uikit';
7
+ import {Tabs} from '@gravity-ui/uikit';
8
8
 
9
9
  import routes, {createHref} from '../../../routes';
10
10
  import {TENANT_INITIAL_TAB_KEY} from '../../../utils/constants';
@@ -6,7 +6,7 @@ import {useHistory, useLocation} from 'react-router';
6
6
  import qs from 'qs';
7
7
  import _ from 'lodash';
8
8
 
9
- import {Button, HelpPopover, Loader, Tabs} from '@yandex-cloud/uikit';
9
+ import {Button, HelpPopover, Loader, Tabs} from '@gravity-ui/uikit';
10
10
 
11
11
  import SplitPane from '../../../components/SplitPane';
12
12
  import {SchemaTree} from '../Schema/SchemaTree/SchemaTree';
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import {connect} from 'react-redux';
4
4
  import cn from 'bem-cn-lite';
5
5
 
6
- import {Loader, Button} from '@yandex-cloud/uikit';
6
+ import {Loader, Button} from '@gravity-ui/uikit';
7
7
 
8
8
  import Icon from '../../../components/Icon/Icon';
9
9
  import Fullscreen from '../../../components/Fullscreen/Fullscreen';
@@ -1,8 +1,6 @@
1
1
  .kv-result-issues {
2
- overflow: auto;
3
-
4
- height: 100%;
5
2
  padding: 0 10px;
3
+
6
4
  &__error-message {
7
5
  position: sticky;
8
6
  z-index: 2;
@@ -16,6 +14,7 @@
16
14
 
17
15
  background-color: var(--yc-color-base-background);
18
16
  }
17
+
19
18
  &__error-message-text {
20
19
  margin: 0 10px;
21
20
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import cn from 'bem-cn-lite';
3
3
 
4
- import {Button, Icon, ArrowToggle} from '@yandex-cloud/uikit';
4
+ import {Button, Icon, ArrowToggle} from '@gravity-ui/uikit';
5
5
  import ShortyString from '../../../../components/ShortyString/ShortyString';
6
6
 
7
7
  import {IssueType, SEVERITY, getSeverity} from './models';
@@ -1,7 +1,7 @@
1
1
  import React, {useRef, useState} from 'react';
2
2
  import cn from 'bem-cn-lite';
3
3
  import _ from 'lodash';
4
- import {Button, Popup} from '@yandex-cloud/uikit';
4
+ import {Button, Popup} from '@gravity-ui/uikit';
5
5
  import TruncatedQuery from '../../../../components/TruncatedQuery/TruncatedQuery';
6
6
  import {useSelector} from 'react-redux';
7
7
 
@@ -4,7 +4,7 @@ import {connect} from 'react-redux';
4
4
  import cn from 'bem-cn-lite';
5
5
  import _ from 'lodash';
6
6
  import MonacoEditor from 'react-monaco-editor';
7
- import {Button, DropdownMenu} from '@yandex-cloud/uikit';
7
+ import {Button, DropdownMenu} from '@gravity-ui/uikit';
8
8
 
9
9
  import SplitPane from '../../../components/SplitPane';
10
10
  import {QueryResultTable} from '../../../components/QueryResultTable';
@@ -341,7 +341,7 @@ function QueryEditor(props) {
341
341
  error={error}
342
342
  explain={data}
343
343
  astQuery={handleAstQuery}
344
- ast={dataAst?.ast}
344
+ ast={dataAst}
345
345
  loading={loading}
346
346
  loadingAst={loadingAst}
347
347
  theme={theme}