diff --git a/ui/src/config/router.js b/ui/src/config/router.js index 9a52c8d2293..a36c03f8e27 100644 --- a/ui/src/config/router.js +++ b/ui/src/config/router.js @@ -6,6 +6,12 @@ import storage from '@/config/section/storage' import network from '@/config/section/network' import image from '@/config/section/image' import project from '@/config/section/project' +import monitor from '@/config/section/monitor' +import iam from '@/config/section/iam' +import infra from '@/config/section/infra' +import offering from '@/config/section/offering' +import config from '@/config/section/config' +import plugin from '@/config/section/plugin' export function generateRouterMap (section) { var map = { @@ -15,22 +21,6 @@ export function generateRouterMap (section) { component: RouteView } - if (section.component) { - map.component = section.component - } - - if (section.permission) { - map.meta.permission = section.permission - } - - if (section.columns) { - map.meta.columns = section.columns - } - - if (section.actions) { - map.meta.actions = section.actions - } - if (section.children && section.children.length > 0) { map.redirect = '/' + section.children[0].name map.meta.permission = section.children[0].permission @@ -74,6 +64,23 @@ export function generateRouterMap (section) { component: section.viewComponent ? section.viewComponent : section.component }] } + + if (section.component) { + map.component = section.component + } + + if (section.permission) { + map.meta.permission = section.permission + } + + if (section.columns) { + map.meta.columns = section.columns + } + + if (section.actions) { + map.meta.actions = section.actions + } + return map } @@ -85,7 +92,6 @@ export const asyncRouterMap = [ meta: { icon: 'home' }, redirect: '/dashboard', children: [ - // dashboard { path: '/dashboard', name: 'dashboard', @@ -98,357 +104,13 @@ export const asyncRouterMap = [ generateRouterMap(network), generateRouterMap(image), generateRouterMap(project), + generateRouterMap(monitor), + generateRouterMap(iam), + generateRouterMap(infra), + generateRouterMap(offering), + generateRouterMap(config), + generateRouterMap(plugin), - // audit - { - path: '/audit', - name: 'audit', - meta: { title: 'Audit', keepAlive: true, icon: 'audit', permission: [ 'listEvents', 'listAlerts' ] }, - component: RouteView, - redirect: '/events', - children: [ - { - path: '/events', - name: 'events', - meta: { title: 'Events', icon: 'schedule', permission: [ 'listEvents' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/events/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/alerts', - name: 'alerts', - meta: { title: 'Alerts', icon: 'flag', permission: [ 'listAlerts' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/alerts/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - } - ] - }, - - // org - { - path: '/iam', - name: 'iam', - meta: { title: 'Identity and Access', keepAlive: true, icon: 'solution', permission: [ 'listAccounts' ] }, - component: RouteView, - redirect: '/account', - children: [ - { - path: '/domain', - name: 'domain', - meta: { title: 'Domains', icon: 'block', permission: [ 'listDomains' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/domain/:id', - meta: { title: 'Domains', icon: 'block', permission: [ 'listDomains' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/account', - name: 'account', - meta: { title: 'Accounts', icon: 'team', permission: [ 'listAccounts' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/account/:id', - meta: { title: 'Manage', keepAlive: true, icon: 'solution', permission: [ 'listAccounts' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/user', - name: 'user', - meta: { title: 'Users', icon: 'user', permission: [ 'listUsers' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/user/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/role', - name: 'role', - meta: { title: 'Roles', icon: 'idcard', permission: [ 'listRoles' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/role/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - } - ] - }, - - // infra - { - path: '/infra', - name: 'infra', - meta: { title: 'Infrastructure', keepAlive: true, icon: 'folder-open', permission: [ 'listInfrastructure' ] }, - component: RouteView, - redirect: '/zone', - children: [ - { - path: '/zone', - name: 'zone', - meta: { title: 'Zones', icon: 'table', permission: [ 'listZonesMetrics', 'listZones' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/zone/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/pod', - name: 'pod', - meta: { title: 'Pods', icon: 'appstore', permission: [ 'listPods' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/pod/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/cluster', - name: 'cluster', - meta: { title: 'Clusters', icon: 'cluster', permission: [ 'listClustersMetrics', 'listClusters' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/cluster/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/host', - name: 'host', - meta: { title: 'Hosts', icon: 'desktop', permission: [ 'listHostsMetrics', 'listHosts' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/host/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/primarystorage', - name: 'primarystorage', - meta: { title: 'Primary Storage', icon: 'database', permission: [ 'listStoragePoolsMetrics', 'listStoragePools' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/primarystorage/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/secondarystorage', - name: 'secondarystorage', - meta: { title: 'Secondary Storage', icon: 'picture', permission: [ 'listImageStores' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/secondarystorage/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/systemvm', - name: 'systemvm', - meta: { title: 'System VMs', icon: 'thunderbolt', permission: [ 'listSystemVms' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/systemvm/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/router', - name: 'router', - meta: { title: 'Virtual Routers', icon: 'fork', permission: [ 'listRouters' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/router/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/cpusockets', - name: 'cpusocket', - component: () => import('@/components/CloudMonkey/Resource.vue'), - meta: { title: 'CPU Sockets', icon: 'api', permission: [ 'listHosts' ] } - } - ] - }, - - // offerings - { - path: '/offering', - name: 'Offerings', - meta: { title: 'Offerings', keepAlive: true, icon: 'shopping', permission: [ 'listServiceOfferings' ] }, - component: RouteView, - redirect: '/computeoffering', - children: [ - { - path: '/computeoffering', - name: 'computeoffering', - meta: { title: 'Compute Offerings', icon: 'cloud', permission: [ 'listServiceOfferings' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/computeoffering/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/diskoffering', - name: 'diskoffering', - meta: { title: 'Disk Offerings', icon: 'hdd', permission: [ 'listDiskOfferings' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/diskoffering/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/networkoffering', - name: 'networkoffering', - meta: { title: 'Network Offerings', icon: 'wifi', permission: [ 'listNetworkOfferings' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/networkoffering/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/vpcoffering', - name: 'vpcoffering', - meta: { title: 'VPC Offerings', icon: 'deployment-unit', permission: [ 'listVPCOfferings' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/vpcoffering/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/systemoffering', - name: 'systemoffering', - meta: { title: 'System Offerings', icon: 'setting', permission: [ 'listServiceOfferings' ], params: { 'issystem': 'true' } }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/systemoffering/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - } - ] - }, - - // setting - { - path: '/setting', - name: 'Settings', - meta: { title: 'Settings', keepAlive: true, icon: 'setting', permission: [ 'listConfigurations' ] }, - component: RouteView, - redirect: '/globalsetting', - children: [ - { - path: '/globalsetting', - name: 'globalsetting', - meta: { title: 'Global Settings', icon: 'global', permission: [ 'listConfigurations' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/globalsetting/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/ldapsetting', - name: 'ldapsetting', - meta: { title: 'LDAP Settings', icon: 'team', permission: [ 'listLdapConfigurations' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/ldapsetting/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - }, - { - path: '/hypervisorcapability', - name: 'hypervisorcapability', - meta: { title: 'Hypervisor Capabilities', icon: 'database', permission: [ 'listHypervisorCapabilities' ] }, - component: () => import('@/components/CloudMonkey/Resource.vue'), - hideChildrenInMenu: true, - children: [ - { - path: '/hypervisorcapability/:id', - component: () => import('@/components/CloudMonkey/Resource.vue') - } - ] - } - ] - }, - - // Exceptions { path: '/exception', name: 'exception', @@ -501,18 +163,6 @@ export const constantRouterMap = [ } ] }, - { - path: '/test', - component: BlankLayout, - redirect: '/test/home', - children: [ - { - path: 'home', - name: 'TestHome', - component: () => import('@/views/Test') - } - ] - }, { path: '/403', component: () => import(/* webpackChunkName: "forbidden" */ '@/views/exception/403') diff --git a/ui/src/config/section/config.js b/ui/src/config/section/config.js new file mode 100644 index 00000000000..04870dbc863 --- /dev/null +++ b/ui/src/config/section/config.js @@ -0,0 +1,29 @@ +export default { + name: 'config', + title: 'Configurations', + icon: 'setting', + permission: [ 'listConfigurations'], + children: [ + { + name: 'globalsetting', + title: 'Global Settings', + icon: 'global', + permission: [ 'listConfigurations' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'ldapsetting', + title: 'LDAP Settings', + icon: 'team', + permission: [ 'listLdapConfigurations' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'hypervisorcapability', + title: 'Hypervisor Capabilities', + icon: 'database', + permission: [ 'listHypervisorCapabilities' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + } + ] +} diff --git a/ui/src/config/section/iam.js b/ui/src/config/section/iam.js new file mode 100644 index 00000000000..edeb9d567c1 --- /dev/null +++ b/ui/src/config/section/iam.js @@ -0,0 +1,36 @@ +export default { + name: 'iam', + title: 'Identity and Access', + icon: 'solution', + permission: [ 'listAccounts', 'listUsers', 'listDomains', 'listRoles' ], + children: [ + { + name: 'user', + title: 'Users', + icon: 'user', + permission: [ 'listUsers' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'account', + title: 'Accounts', + icon: 'team', + permission: [ 'listAccounts' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'domain', + title: 'Domains', + icon: 'block', + permission: [ 'listDomains' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'role', + title: 'Roles', + icon: 'idcard', + permission: [ 'listRoles' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + } + ] +} diff --git a/ui/src/config/section/infra.js b/ui/src/config/section/infra.js new file mode 100644 index 00000000000..2b51b54d62e --- /dev/null +++ b/ui/src/config/section/infra.js @@ -0,0 +1,79 @@ +export default { + name: 'infra', + title: 'Infrastructure', + icon: 'bank', + permission: [ 'listInfrastructure' ], + children: [ + { + name: 'zone', + title: 'Zones', + icon: 'table', + permission: [ 'listZones', 'listZonesMetrics' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'pod', + title: 'Pods', + icon: 'appstore', + permission: [ 'listPods' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'cluster', + title: 'Clusters', + icon: 'cluster', + permission: [ 'listClusters', 'listClustersMetrics' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'host', + title: 'Hosts', + icon: 'desktop', + permission: [ 'listHosts', 'listHostsMetrics' ], + params: {'type': 'routing'}, + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'storagepool', + title: 'Primary Storages', + icon: 'database', + permission: [ 'listStoragePools', 'listStoragePoolsMetrics' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'imagestore', + title: 'Secondary Storages', + icon: 'picture', + permission: [ 'listImageStores' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'systemvm', + title: 'System VMs', + icon: 'thunderbolt', + permission: [ 'listSystemVms' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'router', + title: 'Virtual Routers', + icon: 'fork', + permission: [ 'listRouters' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'cpusockets', + title: 'CPU Sockets', + icon: 'api', + permission: [ 'listHosts' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'ms', + title: 'Management Servers', + icon: 'environment', + permission: [ 'listManagementServers' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + } + ] +} diff --git a/ui/src/config/section/monitor.js b/ui/src/config/section/monitor.js new file mode 100644 index 00000000000..2ce0f616250 --- /dev/null +++ b/ui/src/config/section/monitor.js @@ -0,0 +1,22 @@ +export default { + name: 'monitor', + title: 'Monitor', + icon: 'compass', + permission: [ 'listEvents', 'listAlerts' ], + children: [ + { + name: 'event', + title: 'Events', + icon: 'schedule', + permission: [ 'listEvents' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'alert', + title: 'Alerts', + icon: 'flag', + permission: [ 'listAlerts' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + } + ] +} diff --git a/ui/src/config/section/offering.js b/ui/src/config/section/offering.js new file mode 100644 index 00000000000..35112d8907e --- /dev/null +++ b/ui/src/config/section/offering.js @@ -0,0 +1,44 @@ +export default { + name: 'offering', + title: 'Offerings', + icon: 'shopping', + permission: [ 'listServiceOfferings'], + children: [ + { + name: 'computeoffering', + title: 'Compute Offerings', + icon: 'cloud', + permission: [ 'listServiceOfferings' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'diskoffering', + title: 'Disk Offerings', + icon: 'hdd', + permission: [ 'listDiskOfferings' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'networkoffering', + title: 'Network Offerings', + icon: 'wifi', + permission: [ 'listNetworkOfferings' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'vpcoffering', + title: 'VPC Offerings', + icon: 'deployment-unit', + permission: [ 'listVPCOfferings' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'systemoffering', + title: 'System Offerings', + icon: 'setting', + permission: [ 'listServiceOfferings' ], + params: {'issystem': 'true'}, + component: () => import('@/components/CloudMonkey/Resource.vue'), + } + ] +} diff --git a/ui/src/config/section/plugin.js b/ui/src/config/section/plugin.js new file mode 100644 index 00000000000..5724168c9c0 --- /dev/null +++ b/ui/src/config/section/plugin.js @@ -0,0 +1,22 @@ +export default { + name: 'plugin', + title: 'Plugins', + icon: 'heat-map', + permission: [ 'quotaSummary', 'cloudianSsoLogin' ], + children: [ + { + name: 'quota', + title: 'Quota', + icon: 'pie-chart', + permission: [ 'quotaSummary', 'quotaIsEnabled' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + }, + { + name: 'cloudian', + title: 'Cloudian Storage', + icon: 'cloud-download', + permission: [ 'cloudianSsoLogin', 'cloudianIsEnabled' ], + component: () => import('@/components/CloudMonkey/Resource.vue'), + } + ] +}