diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 2e0a7fcda..68b39ad04 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -1053,7 +1053,7 @@ li{ } /*此处自定义弹框尺寸,不同功能可能需要的尺寸不一样,需自行添加*/ -.right-box-account, .right-box-prom, .right-box-alert-config, .right-box-project, .right-box-module, .right-box-cabinet, +.right-box-menu ,.right-box-role ,.right-box-account, .right-box-prom, .right-box-alert-config, .right-box-project, .right-box-module, .right-box-cabinet, .right-box-edit-endpoint, .right-box-panel, .right-box-dc, .right-box-model, .right-box-mib, .right-box-asset, .right-box-add-chart { width: 850px; } @@ -2303,3 +2303,15 @@ li{ margin-right: 4px; } } +.el-radio-group .el-radio__inner:hover{ + border-color: #ee9d3f !important; +} +.el-radio-group .is-checked { + .el-radio__inner{ + background-color: #ee9d3f !important; + border-color: #ee9d3f !important; + } + .el-radio__label{ + color: #ee9d3f !important;; + } +} diff --git a/nezha-fronted/src/components/charts/chart-single-stat.vue b/nezha-fronted/src/components/charts/chart-single-stat.vue index 6a896cd01..84af5567e 100644 --- a/nezha-fronted/src/components/charts/chart-single-stat.vue +++ b/nezha-fronted/src/components/charts/chart-single-stat.vue @@ -41,7 +41,7 @@
-
+
{{serieSingleStat}}
No Data
@@ -58,7 +58,7 @@
-
+
{{serieSingleStat}}
No Data
@@ -112,6 +112,7 @@ export default { seriesItem: [], // 保存信息 seriesItemScreen:[],//全屏数据 serieSingleStat:'', + mapping:'',//满足valueMapping时 mapping的值 images: '', loading:Object, items: { @@ -409,8 +410,24 @@ export default { this.data = chartItem; this.unit = chartDataFormat.getUnit(this.data.unit); if(Number(seriesItem)){ - let singleStatTmp =parseFloat(Number(seriesItem).toFixed(2)); - this.serieSingleStat = chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); + let singleStatTmp =parseFloat(Number(seriesItem).toFixed(2));//parseFloat :如果没有小数点,或者小数点后都是零,parseFloat() 会返回整数。 + if(chartItem.param.valueMapping && chartItem.param.valueMapping.type){ + let type=chartItem.param.valueMapping.type; + let mappings=chartItem.param.valueMapping.mapping?chartItem.param.valueMapping.mapping:[]; + let mapping; + if(type == 'value'){ + mapping=mappings.find(item=>{return item.value == singleStatTmp}) + }else{ + mapping=mappings.find(item=>{return item.from <= singleStatTmp&& item.to >= singleStatTmp}); + } + this.mapping=mapping; + if(this.mapping&&!this.mapping.color){ + this.mapping.color={bac:'#fff',text:'#000'} + } + this.serieSingleStat = mapping?mapping.text.replace('{{value}}', singleStatTmp):chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); + }else{ + this.serieSingleStat = chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); + } }else { this.serieSingleStat =seriesItem; } @@ -439,7 +456,11 @@ export default { }else{ mapping=mappings.find(item=>{return item.from <= singleStatTmp&& item.to >= singleStatTmp}); } - this.serieSingleStat = mapping?mapping.text:chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); + this.mapping=mapping; + if(this.mapping&&!this.mapping.color){ + this.mapping.color={bac:'#fff',text:'#000'} + } + this.serieSingleStat = mapping?mapping.text.replace('{{value}}', singleStatTmp):chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); }else{ this.serieSingleStat = chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(singleStatTmp,null,2); } diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index a429d635e..fd8186b98 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -52,7 +52,7 @@
+ @sort-change="tableDataSort" > @@ -97,7 +97,7 @@ @@ -210,7 +210,8 @@ }], searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],//全屏显示的时间 oldSearchTime: [], - ps: null + ps: null, + mapping:{}, }; }, created() { @@ -395,7 +396,9 @@ }else{ mapping=mappings.find(t=>{return t.from <= value&& t.to >= value}); } - item.value = mapping?mapping.text:chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(value,null,2); + this.mapping=mapping; + item.mapping=mapping; + item.value = mapping?mapping.text.replace('{{value}}', item.value):chartDataFormat.getUnit(chartItem.unit?chartItem.unit:2).compute(value,null,2); } return item; })); diff --git a/nezha-fronted/src/components/charts/chart.scss b/nezha-fronted/src/components/charts/chart.scss index 8aeea9032..cd2aebdb9 100644 --- a/nezha-fronted/src/components/charts/chart.scss +++ b/nezha-fronted/src/components/charts/chart.scss @@ -248,8 +248,7 @@ .chart-single-stat { width: 100%; .single-stat-container { - padding-left: 8px; - padding-right: 8px; + padding: 8px; display: table; text-align: center; width: calc(100% - 16px); @@ -261,6 +260,18 @@ } } } + .single-stat-screen-container{ + height: 100%; + .single-stat-content{ + font-size: 30px; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + flex-direction: column; + height: 100%; + } + } .chart-container.chart-detail { height: 100%; position: relative; diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index e9c0436af..3c47eb3d0 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -120,7 +120,7 @@ diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 71cd03dc6..a4f062602 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -191,6 +191,9 @@
{{$t('config.account.account')}}
+ +
{{$t('config.roles.roles')}}
+
{{$t('config.promServer.promServerList')}}
diff --git a/nezha-fronted/src/components/common/home.vue b/nezha-fronted/src/components/common/home.vue index 71463e2a9..b2bfd3b15 100644 --- a/nezha-fronted/src/components/common/home.vue +++ b/nezha-fronted/src/components/common/home.vue @@ -4,7 +4,8 @@ - + +
@@ -14,12 +15,20 @@ import Header from "./header"; import webSSH from "../cli/webSSH"; import leftMenu from "./leftMenu"; +import menus from "../page/config/menus"; export default { name: "home", components: { Header, 'web-ssh': webSSH, - 'left-menu': leftMenu + 'left-menu': leftMenu, + menus + }, + computed:{ + isMenuPage:function(){ + console.log(this.$route.path ) + return this.$route.path == '/menu' + } } } diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 5fcb4db11..29d510e45 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -5,6 +5,7 @@ export const staticMenus = { title: i18n.t('overall.config'), menu: [ {route: '/account', name: i18n.t('config.account.account')}, + {route: '/roles', name: i18n.t('config.roles.roles')}, {route: '/promServer', name: i18n.t('config.promServer.promServerList')}, {route: '/dc', name: i18n.t('config.dc.dc')}, {route: '/model', name: i18n.t('config.model.model')}, diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index b6b288bc6..94415bc3f 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -72,7 +72,9 @@ export const clickoutside = { if (binding.arg) { binding.value(e, binding.arg); } else { - binding.value(e); + if(binding.value){ + binding.value(e); + } } } diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 558154282..4820c37e4 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -182,6 +182,9 @@ const cn = { unit: "单位", legend: "图例", legendTip: "使用名称或表达式控制时间序列的名称。例如{{hostname}将替换为标签主机名的标签值。", + valueMappingTip: '使用{{value}}可以显示原值\n'+ + '例如:total alive: {{value}}\n'+ + '结果为:total alive: 100', option: "操作", alertParam:{ param:'参数', @@ -349,7 +352,7 @@ const cn = { total: "总计", up: "up", down: "down", - prometheus: "prometheus" + prometheus: "prometheus", } } }, @@ -554,6 +557,7 @@ const cn = { account: { accountList: "用户列表", account: "用户", + roles:"角色", language: "语言", receiver: "接收人", createTime: "创建时间", @@ -575,6 +579,35 @@ const cn = { reinputPwd: "请再次输入密码", notification: "通知" }, + roles:{ + roles:"角色", + name:"名称", + remark:"备注", + option: '操作',//"操作" + permission:"权限", + menu:"菜单", + createRole:"新增角色", + editRole:"编辑角色", + + }, + menus:{ + menus:'菜单', + name:"名称", + remark:"备注", + option: '操作',//"操作" + code:'Code', + i18n:'I18n', + type:'类型', + route:'路由', + perms:'权限', + button:"按钮", + menu:"菜单", + parent:"上级菜单", + mainMenu:"主菜单", + createMenu:"新增菜单", + editMenu:"编辑菜单", + orderNum:"排序", + }, promServer: { promServerList: "Prometheus服务", promId: "Prometheus服务ID", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 9327151a8..2f21aac04 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -145,6 +145,9 @@ const en = { legend:'Legend', statistics:'Statistics', legendTip:'Controls the name of the time series, using name or pattern. For example {{hostname}} will be replaced with label value for the label hostname.', + valueMappingTip: 'Use {{value}} to display the original value\n'+ + 'For example: Total Alive: {{value}}\n'+ + 'The result is: Total Alive: 100', sync: 'Sync to assets', last:'Last', threshold:'Threshold', @@ -557,6 +560,7 @@ const en = { accountList: 'Account list',//"用户列表" //列表表头 account: 'Account',//"用户" + roles:"Roles", language: 'Language',//"语言" receiver: 'Receiver',//"用户组" createTime: 'Create time',//"创建时间" @@ -579,6 +583,34 @@ const en = { reinputPwd:'Enter password again', notification: 'Notification' }, + roles:{ + roles:"Roles", + name:"Name", + remark:"Remark", + option: 'Operation',//"操作" + permission:"Permission", + menu:"Menu", + createRole:"Create role", + editRole:"Edit role" + }, + menus:{ + menus:'Menus', + name:"Name", + remark:"Remark", + option: 'Operation',//"操作", + code:'Code', + i18n:'I18n', + type:'Type', + route:'Route', + perms:'Permission', + button:"Button", + menu:"Menu", + parent:"Previous menu", + mainMenu:'Primary menu', + createMenu:"Create menu", + editMenu:"Edit menu", + orderNum:"Order", + }, promServer: { promServerList: 'Prometheus server',//"Prometheus Server" //侧滑框 diff --git a/nezha-fronted/src/components/common/leftMenu.vue b/nezha-fronted/src/components/common/leftMenu.vue index 7737a3aa6..6a906b566 100644 --- a/nezha-fronted/src/components/common/leftMenu.vue +++ b/nezha-fronted/src/components/common/leftMenu.vue @@ -48,7 +48,7 @@ {{item.name}}
- + @@ -61,7 +61,7 @@ {{item.name}}
- + @@ -74,7 +74,7 @@ {{item.name}}
- + @@ -84,7 +84,7 @@ - + @@ -103,7 +103,7 @@ {{tag.value}} - + @@ -790,6 +790,9 @@ padding-left: 0; justify-content: center; } + /deep/ .el-badge__content--primary{ + background-color: #74A7FA; + } + diff --git a/nezha-fronted/src/components/common/rightBox/menuBox.vue b/nezha-fronted/src/components/common/rightBox/menuBox.vue new file mode 100644 index 000000000..806680c3f --- /dev/null +++ b/nezha-fronted/src/components/common/rightBox/menuBox.vue @@ -0,0 +1,265 @@ + + + + diff --git a/nezha-fronted/src/components/common/rightBox/roleBox.vue b/nezha-fronted/src/components/common/rightBox/roleBox.vue new file mode 100644 index 000000000..b14d9ab88 --- /dev/null +++ b/nezha-fronted/src/components/common/rightBox/roleBox.vue @@ -0,0 +1,228 @@ + + + + diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index c610d48f8..4150863bb 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -2,6 +2,19 @@ .account { height: 100%; } + .account .account-role-item{ + background-color: #409eff; + border: 1px solid #409eff; + height: 20px; + font-size: 12px; + line-height: 20px; + border-radius: 4px; + display: inline-block; + box-sizing: content-box; + padding:3px; + margin-right: 3px; + color: white; + }