/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/utils/monitoringVisibility.ts
30 строк
1 KB
Anton Standrik
fix: check for correct controlPlane id (#3081)
14 ноя 2025, 14:34
Не верифицирован
14 ноя 2025, 14:34
590fa2d
Код
Авторство
О чём код?
import type {MetaBaseClusterInfo} from '../types/api/meta'; import type {ControlPlane} from '../types/api/tenant'; import {uiFactory} from '../uiFactory/uiFactory'; /** * Centralized check for whether Monitoring should be shown for a database. * Rule: * - If ControlPlane exists, require a non-empty id. * - If ControlPlane does not exist, fallback to cluster monitoring meta presence. */ export function canShowTenantMonitoring( controlPlane?: ControlPlane, clusterMonitoring?: MetaBaseClusterInfo['solomon'], ): boolean { return Boolean(clusterMonitoring) || Boolean(controlPlane?.id); } /** * Unified visibility check for the Monitoring tab/button. * Combines UI factory capability and tenant/cluster monitoring availability. */ export function canShowTenantMonitoringTab( controlPlane?: ControlPlane, clusterMonitoring?: MetaBaseClusterInfo['solomon'], ): boolean { return ( Boolean(uiFactory.renderMonitoring) && canShowTenantMonitoring(controlPlane, clusterMonitoring) ); }