-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CB-5712 adds loaders for administration menu items
- Loading branch information
1 parent
ffe0a18
commit 5f37d7e
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
webapp/packages/plugin-administration/src/Administration/getLoaders.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import type { IAdministrationItem } from '@cloudbeaver/core-administration'; | ||
import type { ILoadableState } from '@cloudbeaver/core-utils'; | ||
|
||
export function reduceLoaders(acc: ILoadableState[], item: IAdministrationItem): ILoadableState[] { | ||
if (!item.getLoader) { | ||
return acc; | ||
} | ||
|
||
const loader = item.getLoader(); | ||
|
||
if (Array.isArray(loader)) { | ||
acc.push(...loader); | ||
} else { | ||
acc.push(loader); | ||
} | ||
|
||
return acc; | ||
} |