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

# Conflicts:
#	nezha-fronted/src/components/charts/chart-alert-list.vue
This commit is contained in:
chenjinsong
2020-06-04 18:36:18 +08:00
22 changed files with 89 additions and 32 deletions

View File

@@ -7,7 +7,7 @@
<div class="resize-box resize-box-alert" ref="resizeBox">
<div class="chart-alert-info" :id="'chartTableDiv'+chartIndex" v-show="divFirstShow" @mouseenter="caretShow=true" @mouseleave="caretShow=false">
<loading :ref="'localLoading'+chartIndex"></loading>
<div class="clearfix chartTitle" :class="{'dragTitle':dragTitleShow}" :id="'chartTitle'+chartIndex">
<div class="clearfix chartTitle" :class="{'dragTitle':dragTitleShow}" :id="'chartTitle'+chartIndex" v-show="!isPreview">
<el-popover
v-if="isError"
:close-delay=10
@@ -482,6 +482,12 @@ export default {
handler(n,o){
this.data=Object.assign({},n)
}
},
panelId:{
immediate:true,
handler(n,o){
this.panelIdInner=n
}
}
},
methods: {
@@ -584,7 +590,11 @@ export default {
type: "line",
symbol: 'none', //去掉点
smooth: 0.2, //曲线变平滑
name: ''
name: '',
lineStyle: {
width: 1,
opacity: 0.9
},
};
chartData.name += "{";
alias += "{";
@@ -626,15 +636,21 @@ export default {
})
}
},
getAlertList: function (filterType,isPreview=false) {
getAlertList: function (filterType,isPreview=false,chartInfo) {
this.resize();
this.isPreview = isPreview;
let queryParam={
pageSize:this.pageObj.pageSize,
pageNo:this.pageObj.pageNo,
}
if(this.chartInfo&&this.chartInfo.param){ //按照粒度project>module>endpoint 查询只传最细粒度
let param=this.chartInfo.param;
let chart=null;
if(chartInfo){
chart=Object.assign({},chartInfo)
}else{
chart=Object.assign({},this.chartInfo)
}
if(chart&&chart.param){ //按照粒度project>module>endpoint 查询只传最细粒度
let param=chart.param;
if(param.endpointId&&param.endpointId != ''){
queryParam.endpointId=param.endpointId;
}else{

View File

@@ -57,7 +57,7 @@
</el-popover>
<div slot="title" class="chart-title">
<span class="nz-dialog-title chart-title-text">{{chart.title}}</span>
<div class="float-right panel-calendar dialog-tool" v-if="chart.type!=='url'">
<div class="float-right panel-calendar dialog-tool" v-if="chart.type!=='url' && chart.type !=='alertList'">
<time-picker ref="calendarPanel" class="nz-dashboard-picker" style="margin-top: -12px;" @change="dateChange"></time-picker>
<!--
@@ -129,7 +129,7 @@
</template>
<template v-if="chart.type === 'alertList'">
<chart-alert-list ref="alertListChart"></chart-alert-list>
<chart-alert-list ref="alertListChart" id="chartAlertListPreview"></chart-alert-list>
</template>
<loading ref="loadingPreview"></loading>
@@ -236,6 +236,8 @@
chartContainerId = 'chartUrlPreview';
}else if (chartType === 'singleStat') {
chartContainerId = 'chartSingleStatPreview';
}else if(chartType === 'alertList'){
chartContainerId = 'chartAlertListPreview';
}
//设置高度 chart-table
@@ -327,7 +329,7 @@
});
},
getAlertListChartData:function(chartInfo,filterType){
this.$refs.alertListChart.getAlertList(filterType,true);
this.$refs.alertListChart.getAlertList(filterType,true,this.chart);
this.$refs.loadingPreview.endLoading();
},
// 获取一个图表具体数据
@@ -406,6 +408,10 @@
showSymbol: false,
data: [],
type: chartItem.type,
lineStyle: {
width: 1,
opacity: 0.9
},
},
metric_name: '',
};
@@ -1112,6 +1118,10 @@
showSymbol:false,
data: [],
type:this.chart.type,
lineStyle: {
width: 1,
opacity: 0.9
},
//visible: true,
//threshold: null,
},

