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
},
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: {
show: false,
},
@@ -1477,7 +1477,7 @@
series:this.seriesItem,
yAxis:{
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){
@@ -1510,7 +1510,7 @@
series:this.seriesItemScreen,
yAxis:{
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){
@@ -1648,19 +1648,22 @@
let maxValue=0;
let minValue=0;
if(chartInfo.unit &&dataArg.length>0){
maxValue=dataArg[0].data[0][1];
minValue=dataArg[0].data[0][1];
maxValue=0;
minValue=0;
for(let j = 0; j < dataArg.length ; j++){
for (let i = 0; i < dataArg[j].data.length - 1; i++) {
if(dataArg[j].data[i+1][1]!=='NaN'){
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 unit=chartDataFormat.getUnit(chartUnit);
minValue=minValue>0?0:minValue;
maxValue=maxValue-minValue;
maxValue=chartDataFormat.formatDatas(maxValue,unit.type,'ceil',unit.ascii);
minValue=chartDataFormat.formatDatas(minValue,unit.type,'floor',unit.ascii);
let oldValue=maxValue;
let dot=0;
if(maxValue==1){

View File

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

View File

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

View File

@@ -166,7 +166,7 @@
currentProjectTitle: '',
currentProject: {id: '', name: '', remark: ''}, //endpoint弹框、module列表用来回显project
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
ready: false,
rightBox: {module: {show: false}},
@@ -340,7 +340,9 @@
});
},
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编辑页
editModule(module) {

View File

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

View File

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

View File

@@ -315,6 +315,7 @@
methods: {
labelsSort:function(obj){
let buildIn=['asset','endpoint','module','project','datacenter']
console.log(obj)
let labels=JSON.parse(JSON.stringify(obj));
let result=[];
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>
<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-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">
<div v-for="(key, index) in orders" >
<div v-html="key" class="popper-group" v-show="showSuggestions[key]"></div>
@@ -153,7 +153,6 @@
this.packageTypeInfo();
}else if(type == 'range'){
this.noStyleSuggestions={range:suggestions.getRateRange()}
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
}
},
packageTypeInfo:function(){
@@ -267,7 +266,6 @@
this.$set(this.noStyleSuggestions,'metrics',this.tempStoreMetric)
// this.$set(this.noStyleSuggestions,'operators',suggestions.getOperators())
this.$set(this.noStyleSuggestions,'functions',suggestions.getFunctions())
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
},
queryValues:function(){
let labelValuesReg=/\{((\w*?(=|!=|=~|!~).*?,{0,1})+?)\}/
@@ -298,7 +296,6 @@
let values=this.labelValues.get(label);
this.noStyleSuggestions={values:values}
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
}
}
},
@@ -362,11 +359,9 @@
})
this.noStyleSuggestions={labels:labels}
this.showSuggestions=this.deepClone(this.noStyleSuggestions);
//console.log('change labels',this.showSuggestions)
}else{
this.noStyleSuggestions={};
this.showSuggestions=this.deepClone(this.noStyleSuggestions)
}
})
},
@@ -532,12 +527,12 @@
filterItems:function(input){ //过滤下拉选显示
let suggestions=this.deepClone(this.noStyleSuggestions)
let hasResolve=false;
new Promise((resolve => {
let counter = 0;
let start = new Date().getTime();
let result={};
this.orders.forEach(key=>{
let typeValues=suggestions[key];
this.showSuggestions[key]=[];
result[key]=[];
typeValues&&typeValues.forEach(item=>{
let index=item.insertText.toLowerCase().indexOf(input.toLowerCase());
//console.log('index',index,'input',input)
@@ -549,20 +544,17 @@
let middle=label.substring(index,index+input.length)
let suf=label.substring(index+input.length,label.length)
item.label=`${pre}<mark>${middle}</mark>${suf}`
this.showSuggestions[key].push(item);
if(++counter > 20){
hasResolve=true;
resolve();
}
result[key].push(item);
}
});
if(this.showSuggestions[key].length<1){
delete this.showSuggestions[key]
if(result[key].length<1){
delete result[key]
}
})
if(!hasResolve){
this.showSuggestions=result;
let end = new Date().getTime();
console.log("filter time:",(end - start),'ms')
resolve();
}
})).then(()=>{
if(Object.keys(this.showSuggestions).length>0){
this.showType=true;

View File

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

View File

@@ -322,11 +322,28 @@
message: this.$t("tip.deleteSuccess")
});
let chartList=this.$refs.chartList.dataList;
let nextChart=null,prevChart=null
for (let i =0;i< chartList.length;i++){
if(chartList[i].id === data.id){
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(); //删除相关图表后,刷新面板数据
} else {
@@ -356,6 +373,7 @@
if(this.$refs.chartList){
this.$refs.chartList.initData(params);
}
this.panelReloadOnlyPanel();
},
/*图表相关操作--end*/