ydb-embedded-ui 4.25.0 → 4.27.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/README.md +39 -0
- package/dist/components/BasicNodeViewer/BasicNodeViewer.scss +3 -11
- package/dist/components/CircularProgressBar/CircularProgressBar.scss +4 -4
- package/dist/components/DateRange/DateRange.scss +3 -3
- package/dist/components/DiagnosticCard/DiagnosticCard.scss +4 -4
- package/dist/components/Divider/Divider.scss +1 -1
- package/dist/components/EmptyState/EmptyState.scss +8 -9
- package/dist/components/EntityStatus/EntityStatus.scss +19 -29
- package/dist/components/ExternalLinkWithIcon/ExternalLinkWithIcon.tsx +2 -2
- package/dist/components/FullNodeViewer/FullNodeViewer.scss +1 -4
- package/dist/components/Fullscreen/Fullscreen.scss +2 -9
- package/dist/components/Icon/Icon.tsx +1 -5
- package/dist/components/InfoViewer/InfoViewer.scss +6 -6
- package/dist/components/LabelWithPopover/LabelWithPopover.tsx +3 -2
- package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +2 -2
- package/dist/components/PoolBar/PoolBar.scss +6 -6
- package/dist/components/PoolUsage/PoolUsage.scss +15 -17
- package/dist/components/ProgressViewer/ProgressViewer.scss +17 -16
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +3 -3
- package/dist/components/SpeedMultiMeter/SpeedMultiMeter.scss +5 -5
- package/dist/components/SpeedMultiMeter/SpeedMultiMeter.tsx +12 -13
- package/dist/components/SplitPane/SplitPane.scss +5 -5
- package/dist/components/TableSkeleton/TableSkeleton.scss +1 -1
- package/dist/components/Tablet/Tablet.scss +10 -10
- package/dist/components/TabletsStatistic/TabletsStatistic.scss +13 -13
- package/dist/components/Tag/Tag.scss +3 -3
- package/dist/components/TruncatedQuery/TruncatedQuery.scss +1 -1
- package/dist/components/UsageLabel/UsageLabel.scss +2 -2
- package/dist/components/UsageLabel/UsageLabel.tsx +1 -1
- package/dist/components/VirtualTable/VirtualTable.scss +3 -3
- package/dist/containers/App/App.scss +20 -24
- package/dist/containers/App/Content.js +5 -4
- package/dist/containers/AsideNavigation/AsideNavigation.scss +1 -4
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +12 -27
- package/dist/containers/Authentication/Authentication.scss +4 -4
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +4 -6
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +1 -1
- package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.scss +3 -3
- package/dist/containers/Cluster/VersionsBar/VersionsBar.tsx +1 -1
- package/dist/containers/Header/Header.scss +1 -1
- package/dist/containers/Heatmap/Heatmap.scss +3 -5
- package/dist/containers/Heatmap/Histogram/Histogram.scss +6 -6
- package/dist/containers/Node/NodeStructure/NodeStructure.scss +10 -13
- package/dist/containers/Node/NodeStructure/Pdisk.tsx +1 -1
- package/dist/containers/ReduxTooltip/ReduxTooltip.js +1 -1
- package/dist/containers/ReduxTooltip/ReduxTooltip.scss +1 -18
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +23 -23
- package/dist/containers/Storage/PDisk/PDisk.scss +4 -4
- package/dist/containers/Storage/PDiskPopup/PDiskPopup.tsx +1 -1
- package/dist/containers/Storage/Storage.scss +1 -1
- package/dist/containers/Storage/StorageGroups/StorageGroups.scss +1 -1
- package/dist/containers/Storage/UsageFilter/UsageFilter.scss +7 -6
- package/dist/containers/Storage/VDiskPopup/VDiskPopup.scss +1 -1
- package/dist/containers/Storage/VDiskPopup/VDiskPopup.tsx +1 -1
- package/dist/containers/Tablet/Tablet.scss +5 -5
- package/dist/containers/TabletsFilters/TabletsFilters.scss +2 -3
- package/dist/containers/Tenant/Acl/Acl.scss +1 -15
- package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.scss +0 -4
- package/dist/containers/Tenant/Diagnostics/Consumers/TopicStats/ConsumersTopicStats.scss +5 -4
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +0 -6
- package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +2 -2
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.scss +2 -2
- package/dist/containers/Tenant/Diagnostics/Network/Network.scss +8 -10
- package/dist/containers/Tenant/Diagnostics/Network/NodeNetwork/NodeNetwork.scss +8 -8
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.scss +1 -5
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.tsx +1 -4
- package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.tsx +0 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/Healthcheck.scss +12 -12
- package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/IssuesViewer/IssueTree.scss +1 -36
- package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/IssuesViewer/IssueTreeItem/IssueTreeItem.scss +3 -3
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.scss +7 -7
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.scss +2 -2
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.scss +1 -1
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +4 -8
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +2 -1
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss +3 -6
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +2 -5
- package/dist/containers/Tenant/Query/Issues/Issues.scss +11 -14
- package/dist/containers/Tenant/Query/Preview/Preview.scss +3 -7
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.scss +1 -1
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +4 -8
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.scss +3 -9
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.scss +0 -9
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.tsx +11 -13
- package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.scss +5 -5
- package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.tsx +3 -3
- package/dist/containers/Tenant/Tenant.scss +1 -2
- package/dist/containers/Tenant/utils/schemaControls.tsx +2 -2
- package/dist/containers/UserSettings/Setting.tsx +5 -1
- package/dist/containers/Versions/GroupedNodesTree/GroupedNodesTree.scss +2 -3
- package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +1 -1
- package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.tsx +1 -1
- package/dist/index.tsx +1 -0
- package/dist/services/api.ts +4 -3
- package/dist/services/settings.ts +113 -0
- package/dist/store/reducers/executeQuery.ts +6 -3
- package/dist/store/reducers/settings/settings.ts +7 -74
- package/dist/store/reducers/settings/types.ts +4 -3
- package/dist/styles/mixins.scss +37 -35
- package/dist/styles/themes/dark-hc.scss +296 -0
- package/dist/styles/themes/dark.scss +297 -0
- package/dist/styles/themes/light-hc.scss +289 -0
- package/dist/styles/themes/light.scss +291 -0
- package/dist/styles/themes.scss +73 -0
- package/dist/types/window.d.ts +2 -2
- package/dist/utils/hooks/useSetting.ts +6 -7
- package/dist/utils/i18n/i18n.ts +2 -2
- package/package.json +7 -6
- package/dist/containers/App/TipPopup/TipPopup.js +0 -66
- package/dist/containers/App/TipPopup/TipPopup.scss +0 -46
- package/dist/utils/settings.ts +0 -13
@@ -92,19 +92,17 @@ export const QueryEditorControls = ({
|
|
92
92
|
return (
|
93
93
|
<div className={b()}>
|
94
94
|
<div className={b('left')}>
|
95
|
-
<
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
</Button>
|
107
|
-
</div>
|
95
|
+
<Button
|
96
|
+
onClick={() => {
|
97
|
+
onRunButtonClick(queryMode);
|
98
|
+
}}
|
99
|
+
disabled={disabled}
|
100
|
+
loading={runIsLoading}
|
101
|
+
view={runView}
|
102
|
+
>
|
103
|
+
<Icon name="startPlay" viewBox="0 0 16 16" width={16} height={16} />
|
104
|
+
{'Run'}
|
105
|
+
</Button>
|
108
106
|
<Button
|
109
107
|
onClick={() => {
|
110
108
|
onExplainButtonClick(queryMode);
|
@@ -4,7 +4,7 @@
|
|
4
4
|
align-items: flex-start;
|
5
5
|
|
6
6
|
& + & {
|
7
|
-
margin-top: var(--
|
7
|
+
margin-top: var(--g-text-body-1-line-height);
|
8
8
|
}
|
9
9
|
}
|
10
10
|
&__field-title {
|
@@ -18,7 +18,7 @@
|
|
18
18
|
&::after {
|
19
19
|
content: '*';
|
20
20
|
|
21
|
-
color: var(--
|
21
|
+
color: var(--g-color-text-danger);
|
22
22
|
}
|
23
23
|
}
|
24
24
|
}
|
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
height: 17px;
|
34
34
|
|
35
|
-
color: var(--
|
35
|
+
color: var(--g-color-text-danger);
|
36
36
|
}
|
37
37
|
&__embedded-tooltip {
|
38
38
|
display: flex;
|
@@ -41,11 +41,11 @@
|
|
41
41
|
height: 100%;
|
42
42
|
margin-left: -10px;
|
43
43
|
|
44
|
-
color: var(--
|
44
|
+
color: var(--g-color-text-secondary);
|
45
45
|
&:hover {
|
46
46
|
cursor: pointer;
|
47
47
|
|
48
|
-
color: var(--
|
48
|
+
color: var(--g-color-text-complementary);
|
49
49
|
}
|
50
50
|
}
|
51
51
|
|
@@ -11,7 +11,7 @@ import {setQueryTab} from '../../../../store/reducers/tenant/tenant';
|
|
11
11
|
import {TENANT_QUERY_TABS_ID} from '../../../../store/reducers/tenant/constants';
|
12
12
|
|
13
13
|
import {TruncatedQuery} from '../../../../components/TruncatedQuery/TruncatedQuery';
|
14
|
-
import {
|
14
|
+
import {Icon} from '../../../../components/Icon';
|
15
15
|
|
16
16
|
import {MAX_QUERY_HEIGHT, QUERY_TABLE_SETTINGS} from '../../utils/constants';
|
17
17
|
|
@@ -110,10 +110,10 @@ export const SavedQueries = ({savedQueries, changeUserInput, onDeleteQuery}: Sav
|
|
110
110
|
</div>
|
111
111
|
<span className={b('controls')}>
|
112
112
|
<Button view="flat-secondary">
|
113
|
-
<
|
113
|
+
<Icon name="pencil" viewBox="0 0 24 24" />
|
114
114
|
</Button>
|
115
115
|
<Button view="flat-secondary" onClick={onDeleteQueryClick(query.name)}>
|
116
|
-
<
|
116
|
+
<Icon name="trash" viewBox="0 0 24 24" />
|
117
117
|
</Button>
|
118
118
|
</span>
|
119
119
|
</div>
|
@@ -6,7 +6,7 @@ import {Button} from '@gravity-ui/uikit';
|
|
6
6
|
import {setShowPreview} from '../../../store/reducers/schema/schema';
|
7
7
|
import {setQueryTab, setTenantPage} from '../../../store/reducers/tenant/tenant';
|
8
8
|
import {TENANT_PAGES_IDS, TENANT_QUERY_TABS_ID} from '../../../store/reducers/tenant/constants';
|
9
|
-
import {
|
9
|
+
import {Icon} from '../../../components/Icon';
|
10
10
|
|
11
11
|
import i18n from '../i18n';
|
12
12
|
|
@@ -44,7 +44,7 @@ export const getControls =
|
|
44
44
|
title={i18n('actions.openPreview')}
|
45
45
|
size="s"
|
46
46
|
>
|
47
|
-
<
|
47
|
+
<Icon name="tablePreview" />
|
48
48
|
</Button>
|
49
49
|
);
|
50
50
|
|
@@ -82,7 +82,11 @@ export const Setting = ({
|
|
82
82
|
};
|
83
83
|
|
84
84
|
return (
|
85
|
-
<Settings.Item
|
85
|
+
<Settings.Item
|
86
|
+
title={title}
|
87
|
+
highlightedTitle={title}
|
88
|
+
renderTitleComponent={renderTitleComponent}
|
89
|
+
>
|
86
90
|
{getSettingsElement(type)}
|
87
91
|
</Settings.Item>
|
88
92
|
);
|
@@ -8,7 +8,7 @@
|
|
8
8
|
margin-top: 10px;
|
9
9
|
margin-bottom: 10px;
|
10
10
|
|
11
|
-
border: 1px solid var(--
|
11
|
+
border: 1px solid var(--g-color-line-generic);
|
12
12
|
border-radius: 10px;
|
13
13
|
}
|
14
14
|
|
@@ -29,8 +29,7 @@
|
|
29
29
|
}
|
30
30
|
|
31
31
|
.ydb-tree-view {
|
32
|
-
|
33
|
-
line-height: var(--yc-text-body-2-line-height);
|
32
|
+
@include body-2-typography();
|
34
33
|
|
35
34
|
// Apply margin ignoring first element of the tree
|
36
35
|
.ydb-tree-view {
|
@@ -53,7 +53,7 @@ export const NodesTreeTitle = ({
|
|
53
53
|
{versionsValues ? (
|
54
54
|
<div className={b('version-progress')}>
|
55
55
|
<span className={b('info-label', {margin: 'right'})}>Versions</span>
|
56
|
-
<Progress
|
56
|
+
<Progress size="s" value={100} stack={versionsValues} />
|
57
57
|
</div>
|
58
58
|
) : null}
|
59
59
|
</div>
|
package/dist/index.tsx
CHANGED
package/dist/services/api.ts
CHANGED
@@ -34,7 +34,6 @@ import type {StorageApiRequestParams} from '../store/reducers/storage/types';
|
|
34
34
|
|
35
35
|
import {backend as BACKEND} from '../store';
|
36
36
|
import {prepareSortValue} from '../utils/filters';
|
37
|
-
import {settingsApi} from '../utils/settings';
|
38
37
|
|
39
38
|
const config = {withCredentials: !window.custom_backend};
|
40
39
|
|
@@ -378,10 +377,12 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
|
|
378
377
|
path_id: tenantId?.PathId,
|
379
378
|
});
|
380
379
|
}
|
381
|
-
|
380
|
+
|
381
|
+
/** @deprecated use localStorage instead */
|
382
|
+
postSetting(settingsApi: string, name: string, value: string) {
|
382
383
|
return this.request({
|
383
384
|
method: 'PATCH',
|
384
|
-
url: settingsApi
|
385
|
+
url: settingsApi,
|
385
386
|
data: {[name]: value},
|
386
387
|
});
|
387
388
|
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
import {TENANT_PAGES_IDS} from '../store/reducers/tenant/constants';
|
2
|
+
|
3
|
+
import {
|
4
|
+
ASIDE_HEADER_COMPACT_KEY,
|
5
|
+
CLUSTER_INFO_HIDDEN_KEY,
|
6
|
+
INVERTED_DISKS_KEY,
|
7
|
+
LANGUAGE_KEY,
|
8
|
+
LAST_USED_QUERY_ACTION_KEY,
|
9
|
+
PARTITIONS_HIDDEN_COLUMNS_KEY,
|
10
|
+
QUERY_INITIAL_MODE_KEY,
|
11
|
+
QUERY_USE_MULTI_SCHEMA_KEY,
|
12
|
+
SAVED_QUERIES_KEY,
|
13
|
+
TENANT_INITIAL_PAGE_KEY,
|
14
|
+
THEME_KEY,
|
15
|
+
USE_BACKEND_PARAMS_FOR_TABLES_KEY,
|
16
|
+
USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
|
17
|
+
} from '../utils/constants';
|
18
|
+
import {QUERY_ACTIONS, QUERY_MODES} from '../utils/query';
|
19
|
+
import {parseJson} from '../utils/utils';
|
20
|
+
|
21
|
+
export type SettingsObject = Record<string, unknown>;
|
22
|
+
|
23
|
+
const USE_LOCAL_STORAGE_FOR_SETTINGS_KEY = 'useLocalStorageForSettings';
|
24
|
+
|
25
|
+
/** User settings keys and their default values */
|
26
|
+
const DEFAULT_USER_SETTINGS: SettingsObject = {
|
27
|
+
[THEME_KEY]: 'system',
|
28
|
+
[LANGUAGE_KEY]: undefined,
|
29
|
+
[INVERTED_DISKS_KEY]: false,
|
30
|
+
[USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY]: false,
|
31
|
+
[QUERY_USE_MULTI_SCHEMA_KEY]: false,
|
32
|
+
[SAVED_QUERIES_KEY]: [],
|
33
|
+
[TENANT_INITIAL_PAGE_KEY]: TENANT_PAGES_IDS.query,
|
34
|
+
[QUERY_INITIAL_MODE_KEY]: QUERY_MODES.script,
|
35
|
+
[LAST_USED_QUERY_ACTION_KEY]: QUERY_ACTIONS.execute,
|
36
|
+
[ASIDE_HEADER_COMPACT_KEY]: true,
|
37
|
+
[PARTITIONS_HIDDEN_COLUMNS_KEY]: [],
|
38
|
+
[CLUSTER_INFO_HIDDEN_KEY]: true,
|
39
|
+
[USE_BACKEND_PARAMS_FOR_TABLES_KEY]: false,
|
40
|
+
};
|
41
|
+
|
42
|
+
class SettingsManager {
|
43
|
+
constructor() {
|
44
|
+
// Migrate settings to LS if external API was used before
|
45
|
+
const settingsApi = window.web_version ? window.systemSettings?.settingsApi : undefined;
|
46
|
+
|
47
|
+
const useLocalStorage = this.readUserSettingsValue(USE_LOCAL_STORAGE_FOR_SETTINGS_KEY);
|
48
|
+
|
49
|
+
if (settingsApi && !useLocalStorage) {
|
50
|
+
const externalUserSettings = window.userSettings;
|
51
|
+
|
52
|
+
if (externalUserSettings) {
|
53
|
+
Object.entries(externalUserSettings).forEach(([key, value]) =>
|
54
|
+
this.setUserSettingsValue(key, value),
|
55
|
+
);
|
56
|
+
}
|
57
|
+
|
58
|
+
this.setUserSettingsValue(USE_LOCAL_STORAGE_FOR_SETTINGS_KEY, true);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* User settings - settings stored in LS or external store
|
64
|
+
*/
|
65
|
+
getUserSettings() {
|
66
|
+
return this.extractSettingsFromLS();
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Returns parsed settings value.
|
71
|
+
* If value cannot be parsed, returns initially stored string.
|
72
|
+
* If there is no value, return default value
|
73
|
+
*/
|
74
|
+
readUserSettingsValue(key: string, defaultValue?: unknown) {
|
75
|
+
return this.readValueFromLS(key) ?? defaultValue ?? DEFAULT_USER_SETTINGS[key];
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Stringify value and set it to LS
|
80
|
+
*/
|
81
|
+
setUserSettingsValue(key: string, value: unknown) {
|
82
|
+
return this.setValueToLS(key, value);
|
83
|
+
}
|
84
|
+
|
85
|
+
private extractSettingsFromLS = () => {
|
86
|
+
return Object.entries(DEFAULT_USER_SETTINGS).reduce<SettingsObject>((acc, [key, value]) => {
|
87
|
+
acc[key] = this.readUserSettingsValue(key, value);
|
88
|
+
return acc;
|
89
|
+
}, {});
|
90
|
+
};
|
91
|
+
|
92
|
+
private readValueFromLS = (key: string): unknown => {
|
93
|
+
try {
|
94
|
+
const value = localStorage.getItem(key);
|
95
|
+
|
96
|
+
return parseJson(value);
|
97
|
+
} catch {
|
98
|
+
return undefined;
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
private setValueToLS = (key: string, value: unknown): void => {
|
103
|
+
try {
|
104
|
+
if (typeof value === 'string') {
|
105
|
+
localStorage.setItem(key, value);
|
106
|
+
} else {
|
107
|
+
localStorage.setItem(key, JSON.stringify(value));
|
108
|
+
}
|
109
|
+
} catch {}
|
110
|
+
};
|
111
|
+
}
|
112
|
+
|
113
|
+
export const settingsManager = new SettingsManager();
|
@@ -9,10 +9,10 @@ import type {
|
|
9
9
|
QueryInHistory,
|
10
10
|
} from '../../types/store/executeQuery';
|
11
11
|
import type {QueryRequestParams, QueryMode, QuerySyntax} from '../../types/store/query';
|
12
|
-
import {getValueFromLS, parseJson} from '../../utils/utils';
|
13
12
|
import {QUERIES_HISTORY_KEY} from '../../utils/constants';
|
14
13
|
import {QUERY_MODES, QUERY_SYNTAX, parseQueryAPIExecuteResponse} from '../../utils/query';
|
15
14
|
import {parseQueryError} from '../../utils/error';
|
15
|
+
import {settingsManager} from '../../services/settings';
|
16
16
|
import '../../services/api';
|
17
17
|
|
18
18
|
import {createRequestActionTypes, createApiRequest} from '../utils';
|
@@ -28,7 +28,10 @@ const GO_TO_NEXT_QUERY = 'query/GO_TO_NEXT_QUERY';
|
|
28
28
|
const SET_MONACO_HOT_KEY = 'query/SET_MONACO_HOT_KEY';
|
29
29
|
const SET_TENANT_PATH = 'query/SET_TENANT_PATH';
|
30
30
|
|
31
|
-
const queriesHistoryInitial
|
31
|
+
const queriesHistoryInitial = settingsManager.readUserSettingsValue(
|
32
|
+
QUERIES_HISTORY_KEY,
|
33
|
+
[],
|
34
|
+
) as string[];
|
32
35
|
|
33
36
|
const sliceLimit = queriesHistoryInitial.length - MAXIMUM_QUERIES_IN_HISTORY;
|
34
37
|
|
@@ -97,7 +100,7 @@ const executeQuery: Reducer<ExecuteQueryState, ExecuteQueryAction> = (
|
|
97
100
|
const newQueries = [...state.history.queries, {queryText, syntax}].slice(
|
98
101
|
state.history.queries.length >= MAXIMUM_QUERIES_IN_HISTORY ? 1 : 0,
|
99
102
|
);
|
100
|
-
|
103
|
+
settingsManager.setUserSettingsValue(QUERIES_HISTORY_KEY, newQueries);
|
101
104
|
const currentIndex = newQueries.length - 1;
|
102
105
|
|
103
106
|
return {
|
@@ -1,32 +1,8 @@
|
|
1
1
|
import type {Reducer} from 'redux';
|
2
2
|
import type {ThunkAction} from 'redux-thunk';
|
3
3
|
|
4
|
-
import {
|
5
|
-
SAVED_QUERIES_KEY,
|
6
|
-
THEME_KEY,
|
7
|
-
TENANT_INITIAL_PAGE_KEY,
|
8
|
-
INVERTED_DISKS_KEY,
|
9
|
-
ASIDE_HEADER_COMPACT_KEY,
|
10
|
-
USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
|
11
|
-
PARTITIONS_HIDDEN_COLUMNS_KEY,
|
12
|
-
QUERY_INITIAL_MODE_KEY,
|
13
|
-
CLUSTER_INFO_HIDDEN_KEY,
|
14
|
-
LAST_USED_QUERY_ACTION_KEY,
|
15
|
-
USE_BACKEND_PARAMS_FOR_TABLES_KEY,
|
16
|
-
LANGUAGE_KEY,
|
17
|
-
QUERY_USE_MULTI_SCHEMA_KEY,
|
18
|
-
} from '../../../utils/constants';
|
19
4
|
import '../../../services/api';
|
20
|
-
import {
|
21
|
-
import {QUERY_ACTIONS, QUERY_MODES} from '../../../utils/query';
|
22
|
-
import {
|
23
|
-
readSavedSettingsValue,
|
24
|
-
settingsApi,
|
25
|
-
systemSettings,
|
26
|
-
userSettings,
|
27
|
-
} from '../../../utils/settings';
|
28
|
-
|
29
|
-
import {TENANT_PAGES_IDS} from '../tenant/constants';
|
5
|
+
import {settingsManager} from '../../../services/settings';
|
30
6
|
|
31
7
|
import type {RootState} from '..';
|
32
8
|
import type {
|
@@ -45,39 +21,12 @@ export const ProblemFilterValues = {
|
|
45
21
|
PROBLEMS: 'With problems',
|
46
22
|
} as const;
|
47
23
|
|
24
|
+
const userSettings = settingsManager.getUserSettings();
|
25
|
+
const systemSettings = window.systemSettings || {};
|
26
|
+
|
48
27
|
export const initialState = {
|
49
28
|
problemFilter: ProblemFilterValues.ALL,
|
50
|
-
userSettings
|
51
|
-
...userSettings,
|
52
|
-
[THEME_KEY]: readSavedSettingsValue(THEME_KEY, 'system'),
|
53
|
-
[LANGUAGE_KEY]: readSavedSettingsValue(LANGUAGE_KEY),
|
54
|
-
[INVERTED_DISKS_KEY]: readSavedSettingsValue(INVERTED_DISKS_KEY, 'false'),
|
55
|
-
[USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY]: readSavedSettingsValue(
|
56
|
-
USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
|
57
|
-
'false',
|
58
|
-
),
|
59
|
-
[QUERY_USE_MULTI_SCHEMA_KEY]: readSavedSettingsValue(QUERY_USE_MULTI_SCHEMA_KEY, 'false'),
|
60
|
-
[SAVED_QUERIES_KEY]: readSavedSettingsValue(SAVED_QUERIES_KEY, '[]'),
|
61
|
-
[TENANT_INITIAL_PAGE_KEY]: readSavedSettingsValue(
|
62
|
-
TENANT_INITIAL_PAGE_KEY,
|
63
|
-
TENANT_PAGES_IDS.query,
|
64
|
-
),
|
65
|
-
[QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(
|
66
|
-
QUERY_INITIAL_MODE_KEY,
|
67
|
-
QUERY_MODES.script,
|
68
|
-
),
|
69
|
-
[LAST_USED_QUERY_ACTION_KEY]: readSavedSettingsValue(
|
70
|
-
LAST_USED_QUERY_ACTION_KEY,
|
71
|
-
QUERY_ACTIONS.execute,
|
72
|
-
),
|
73
|
-
[ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(ASIDE_HEADER_COMPACT_KEY, 'true'),
|
74
|
-
[PARTITIONS_HIDDEN_COLUMNS_KEY]: readSavedSettingsValue(PARTITIONS_HIDDEN_COLUMNS_KEY),
|
75
|
-
[CLUSTER_INFO_HIDDEN_KEY]: readSavedSettingsValue(CLUSTER_INFO_HIDDEN_KEY, 'true'),
|
76
|
-
[USE_BACKEND_PARAMS_FOR_TABLES_KEY]: readSavedSettingsValue(
|
77
|
-
USE_BACKEND_PARAMS_FOR_TABLES_KEY,
|
78
|
-
'false',
|
79
|
-
),
|
80
|
-
},
|
29
|
+
userSettings,
|
81
30
|
systemSettings,
|
82
31
|
};
|
83
32
|
|
@@ -108,19 +57,12 @@ const settings: Reducer<SettingsState, SettingsAction> = (state = initialState,
|
|
108
57
|
|
109
58
|
export const setSettingValue = (
|
110
59
|
name: string,
|
111
|
-
value:
|
60
|
+
value: unknown,
|
112
61
|
): ThunkAction<void, RootState, unknown, SetSettingValueAction> => {
|
113
62
|
return (dispatch) => {
|
114
63
|
dispatch({type: SET_SETTING_VALUE, data: {name, value}});
|
115
64
|
|
116
|
-
|
117
|
-
if (settingsApi) {
|
118
|
-
window.api.postSetting(name, value);
|
119
|
-
} else {
|
120
|
-
try {
|
121
|
-
localStorage.setItem(name, value);
|
122
|
-
} catch {}
|
123
|
-
}
|
65
|
+
settingsManager.setUserSettingsValue(name, value);
|
124
66
|
};
|
125
67
|
};
|
126
68
|
|
@@ -128,15 +70,6 @@ export const getSettingValue = (state: SettingsRootStateSlice, name: string) =>
|
|
128
70
|
return state.settings.userSettings[name];
|
129
71
|
};
|
130
72
|
|
131
|
-
/**
|
132
|
-
* Returns parsed settings value.
|
133
|
-
* If value cannot be parsed, returns initially stored string
|
134
|
-
*/
|
135
|
-
export const getParsedSettingValue = (state: SettingsRootStateSlice, name: string) => {
|
136
|
-
const value = state.settings.userSettings[name];
|
137
|
-
return parseJson(value);
|
138
|
-
};
|
139
|
-
|
140
73
|
export const changeFilter = (filter: ProblemFilterValue) => {
|
141
74
|
return {
|
142
75
|
type: CHANGE_PROBLEM_FILTER,
|
@@ -1,17 +1,18 @@
|
|
1
1
|
import type {ValueOf} from '../../../types/common';
|
2
|
+
import type {SettingsObject} from '../../../services/settings';
|
2
3
|
import {changeFilter, ProblemFilterValues, SET_SETTING_VALUE} from './settings';
|
3
4
|
|
4
5
|
export type ProblemFilterValue = ValueOf<typeof ProblemFilterValues>;
|
5
6
|
|
6
7
|
export interface SettingsState {
|
7
8
|
problemFilter: ProblemFilterValue;
|
8
|
-
userSettings:
|
9
|
-
systemSettings:
|
9
|
+
userSettings: SettingsObject;
|
10
|
+
systemSettings: SettingsObject;
|
10
11
|
}
|
11
12
|
|
12
13
|
export type SetSettingValueAction = {
|
13
14
|
type: typeof SET_SETTING_VALUE;
|
14
|
-
data: {name: string; value:
|
15
|
+
data: {name: string; value: unknown};
|
15
16
|
};
|
16
17
|
|
17
18
|
export type SettingsAction = ReturnType<typeof changeFilter> | SetSettingValueAction;
|
package/dist/styles/mixins.scss
CHANGED
@@ -15,26 +15,29 @@
|
|
15
15
|
flex-direction: column;
|
16
16
|
}
|
17
17
|
|
18
|
-
@mixin body-typography() {
|
19
|
-
font-size: var(--
|
20
|
-
line-height: var(--
|
18
|
+
@mixin body-1-typography() {
|
19
|
+
font-size: var(--g-text-body-1-font-size);
|
20
|
+
line-height: var(--g-text-body-1-line-height);
|
21
21
|
}
|
22
|
-
@mixin
|
23
|
-
font-size: var(--
|
24
|
-
line-height: var(--
|
22
|
+
@mixin body-2-typography() {
|
23
|
+
font-size: var(--g-text-body-2-font-size);
|
24
|
+
line-height: var(--g-text-body-2-line-height);
|
25
25
|
}
|
26
|
-
@mixin
|
27
|
-
font-size: var(--
|
28
|
-
line-height: var(--
|
26
|
+
@mixin body-3-typography() {
|
27
|
+
font-size: var(--g-text-body-3-font-size);
|
28
|
+
line-height: var(--g-text-body-3-line-height);
|
29
29
|
}
|
30
30
|
@mixin lead-typography() {
|
31
|
-
font-size: var(--
|
32
|
-
line-height: var(--
|
31
|
+
font-size: var(--g-text-subheader-3-font-size);
|
32
|
+
line-height: var(--g-text-subheader-3-line-height);
|
33
33
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
@mixin header-1-typography() {
|
35
|
+
font-size: var(--g-text-header-1-font-size);
|
36
|
+
line-height: var(--g-text-header-1-line-height);
|
37
|
+
}
|
38
|
+
@mixin header-2-typography() {
|
39
|
+
font-size: var(--g-text-header-2-font-size);
|
40
|
+
line-height: var(--g-text-header-2-line-height);
|
38
41
|
}
|
39
42
|
|
40
43
|
@mixin sticky-top {
|
@@ -42,7 +45,7 @@
|
|
42
45
|
top: 0;
|
43
46
|
left: 0;
|
44
47
|
|
45
|
-
background-color: var(--
|
48
|
+
background-color: var(--g-color-base-background);
|
46
49
|
}
|
47
50
|
|
48
51
|
@mixin loader() {
|
@@ -82,9 +85,8 @@
|
|
82
85
|
@mixin info-viewer-title {
|
83
86
|
margin: 15px 0 10px;
|
84
87
|
|
85
|
-
font-size: var(--yc-text-body-2-font-size);
|
86
88
|
font-weight: 600;
|
87
|
-
|
89
|
+
@include body-2-typography();
|
88
90
|
}
|
89
91
|
|
90
92
|
@mixin query-data-table() {
|
@@ -113,7 +115,7 @@
|
|
113
115
|
}
|
114
116
|
|
115
117
|
&__th {
|
116
|
-
box-shadow: inset 0 -1px 0 0 var(--
|
118
|
+
box-shadow: inset 0 -1px 0 0 var(--g-tabs-color-divider);
|
117
119
|
}
|
118
120
|
}
|
119
121
|
}
|
@@ -121,14 +123,14 @@
|
|
121
123
|
.link {
|
122
124
|
text-decoration: none;
|
123
125
|
|
124
|
-
color: var(--
|
126
|
+
color: var(--g-color-text-link);
|
125
127
|
|
126
128
|
&_external {
|
127
129
|
margin-right: 10px;
|
128
130
|
}
|
129
131
|
|
130
132
|
&:hover {
|
131
|
-
color: var(--
|
133
|
+
color: var(--g-color-text-link-hover);
|
132
134
|
}
|
133
135
|
}
|
134
136
|
|
@@ -143,8 +145,8 @@
|
|
143
145
|
z-index: 2000;
|
144
146
|
left: $left;
|
145
147
|
|
146
|
-
border-right: $border-width solid var(--
|
147
|
-
background-color: var(--
|
148
|
+
border-right: $border-width solid var(--g-color-line-generic);
|
149
|
+
background-color: var(--g-color-base-background);
|
148
150
|
}
|
149
151
|
.data-table__row:hover .data-table__td:nth-child(#{$nth}) {
|
150
152
|
background-color: var(--ydb-data-table-color-hover) !important;
|
@@ -199,9 +201,9 @@
|
|
199
201
|
|
200
202
|
@mixin json-tree-styles {
|
201
203
|
// stylelint-disable
|
202
|
-
font-family: var(--
|
203
|
-
font-size: var(--
|
204
|
-
line-height: var(--
|
204
|
+
font-family: var(--g-font-family-monospace) !important;
|
205
|
+
font-size: var(--g-text-code-1-font-size) !important;
|
206
|
+
line-height: var(--g-text-code-1-line-height) !important;
|
205
207
|
// stylelint-enable
|
206
208
|
|
207
209
|
.json-inspector__leaf_composite:before {
|
@@ -210,7 +212,7 @@
|
|
210
212
|
|
211
213
|
font-size: 9px;
|
212
214
|
|
213
|
-
color: var(--
|
215
|
+
color: var(--g-color-text-secondary);
|
214
216
|
}
|
215
217
|
.json-inspector__leaf_composite.json-inspector__leaf_root:before {
|
216
218
|
left: 0;
|
@@ -224,7 +226,7 @@
|
|
224
226
|
|
225
227
|
& .json-inspector {
|
226
228
|
&__key {
|
227
|
-
color: var(--
|
229
|
+
color: var(--g-color-text-misc);
|
228
230
|
}
|
229
231
|
&__leaf {
|
230
232
|
position: relative;
|
@@ -241,7 +243,7 @@
|
|
241
243
|
width: 300px;
|
242
244
|
margin-bottom: 10px;
|
243
245
|
|
244
|
-
border: 1px solid var(--
|
246
|
+
border: 1px solid var(--g-color-line-generic);
|
245
247
|
border-radius: 4px;
|
246
248
|
}
|
247
249
|
&__search {
|
@@ -251,11 +253,11 @@
|
|
251
253
|
margin: 0;
|
252
254
|
padding: 0;
|
253
255
|
|
254
|
-
font-family: var(--
|
256
|
+
font-family: var(--g-text-body-font-family);
|
255
257
|
font-size: 13px;
|
256
258
|
vertical-align: top;
|
257
259
|
|
258
|
-
color: var(--
|
260
|
+
color: var(--g-color-text-primary);
|
259
261
|
border: 0 solid transparent;
|
260
262
|
border-width: 0 8px;
|
261
263
|
border-right-width: 22px;
|
@@ -264,18 +266,18 @@
|
|
264
266
|
}
|
265
267
|
&__value {
|
266
268
|
&_helper {
|
267
|
-
color: var(--
|
269
|
+
color: var(--g-color-text-secondary);
|
268
270
|
}
|
269
271
|
}
|
270
272
|
&__line:hover:after {
|
271
|
-
background: var(--
|
273
|
+
background: var(--g-color-base-simple-hover);
|
272
274
|
}
|
273
275
|
&__show-original:before {
|
274
|
-
color: var(--
|
276
|
+
color: var(--g-color-text-secondary);
|
275
277
|
}
|
276
278
|
&__show-original:hover:after,
|
277
279
|
&__show-original:hover:before {
|
278
|
-
color: var(--
|
280
|
+
color: var(--g-color-text-primary);
|
279
281
|
}
|
280
282
|
}
|
281
283
|
}
|