-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(Diagnostics): display db feature flags #1229
Conversation
src/types/api/cluster.ts
Outdated
export interface TClusterConfigFeatureFlag { | ||
Name: string; | ||
Current?: boolean; | ||
Default?: boolean; | ||
} | ||
|
||
export interface TClusterConfigDb { | ||
Name: string; | ||
FeatureFlags: TClusterConfigFeatureFlag[]; | ||
} | ||
|
||
export interface TClusterConfigs { | ||
Databases: TClusterConfigDb[]; | ||
} |
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.
In types/api
types are grouped by endpoints or entites. Please, create a separate file for configs, they don't connected with TClusterInfo
- /viewer/cluster
response
const featureFlagsFilter = useTypedSelector( | ||
(state) => state.tenant.featureFlagsFilter, | ||
)?.toLocaleLowerCase(); |
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.
Do we really need this state in the store?
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.
yes. in some other tabs search filter is saved between tab navigation
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.
But current solution is not good, we have two sources of truth. On other tabs behavior is different. For example, on Top queries tab the search is saved only in the store, and on Nodes and Storage tabs the search is saved only in query params.
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.
I suggested to have same UX in such cases - sync btw store and url, others agreed.
Why do you think it's not good?
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.
discussed in pm, fixed
]; | ||
|
||
interface Props { | ||
path: string; |
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.
path is not used
|
||
return ( | ||
<TableWithControlsLayout> | ||
<TableWithControlsLayout.Controls>{renderControls()}</TableWithControlsLayout.Controls> |
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.
Why not inline controls here?
<TableWithControlsLayout> | ||
<TableWithControlsLayout.Controls>{renderControls()}</TableWithControlsLayout.Controls> | ||
<TableWithControlsLayout.Table loading={isFetching}> | ||
{renderContent()} |
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.
Let's extract this to another component
src/types/api/featureFlags.ts
Outdated
export interface TConfigFeatureFlag { | ||
Name: string; | ||
Current?: boolean; | ||
Default?: boolean; | ||
} | ||
|
||
export interface TConfigDb { | ||
Name: string; | ||
FeatureFlags: TConfigFeatureFlag[]; | ||
} | ||
|
||
export interface TConfigs { | ||
Databases: TConfigDb[]; | ||
} |
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.
Not a request, but for you information: types are called TSomething and ESomething to match with names from Swagger or backend types, you may not follow the same pattern for your own types
Co-authored-by: Valerii Sidorenko <[email protected]>
placeholder={i18n('search-placeholder')} | ||
/> | ||
</TableWithControlsLayout.Controls> | ||
<TableWithControlsLayout.Table loading={isFetching}> |
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.
Let's move this and fetching and filtering data to the FeatureFlagsList
.
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.
Why? Now Configs
component includes logic and FeatureFlagsList
is stupid (and is not very necessary imho). After moving logic Config
will be almost redundant
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.
discussed in pm, fixed
const featureFlagsFilter = useTypedSelector( | ||
(state) => state.tenant.featureFlagsFilter, | ||
)?.toLocaleLowerCase(); |
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.
But current solution is not good, we have two sources of truth. On other tabs behavior is different. For example, on Top queries tab the search is saved only in the store, and on Nodes and Storage tabs the search is saved only in query params.
<ResizeableDataTable | ||
columnsWidthLSKey={FEATURE_FLAGS_COLUMNS_WIDTH_LS_KEY} | ||
columns={columns} | ||
data={featureFlags} | ||
settings={DEFAULT_TABLE_SETTINGS} | ||
/> |
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.
<ResizeableDataTable | |
columnsWidthLSKey={FEATURE_FLAGS_COLUMNS_WIDTH_LS_KEY} | |
columns={columns} | |
data={featureFlags} | |
settings={DEFAULT_TABLE_SETTINGS} | |
/> | |
<ResizeableDataTable | |
columnsWidthLSKey={FEATURE_FLAGS_COLUMNS_WIDTH_LS_KEY} | |
columns={columns} | |
data={featureFlags} | |
settings={DEFAULT_TABLE_SETTINGS} | |
emptyDataMessage={i18n(featureFlagsFilter ? 'search-empty' : 'no-data')} | |
/> |
|
||
const FeatureFlagsList = ({isError, featureFlags, featureFlagsFilter}: FeatureFlagsListsProps) => { | ||
if (isError) { | ||
return i18n('error-msg'); |
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.
Why not a real error from query?
return i18n('error-msg'); | |
return <ResponseError error={error} />; |
src/store/reducers/tenant/tenant.ts
Outdated
@@ -62,6 +62,19 @@ export const tenantApi = api.injectEndpoints({ | |||
}, | |||
providesTags: ['All'], | |||
}), | |||
getClusterConfig: builder.query({ | |||
queryFn: async ({database}: {database?: string}, {signal}) => { |
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.
queryFn: async ({database}: {database?: string}, {signal}) => { | |
queryFn: async ({database}: {database: string}, {signal}) => { |
Demo
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Bundle Size: 🔺
Current: 78.93 MB | Main: 78.92 MB
Diff: +0.01 MB (0.02%)
ℹ️ CI Information