Merge remote-tracking branch 'origin/codeCheck' into codeCheck

This commit is contained in:
chenjinsong
2020-10-13 15:21:13 +08:00
12 changed files with 74 additions and 50 deletions

View File

@@ -731,7 +731,7 @@
show:false show:false
}, },
minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'), minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'),
maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max'), maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max')*Math.ceil(dataArg.length/5),
axisTick: { axisTick: {
show: false, show: false,
}, },
@@ -1477,7 +1477,7 @@
series:this.seriesItem, series:this.seriesItem,
yAxis:{ yAxis:{
minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'), minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'),
maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max'), maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max')*Math.ceil(dataArg.length/5),
} }
}); });
if(this.hasLegendOptions){ if(this.hasLegendOptions){
@@ -1510,7 +1510,7 @@
series:this.seriesItemScreen, series:this.seriesItemScreen,
yAxis:{ yAxis:{
minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'), minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'),
maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max'), maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max')*Math.ceil(dataArg.length/5),
} }
}); });
if(this.hasLegendOptions){ if(this.hasLegendOptions){
@@ -1648,19 +1648,22 @@
let maxValue=0; let maxValue=0;
let minValue=0; let minValue=0;
if(chartInfo.unit &&dataArg.length>0){ if(chartInfo.unit &&dataArg.length>0){
maxValue=dataArg[0].data[0][1]; maxValue=0;
minValue=dataArg[0].data[0][1]; minValue=0;
for(let j = 0; j < dataArg.length ; j++){ for(let j = 0; j < dataArg.length ; j++){
for (let i = 0; i < dataArg[j].data.length - 1; i++) { for (let i = 0; i < dataArg[j].data.length - 1; i++) {
maxValue = (maxValue < Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : maxValue); if(dataArg[j].data[i+1][1]!=='NaN'){
minValue = (minValue > Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : minValue); maxValue = (maxValue < Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : maxValue);
minValue = (minValue > Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : minValue);
}
} }
} }
} }
let chartUnit=chartInfo.unit?chartInfo.unit:2; let chartUnit=chartInfo.unit?chartInfo.unit:2;
let unit=chartDataFormat.getUnit(chartUnit); let unit=chartDataFormat.getUnit(chartUnit);
minValue=minValue>0?0:minValue;
maxValue=maxValue-minValue;
maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii); maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii);
minValue=chartDataFormat.formatDatas(minValue,unit.type,'floor',unit.ascii);
let oldValue=maxValue; let oldValue=maxValue;
let dot=0; let dot=0;
if(maxValue==1){ if(maxValue==1){

View File

@@ -381,6 +381,7 @@
methods: { methods: {
labelsSort:function(obj){ labelsSort:function(obj){
let buildIn=['asset','endpoint','module','project','datacenter'] let buildIn=['asset','endpoint','module','project','datacenter']
if(typeof obj == "string") obj=JSON.parse(obj)
let labels=JSON.parse(JSON.stringify(obj)); let labels=JSON.parse(JSON.stringify(obj));
let result=[]; let result=[];
for(let key of buildIn){ for(let key of buildIn){
@@ -938,21 +939,21 @@
cursor: pointer; cursor: pointer;
} }
.severity .high{ .severity .high{
background: #F2866E; background: #F5846A;
border-radius: 2px; border-radius: 2px;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #FFFFFF;
padding: 2px 6px; padding: 2px 6px;
} }
.severity .medium{ .severity .medium{
background: #F89984; background: #F7A54A;
border-radius: 2px; border-radius: 2px;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #FFFFFF;
padding: 2px 6px; padding: 2px 6px;
} }
.severity .low{ .severity .low{
background: #F7BA78; background: #F1C13D;
border-radius: 2px; border-radius: 2px;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #FFFFFF;

View File

@@ -325,7 +325,7 @@
this.rightBox.module.show = true; this.rightBox.module.show = true;
this.editModule = { this.editModule = {
name: '', name: '',
project: this.$store.state.currentProject, project: {},
port: 9100, port: 9100,
path: '', path: '',
param: '', param: '',

View File

@@ -166,7 +166,7 @@
currentProjectTitle: '', currentProjectTitle: '',
currentProject: {id: '', name: '', remark: ''}, //endpoint弹框、module列表用来回显project currentProject: {id: '', name: '', remark: ''}, //endpoint弹框、module列表用来回显project
module: {}, //编辑的module module: {}, //编辑的module
blankModule: {id: '', type: '', name: '', project: {}, port: '', path: '', param: '', paramObj: [], snmpParam: ''}, //空白module blankModule: {name: '', project: {}, port: 9100, path: '', param: '', type: 'http', paramObj: [], snmpParam: '', walk: [], version: 2, max_repetitions: 25, retries: 3, timeout: 10, community: 'public', username: '', security_level: 'noAuthNoPriv', password: '', auth_protocol: 'MD5', priv_protocol: 'DES', priv_password: '', context_name: ''}, //空白module
currentModule: {id: '', type: '', name: '', project: {}, port: '', path: '', param: '', paramObj: [], snmpParam: ''}, //用来回显的module currentModule: {id: '', type: '', name: '', project: {}, port: '', path: '', param: '', paramObj: [], snmpParam: ''}, //用来回显的module
ready: false, ready: false,
rightBox: {module: {show: false}}, rightBox: {module: {show: false}},
@@ -340,7 +340,9 @@
}); });
}, },
newModule() { newModule() {
return JSON.parse(JSON.stringify(this.blankModule)); let module=JSON.parse(JSON.stringify(this.blankModule));
module.project = this.$store.state.currentProject
return module
}, },
//弹出module编辑页 //弹出module编辑页
editModule(module) { editModule(module) {

View File

@@ -515,21 +515,21 @@
border-radius: 4px; border-radius: 4px;
} }
.severity .high{ .severity .high{
background: #F2866E; background: #F5846A;
border-radius: 2px; border-radius: 2px;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #FFFFFF;
padding: 2px 6px; padding: 2px 6px;
} }
.severity .medium{ .severity .medium{
background: #F89984; background: #F7A54A;
border-radius: 2px; border-radius: 2px;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #FFFFFF;
padding: 2px 6px; padding: 2px 6px;
} }
.severity .low{ .severity .low{
background: #F7BA78; background: #F1C13D;
border-radius: 2px; border-radius: 2px;
font-size: 12px; font-size: 12px;
color: #FFFFFF; color: #FFFFFF;

View File

@@ -736,7 +736,7 @@
show:false show:false
}, },
minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'), minInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'min'),
maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max'), // maxInterval: chartDataFormat.Interval(maxValue,copies,unit.type,'max'),
axisTick: { axisTick: {
show: false, show: false,
}, },
@@ -760,6 +760,7 @@
if (chartSite === 'local') { // 本地显示 if (chartSite === 'local') { // 本地显示
if(legend){ if(legend){
this.legendList = []; this.legendList = [];
this.isGrey=[];
legend.forEach((item, i) => { legend.forEach((item, i) => {
const legend = { const legend = {
name:item.name, name:item.name,
@@ -873,6 +874,7 @@
// eslint-disable-next-line // eslint-disable-next-line
if(legend){ if(legend){
this.screenLegendList = []; this.screenLegendList = [];
this.isGreyScreen=[]
legend.forEach((item, i) => { legend.forEach((item, i) => {
const legend = { const legend = {
name:item.name, name:item.name,
@@ -1514,19 +1516,22 @@
let maxValue=0; let maxValue=0;
let minValue=0; let minValue=0;
if(chartInfo.unit &&dataArg.length>0){ if(chartInfo.unit &&dataArg.length>0){
maxValue=dataArg[0].data[0][1]; maxValue=0;
minValue=dataArg[0].data[0][1]; minValue=0;
for(let j = 0; j < dataArg.length ; j++){ for(let j = 0; j < dataArg.length ; j++){
for (let i = 0; i < dataArg[j].data.length - 1; i++) { for (let i = 0; i < dataArg[j].data.length - 1; i++) {
maxValue = (maxValue < Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : maxValue); if(dataArg[j].data[i+1][1]!=='NaN'){
minValue = (minValue > Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : minValue); maxValue = (maxValue < Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : maxValue);
minValue = (minValue > Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : minValue);
}
} }
} }
} }
let chartUnit=chartInfo.unit?chartInfo.unit:2; let chartUnit=chartInfo.unit?chartInfo.unit:2;
let unit=chartDataFormat.getUnit(chartUnit); let unit=chartDataFormat.getUnit(chartUnit);
minValue=minValue>0?0:minValue;
maxValue=maxValue-minValue;
maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii); maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii);
minValue=chartDataFormat.formatDatas(minValue,unit.type,'floor',unit.ascii);
let oldValue=maxValue; let oldValue=maxValue;
let dot=0; let dot=0;
if(maxValue==1){ if(maxValue==1){

View File

@@ -315,6 +315,7 @@
methods: { methods: {
labelsSort:function(obj){ labelsSort:function(obj){
let buildIn=['asset','endpoint','module','project','datacenter'] let buildIn=['asset','endpoint','module','project','datacenter']
console.log(obj)
let labels=JSON.parse(JSON.stringify(obj)); let labels=JSON.parse(JSON.stringify(obj));
let result=[]; let result=[];
for(let key of buildIn){ for(let key of buildIn){

View File

@@ -3,7 +3,7 @@
<div :id="id" class="editor-core" ref="editor" :style="{height: styleType == 2 ? 'auto' : ''}"></div> <div :id="id" class="editor-core" ref="editor" :style="{height: styleType == 2 ? 'auto' : ''}"></div>
<span class="nz-input-append editor-clear" style="display: none" @click="clearContent"><i class="nz-icon nz-icon-circle-close"></i></span> <span class="nz-input-append editor-clear" style="display: none" @click="clearContent"><i class="nz-icon nz-icon-circle-close"></i></span>
<div class="metric-editor-popper" :style="{left:popperPos.left+'px'}"> <div class="metric-editor-popper" :style="{left:popperPos.left+'px'}">
<div class="metric-popper-main" v-show="showType&&Object.keys(showSuggestions).length>0"> <div class="metric-popper-main" v-show="showType">
<el-scrollbar style="height: 100%;width:100%" class="el-scrollbar-small" ref="scroll"> <el-scrollbar style="height: 100%;width:100%" class="el-scrollbar-small" ref="scroll">
<div v-for="(key, index) in orders" > <div v-for="(key, index) in orders" >
<div v-html="key" class="popper-group" v-show="showSuggestions[key]"></div> <div v-html="key" class="popper-group" v-show="showSuggestions[key]"></div>
@@ -153,7 +153,6 @@
this.packageTypeInfo(); this.packageTypeInfo();
}else if(type == 'range'){ }else if(type == 'range'){
this.noStyleSuggestions={range:suggestions.getRateRange()} this.noStyleSuggestions={range:suggestions.getRateRange()}
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
} }
}, },
packageTypeInfo:function(){ packageTypeInfo:function(){
@@ -267,7 +266,6 @@
this.$set(this.noStyleSuggestions,'metrics',this.tempStoreMetric) this.$set(this.noStyleSuggestions,'metrics',this.tempStoreMetric)
// this.$set(this.noStyleSuggestions,'operators',suggestions.getOperators()) // this.$set(this.noStyleSuggestions,'operators',suggestions.getOperators())
this.$set(this.noStyleSuggestions,'functions',suggestions.getFunctions()) this.$set(this.noStyleSuggestions,'functions',suggestions.getFunctions())
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
}, },
queryValues:function(){ queryValues:function(){
let labelValuesReg=/\{((\w*?(=|!=|=~|!~).*?,{0,1})+?)\}/ let labelValuesReg=/\{((\w*?(=|!=|=~|!~).*?,{0,1})+?)\}/
@@ -298,7 +296,6 @@
let values=this.labelValues.get(label); let values=this.labelValues.get(label);
this.noStyleSuggestions={values:values} this.noStyleSuggestions={values:values}
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
} }
} }
}, },
@@ -362,11 +359,9 @@
}) })
this.noStyleSuggestions={labels:labels} this.noStyleSuggestions={labels:labels}
this.showSuggestions=this.deepClone(this.noStyleSuggestions);
//console.log('change labels',this.showSuggestions) //console.log('change labels',this.showSuggestions)
}else{ }else{
this.noStyleSuggestions={}; this.noStyleSuggestions={};
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
} }
}) })
}, },
@@ -532,12 +527,12 @@
filterItems:function(input){ //过滤下拉选显示 filterItems:function(input){ //过滤下拉选显示
let suggestions=this.deepClone(this.noStyleSuggestions) let suggestions=this.deepClone(this.noStyleSuggestions)
let hasResolve=false;
new Promise((resolve => { new Promise((resolve => {
let counter = 0; let start = new Date().getTime();
let result={};
this.orders.forEach(key=>{ this.orders.forEach(key=>{
let typeValues=suggestions[key]; let typeValues=suggestions[key];
this.showSuggestions[key]=[]; result[key]=[];
typeValues&&typeValues.forEach(item=>{ typeValues&&typeValues.forEach(item=>{
let index=item.insertText.toLowerCase().indexOf(input.toLowerCase()); let index=item.insertText.toLowerCase().indexOf(input.toLowerCase());
//console.log('index',index,'input',input) //console.log('index',index,'input',input)
@@ -549,20 +544,17 @@
let middle=label.substring(index,index+input.length) let middle=label.substring(index,index+input.length)
let suf=label.substring(index+input.length,label.length) let suf=label.substring(index+input.length,label.length)
item.label=`${pre}<mark>${middle}</mark>${suf}` item.label=`${pre}<mark>${middle}</mark>${suf}`
this.showSuggestions[key].push(item); result[key].push(item);
if(++counter > 20){
hasResolve=true;
resolve();
}
} }
}); });
if(this.showSuggestions[key].length<1){ if(result[key].length<1){
delete this.showSuggestions[key] delete result[key]
} }
}) })
if(!hasResolve){ this.showSuggestions=result;
resolve(); let end = new Date().getTime();
} console.log("filter time:",(end - start),'ms')
resolve();
})).then(()=>{ })).then(()=>{
if(Object.keys(this.showSuggestions).length>0){ if(Object.keys(this.showSuggestions).length>0){
this.showType=true; this.showType=true;

View File

@@ -412,19 +412,22 @@
let maxValue=0; let maxValue=0;
let minValue=0; let minValue=0;
if(chartInfo.unit &&dataArg.length>0){ if(chartInfo.unit &&dataArg.length>0){
maxValue=dataArg[0].data[0][1]; maxValue=0;
minValue=dataArg[0].data[0][1]; minValue=0;
for(let j = 0; j < dataArg.length ; j++){ for(let j = 0; j < dataArg.length ; j++){
for (let i = 0; i < dataArg[j].data.length - 1; i++) { for (let i = 0; i < dataArg[j].data.length - 1; i++) {
maxValue = (maxValue < Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : maxValue); if(dataArg[j].data[i+1][1]!=='NaN'){
minValue = (minValue > Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : minValue); maxValue = (maxValue < Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : maxValue);
minValue = (minValue > Number(dataArg[j].data[i+1][1]) ? Number(dataArg[j].data[i+1][1]) : minValue);
}
} }
} }
} }
let chartUnit=chartInfo.unit?chartInfo.unit:2; let chartUnit=chartInfo.unit?chartInfo.unit:2;
let unit=chartDataFormat.getUnit(chartUnit); let unit=chartDataFormat.getUnit(chartUnit);
minValue=minValue>0?0:minValue;
maxValue=maxValue-minValue;
maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii); maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii);
minValue=chartDataFormat.formatDatas(minValue,unit.type,'floor',unit.ascii);
let oldValue=maxValue; let oldValue=maxValue;
let dot=0; let dot=0;
if(maxValue==1){ if(maxValue==1){
@@ -443,7 +446,6 @@
dot++; dot++;
} }
let copies=chartDataFormat.copies(oldValue,unit.type); let copies=chartDataFormat.copies(oldValue,unit.type);
// console.log(oldValue,copies,maxValue);
let oldDot=2; let oldDot=2;
if(maxValue<=1){ if(maxValue<=1){
oldDot=dot>6?6:dot; oldDot=dot>6?6:dot;
@@ -456,7 +458,7 @@
unit, unit,
oldDot oldDot
} }
} },
}, },
mounted() { mounted() {
this.chartInit(); this.chartInit();

View File

@@ -322,11 +322,28 @@
message: this.$t("tip.deleteSuccess") message: this.$t("tip.deleteSuccess")
}); });
let chartList=this.$refs.chartList.dataList; let chartList=this.$refs.chartList.dataList;
let nextChart=null,prevChart=null
for (let i =0;i< chartList.length;i++){ for (let i =0;i< chartList.length;i++){
if(chartList[i].id === data.id){ if(chartList[i].id === data.id){
chartList.splice(i,1); chartList.splice(i,1);
break;
} }
if(data.next != -1){
if(chartList[i].id === data.next){
nextChart = chartList[i]
}
}
if(data.prev != 0){
if(chartList[i].id === data.prev){
prevChart = chartList[i]
}
}
}
if(nextChart&&prevChart){ //删除图表为中间位置
prevChart.next = nextChart.id;
nextChart.prev = prevChart.id;
}else{
if(!nextChart) prevChart.next = -1;
if(!prevChart) nextChart.prev = 0;
} }
// this.getTableData(); //删除相关图表后,刷新面板数据 // this.getTableData(); //删除相关图表后,刷新面板数据
} else { } else {
@@ -356,6 +373,7 @@
if(this.$refs.chartList){ if(this.$refs.chartList){
this.$refs.chartList.initData(params); this.$refs.chartList.initData(params);
} }
this.panelReloadOnlyPanel();
}, },
/*图表相关操作--end*/ /*图表相关操作--end*/