@@ -7,6 +7,8 @@ import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../store/reducers/tenant/consta
77import type { TenantDiagnosticsTab } from '../../../store/reducers/tenant/types' ;
88import { EPathSubType , EPathType } from '../../../types/api/schema' ;
99import type { ETenantType } from '../../../types/api/tenant' ;
10+ import type { AdditionalDiagnosticsTab } from '../../../uiFactory/types' ;
11+ import { uiFactory } from '../../../uiFactory/uiFactory' ;
1012import type { TenantQuery } from '../TenantPages' ;
1113import { TenantTabsGroups } from '../TenantPages' ;
1214import { isDatabaseEntityType , isTopicEntityType } from '../utils/schema' ;
@@ -233,7 +235,34 @@ export const getPagesByType = (
233235 const dbContext = isDatabaseEntityType ( type ) || options ?. isTopLevel ;
234236 const seeded = dbContext ? getDatabasePages ( options ?. databaseType ) : base ;
235237
236- return applyFilters ( seeded , type , options ) ;
238+ const filtered = applyFilters ( seeded , type , options ) ;
239+
240+ // Add custom tabs from uiFactory if available
241+ const customTabsToInsert =
242+ uiFactory . additionalDiagnosticsTabs ?. filter (
243+ ( tab : AdditionalDiagnosticsTab ) => ! tab . shouldShow || tab . shouldShow ( type , subType ) ,
244+ ) || [ ] ;
245+
246+ if ( customTabsToInsert . length === 0 ) {
247+ return filtered ;
248+ }
249+
250+ const result = [ ...filtered ] ;
251+
252+ customTabsToInsert . forEach ( ( customTab : AdditionalDiagnosticsTab ) => {
253+ const tabPage = { id : customTab . id , title : customTab . title } ;
254+
255+ if ( customTab . insertAfter === undefined ) {
256+ // Append at the end
257+ result . push ( tabPage ) ;
258+ } else {
259+ // Insert at specific index
260+ const index = Math . max ( 0 , Math . min ( customTab . insertAfter , result . length ) ) ;
261+ result . splice ( index , 0 , tabPage ) ;
262+ }
263+ } ) ;
264+
265+ return result ;
237266} ;
238267
239268export const useDiagnosticsPageLinkGetter = ( ) => {
0 commit comments