Skip to content

Commit

Permalink
feat: now UIFactory.getNavigationExtraTabs allows to request addition…
Browse files Browse the repository at this point in the history
…al attributes for navigation node
  • Loading branch information
vrozaev committed Feb 4, 2025
1 parent 93722c7 commit 36a2d12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ui/src/ui/UIFactory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export type ExtraTab = {
params: LocationParameters;
getPreparedState: (state: RootState, location: {query: RootState}) => RootState;
};
additionalAttributes: Array<string>;
};

export type QueryResultChartTab = {
Expand Down
15 changes: 14 additions & 1 deletion packages/ui/src/ui/store/actions/navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -73,7 +74,7 @@ export function updateView(settings = {}) {
parameters: prepareRequest('/@', {
...requestParams,
attributes: [
...attributesToLoad,
...getAttributesToLoad(),
...(allowEffectiveExpiration
? ['effective_expiration']
: []),
Expand Down Expand Up @@ -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];
}

0 comments on commit 36a2d12

Please sign in to comment.