Skip to content

Commit 5828754

Browse files
Copilotadameat
andcommitted
Add state formatting for database list to show 'Pending' instead of 'pending_resources'
Co-authored-by: adameat <[email protected]>
1 parent e94aac1 commit 5828754

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

src/containers/Tenants/Tenants.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ const b = cn('tenants');
6565

6666
const DATABASES_COLUMNS_WIDTH_LS_KEY = 'databasesTableColumnsWidth';
6767

68+
function formatDatabaseState(state?: string): string {
69+
if (!state) {
70+
return EMPTY_DATA_PLACEHOLDER;
71+
}
72+
73+
// Map specific state values to user-friendly display names
74+
switch (state) {
75+
case 'PENDING_RESOURCES':
76+
return i18n('value_pending');
77+
default:
78+
// For other states, use capitalized version (first letter uppercase, rest lowercase)
79+
return state.charAt(0).toUpperCase() + state.slice(1).toLowerCase();
80+
}
81+
}
82+
6883
interface TenantsProps {
6984
scrollContainerRef: React.RefObject<HTMLElement>;
7085
additionalTenantsProps?: AdditionalTenantsProps;
@@ -195,8 +210,7 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
195210
{
196211
name: 'State',
197212
width: 150,
198-
render: ({row}) => (row.State ? row.State.toLowerCase() : EMPTY_DATA_PLACEHOLDER),
199-
customStyle: () => ({textTransform: 'capitalize'}),
213+
render: ({row}) => formatDatabaseState(row.State),
200214
},
201215
{
202216
name: 'cpu',
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"create-database": "Create database",
33
"remove": "Remove",
4-
"edit": "Edit"
4+
"edit": "Edit",
5+
"value_pending": "Pending"
56
}

src/utils/yaMetrica.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import {uiFactory} from '../uiFactory/uiFactory';
22

33
/**
44
* Interface for a counter that provides methods for tracking metrics.
5-
*
6-
* @method hit - Tracks a hit event with optional arguments. https://yandex.ru/support/metrica/ru/objects/hit
7-
* @method params - Sets parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/params-method
8-
* @method userParams - Sets user-specific parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/user-params
9-
* @method reachGoal - Tracks a goal achievement event with optional arguments. https://yandex.ru/support/metrica/ru/objects/reachgoal
5+
* @function hit - Tracks a hit event with optional arguments. https://yandex.ru/support/metrica/ru/objects/hit
6+
* @function params - Sets parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/params-method
7+
* @function userParams - Sets user-specific parameters for the counter with optional arguments. https://yandex.ru/support/metrica/ru/objects/user-params
8+
* @function reachGoal - Tracks a goal achievement event with optional arguments. https://yandex.ru/support/metrica/ru/objects/reachgoal
109
*/
1110
export interface Counter {
1211
hit: (...args: unknown[]) => void;
@@ -21,7 +20,6 @@ const yaMetricaMap = uiFactory.yaMetricaMap;
2120
* A fake implementation of a counter metric for Yandex.Metrica.
2221
* This class is used when the actual Yandex.Metrica counter is not defined,
2322
* and it provides a warning message the first time any of its methods are called.
24-
*
2523
* @property name - The name of the counter.
2624
* @property warnShown - Flag to indicate if the warning has been shown.
2725
*/
@@ -61,7 +59,6 @@ class FakeMetrica implements Counter {
6159
/**
6260
* Retrieves a Yandex Metrica instance by name from the global window object.
6361
* If no instance is found for the given name, returns a FakeMetrica instance instead.
64-
*
6562
* @param name The name of the metrica to retrieve
6663
* @returns The Yandex Metrica instance if found, otherwise a FakeMetrica instance
6764
*/

0 commit comments

Comments
 (0)