View File

@@ -1120,6 +1120,10 @@
showSymbol:false,
data: [],
type:this.data.type,
lineStyle: {
width: 1,
opacity: 0.9
},
//visible: true,
//threshold: null,
},

View File

@@ -513,7 +513,11 @@
type: "line",
symbol: 'none', //去掉点
smooth: 0.2, //曲线变平滑
name: ''
name: '',
lineStyle: {
width: 1,
opacity: 0.9
},
};
chartData.name += "{";
alias += "{";

View File

@@ -418,7 +418,11 @@
let chartData={
type:"line",
symbol:'none', //去掉点
smooth:0.2, //曲线变平滑
smooth:0.2,
lineStyle: {
width: 1,
opacity: 0.9
},
};
chartData.name=queryData.metric.__name__;
let alias=queryData.metric.__name__;

View File

@@ -426,6 +426,9 @@
this.$put('/model/syncChart',param).then(response=>{
if(response.code == 200){
this.$message({duration: 1000, type: 'success', message: this.$t("tip.syncSuccess")});
if(this.from == 'asset'){
this.Refresh();
}
}else{
console.error(response.msg)
this.$message.error(response.msg)

View File

@@ -12,7 +12,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" label-position="top" ref="addEndpointForm" :model="endpointForm" :rules="rules">
<el-form class="right-box-form right-box-form-left" label-position="right" label-width="120px" ref="addEndpointForm" :model="endpointForm" :rules="rules">
<!--project-->
<el-form-item :label='$t("project.project.project")' prop="projectId">
<el-select @change="((val) => {changeProject(val)})" value-key="id" popper-class="config-dropdown" v-model="currentProjectCopy" placeholder="" size="small">

View File

@@ -21,7 +21,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="alertRule" label-position="top" :rules="rules" ref="alertRuleForm">
<el-form class="right-box-form right-box-form-left" :model="alertRule" label-position="right" label-width="120px" :rules="rules" ref="alertRuleForm">
<!--alertName-->
<el-form-item :label='$t("alert.config.name")' prop="alertName">
<el-input v-if="rightBox.isEdit" placeholder="" maxlength="64" show-word-limit v-model="alertRule.alertName" size="small"></el-input>

View File

@@ -20,7 +20,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="cabinet" ref="cabinetForm" :rules="rules">
<el-form class="right-box-form right-box-form-left" label-width="120px" label-position="right" :model="cabinet" ref="cabinetForm" :rules="rules">
<el-form-item :label="this.$t('asset.createAssetTab.AddCabinetTab.name')" prop="name">
<el-input size='mini' v-model="cabinet.name" v-if="rightBox.isEdit"/>
<div class="right-box-form-content-txt" v-if="!rightBox.isEdit">{{cabinet.name}}</div>

View File

@@ -20,7 +20,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="currentDc" label-position="top" :rules="rules" ref="dcForm">
<el-form class="right-box-form right-box-form-left" label-width="120px" :model="currentDc" label-position="right" :rules="rules" ref="dcForm">
<el-form-item :label='$t("overall.name")' prop="name">
<el-input v-if="rightBox.isEdit" placeholder="" maxlength="64" show-word-limit v-model="currentDc.name" size="small"></el-input>
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{currentDc.name}}</div>

View File

@@ -20,7 +20,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="endpoint" label-position="top" :rules="rules" ref="endPointForm">
<el-form class="right-box-form right-box-form-left" :model="endpoint" label-position="right" label-width="120px" :rules="rules" ref="endPointForm">
<!--project-->
<el-form-item :label="$t('project.project.project')" prop="project.id">
<el-select @change="((val) => {changeProject(val);})" value-key="id" popper-class="config-dropdown" v-model="endpoint.projectId" placeholder="" v-if="rightBox.isEdit" size="small">
@@ -137,7 +137,8 @@
<el-form-item class="right-box-form-param" v-if="currentModule.type.toLowerCase() == 'http'">
<template slot="label">
<span>{{$t('project.endpoint.param')}}</span>
<div class="right-box-form-btns" v-if="rightBox.isEdit">
</template>
<div v-if="rightBox.isEdit" style="text-align: right">
<button style="display: none;">第一个button会出现意料之外的hover样式找不到原因只好加个不可见的button规避问题</button>
<button type="button" id="edit-clear-all" @click="clearAllParam" class="nz-btn nz-btn-size-normal nz-btn-style-light">
<span><i class="el-icon-delete"></i></span>
@@ -146,7 +147,6 @@
<span><i style="font-size: 12px;" class="nz-icon nz-icon-create-square"></i></span>
</button>
</div>
</template>
<div v-if="rightBox.isEdit" class="param-box param-box-module">
<el-scrollbar ref="paramBoxScrollbar" style="height: 100%">
<div class="param-box-row" v-for="(item, index) in endpoint.paramObj">

View File

@@ -20,7 +20,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="currentMib" label-position="top" :rules="rules" ref="mibForm">
<el-form class="right-box-form right-box-form-left" :model="currentMib" label-position="right" label-width="120px" :rules="rules" ref="mibForm">
<!--mib名称-->
<!--<el-form-item :label='$t("overall.name")' prop="name">
<el-input v-if="rightBox.isEdit" placeholder="" maxlength="64" show-word-limit v-model.trim="currentMib.name" size="small"></el-input>
@@ -54,7 +54,7 @@
<el-input maxlength="512" rows="4" show-word-limit v-if="rightBox.isEdit" type="textarea" placeholder="" v-model.trim="currentMib.remark" size="small"></el-input>
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{currentMib.remark}}</div>
</el-form-item>
<el-form-item :label="$t('config.mib.mibFile')" prop="file" :rules="[{validator:checkMibFile,trigger:'change'}]" :class="{'add-required':!currentMib.id}">
<el-form-item :label="$t('config.mib.mibFiles')" prop="file" :rules="[{validator:checkMibFile,trigger:'change'}]" :class="{'add-required':!currentMib.id}">
<el-upload drag v-if="rightBox.isEdit" :multiple="false" action="" :file-list="uploadFileList" :on-change="uploadChange" :auto-upload="false" accept="" :on-remove="afterClearFile" ref="mibFileUpload" class="mib-upload right-box-form-row">
<div slot="tip" class="el-upload__tip" >
<!-- <span v-if="!currentMib.fileName">{{$t('config.mib.uploadTip')}}</span>

View File

@@ -20,7 +20,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="currentModel" label-position="top" :rules="rules" ref="modelForm">
<el-form class="right-box-form right-box-form-left" :model="currentModel" label-position="right" label-width="120px" :rules="rules" ref="modelForm">
<!--model名称-->
<el-form-item :label='$t("overall.name")' prop="name">
<el-input v-if="rightBox.isEdit" placeholder="" maxlength="64" show-word-limit v-model.trim="currentModel.name" size="small"></el-input>
@@ -69,10 +69,10 @@
</div>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item :label="this.$t('asset.createAssetTab.AddCabinetTab.uSize')" prop="uSize">
<el-input v-model.number="currentModel.uSize" :max="47" size="small"></el-input>
</el-form-item>
</el-form-item>
</el-form>
</el-scrollbar>

View File

@@ -20,7 +20,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box" ref="scrollbar">
<el-form class="right-box-form" :model="currentModule" label-position="top" :rules="rules" ref="moduleForm">
<el-form class="right-box-form right-box-form-left" :model="currentModule" label-position="right" label-width="120px" :rules="rules" ref="moduleForm">
<el-form-item :label='$t("project.project.project")' prop="project">
<el-select v-if="rightBox.isEdit" value-key="id" popper-class="config-dropdown" v-model="currentModule.project" placeholder="" size="small">
<el-option :id="'module-project-'+item.id" v-for="item in projectList" :key="item.id" :label="item.name" :value="item"></el-option>

View File

@@ -16,7 +16,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="panel" label-position="top" ref="panelForm">
<el-form class="right-box-form right-box-form-left" label-width="120px" :model="panel" label-position="right" ref="panelForm">
<el-form-item :label='$t("overall.name")' prop="name" :rules="{required: true, message: $t('validate.required'), trigger: 'blur'}">
<el-input placeholder="" maxlength="64" show-word-limit v-model="panel.name" size="small" ></el-input>
</el-form-item>

View File

@@ -18,7 +18,7 @@
<div class="right-box-title">{{rightBox.title}}</div>
<!-- end--标题-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="project" label-position="top" :rules="rules" ref="projectForm">
<el-form class="right-box-form right-box-form-left" :model="project" label-position="right" label-width="120px" :rules="rules" ref="projectForm">
<el-form-item :label='$t("project.project.projectName")' prop="name">
<el-input v-if="rightBox.isEdit" size="mini" maxlength="64" show-word-limit v-model="project.name"></el-input>
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{project.name}}</div>

