diff --git a/webapp/packages/core-administration/src/AdministrationItem/IAdministrationItem.ts b/webapp/packages/core-administration/src/AdministrationItem/IAdministrationItem.ts index dce7254076..0ebcff7979 100644 --- a/webapp/packages/core-administration/src/AdministrationItem/IAdministrationItem.ts +++ b/webapp/packages/core-administration/src/AdministrationItem/IAdministrationItem.ts @@ -5,6 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { ILoadableState } from '@cloudbeaver/core-utils'; + import type { IRouteParams } from './IRouteParams.js'; export enum AdministrationItemType { @@ -84,6 +86,7 @@ export interface IAdministrationItemOptions { replace?: IAdministrationItemReplaceOptions; defaultSub?: string; defaultParam?: string; + getLoader?: () => ILoadableState[] | ILoadableState; getDrawerComponent: () => AdministrationItemDrawerComponent; getContentComponent: () => AdministrationItemContentComponent; onLoad?: AdministrationItemEvent; diff --git a/webapp/packages/plugin-administration/src/Administration/Administration.tsx b/webapp/packages/plugin-administration/src/Administration/Administration.tsx index 14b075389a..f34bb5a942 100644 --- a/webapp/packages/plugin-administration/src/Administration/Administration.tsx +++ b/webapp/packages/plugin-administration/src/Administration/Administration.tsx @@ -24,10 +24,12 @@ import { type StyleRegistry, ToolsActionStyles, ToolsPanelStyles, + useAutoLoad, useS, } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { OptionsPanelService, TabList, TabListStyles, TabsState, TabStyles } from '@cloudbeaver/core-ui'; +import type { ILoadableState } from '@cloudbeaver/core-utils'; import { CaptureView } from '@cloudbeaver/core-view'; import { AdministrationCaptureViewContext } from './AdministrationCaptureViewContext.js'; @@ -95,6 +97,9 @@ export const Administration = observer>(function const OptionsPanel = optionsPanelService.getPanelComponent(); const visibleItems = administrationItemService.getActiveItems(configurationWizard); const onlyActiveItem = administrationItemService.items.find(filterOnlyActive(configurationWizard)); + const loaders = administrationItemService.items.reduce((acc, item) => [...acc, item.getLoader?.() || []].flat(), []); + + useAutoLoad(Administration, loaders); useLayoutEffect(() => { contentRef.current?.scrollTo({ top: 0, left: 0 });