@@ -462,6 +608,7 @@
sortedOptionKeys:[{key:'min',label:'Min'},{key:'max',label:'Max'},{key:'avg',label:'Avg'},{key:'last',label:'Last'},{key:'total',label:'Total'}],
textShow:false,
metricOptions: [],
+ showPicker:[],
//metricStore: []
}
},
@@ -1132,7 +1279,7 @@
param.last=0;
param.url='';
param.threshold='';
- param.valueMapping={type:'text',mapping:[{value:'',text:''}]};
+ param.valueMapping={type:'text',mapping:[{value:'',text:'',color:{bac:'#fff',text:'#000'}}]};
param.legendValue={min:'off',max:'off',avg:'off',last:'off',total:'off'};
param.nullType='connected';
this.$set(this.editChart, "param", param);
@@ -1189,9 +1336,10 @@
statistics:'',
valueMapping:{
type:'value',
- mapping:[{text:'',value:''}]
+ mapping:[{text:'',value:'',color:{bac:'#fff',text:'#000'}}]
}
}
+ this.showPicker=[{bac:false,text:false}];
}else {
this.setIsOtherChart();
if(chartType === 'bar'||chartType === 'line'||chartType === 'stackArea'){
@@ -1202,9 +1350,10 @@
statistics:'',
valueMapping:{
type:'value',
- mapping:[{text:'',value:''}]
+ mapping:[{text:'',value:'',color:{bac:'#fff',text:'#000'}}]
}
}
+ this.showPicker=[{bac:false,text:false}];
}
/*if(this.$refs.chartTag){
this.$refs.chartTag.forEach((item, index) => {
@@ -1283,6 +1432,7 @@
}
params.param.nullType=this.editChart.param.nullType;
params.param.legendValue=this.editChart.param.legendValue;
+ params.param.last=this.editChart.param.last;
} else {
delete params.param.threshold;
delete params.param.nullType;
@@ -1372,18 +1522,66 @@
},
valueMappingChange:function(value){
if(this.editChart.param.valueMapping.type == 'value'){
- this.editChart.param.valueMapping.mapping =[{text:'',value:''}];
+ this.editChart.param.valueMapping.mapping =[{text:'',value:'',color:{bac:'#fff',text:'#000'}}];
+ this.showPicker=[{bac:false,text:false}]
}else{
- this.editChart.param.valueMapping.mapping =[{from:'',to:'',text:''}];
+ this.editChart.param.valueMapping.mapping =[{from:'',to:'',text:'',color:{bac:'#fff',text:'#000'}}];
+ this.showPicker=[{bac:false,text:false}]
}
},
addMapping:function(){
if(this.editChart.param.valueMapping.type == 'value'){
- this.editChart.param.valueMapping.mapping .push({text:'',value:''});
+ this.editChart.param.valueMapping.mapping .push({text:'',value:'',color:{bac:'#fff',text:'#000'}});
+ this.showPicker.push({bac:false,text:false})
}else{
- this.editChart.param.valueMapping.mapping .push({from:'',to:'',text:''});
+ this.editChart.param.valueMapping.mapping .push({from:'',to:'',text:'',color:{bac:'#fff',text:'#000'}});
+ this.showPicker.push({bac:false,text:false})
}
},
+ colorPickerClick(index){
+ if(this.showPicker[index].bac|| this.showPicker[index].text){//再次点击关闭
+ this.showPicker[index].bac=false;
+ this.showPicker[index].text=false;
+ return
+ }
+ this.showPicker[index].bac=true;
+ this.$refs['colorPickerBac'+ index][0].showPicker=true;
+ },
+ changeShowPicker(index,atr){
+ this.$refs['colorPickerBac' + index][0].showPicker=true;
+ this.showPicker[index].bac=false;
+ this.showPicker[index].text=false;
+ this.showPicker[index][atr]=true;
+ // atr=atr.toLowerCase().replace(/( |^)[a-z]/g,(L)=>L.toUpperCase());
+ },
+ colorChange(mapping,flag,val){
+ if(flag){
+ mapping.color['bac']=this.colorRGBtoHex(val)
+ }else{
+ mapping.color['text']=this.colorRGBtoHex(val)
+ }
+ },
+ colorRGBtoHex(color) {
+ let rgb = color.split(',');
+ let r = parseInt(rgb[0].split('(')[1]);
+ let g = parseInt(rgb[1]);
+ let b = parseInt(rgb[2].split(')')[0]);
+ let hex = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
+ return hex;
+ },
+ colorOut(index,e){
+ let flag=false;
+ e.path.forEach((item)=>{
+ if(item.className==='el-color-dropdown el-color-picker__panel' || item.className==='color-tab'){
+ flag=true
+ }
+ })
+ if(flag){
+ return
+ }
+ this.showPicker[index].bac=false;
+ this.showPicker[index].text=false;
+ },
delMapping:function(index){
this.editChart.param.valueMapping.mapping.splice(index,1)
},
@@ -1437,7 +1635,15 @@
deep: true,
immediate: true,
handler(n) {
- //console.log(n);
+ if((n.param&&n.param.valueMapping)&&(n.type === 'singleStat' || n.type === 'table')){
+ n.param.valueMapping.mapping.forEach(item=>{
+ this.showPicker.push({bac:false,text:false})
+ if(!item.color){
+ item.color={bac:'#fff',text:'#000'};
+ }
+ })
+ }
+
if(n.title){
this.isEdit=true;
}
@@ -1450,11 +1656,11 @@
} else if(n.type === 'alertList'){
this.setIsAlertList();
} else if(n.type === 'singleStat'){
- n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:''}]})
+ n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:'',color:{bac:'#fff',text:'#000'}}]})
this.setIsSingleStat();
} else if(n.type === 'table'){
n.param.last?this.$set(this.editChart.param,'last',n.param.last):this.$set(this.editChart.param,'last',0)
- n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:''}]})
+ n.param&&!n.param.valueMapping&&this.$set(this.editChart.param,'valueMapping',{type:'value',mapping:[{text:'',value:'',color:{bac:'#fff',text:'#000'}}]});
}else {
this.setIsOtherChart();
n.param&&!n.param.legendValue&&this.$set(this.editChart.param,'legendValue',{min:'off',max:'off',avg:'off',last:'off',total:'off'})
@@ -1509,5 +1715,8 @@
.val-mapping-type .no-fill span{
background-color: unset !important;
}
+ .el-color-picker__panel{
+ border-radius: 0 0 5px 5px;
+ }
diff --git a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue
index c8aedcc2f..68f3ee290 100644
--- a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue
+++ b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue
@@ -14,7 +14,7 @@
diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss
index 6fa129111..ef0e0a70b 100644
--- a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss
+++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss
@@ -595,4 +595,7 @@
}
}
}
+.over-num{
+ margin-left: -11px;
+}
diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
index c3c1b1583..7a00d4de2 100644
--- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
+++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
@@ -26,10 +26,14 @@
+
-
+
+ +
{{(assetData ? assetData.totalStat.total : '') | unitFormat}}
+
{{$t("dashboard.overview.asset.title")}}
@@ -38,10 +42,13 @@
+
-
+
+ +
{{(projectData ? projectData.projectStat.length : '') | unitFormat}}
+
{{$t("dashboard.overview.project.project")}}
@@ -50,10 +57,13 @@
+
-
+
+ +
{{(moduleData ? moduleData.moduleStat.length : '') | unitFormat}}
+
{{$t("dashboard.overview.module.module")}}
@@ -62,10 +72,13 @@
+
-
+
+ +
{{(endpointData ? endpointData.total : '') | unitFormat}}
+
{{$t("dashboard.overview.endpoint.endpoint")}}
@@ -74,10 +87,13 @@
+
-
+
+ +
{{(alertMessageData ? alertMessageData.alertMessageTotal : '') | unitFormat}}
+
{{$t("overall.alert")}}
{{$t("dashboard.overview.alert.ruleNum")}} : {{(alertRuleData ? alertRuleData.alertRuleTotal : "") | numberFormat}}
@@ -305,9 +321,25 @@
if (num < 1000) {
return num;
} else if (num < 1000000) {
- return (num/1000).toFixed(fixed);
+ num=num/1000;
+ num = num.toString();
+ let index = num.indexOf('.');
+ if (index !== -1) {
+ num = num.substring(0, fixed + index + 1);
+ } else {
+ num = num.substring(0);
+ }
+ return parseFloat(num).toFixed(fixed)
} else if (num < 1000000000) {
- return (num/1000000).toFixed(fixed);
+ num=num/1000000;
+ num = num.toString();
+ let index = num.indexOf('.');
+ if (index !== -1) {
+ num = num.substring(0, fixed + index + 1);
+ } else {
+ num = num.substring(0);
+ }
+ return parseFloat(num).toFixed(fixed)
}
} catch (err) {
return 0;
diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js
index 061a3500f..8519bcdf5 100644
--- a/nezha-fronted/src/router/index.js
+++ b/nezha-fronted/src/router/index.js
@@ -41,6 +41,14 @@ export default new Router({
path: '/account',
component: resolve => require(['../components/page/config/account.vue'], resolve),
},
+ {
+ path: '/menu',
+ component: resolve => require(['../components/page/config/menus.vue'], resolve),
+ },
+ {
+ path: '/roles',
+ component: resolve => require(['../components/page/config/roles.vue'], resolve),
+ },
{
path: '/promServer',
component: resolve => require(['../components/page/config/promServer.vue'], resolve),