Skip to content
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

Merged
merged 15 commits into from
Sep 9, 2024
Merged

feat(Diagnostics): display db feature flags #1229

merged 15 commits into from
Sep 9, 2024

Conversation

sareyu
Copy link
Collaborator

@sareyu sareyu commented Aug 28, 2024

Demo

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
124 121 0 3 0

Bundle Size: 🔺

Current: 78.93 MB | Main: 78.92 MB
Diff: +0.01 MB (0.02%)

⚠️ Bundle size increased. Please review.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

@sareyu sareyu linked an issue Aug 28, 2024 that may be closed by this pull request
@sareyu sareyu marked this pull request as ready for review September 2, 2024 10:30
@sareyu sareyu requested a review from Raubzeug September 3, 2024 11:58
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
Comment on lines 42 to 55
export interface TClusterConfigFeatureFlag {
Name: string;
Current?: boolean;
Default?: boolean;
}

export interface TClusterConfigDb {
Name: string;
FeatureFlags: TClusterConfigFeatureFlag[];
}

export interface TClusterConfigs {
Databases: TClusterConfigDb[];
}
Copy link
Member

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

src/store/reducers/tenant/tenant.ts Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
src/containers/Tenant/Diagnostics/Configs/Configs.tsx Outdated Show resolved Hide resolved
Comment on lines 88 to 90
const featureFlagsFilter = useTypedSelector(
(state) => state.tenant.featureFlagsFilter,
)?.toLocaleLowerCase();
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

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;
Copy link
Collaborator

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>
Copy link
Collaborator

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()}
Copy link
Collaborator

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

Comment on lines 1 to 14
export interface TConfigFeatureFlag {
Name: string;
Current?: boolean;
Default?: boolean;
}

export interface TConfigDb {
Name: string;
FeatureFlags: TConfigFeatureFlag[];
}

export interface TConfigs {
Databases: TConfigDb[];
}
Copy link
Member

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

placeholder={i18n('search-placeholder')}
/>
</TableWithControlsLayout.Controls>
<TableWithControlsLayout.Table loading={isFetching}>
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed in pm, fixed

Comment on lines 88 to 90
const featureFlagsFilter = useTypedSelector(
(state) => state.tenant.featureFlagsFilter,
)?.toLocaleLowerCase();
Copy link
Collaborator

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.

Comment on lines 102 to 107
<ResizeableDataTable
columnsWidthLSKey={FEATURE_FLAGS_COLUMNS_WIDTH_LS_KEY}
columns={columns}
data={featureFlags}
settings={DEFAULT_TABLE_SETTINGS}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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');
Copy link
Collaborator

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?

Suggested change
return i18n('error-msg');
return <ResponseError error={error} />;

@@ -62,6 +62,19 @@ export const tenantApi = api.injectEndpoints({
},
providesTags: ['All'],
}),
getClusterConfig: builder.query({
queryFn: async ({database}: {database?: string}, {signal}) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
queryFn: async ({database}: {database?: string}, {signal}) => {
queryFn: async ({database}: {database: string}, {signal}) => {

@sareyu sareyu merged commit 182d803 into main Sep 9, 2024
6 checks passed
@sareyu sareyu deleted the issue1035 branch September 9, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

display feature flags status
3 participants