diff --git a/src/containers/Tenants/Tenants.tsx b/src/containers/Tenants/Tenants.tsx index 1eea86b656..77a9a452a6 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,6 +66,23 @@ const b = cn('tenants'); const DATABASES_COLUMNS_WIDTH_LS_KEY = 'databasesTableColumnsWidth'; +function formatDatabaseState(state?: State): string { + if (!state) { + return EMPTY_DATA_PLACEHOLDER; + } + + // Map specific state values to user-friendly display names + switch (state) { + case State.STATE_UNSPECIFIED: + return 'Unspecified'; + case State.PENDING_RESOURCES: + return '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 +213,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/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 */