View File

@@ -514,7 +514,11 @@
type: "line",
symbol: 'none', //去掉点
smooth: 0.2, //曲线变平滑
name: ''
name: '',
lineStyle: {
width: 1,
opacity: 0.9
},
};
chartData.name += "{";
alias += "{";

View File

@@ -120,7 +120,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box">
<el-form class="right-box-form" :model="promServer" label-position="top" label-width="80px" :rules="rules"
<el-form class="right-box-form right-box-form-left" :model="promServer" label-position="right" label-width="120px" :rules="rules"
ref="promServerForm">
<!--DC start-->
<el-form-item :label="$t('config.dc.dc')" prop="idc.name">

View File

@@ -73,7 +73,7 @@
<!-- begin--表单-->
<el-scrollbar class="right-box-form-box" ref="scrollbar">
<el-form class="right-box-form" :model="chart" :rules="rules" ref="chartForm">
<el-form class="right-box-form right-box-form-left" :model="chart" label-width="120px" label-position="right" :rules="rules" ref="chartForm">
<el-form-item :label="$t('dashboard.panel.title')" prop="panel" v-if="!showPanel.type">
<el-autocomplete
:fetch-suggestions="panelSuggestion"

View File

@@ -313,7 +313,11 @@ export default {
type:chartItem.type ? chartItem.type : 'line',
//visible: true,
//threshold: null,
chartTitle:''
chartTitle:'',
lineStyle: {
width: 1,
opacity: 0.9
},
},
metric_name: '',
};

View File

@@ -513,6 +513,10 @@
smooth:0.2, //曲线变平滑
data: [],
type:'line',
lineStyle: {
width: 1,
opacity: 0.9
},
};
if (response.data.result.length > 0) {
series.data=response.data.result[0].values.map((item)=>{
@@ -545,6 +549,10 @@
smooth:0.2, //曲线变平滑
data: [],
type:'line',
lineStyle: {
width: 1,
opacity: 0.9
},
};
if (response.data.result.length > 0) {
series.data=response.data.result[0].values.map((item)=>{

View File

@@ -593,7 +593,7 @@
margin-top: 3px;
text-align:left;
border-radius:4px;
width:120px;
width:260px;
height:24px;
border:solid 1px #d8dce1;
white-space: nowrap;
@@ -602,7 +602,7 @@
}
.panel-list-title {
min-height:24px;
width:100px;
width:236px;
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;