From f00e5d05f7bf98ae3347a6257f4cc66656b41f82 Mon Sep 17 00:00:00 2001 From: mufazalov Date: Tue, 13 May 2025 12:28:09 +0300 Subject: [PATCH] fix: use uiFactory for logs and monitoring links --- .../AppWithClusters/AppWithClusters.tsx | 30 +++++-------------- src/uiFactory/types.ts | 7 +++++ src/uiFactory/uiFactory.ts | 10 ++++++- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/containers/AppWithClusters/AppWithClusters.tsx b/src/containers/AppWithClusters/AppWithClusters.tsx index 3b62b08603..a388eba3c0 100644 --- a/src/containers/AppWithClusters/AppWithClusters.tsx +++ b/src/containers/AppWithClusters/AppWithClusters.tsx @@ -3,12 +3,7 @@ import React from 'react'; import type {Store} from '@reduxjs/toolkit'; import type {History} from 'history'; -import type {GetLogsLink} from '../../utils/logs'; -import type {GetMonitoringClusterLink, GetMonitoringLink} from '../../utils/monitoring'; -import { - getMonitoringClusterLink as getMonitoringClusterLinkDefault, - getMonitoringLink as getMonitoringLinkDefault, -} from '../../utils/monitoring'; +import {uiFactory} from '../../uiFactory/uiFactory'; import {App, AppSlots} from '../App'; import type {YDBEmbeddedUISettings} from '../UserSettings/settings'; @@ -18,22 +13,11 @@ import {ExtendedTenant} from './ExtendedTenant/ExtendedTenant'; export interface AppWithClustersProps { store: Store; history: History; - getLogsLink?: GetLogsLink; - getMonitoringLink?: GetMonitoringLink; - getMonitoringClusterLink?: GetMonitoringClusterLink; userSettings?: YDBEmbeddedUISettings; children?: React.ReactNode; } -export function AppWithClusters({ - store, - history, - getLogsLink, - getMonitoringLink = getMonitoringLinkDefault, - getMonitoringClusterLink = getMonitoringClusterLinkDefault, - userSettings, - children, -}: AppWithClustersProps) { +export function AppWithClusters({store, history, userSettings, children}: AppWithClustersProps) { return ( @@ -41,9 +25,9 @@ export function AppWithClusters({ return ( ); }} @@ -53,8 +37,8 @@ export function AppWithClusters({ return ( ); }} diff --git a/src/uiFactory/types.ts b/src/uiFactory/types.ts index 4ce6013a4a..022c99e9dc 100644 --- a/src/uiFactory/types.ts +++ b/src/uiFactory/types.ts @@ -1,6 +1,13 @@ +import type {GetLogsLink} from '../utils/logs'; +import type {GetMonitoringClusterLink, GetMonitoringLink} from '../utils/monitoring'; + export interface UIFactory { onCreateDB?: HandleCreateDB; onDeleteDB?: HandleDeleteDB; + + getLogsLink?: GetLogsLink; + getMonitoringLink?: GetMonitoringLink; + getMonitoringClusterLink?: GetMonitoringClusterLink; } export type HandleCreateDB = (params: {clusterName: string}) => Promise; diff --git a/src/uiFactory/uiFactory.ts b/src/uiFactory/uiFactory.ts index 2edf7058b5..6dae3aceb3 100644 --- a/src/uiFactory/uiFactory.ts +++ b/src/uiFactory/uiFactory.ts @@ -1,6 +1,14 @@ +import { + getMonitoringClusterLink as getMonitoringClusterLinkDefault, + getMonitoringLink as getMonitoringLinkDefault, +} from '../utils/monitoring'; + import type {UIFactory} from './types'; -const uiFactoryBase: UIFactory = {}; +const uiFactoryBase: UIFactory = { + getMonitoringLink: getMonitoringLinkDefault, + getMonitoringClusterLink: getMonitoringClusterLinkDefault, +}; export function configureUIFactory(overrides: UIFactory) { Object.assign(uiFactoryBase, overrides);