forked from cloudforet-io/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigurator.ts
66 lines (57 loc) · 2.08 KB
/
configurator.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import type { RouteConfig } from 'vue-router';
import type { FeatureConfiguratorType, FeatureMenuConfig, FeatureUiAffect } from '@/lib/config/global-config/types/type';
import type { Menu } from '@/lib/menu/config';
import { MENU_ID } from '@/lib/menu/config';
import adminCostExplorerRoutes from '@/services/cost-explorer/routes/admin/routes';
import costExplorerRoutes from '@/services/cost-explorer/routes/routes';
class CostExplorerConfigurator implements FeatureConfiguratorType {
private version: 'V1' | 'V2' = 'V1';
readonly uiAffect: FeatureUiAffect[] = [
{
feature: 'ALERT_MANAGER',
affects: [
{
method: 'visibleBudgetNotification',
version: 'V2',
},
],
},
];
initialize(version: 'V1' | 'V2'): void {
this.version = version;
}
// eslint-disable-next-line class-methods-use-this
getRoutes(isAdmin?: boolean): RouteConfig | null {
return isAdmin ? adminCostExplorerRoutes : costExplorerRoutes;
}
getMenu(): FeatureMenuConfig {
const baseMenu: Menu = {
id: MENU_ID.COST_EXPLORER,
needPermissionByRole: true,
subMenuList: [],
order: 5,
};
return {
menu: {
...baseMenu,
subMenuList: [
{ id: MENU_ID.COST_ANALYSIS, needPermissionByRole: true },
{ id: MENU_ID.BUDGET, needPermissionByRole: true },
{ id: MENU_ID.COST_REPORT, needPermissionByRole: true },
],
},
adminMenu: {
...baseMenu,
subMenuList: [
{ id: MENU_ID.COST_ANALYSIS },
{ id: MENU_ID.BUDGET },
{ id: MENU_ID.COST_REPORT },
{ id: MENU_ID.DATA_SOURCES },
{ id: MENU_ID.COST_ADVANCED_SETTINGS },
],
},
version: this.version,
};
}
}
export default new CostExplorerConfigurator();