mirror of
https://github.com/veops/cmdb.git
synced 2025-08-09 14:01:04 +08:00
前后端全面升级
This commit is contained in:
14
cmdb-ui/src/config/app.js
Normal file
14
cmdb-ui/src/config/app.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const appConfig = {
|
||||
buildModules: ['cmdb'], // 需要编译的模块
|
||||
useMessageNotice: false, // 是否启用消息通知
|
||||
useTodoNotice: false, // 是否启用ticket通知
|
||||
useClaimNotice: false, // 是否启动ticket claim 通知
|
||||
useDagReviewNotice: false, // 是否启用dag审核通知
|
||||
redirectTo: '/cmdb', // 首页的重定向路径
|
||||
buildAclToModules: true, // 是否在各个应用下 内联权限管理
|
||||
ssoLogoutURL: '/api/sso/logout',
|
||||
useDFC: false,
|
||||
showDocs: false,
|
||||
}
|
||||
|
||||
export default appConfig
|
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Project default configuration items
|
||||
* showLocale - Whether to display the Chinese and English switch buttons: boolean
|
||||
* defaultLang - Default display language: zh-CN | en-US
|
||||
* useSSO - Whether to use single sign-on: boolean
|
||||
* primaryColor - Default theme color, clean up localStorage if changing color does not take effect
|
||||
* navTheme - sidebar theme ['dark', 'light']
|
||||
* colorWeak - Color blindness mode
|
||||
* layout - Overall layout ['sidemenu', 'topmenu']
|
||||
* fixedHeader - Fix Header: boolean
|
||||
* fixSiderbar - Fix the left menu bar: boolean
|
||||
* autoHideHeader - Hide header as you scroll down: boolean
|
||||
* contentWidth - Content area layout: streaming | fixed
|
||||
*
|
||||
* storageOptions: {} - Vue-ls Plug-in configuration item (localStorage/sessionStorage)
|
||||
*
|
||||
*/
|
||||
|
||||
export default {
|
||||
showLocale: true,
|
||||
defaultLang: 'zh-CN', // zh-CN | en-US
|
||||
useSSO: false,
|
||||
ssoLogoutRedirectUrl: 'https://xxx.yyy.com/zzz/logout',
|
||||
ssoLoginRedirectUrl: 'https://xxx.yyy.com/zzz/login',
|
||||
primaryColor: '#1890ff', // primary color of ant design
|
||||
navTheme: 'dark', // theme for nav menu
|
||||
layout: 'sidemenu', // nav menu position: sidemenu or topmenu
|
||||
contentWidth: 'Fixed', // layout of content: Fluid or Fixed, only works when layout is topmenu
|
||||
fixedHeader: true, // sticky header
|
||||
fixSiderbar: true, // sticky siderbar
|
||||
autoHideHeader: true, // auto hide header
|
||||
colorWeak: false,
|
||||
multiTab: false,
|
||||
production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true',
|
||||
// vue-ls options
|
||||
storageOptions: {
|
||||
namespace: 'pro__', // key prefix
|
||||
name: 'ls', // name variable Vue.[ls] or this.[$ls],
|
||||
storage: 'local' // storage name session, local, memory
|
||||
}
|
||||
}
|
@@ -1,229 +0,0 @@
|
||||
// eslint-disable-next-line
|
||||
import store from '@/store'
|
||||
|
||||
import { UserLayout, BasicLayout, RouteView } from '@/layouts'
|
||||
import { getPreference } from '@/api/cmdb/preference'
|
||||
|
||||
const cmdbRouter = [
|
||||
// resource views
|
||||
{
|
||||
path: '/resource_views',
|
||||
redirect: '/relation_views',
|
||||
component: RouteView,
|
||||
name: 'cmdb_resource_views',
|
||||
meta: { title: 'menu.resourceViews', icon: 'hdd', keepAlive: true },
|
||||
children: []
|
||||
},
|
||||
// relation views
|
||||
{
|
||||
path: '/relation_views',
|
||||
component: () => import('@/views/cmdb/relation_views'),
|
||||
name: 'cmdb_relation_views',
|
||||
meta: { title: 'menu.relationViews', icon: 'link', keepAlive: true },
|
||||
hideChildrenInMenu: true,
|
||||
children: [
|
||||
{
|
||||
path: '/relation_views/:viewId',
|
||||
name: 'cmdb_relation_views_item',
|
||||
component: () => import('@/views/cmdb/relation_views'),
|
||||
meta: { title: 'menu.relationViews', keepAlive: true },
|
||||
hidden: true
|
||||
}]
|
||||
},
|
||||
// tree views
|
||||
{
|
||||
path: '/tree_views',
|
||||
component: () => import('@/views/cmdb/tree_views'),
|
||||
name: 'cmdb_tree_views',
|
||||
meta: { title: 'menu.treeViews', icon: 'share-alt', keepAlive: true },
|
||||
hideChildrenInMenu: true,
|
||||
children: [
|
||||
{
|
||||
path: '/tree_views/:typeId',
|
||||
name: 'cmdb_tree_views_item',
|
||||
component: () => import('@/views/cmdb/tree_views'),
|
||||
meta: { title: 'menu.treeViews', keepAlive: true },
|
||||
hidden: true
|
||||
}]
|
||||
},
|
||||
// preference
|
||||
{
|
||||
path: '/preference',
|
||||
component: () => import('@/views/cmdb/preference'),
|
||||
name: 'cmdb_preference',
|
||||
meta: { title: 'menu.preference', icon: 'star', keepAlive: true }
|
||||
},
|
||||
// batch
|
||||
{
|
||||
path: '/batch',
|
||||
component: () => import('@/views/cmdb/batch'),
|
||||
name: 'cmdb_batch',
|
||||
meta: { 'title': 'menu.batch', icon: 'upload', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/config/ci_types',
|
||||
name: 'cmdb_ci_type',
|
||||
component: RouteView,
|
||||
redirect: '/ci_types',
|
||||
meta: { title: 'menu.ciType', icon: 'setting', permission: ['admin'] },
|
||||
children: [
|
||||
{
|
||||
path: '/config/ci_types',
|
||||
name: 'ci_type',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/cmdb/modeling/ci_type/list'),
|
||||
meta: { title: 'menu.ciModelManager', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/config/ci_types/:CITypeName/detail/:CITypeId',
|
||||
name: 'ci_type_detail',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/cmdb/modeling/ci_type/detail'),
|
||||
meta: { title: 'menu.ciModelManager', keepAlive: true, hidden: true },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/config/attributes',
|
||||
name: 'attributes',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/cmdb/modeling/attributes/index'),
|
||||
meta: { title: 'menu.ciPropertyRep', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/config/relation_type',
|
||||
name: 'relation_type',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/cmdb/modeling/relation_type/index'),
|
||||
meta: { title: 'menu.ciRelationType', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/config/preference_relation',
|
||||
name: 'preference_relation',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/cmdb/modeling/preference_relation/index'),
|
||||
meta: { title: 'menu.ciRelationViewDefine', keepAlive: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/acl',
|
||||
name: 'cmdb_acl',
|
||||
component: RouteView,
|
||||
redirect: '/acl/users',
|
||||
meta: { title: 'menu.acl', icon: 'safety-certificate', permission: ['admin'] },
|
||||
children: [
|
||||
{
|
||||
path: '/acl/users',
|
||||
name: 'cmdb_acl_users',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/acl/users'),
|
||||
meta: { title: 'menu.aclUsersManager', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/acl/roles',
|
||||
name: 'cmdb_acl_roles',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/acl/roles'),
|
||||
meta: { title: 'menu.aclRolesManager', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/acl/resources',
|
||||
name: 'cmdb_acl_resources',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/acl/resources'),
|
||||
meta: { title: 'menu.aclResourceManager', keepAlive: true }
|
||||
},
|
||||
{
|
||||
path: '/acl/resource_types',
|
||||
name: 'cmdb_acl_resource_types',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('@/views/acl/resource_types'),
|
||||
meta: { title: 'menu.aclResourceType', keepAlive: true }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
function copyArray (arr) {
|
||||
return arr.map((e) => {
|
||||
if (typeof e === 'object') {
|
||||
return Object.assign({}, e)
|
||||
} else {
|
||||
return e
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const generatorDynamicRouter = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// sub menu of the resource view
|
||||
getPreference().then(res => {
|
||||
const routers = copyArray(asyncRouterMap)
|
||||
routers[0].children = copyArray(cmdbRouter)
|
||||
const resourceMenus = []
|
||||
res.forEach(item => {
|
||||
resourceMenus.push({
|
||||
path: `/instances/types/${item.id}`,
|
||||
component: () => import(`@/views/cmdb/ci/index`),
|
||||
name: `cmdb_${item.id}`,
|
||||
meta: { title: item.alias, icon: 'table', keepAlive: true, typeId: item.id },
|
||||
hideChildrenInMenu: true
|
||||
})
|
||||
})
|
||||
routers[0].children[0].children = resourceMenus
|
||||
|
||||
resolve(routers)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const asyncRouterMap = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'cmdb',
|
||||
component: BasicLayout,
|
||||
meta: { title: 'CMDB', keepAlive: true },
|
||||
redirect: () => {
|
||||
return store.getters.addRouters[0].children.find(item => !item.hidden)
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '*', redirect: '/404', hidden: true
|
||||
}
|
||||
]
|
||||
|
||||
/**
|
||||
* basic route
|
||||
* @type { *[] }
|
||||
*/
|
||||
export const constantRouterMap = [
|
||||
{
|
||||
path: '/user',
|
||||
component: UserLayout,
|
||||
redirect: '/user/login',
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: 'login',
|
||||
name: 'login',
|
||||
component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
|
||||
},
|
||||
{
|
||||
path: 'register',
|
||||
name: 'register',
|
||||
component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
|
||||
},
|
||||
{
|
||||
path: 'register-result',
|
||||
name: 'registerResult',
|
||||
component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/404',
|
||||
component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
|
||||
}
|
||||
|
||||
]
|
36
cmdb-ui/src/config/setting.js
Normal file
36
cmdb-ui/src/config/setting.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 项目默认配置项
|
||||
* useSSO - 是否启用单点登录, 默认为否, 可以根据需要接入到公司的单点登录系统
|
||||
* primaryColor - 默认主题色, 如果修改颜色不生效,请清理 localStorage
|
||||
* navTheme - sidebar theme ['dark', 'light'] 两种主题
|
||||
* colorWeak - 色盲模式
|
||||
* layout - 整体布局方式 ['sidemenu', 'topmenu'] 两种布局
|
||||
* fixedHeader - 固定 Header : boolean
|
||||
* fixSiderbar - 固定左侧菜单栏 : boolean
|
||||
* autoHideHeader - 向下滚动时,隐藏 Header : boolean
|
||||
* contentWidth - 内容区布局: 流式 | 固定
|
||||
*
|
||||
* storageOptions: {} - Vue-ls 插件配置项 (localStorage/sessionStorage)
|
||||
*
|
||||
*/
|
||||
|
||||
export default {
|
||||
useSSO: false,
|
||||
ssoLoginUrl: '/api/sso/login',
|
||||
primaryColor: '#1890ff', // primary color of ant design
|
||||
navTheme: 'dark', // theme for nav menu
|
||||
layout: 'sidemenu', // nav menu position: sidemenu or topmenu
|
||||
contentWidth: 'Fixed', // layout of content: Fluid or Fixed, only works when layout is topmenu
|
||||
fixedHeader: true, // sticky header
|
||||
fixSiderbar: true, // sticky siderbar
|
||||
autoHideHeader: true, // auto hide header
|
||||
colorWeak: false,
|
||||
multiTab: false,
|
||||
production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true',
|
||||
// vue-ls options
|
||||
storageOptions: {
|
||||
namespace: 'pro__', // key prefix
|
||||
name: 'ls', // name variable Vue.[ls] or this.[$ls],
|
||||
storage: 'local' // storage name session, local, memory
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user