From 36a2d128fd36b9cdcc6e347c20166a3816ea59f8 Mon Sep 17 00:00:00 2001 From: Viktor Rozaev Date: Tue, 4 Feb 2025 12:14:30 +0100 Subject: [PATCH] feat: now UIFactory.getNavigationExtraTabs allows to request additional attributes for navigation node --- packages/ui/src/ui/UIFactory/index.tsx | 1 + .../ui/src/ui/store/actions/navigation/index.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/ui/UIFactory/index.tsx b/packages/ui/src/ui/UIFactory/index.tsx index 2910943fd..a3e25a3a8 100644 --- a/packages/ui/src/ui/UIFactory/index.tsx +++ b/packages/ui/src/ui/UIFactory/index.tsx @@ -119,6 +119,7 @@ export type ExtraTab = { params: LocationParameters; getPreparedState: (state: RootState, location: {query: RootState}) => RootState; }; + additionalAttributes: Array; }; export type QueryResultChartTab = { diff --git a/packages/ui/src/ui/store/actions/navigation/index.js b/packages/ui/src/ui/store/actions/navigation/index.js index 01d7484b5..eba69a961 100644 --- a/packages/ui/src/ui/store/actions/navigation/index.js +++ b/packages/ui/src/ui/store/actions/navigation/index.js @@ -35,6 +35,7 @@ import {getAnnotation} from './tabs/annotation'; import {loadTabletErrorsCount} from './tabs/tablet-errors/tablet-errors-background'; import {isSupportedEffectiveExpiration} from '../../../store/selectors/thor/support'; import {getTabs} from '../../../store/selectors/navigation/navigation'; +import UIFactory from '../../../UIFactory'; export function updateView(settings = {}) { return (dispatch, getState) => { @@ -73,7 +74,7 @@ export function updateView(settings = {}) { parameters: prepareRequest('/@', { ...requestParams, attributes: [ - ...attributesToLoad, + ...getAttributesToLoad(), ...(allowEffectiveExpiration ? ['effective_expiration'] : []), @@ -343,3 +344,15 @@ const attributesToLoad = [ 'leader_controller_address', 'treat_as_queue_consumer', ]; + +function getAttributesToLoad() { + const additionalAttributes = []; + + UIFactory.getNavigationExtraTabs().forEach((extraTab) => { + additionalAttributes.push(...extraTab.additionalAttributes); + }); + + const attributesSet = new Set([...attributesToLoad, ...additionalAttributes]); + + return [...attributesSet]; +}