-
Notifications
You must be signed in to change notification settings - Fork 17
feat(settings): simplify hook, split meta and LS cases #3111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ import type {AxiosWrapperOptions} from '@gravity-ui/axios-wrapper'; | |
| import type {AxiosRequestConfig} from 'axios'; | ||
|
|
||
| import {codeAssistBackend} from '../../store'; | ||
| import {uiFactory} from '../../uiFactory/uiFactory'; | ||
|
|
||
| import {AuthAPI} from './auth'; | ||
| import {CodeAssistAPI} from './codeAssist'; | ||
|
|
@@ -27,6 +26,7 @@ interface YdbEmbeddedAPIProps { | |
| proxyMeta: undefined | boolean; | ||
| // this setting allows to use schema object path relative to database in api requests | ||
| useRelativePath: undefined | boolean; | ||
| useMetaSettings: undefined | boolean; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved So this help to reduce it to only one setting without any additional requirements |
||
| csrfTokenGetter: undefined | (() => string | undefined); | ||
| defaults: undefined | AxiosRequestConfig; | ||
| } | ||
|
|
@@ -54,6 +54,7 @@ export class YdbEmbeddedAPI { | |
| csrfTokenGetter = () => undefined, | ||
| defaults = {}, | ||
| useRelativePath = false, | ||
| useMetaSettings = false, | ||
| }: YdbEmbeddedAPIProps) { | ||
| const axiosParams: AxiosWrapperOptions = {config: {withCredentials, ...defaults}}; | ||
| const baseApiParams = {singleClusterMode, proxyMeta, useRelativePath}; | ||
|
|
@@ -62,7 +63,7 @@ export class YdbEmbeddedAPI { | |
| if (webVersion) { | ||
| this.meta = new MetaAPI(axiosParams, baseApiParams); | ||
| } | ||
| if (uiFactory.useMetaSettings) { | ||
| if (useMetaSettings) { | ||
| this.metaSettings = new MetaSettingsAPI(axiosParams, baseApiParams); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ const initialState: AuthenticationState = { | |
| isAuthenticated: true, | ||
| user: undefined, | ||
| id: undefined, | ||
| metaUser: undefined, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not figured out how to properly receive What are the problems with
|
||
| }; | ||
|
|
||
| export const slice = createSlice({ | ||
|
|
@@ -45,13 +46,13 @@ export const slice = createSlice({ | |
| selectIsUserAllowedToMakeChanges: (state) => state.isUserAllowedToMakeChanges, | ||
| selectIsViewerUser: (state) => state.isViewerUser, | ||
| selectUser: (state) => state.user, | ||
| selectID: (state) => state.id, | ||
| selectMetaUser: (state) => state.metaUser ?? state.id, | ||
| }, | ||
| }); | ||
|
|
||
| export default slice.reducer; | ||
| export const {setIsAuthenticated, setUser} = slice.actions; | ||
| export const {selectIsUserAllowedToMakeChanges, selectIsViewerUser, selectUser, selectID} = | ||
| export const {selectIsUserAllowedToMakeChanges, selectIsViewerUser, selectUser, selectMetaUser} = | ||
| slice.selectors; | ||
|
|
||
| export const authenticationApi = api.injectEndpoints({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table loading changes are needed to synchronize settings and data loading states, without it tests somehow fail to find table container