ydb-embedded-ui 4.15.1 → 4.16.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +21 -0
- package/dist/components/BasicNodeViewer/BasicNodeViewer.tsx +2 -2
- package/dist/components/DiagnosticCard/DiagnosticCard.scss +5 -0
- package/dist/components/DiagnosticCard/DiagnosticCard.tsx +17 -0
- package/dist/components/EntityStatus/EntityStatus.js +2 -2
- package/dist/components/EntityStatus/EntityStatus.scss +15 -0
- package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +2 -1
- package/dist/containers/Cluster/Cluster.tsx +2 -2
- package/dist/containers/Node/Node.tsx +3 -1
- package/dist/containers/Node/NodeStructure/NodeStructure.tsx +3 -1
- package/dist/containers/Node/NodeStructure/Pdisk.tsx +2 -2
- package/dist/containers/Nodes/Nodes.tsx +3 -2
- package/dist/containers/Nodes/getNodesColumns.tsx +3 -1
- package/dist/containers/Storage/Storage.tsx +3 -2
- package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +2 -2
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +5 -12
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +3 -2
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Details/Details.tsx +20 -11
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +14 -1
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.tsx +26 -37
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Preview/Preview.tsx +37 -25
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx +155 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +7 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.ts +11 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/ru.json +7 -0
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +3 -2
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.scss +4 -1
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.tsx +42 -11
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +1 -1
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.tsx +11 -7
- package/dist/containers/Tenant/Query/i18n/en.json +3 -0
- package/dist/containers/Tenant/Query/i18n/ru.json +3 -0
- package/dist/containers/Tenant/Tenant.tsx +3 -2
- package/dist/containers/UserSettings/Setting.tsx +9 -2
- package/dist/containers/UserSettings/i18n/en.json +5 -1
- package/dist/containers/UserSettings/i18n/ru.json +5 -1
- package/dist/containers/UserSettings/settings.ts +25 -0
- package/dist/services/api.ts +16 -16
- package/dist/store/reducers/executeQuery.ts +33 -7
- package/dist/store/reducers/explainQuery.ts +12 -4
- package/dist/store/reducers/healthcheckInfo.ts +27 -11
- package/dist/store/reducers/settings/settings.ts +4 -10
- package/dist/store/reducers/tenant/tenant.ts +19 -1
- package/dist/store/reducers/tenant/types.ts +3 -1
- package/dist/store/reducers/tenants/selectors.ts +1 -1
- package/dist/store/reducers/tenants/utils.ts +2 -2
- package/dist/types/additionalProps.ts +8 -1
- package/dist/types/api/tenant.ts +19 -20
- package/dist/types/store/executeQuery.ts +11 -1
- package/dist/types/store/query.ts +2 -1
- package/dist/utils/autofetcher.ts +7 -7
- package/dist/utils/constants.ts +2 -1
- package/dist/utils/hooks/i18n/en.json +1 -1
- package/dist/utils/hooks/i18n/ru.json +1 -1
- package/dist/utils/hooks/useQueryModes.ts +4 -2
- package/dist/utils/i18n/i18n.ts +10 -4
- package/dist/utils/nodes.ts +0 -6
- package/dist/utils/query.ts +14 -0
- package/dist/utils/settings.ts +10 -0
- package/package.json +1 -1
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Preview/PreviewItem/PreviewItem.tsx +0 -33
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Preview/PreviewItem/index.ts +0 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +0 -213
package/dist/utils/query.ts
CHANGED
@@ -19,6 +19,20 @@ export const QUERY_MODES = {
|
|
19
19
|
script: 'script',
|
20
20
|
data: 'data',
|
21
21
|
query: 'query',
|
22
|
+
pg: 'pg',
|
23
|
+
} as const;
|
24
|
+
|
25
|
+
export const QUERY_MODES_TITLES: Record<QueryMode, string> = {
|
26
|
+
scan: 'Scan',
|
27
|
+
script: 'YQL Script',
|
28
|
+
data: 'Data',
|
29
|
+
query: 'YQL - QueryService',
|
30
|
+
pg: 'PostgreSQL',
|
31
|
+
} as const;
|
32
|
+
|
33
|
+
export const QUERY_SYNTAX = {
|
34
|
+
yql: 'yql_v1',
|
35
|
+
pg: 'pg',
|
22
36
|
} as const;
|
23
37
|
|
24
38
|
export const isNewQueryMode = (value: QueryMode) => {
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import {getValueFromLS} from './utils';
|
2
|
+
|
3
|
+
export const userSettings = window.userSettings || {};
|
4
|
+
export const systemSettings = window.systemSettings || {};
|
5
|
+
|
6
|
+
export function readSavedSettingsValue(key: string, defaultValue?: string) {
|
7
|
+
const savedValue = window.web_version ? userSettings[key] : getValueFromLS(key);
|
8
|
+
|
9
|
+
return savedValue ?? defaultValue;
|
10
|
+
}
|
package/package.json
CHANGED
@@ -1,33 +0,0 @@
|
|
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 PreviewItemProps {
|
13
|
-
data?: IssueLog;
|
14
|
-
onShowMore?: (id: string) => void;
|
15
|
-
}
|
16
|
-
|
17
|
-
export const PreviewItem = (props: PreviewItemProps) => {
|
18
|
-
const {data, onShowMore} = props;
|
19
|
-
|
20
|
-
if (!data) {
|
21
|
-
return null;
|
22
|
-
}
|
23
|
-
|
24
|
-
return (
|
25
|
-
<div className={b('issue-preview')}>
|
26
|
-
<EntityStatus mode="icons" status={data.status} name={data.type} />
|
27
|
-
<Text as="div" color="secondary" variant="body-2">
|
28
|
-
{data.message}
|
29
|
-
</Text>
|
30
|
-
<Link onClick={() => onShowMore?.(data.id)}>{i18n('label.show-details')}</Link>
|
31
|
-
</div>
|
32
|
-
);
|
33
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './PreviewItem';
|
@@ -1,213 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import {connect} from 'react-redux';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
import PropTypes from 'prop-types';
|
5
|
-
import {Loader} from '@gravity-ui/uikit';
|
6
|
-
|
7
|
-
import EntityStatus from '../../../../components/EntityStatus/EntityStatus';
|
8
|
-
import InfoViewer from '../../../../components/InfoViewer/InfoViewer';
|
9
|
-
import {PoolUsage} from '../../../../components/PoolUsage/PoolUsage';
|
10
|
-
import {Tablet} from '../../../../components/Tablet';
|
11
|
-
|
12
|
-
import {getTenantInfo} from '../../../../store/reducers/tenant/tenant';
|
13
|
-
|
14
|
-
import {formatCPU} from '../../../../utils';
|
15
|
-
import {bytesToGB} from '../../../../utils/utils';
|
16
|
-
import {TABLET_STATES} from '../../../../utils/constants';
|
17
|
-
import {AutoFetcher} from '../../../../utils/autofetcher';
|
18
|
-
|
19
|
-
import {mapDatabaseTypeToDBName} from '../../utils/schema';
|
20
|
-
|
21
|
-
import './TenantOverview.scss';
|
22
|
-
|
23
|
-
const b = cn('tenant-overview');
|
24
|
-
|
25
|
-
const renderName = (tenant) => {
|
26
|
-
if (tenant) {
|
27
|
-
const {Name} = tenant;
|
28
|
-
return (
|
29
|
-
<div className={b('tenant-name-wrapper')}>
|
30
|
-
<EntityStatus
|
31
|
-
status={tenant.State}
|
32
|
-
name={Name}
|
33
|
-
withLeftTrim
|
34
|
-
hasClipboardButton
|
35
|
-
clipboardButtonAlwaysVisible
|
36
|
-
/>
|
37
|
-
</div>
|
38
|
-
);
|
39
|
-
}
|
40
|
-
|
41
|
-
return <div>no tenant data</div>;
|
42
|
-
};
|
43
|
-
|
44
|
-
class TenantOverview extends React.Component {
|
45
|
-
static propTypes = {
|
46
|
-
loading: PropTypes.bool,
|
47
|
-
autorefresh: PropTypes.bool,
|
48
|
-
tenant: PropTypes.object,
|
49
|
-
systemTablets: PropTypes.array,
|
50
|
-
additionalTenantInfo: PropTypes.func,
|
51
|
-
tenantName: PropTypes.string,
|
52
|
-
};
|
53
|
-
|
54
|
-
autofetcher;
|
55
|
-
|
56
|
-
componentDidMount() {
|
57
|
-
const {tenantName, autorefresh, getTenantInfo} = this.props;
|
58
|
-
getTenantInfo({path: tenantName});
|
59
|
-
this.autofetcher = new AutoFetcher();
|
60
|
-
if (autorefresh) {
|
61
|
-
this.autofetcher.start();
|
62
|
-
this.autofetcher.fetch(() => getTenantInfo({path: tenantName}));
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
componentDidUpdate(prevProps) {
|
67
|
-
const {autorefresh, tenantName, getTenantInfo} = this.props;
|
68
|
-
|
69
|
-
const restartAutorefresh = () => {
|
70
|
-
this.autofetcher.stop();
|
71
|
-
this.autofetcher.start();
|
72
|
-
this.autofetcher.fetch(() => getTenantInfo({path: tenantName}));
|
73
|
-
};
|
74
|
-
|
75
|
-
if (prevProps.tenantName !== this.props.tenantName) {
|
76
|
-
getTenantInfo({path: tenantName});
|
77
|
-
if (autorefresh) {
|
78
|
-
restartAutorefresh();
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
if (autorefresh && !prevProps.autorefresh) {
|
83
|
-
getTenantInfo({path: tenantName});
|
84
|
-
restartAutorefresh();
|
85
|
-
}
|
86
|
-
|
87
|
-
if (!autorefresh && prevProps.autorefresh) {
|
88
|
-
this.autofetcher.stop();
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
componentWillUnmount() {
|
93
|
-
this.autofetcher.stop();
|
94
|
-
}
|
95
|
-
|
96
|
-
renderLoader = () => {
|
97
|
-
return (
|
98
|
-
<div className={b('loader')}>
|
99
|
-
<Loader size="m" />
|
100
|
-
</div>
|
101
|
-
);
|
102
|
-
};
|
103
|
-
|
104
|
-
render() {
|
105
|
-
const {tenant, loading} = this.props;
|
106
|
-
const {
|
107
|
-
Metrics = {},
|
108
|
-
PoolStats,
|
109
|
-
StateStats = [],
|
110
|
-
MemoryUsed,
|
111
|
-
Name,
|
112
|
-
CoresUsed,
|
113
|
-
StorageGroups,
|
114
|
-
StorageAllocatedSize,
|
115
|
-
Type,
|
116
|
-
SystemTablets,
|
117
|
-
} = tenant;
|
118
|
-
|
119
|
-
const tenantName = mapDatabaseTypeToDBName(Type);
|
120
|
-
const memoryRaw = MemoryUsed ?? Metrics.Memory;
|
121
|
-
|
122
|
-
const memory = (memoryRaw && bytesToGB(memoryRaw)) || 'no data';
|
123
|
-
const storage = (Metrics.Storage && bytesToGB(Metrics.Storage)) || 'no data';
|
124
|
-
const storageGroups = StorageGroups ?? 'no data';
|
125
|
-
const blobStorage = (StorageAllocatedSize && bytesToGB(StorageAllocatedSize)) || 'no data';
|
126
|
-
const storageEfficiency =
|
127
|
-
Metrics.Storage && StorageAllocatedSize
|
128
|
-
? `${((Metrics.Storage * 100) / StorageAllocatedSize).toFixed(2)}%`
|
129
|
-
: 'no data';
|
130
|
-
|
131
|
-
const cpuRaw = CoresUsed !== undefined ? Number(CoresUsed) * 1_000_000 : Metrics.CPU;
|
132
|
-
|
133
|
-
const cpu = formatCPU(cpuRaw);
|
134
|
-
|
135
|
-
const metricsInfo = [
|
136
|
-
{label: 'Type', value: Type},
|
137
|
-
{label: 'Memory', value: memory},
|
138
|
-
{label: 'CPU', value: cpu},
|
139
|
-
{label: 'Tablet storage', value: storage},
|
140
|
-
{label: 'Storage groups', value: storageGroups},
|
141
|
-
{label: 'Blob storage', value: blobStorage},
|
142
|
-
{label: 'Storage efficiency', value: storageEfficiency},
|
143
|
-
];
|
144
|
-
|
145
|
-
const tabletsInfo = StateStats.map((info) => ({
|
146
|
-
label: TABLET_STATES[info.VolatileState],
|
147
|
-
value: info.Count,
|
148
|
-
}));
|
149
|
-
|
150
|
-
return loading ? (
|
151
|
-
this.renderLoader()
|
152
|
-
) : (
|
153
|
-
<div className={b()}>
|
154
|
-
<div className={b('top-label')}>{tenantName}</div>
|
155
|
-
<div className={b('top')}>
|
156
|
-
{renderName(tenant)}
|
157
|
-
{this.props.additionalTenantInfo &&
|
158
|
-
this.props.additionalTenantInfo(
|
159
|
-
this.props.tenant.Name,
|
160
|
-
this.props.tenant.Type,
|
161
|
-
)}
|
162
|
-
</div>
|
163
|
-
<div className={b('system-tablets')}>
|
164
|
-
{SystemTablets &&
|
165
|
-
SystemTablets.map((tablet, tabletIndex) => (
|
166
|
-
<Tablet key={tabletIndex} tablet={tablet} tenantName={Name} />
|
167
|
-
))}
|
168
|
-
</div>
|
169
|
-
<div className={b('common-info')}>
|
170
|
-
<div>
|
171
|
-
<div className={b('section-title')}>Pools</div>
|
172
|
-
{PoolStats ? (
|
173
|
-
<div className={b('section', {pools: true})}>
|
174
|
-
{PoolStats.map((pool, poolIndex) => (
|
175
|
-
<PoolUsage key={poolIndex} data={pool} />
|
176
|
-
))}
|
177
|
-
</div>
|
178
|
-
) : (
|
179
|
-
<div className="error">no pools data</div>
|
180
|
-
)}
|
181
|
-
</div>
|
182
|
-
<InfoViewer
|
183
|
-
title="Metrics"
|
184
|
-
className={b('section', {metrics: true})}
|
185
|
-
info={metricsInfo}
|
186
|
-
/>
|
187
|
-
|
188
|
-
<div className={b('section')}>
|
189
|
-
<InfoViewer info={tabletsInfo} title="Tablets" />
|
190
|
-
</div>
|
191
|
-
</div>
|
192
|
-
</div>
|
193
|
-
);
|
194
|
-
}
|
195
|
-
}
|
196
|
-
|
197
|
-
function mapStateToProps(state) {
|
198
|
-
const {tenant = {}, loading, error: {status} = {}} = state.tenant;
|
199
|
-
const {autorefresh} = state.schema;
|
200
|
-
|
201
|
-
return {
|
202
|
-
tenant,
|
203
|
-
loading,
|
204
|
-
status,
|
205
|
-
autorefresh,
|
206
|
-
};
|
207
|
-
}
|
208
|
-
|
209
|
-
const mapDispatchToProps = {
|
210
|
-
getTenantInfo,
|
211
|
-
};
|
212
|
-
|
213
|
-
export default connect(mapStateToProps, mapDispatchToProps)(TenantOverview);
|