diff --git a/src/containers/Header/breadcrumbs.tsx b/src/containers/Header/breadcrumbs.tsx index 866fc78204..dbe6d8b6d9 100644 --- a/src/containers/Header/breadcrumbs.tsx +++ b/src/containers/Header/breadcrumbs.tsx @@ -178,9 +178,11 @@ const getStorageGroupBreadcrumbs: GetBreadcrumbs }; const getTabletBreadcrumbs: GetBreadcrumbs = (options, query = {}) => { - const {tabletId, tabletType, nodeId, nodeRole, nodeActiveTab = TABLETS, tenantName} = options; + const {tabletId, tabletType, tenantName} = options; - const breadcrumbs = getNodeBreadcrumbs({nodeId, nodeRole, nodeActiveTab, tenantName}, query); + const breadcrumbs = tenantName + ? getTenantBreadcrumbs(options, query) + : getClusterBreadcrumbs(options, query); const lastItem = { text: tabletId || headerKeyset('breadcrumbs.tablet'), diff --git a/src/containers/Tablet/Tablet.tsx b/src/containers/Tablet/Tablet.tsx index d8f5f212e0..bd6d52c7f5 100644 --- a/src/containers/Tablet/Tablet.tsx +++ b/src/containers/Tablet/Tablet.tsx @@ -16,11 +16,9 @@ import {PageMetaWithAutorefresh} from '../../components/PageMeta/PageMeta'; import {getTabletPagePath} from '../../routes'; import {selectIsUserAllowedToMakeChanges} from '../../store/reducers/authentication/authentication'; import {setHeaderBreadcrumbs} from '../../store/reducers/header/header'; -import {nodeApi} from '../../store/reducers/node/node'; import {tabletApi} from '../../store/reducers/tablet'; import {EFlag} from '../../types/api/enums'; import type {TTabletStateInfo} from '../../types/api/tablet'; -import {EType} from '../../types/api/tablet'; import type {ITabletPreparedHistoryItem} from '../../types/store/tablet'; import {cn} from '../../utils/cn'; import {CLUSTER_DEFAULT_TITLE} from '../../utils/constants'; @@ -59,12 +57,9 @@ const TABLET_PAGE_TABS = [ ]; const tabletTabSchema = z.nativeEnum(TABLET_TABS_IDS).catch(TABLET_TABS_IDS.history); -const eTypeSchema = z.nativeEnum(EType).or(z.undefined()).catch(undefined); const tabletQueryParams = { - nodeId: StringParam, tenantName: StringParam, - type: StringParam, clusterName: StringParam, activeTab: StringParam, }; @@ -74,18 +69,12 @@ export function Tablet() { const {id} = useParams<{id: string}>(); - const [ - { - nodeId: queryNodeId, - tenantName: queryDatabase, - type: queryTabletType, - clusterName: queryClusterName, - }, - ] = useQueryParams(tabletQueryParams); + const [{tenantName: queryDatabase, clusterName: queryClusterName}] = + useQueryParams(tabletQueryParams); const [autoRefreshInterval] = useAutoRefreshInterval(); const {currentData, isFetching, error} = tabletApi.useGetTabletQuery( - {id, database: queryDatabase ?? undefined, nodeId: queryNodeId ?? undefined}, + {id, database: queryDatabase ?? undefined}, {pollingInterval: autoRefreshInterval}, ); @@ -96,24 +85,19 @@ export function Tablet() { tablet.TenantId ? {tenantId: tablet.TenantId} : skipToken, ); - const nodeId = tablet.NodeId ?? queryNodeId ?? undefined; const database = (tenantPath || queryDatabase) ?? undefined; - const nodeRole = useNodeRole(nodeId?.toString()); - - const tabletType = tablet.Type || eTypeSchema.parse(queryTabletType); + const tabletType = tablet.Type; React.useEffect(() => { dispatch( setHeaderBreadcrumbs('tablet', { - nodeId, - nodeRole, tenantName: queryDatabase ?? undefined, tabletId: id, tabletType, }), ); - }, [dispatch, queryDatabase, id, nodeId, nodeRole, tabletType]); + }, [dispatch, queryDatabase, id, tabletType]); const {Leader, Type} = tablet; const metaItems: string[] = []; @@ -246,17 +230,3 @@ function Channels({id, hiveId}: {id: string; hiveId: string}) { ); } - -function useNodeRole(nodeId: string | undefined) { - const {currentData: node} = nodeApi.useGetNodeInfoQuery(nodeId ? {nodeId} : skipToken); - - let nodeRole: 'Storage' | 'Compute' | undefined; - - if (node) { - // Compute nodes have tenantName, storage nodes doesn't - const isStorage = !node?.Tenants?.[0]; - nodeRole = isStorage ? 'Storage' : 'Compute'; - } - - return nodeRole; -} diff --git a/src/containers/Tablets/TabletsTable.tsx b/src/containers/Tablets/TabletsTable.tsx index 6129e14523..3df6f29d92 100644 --- a/src/containers/Tablets/TabletsTable.tsx +++ b/src/containers/Tablets/TabletsTable.tsx @@ -50,8 +50,6 @@ function getColumns({database}: {database?: string}) { } const tabletPath = getTabletPagePath(row.TabletId, { - nodeId: row.NodeId, - type: row.Type, tenantName: database, }); diff --git a/src/services/api.ts b/src/services/api.ts index 2a16def959..bf319f8204 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -467,7 +467,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper { ); } getTablet( - {id, database, nodeId}: {id: string; database?: string; nodeId?: string}, + {id, database}: {id: string; database?: string}, {concurrentId, signal}: AxiosOptions = {}, ) { return this.get( @@ -475,7 +475,6 @@ export class YdbEmbeddedAPI extends AxiosWrapper { { enums: true, database, - node_id: nodeId, filter: `(TabletId=${id})`, }, { @@ -485,7 +484,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper { ); } getTabletHistory( - {id, database, nodeId}: {id: string; database?: string; nodeId?: string}, + {id, database}: {id: string; database?: string}, {concurrentId, signal}: AxiosOptions = {}, ) { return this.get( @@ -494,7 +493,6 @@ export class YdbEmbeddedAPI extends AxiosWrapper { enums: true, merge: false, database, - node_id: nodeId, filter: `(TabletId=${id})`, }, { diff --git a/src/store/reducers/header/types.ts b/src/store/reducers/header/types.ts index 7cf75a480b..e4e01f9127 100644 --- a/src/store/reducers/header/types.ts +++ b/src/store/reducers/header/types.ts @@ -41,7 +41,7 @@ export interface VDiskBreadcrumbsOptions extends PDiskBreadcrumbsOptions { vDiskSlotId?: string | number; } -export interface TabletBreadcrumbsOptions extends NodeBreadcrumbsOptions { +export interface TabletBreadcrumbsOptions extends TenantBreadcrumbsOptions { tabletId?: string; tabletType?: EType; } diff --git a/src/store/reducers/tablet.ts b/src/store/reducers/tablet.ts index 66ef46e9bf..e3ba91e68f 100644 --- a/src/store/reducers/tablet.ts +++ b/src/store/reducers/tablet.ts @@ -8,13 +8,13 @@ export const tabletApi = api.injectEndpoints({ endpoints: (build) => ({ getTablet: build.query({ queryFn: async ( - {id, database, nodeId}: {id: string; database?: string; nodeId?: string}, + {id, database}: {id: string; database?: string; nodeId?: string}, {signal}, ) => { try { const [tabletResponseData, historyResponseData, nodesList] = await Promise.all([ - window.api.getTablet({id, database, nodeId}, {signal}), - window.api.getTabletHistory({id, database, nodeId}, {signal}), + window.api.getTablet({id, database}, {signal}), + window.api.getTabletHistory({id, database}, {signal}), window.api.getNodesList({signal}), ]); const nodeHostsMap = prepareNodeHostsMap(nodesList);