Skip to content

Commit

Permalink
fix: review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Standrik committed Jul 30, 2024
1 parent 3d3c140 commit 627347a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
3 changes: 1 addition & 2 deletions src/containers/UserSettings/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"settings.usePaginatedTables.title": "Use paginated tables",
"settings.usePaginatedTables.description": " Use table with data load on scroll for Nodes and Storage tabs. It will increase performance, but could work unstable",

"settings.hideDomainDatabase.title": "Hide root domain",
"settings.hideDomainDatabase.description": "Hide root domain on database list",
"settings.showDomainDatabase.title": "Show domain database",

"settings.useQuerySettings.title": "Use query settings",
"settings.useQuerySettings.description": "Use query settings",
Expand Down
17 changes: 10 additions & 7 deletions src/containers/UserSettings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
AUTOCOMPLETE_ON_ENTER,
BINARY_DATA_IN_PLAIN_TEXT_DISPLAY,
ENABLE_AUTOCOMPLETE,
HIDE_DOMAIN_DATABASE_KEY,
INVERTED_DISKS_KEY,
LANGUAGE_KEY,
QUERY_SETTINGS,
QUERY_USE_MULTI_SCHEMA_KEY,
SHOW_DOMAIN_DATABASE_KEY,
THEME_KEY,
USE_CLUSTER_BALANCER_AS_BACKEND_KEY,
USE_DIRECTORY_OPERATIONS,
Expand Down Expand Up @@ -110,10 +110,9 @@ export const usePaginatedTables: SettingProps = {
description: i18n('settings.usePaginatedTables.description'),
};

export const hideDomainDatabase: SettingProps = {
settingKey: HIDE_DOMAIN_DATABASE_KEY,
title: i18n('settings.hideDomainDatabase.title'),
description: i18n('settings.hideDomainDatabase.description'),
export const showDomainDatabase: SettingProps = {
settingKey: SHOW_DOMAIN_DATABASE_KEY,
title: i18n('settings.showDomainDatabase.title'),
};

export const useQuerySettings: SettingProps = {
Expand Down Expand Up @@ -166,15 +165,19 @@ export const interfaceVersionInfoField: SettingsInfoFieldProps = {
export const appearanceSection: SettingsSection = {
id: 'appearanceSection',
title: i18n('section.appearance'),
settings: [themeSetting, invertedDisksSetting, binaryDataInPlainTextDisplay],
settings: [
themeSetting,
invertedDisksSetting,
binaryDataInPlainTextDisplay,
showDomainDatabase,
],
};
export const experimentsSection: SettingsSection = {
id: 'experimentsSection',
title: i18n('section.experiments'),
settings: [
useNodesEndpointSetting,
usePaginatedTables,
hideDomainDatabase,
queryUseMultiSchemaSetting,
useSeparateDisksPagesSetting,
useDirectoryActionsSetting,
Expand Down
4 changes: 2 additions & 2 deletions src/services/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AUTO_REFRESH_INTERVAL,
BINARY_DATA_IN_PLAIN_TEXT_DISPLAY,
ENABLE_AUTOCOMPLETE,
HIDE_DOMAIN_DATABASE_KEY,
INVERTED_DISKS_KEY,
IS_HOTKEYS_HELP_HIDDEN_KEY,
LANGUAGE_KEY,
Expand All @@ -15,6 +14,7 @@ import {
QUERY_SETTINGS,
QUERY_USE_MULTI_SCHEMA_KEY,
SAVED_QUERIES_KEY,
SHOW_DOMAIN_DATABASE_KEY,
TENANT_INITIAL_PAGE_KEY,
THEME_KEY,
USE_CLUSTER_BALANCER_AS_BACKEND_KEY,
Expand Down Expand Up @@ -51,7 +51,7 @@ export const DEFAULT_USER_SETTINGS = {
[AUTO_REFRESH_INTERVAL]: 0,
[USE_DIRECTORY_OPERATIONS]: false,
[QUERY_SETTINGS]: false,
[HIDE_DOMAIN_DATABASE_KEY]: true,
[SHOW_DOMAIN_DATABASE_KEY]: false,
} as const satisfies SettingsObject;

class SettingsManager {
Expand Down
12 changes: 6 additions & 6 deletions src/store/reducers/tenants/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {createSelector} from '@reduxjs/toolkit';
import escapeRegExp from 'lodash/escapeRegExp';

import type {RootState} from '../..';
import {HIDE_DOMAIN_DATABASE_KEY} from '../../../lib';
import {SHOW_DOMAIN_DATABASE_KEY} from '../../../lib';
import {EFlag} from '../../../types/api/enums';
import {ProblemFilterValues, getSettingValue, selectProblemFilter} from '../settings/settings';
import type {ProblemFilterValue} from '../settings/types';
Expand Down Expand Up @@ -43,18 +43,18 @@ export const selectTenants = createSelector(
);
export const selectTenantsSearchValue = (state: TenantsStateSlice) => state.tenants.searchValue;

export const selectUseHideDomainDatabase = (state: RootState) =>
getSettingValue(state, HIDE_DOMAIN_DATABASE_KEY);
export const selectShowDomainDatabase = (state: RootState) =>
getSettingValue(state, SHOW_DOMAIN_DATABASE_KEY);

// ==== Complex selectors ====

export const selectFilteredTenants = createSelector(
[selectTenants, selectProblemFilter, selectTenantsSearchValue, selectUseHideDomainDatabase],
(tenants, problemFilter, searchQuery, useHideDomainDatabase) => {
[selectTenants, selectProblemFilter, selectTenantsSearchValue, selectShowDomainDatabase],
(tenants, problemFilter, searchQuery, showDomainDatabase) => {
let result = filterTenantsByProblems(tenants, problemFilter);
result = filteredTenantsBySearch(result, searchQuery);
result =
useHideDomainDatabase && result.length > 1
!showDomainDatabase && result.length > 1
? result.filter((item) => item.Type !== 'Domain')
: result;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const TENANT_INITIAL_PAGE_KEY = 'saved_tenant_initial_tab';
export const USE_PAGINATED_TABLES_KEY = 'useBackendParamsForTables';

// Setting to hide domain in database list
export const HIDE_DOMAIN_DATABASE_KEY = 'hideDomainDatabase';
export const SHOW_DOMAIN_DATABASE_KEY = 'showDomainDatabase';

// Enable schema that supports multiple resultsets
export const QUERY_USE_MULTI_SCHEMA_KEY = 'queryUseMultiSchema';
Expand Down

0 comments on commit 627347a

Please sign in to comment.