ydb-embedded-ui 4.23.0 → 4.24.0
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [4.24.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.23.0...v4.24.0) (2023-12-07)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* always use localStorage if no settingsApi ([#603](https://github.com/ydb-platform/ydb-embedded-ui/issues/603)) ([ff692df](https://github.com/ydb-platform/ydb-embedded-ui/commit/ff692dffa99d278f6b261bbf1aac0ee24c661a6d))
|
9
|
+
|
3
10
|
## [4.23.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.22.0...v4.23.0) (2023-12-06)
|
4
11
|
|
5
12
|
|
package/dist/services/api.ts
CHANGED
@@ -34,11 +34,10 @@ 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';
|
37
38
|
|
38
39
|
const config = {withCredentials: !window.custom_backend};
|
39
40
|
|
40
|
-
const settingsApi = window.web_version ? window.systemSettings?.settingsApi : undefined;
|
41
|
-
|
42
41
|
type AxiosOptions = {
|
43
42
|
concurrentId?: string;
|
44
43
|
};
|
@@ -21,7 +21,12 @@ import {
|
|
21
21
|
import '../../../services/api';
|
22
22
|
import {parseJson} from '../../../utils/utils';
|
23
23
|
import {QUERY_ACTIONS, QUERY_MODES} from '../../../utils/query';
|
24
|
-
import {
|
24
|
+
import {
|
25
|
+
readSavedSettingsValue,
|
26
|
+
settingsApi,
|
27
|
+
systemSettings,
|
28
|
+
userSettings,
|
29
|
+
} from '../../../utils/settings';
|
25
30
|
|
26
31
|
import {TENANT_PAGES_IDS} from '../tenant/constants';
|
27
32
|
|
@@ -115,13 +120,16 @@ export const setSettingValue = (
|
|
115
120
|
name: string,
|
116
121
|
value: string,
|
117
122
|
): ThunkAction<void, RootState, unknown, SetSettingValueAction> => {
|
118
|
-
return (dispatch
|
123
|
+
return (dispatch) => {
|
119
124
|
dispatch({type: SET_SETTING_VALUE, data: {name, value}});
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
} else {
|
125
|
+
|
126
|
+
// If there is no settingsApi, use localStorage
|
127
|
+
if (settingsApi) {
|
124
128
|
window.api.postSetting(name, value);
|
129
|
+
} else {
|
130
|
+
try {
|
131
|
+
localStorage.setItem(name, value);
|
132
|
+
} catch {}
|
125
133
|
}
|
126
134
|
};
|
127
135
|
};
|
package/dist/utils/settings.ts
CHANGED
@@ -3,8 +3,11 @@ import {getValueFromLS} from './utils';
|
|
3
3
|
export const userSettings = window.userSettings || {};
|
4
4
|
export const systemSettings = window.systemSettings || {};
|
5
5
|
|
6
|
+
export const settingsApi = window.web_version ? systemSettings.settingsApi : undefined;
|
7
|
+
|
6
8
|
export function readSavedSettingsValue(key: string, defaultValue?: string) {
|
7
|
-
|
9
|
+
// If there is no settingsApi, use localStorage
|
10
|
+
const savedValue = settingsApi ? userSettings[key] : getValueFromLS(key);
|
8
11
|
|
9
12
|
return savedValue ?? defaultValue;
|
10
13
|
}
|