From e94aac13b960e6762d45a97bf03cbb492355e840 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:52:57 +0000 Subject: [PATCH 1/4] Initial plan From 58287547c71e154a66160ba194c02c72948f6f17 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:04:55 +0000 Subject: [PATCH 2/4] Add state formatting for database list to show 'Pending' instead of 'pending_resources' Co-authored-by: adameat <34044711+adameat@users.noreply.github.com> --- src/containers/Tenants/Tenants.tsx | 18 ++++++++++++++++-- src/containers/Tenants/i18n/en.json | 3 ++- src/utils/yaMetrica.ts | 11 ++++------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/containers/Tenants/Tenants.tsx b/src/containers/Tenants/Tenants.tsx index 1eea86b656..ac96f5c5ec 100644 --- a/src/containers/Tenants/Tenants.tsx +++ b/src/containers/Tenants/Tenants.tsx @@ -65,6 +65,21 @@ const b = cn('tenants'); const DATABASES_COLUMNS_WIDTH_LS_KEY = 'databasesTableColumnsWidth'; +function formatDatabaseState(state?: string): string { + if (!state) { + return EMPTY_DATA_PLACEHOLDER; + } + + // Map specific state values to user-friendly display names + switch (state) { + case 'PENDING_RESOURCES': + return i18n('value_pending'); + default: + // For other states, use capitalized version (first letter uppercase, rest lowercase) + return state.charAt(0).toUpperCase() + state.slice(1).toLowerCase(); + } +} + interface TenantsProps { scrollContainerRef: React.RefObject; additionalTenantsProps?: AdditionalTenantsProps; @@ -195,8 +210,7 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro { name: 'State', width: 150, - render: ({row}) => (row.State ? row.State.toLowerCase() : EMPTY_DATA_PLACEHOLDER), - customStyle: () => ({textTransform: 'capitalize'}), + render: ({row}) => formatDatabaseState(row.State), }, { name: 'cpu', diff --git a/src/containers/Tenants/i18n/en.json b/src/containers/Tenants/i18n/en.json index 93ee461dd3..3183c98f52 100644 --- a/src/containers/Tenants/i18n/en.json +++ b/src/containers/Tenants/i18n/en.json @@ -1,5 +1,6 @@ { "create-database": "Create database", "remove": "Remove", - "edit": "Edit" + "edit": "Edit", + "value_pending": "Pending" } diff --git a/src/utils/yaMetrica.ts b/src/utils/yaMetrica.ts index b6465eee4b..2b8f37b125 100644 --- a/src/utils/yaMetrica.ts +++ b/src/utils/yaMetrica.ts @@ -2,11 +2,10 @@ import {uiFactory} from '../uiFactory/uiFactory'; /** * Interface for a counter that provides methods for tracking metrics. - * - * @method hit - Tracks a hit event with optional arguments. https://yandex.ru/support/metrica/ru/objects/hit - * @method params - Sets parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/params-method - * @method userParams - Sets user-specific parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/user-params - * @method reachGoal - Tracks a goal achievement event with optional arguments. https://yandex.ru/support/metrica/ru/objects/reachgoal + * @function hit - Tracks a hit event with optional arguments. https://yandex.ru/support/metrica/ru/objects/hit + * @function params - Sets parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/params-method + * @function userParams - Sets user-specific parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/user-params + * @function reachGoal - Tracks a goal achievement event with optional arguments. https://yandex.ru/support/metrica/ru/objects/reachgoal */ export interface Counter { hit: (...args: unknown[]) => void; @@ -21,7 +20,6 @@ const yaMetricaMap = uiFactory.yaMetricaMap; * A fake implementation of a counter metric for Yandex.Metrica. * This class is used when the actual Yandex.Metrica counter is not defined, * and it provides a warning message the first time any of its methods are called. - * * @property name - The name of the counter. * @property warnShown - Flag to indicate if the warning has been shown. */ @@ -61,7 +59,6 @@ class FakeMetrica implements Counter { /** * Retrieves a Yandex Metrica instance by name from the global window object. * If no instance is found for the given name, returns a FakeMetrica instance instead. - * * @param name The name of the metrica to retrieve * @returns The Yandex Metrica instance if found, otherwise a FakeMetrica instance */ From 15f3f8e166223e8b82b07ba470786fa3843f709b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:43:25 +0000 Subject: [PATCH 3/4] Use State enum as type and transform STATE_UNSPECIFIED to "Unspecified" Co-authored-by: artemmufazalov <67755036+artemmufazalov@users.noreply.github.com> --- src/containers/Tenants/Tenants.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/containers/Tenants/Tenants.tsx b/src/containers/Tenants/Tenants.tsx index ac96f5c5ec..7e57b31559 100644 --- a/src/containers/Tenants/Tenants.tsx +++ b/src/containers/Tenants/Tenants.tsx @@ -35,6 +35,7 @@ import { import {setSearchValue, tenantsApi} from '../../store/reducers/tenants/tenants'; import type {PreparedTenant} from '../../store/reducers/tenants/types'; import type {AdditionalTenantsProps} from '../../types/additionalProps'; +import {State} from '../../types/api/tenant'; import {uiFactory} from '../../uiFactory/uiFactory'; import {formatBytes} from '../../utils/bytesParsers'; import {cn} from '../../utils/cn'; @@ -65,14 +66,16 @@ const b = cn('tenants'); const DATABASES_COLUMNS_WIDTH_LS_KEY = 'databasesTableColumnsWidth'; -function formatDatabaseState(state?: string): string { +function formatDatabaseState(state?: State): string { if (!state) { return EMPTY_DATA_PLACEHOLDER; } // Map specific state values to user-friendly display names switch (state) { - case 'PENDING_RESOURCES': + case State.STATE_UNSPECIFIED: + return 'Unspecified'; + case State.PENDING_RESOURCES: return i18n('value_pending'); default: // For other states, use capitalized version (first letter uppercase, rest lowercase) From 124b3376fbb21bf989db721d1d45a2dd5e22dabc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 11 Sep 2025 12:54:48 +0000 Subject: [PATCH 4/4] Remove i18n usage for database state formatting and use consistent approach Co-authored-by: artemmufazalov <67755036+artemmufazalov@users.noreply.github.com> --- src/containers/Tenants/Tenants.tsx | 2 +- src/containers/Tenants/i18n/en.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/containers/Tenants/Tenants.tsx b/src/containers/Tenants/Tenants.tsx index 7e57b31559..77a9a452a6 100644 --- a/src/containers/Tenants/Tenants.tsx +++ b/src/containers/Tenants/Tenants.tsx @@ -76,7 +76,7 @@ function formatDatabaseState(state?: State): string { case State.STATE_UNSPECIFIED: return 'Unspecified'; case State.PENDING_RESOURCES: - return i18n('value_pending'); + return 'Pending'; default: // For other states, use capitalized version (first letter uppercase, rest lowercase) return state.charAt(0).toUpperCase() + state.slice(1).toLowerCase(); diff --git a/src/containers/Tenants/i18n/en.json b/src/containers/Tenants/i18n/en.json index 3183c98f52..93ee461dd3 100644 --- a/src/containers/Tenants/i18n/en.json +++ b/src/containers/Tenants/i18n/en.json @@ -1,6 +1,5 @@ { "create-database": "Create database", "remove": "Remove", - "edit": "Edit", - "value_pending": "Pending" + "edit": "Edit" }