Merge branch 'codeCheck' of https://git.mesalab.cn/nezha/nezha-fronted into codeCheck

This commit is contained in:
zhangyu
2021-03-12 10:26:24 +08:00
8 changed files with 102 additions and 36 deletions

View File

@@ -2373,15 +2373,26 @@ li{
}
.right-box-form .nz-icon-minus-medium{
padding: 2px 6px;
background: rgba(236,127,102,.1);
background-color: rgba(236,127,102,.1);
border-radius: 2px;
cursor: pointer;
}
.right-box-form .form-row-item .nz-icon-minus-position{
.nz-icon-copy {
padding: 2px 6px;
color: $global-text-color-active;
background-color: #FDF5E9;
border-radius: 2px;
cursor: pointer;
}
.nz-icon-minus-position{
display: inline-flex;
flex-direction: column;
position: absolute;
right: -40px;
top: 50%;
right: -55px;
transform: translate(-50%,-50%);
transform: translateY(-50%);
height: 70px;
justify-content: space-around;
}
.right-box-form>.el-form-item.half-form-item-other{
display: inline-block;

View File

@@ -464,7 +464,6 @@ export const tableSet = {
//是否需要排序
sortableShow(prop,from){
switch(prop){
case 'id':
case 'alertRule':
case 'severity':
case 'startAt':
@@ -504,7 +503,13 @@ export const tableSet = {
case 'alertNum':
return'custom';
case 'state':
if( from === 'operationlog'){
if( from === 'operationlog' ){
return false
}else{
return'custom'
}
case 'id':
if( from === 'alertSilence' ){
return false
}else{
return'custom'

View File

@@ -923,7 +923,12 @@ const cn = {
matcher:'Matcher',
reason:'原因',
selectTime:'请选择时间',
selectMather:'必填项'
selectMather:'必填项',
datacenter:'数据中心',
project:'项目',
module:'模块',
endpoint:'endpoint',
asset:'资产',
},
P1Rule:'P1: 万分紧急,可导致业务瘫痪的告警',
P2Rule:'P2: 急需处理,但不影响业务的告警',

View File

@@ -928,7 +928,13 @@ const en = {
matcher:'Matcher',
reason:'Reason',
selectTime:'Please select time',
selectMather:'Required'
selectMather:'Required',
datacenter:'datacenter',
project:'project',
module:'module',
endpoint:'endpoint',
asset:'asset',
},
P1Rule:'P1: Critical, alarm that can cause business paralysis',
P2Rule:'P2: Major, alarm that do not affect the business',

View File

@@ -71,9 +71,14 @@
</el-col>
</template>
</el-row>
<span class="nz-icon-minus-medium nz-icon-minus-position">
<i class="nz-icon nz-icon-minus" @click="removeExpression(index)"></i>
</span>
<div class="nz-icon-minus-position">
<span class="nz-icon-minus-medium">
<i @click="removeExpression(index)" class="nz-icon nz-icon-minus"></i>
</span>
<span class="nz-icon-copy">
<i @click="copyExpression(index)" class="nz-icon nz-icon-override"></i>
</span>
</div>
</el-row>
<!--tooltip-->
@@ -1564,6 +1569,17 @@
});
}
},
copyExpression(index) {
this.selection.pen.data.expressArr.push(this.selection.pen.data.expressArr[index]);
this.selection.pen.data.legends.push(this.selection.pen.data.legends[index]);
this.$nextTick(() => {
this.expressions.forEach((ex, index) => {
if (ex) {
this.$refs[`promql-${index}`][0].metricChange(ex);
}
});
});
},
valueMappingAdd(){
if(this.selection.pen.data.valueMappingSort==='desc'){
this.selection.pen.data.valueMapping.push({
@@ -1835,8 +1851,12 @@
width: calc(100% - 120px);
padding: 20px 20px 20px 0;
}
.form-row-item .nz-icon-minus-position {
.form-row-item .nz-icon-minus-position .nz-icon-minus-medium {
background: rgba(236, 127, 102, 0.1);
padding: 2px 6px;
color: #EC7F66;
}
/*.form-row-item .nz-icon-minus-position {
position: absolute;
top: 50%;
right: -55px;
@@ -1849,7 +1869,7 @@
.nz-icon-minus {
color: #EC7F66;
}
}
}*/
.tooltip-box {
padding-left: 10px;

View File

@@ -232,7 +232,7 @@
}
});
}else{
this.$post('/alert/silence',params).then(response=>{
this.$post('alert/silence',params).then(response=>{
this.prevent_opt.save=false;
if(response.code===200){
this.$message({duration:1000,type:'success',message:this.$t("tip.saveSuccess")});
@@ -273,7 +273,7 @@
});
},
getRuleList(){
this.$get('/alert/rule',{pageNo:1,pageSize:-1}).then(response=>{
this.$get('alert/rule',{pageNo:1,pageSize:-1}).then(response=>{
if(response.code==200){
this.ruleList=response.data.list;
}
@@ -333,7 +333,7 @@
this.editAlertSilence.linkId=linkId?linkId:'';
this.editAlertSilence.name='';
if(val==='datacenter'){
this.$get('/idc',{pageNo:1,pageSize:-1}).then(response=>{
this.$get('idc',{pageNo:1,pageSize:-1}).then(response=>{
if(response.code==200){
firstArr=response.data.list;
if(linkId){
@@ -347,7 +347,7 @@
}
if(val==='asset'){
this.$get('/asset?pageNo=1&pageSize=-1').then(res=>{
this.$get('asset?pageNo=1&pageSize=-1').then(res=>{
if(res.code==200){
let arr=[];
res.data.list.forEach(asset=>{
@@ -372,7 +372,7 @@
}
if(val==='project'){
this.$get('/project',{pageNo:1,pageSize:-1}).then(response=>{
this.$get('project',{pageNo:1,pageSize:-1}).then(response=>{
if(response.code==200){
firstArr=response.data.list;
if(linkId){
@@ -387,7 +387,7 @@
if(val==='module'){
this.$get('/module?pageNo=1&pageSize=-1').then(res=>{
this.$get('module?pageNo=1&pageSize=-1').then(res=>{
if(res.code==200){
let arr=[];
res.data.list.forEach(module=>{
@@ -411,7 +411,7 @@
}
if(val==='endpoint'){
this.$get('/endpoint?pageNo=1&pageSize=-1').then(res=>{
this.$get('endpoint?pageNo=1&pageSize=-1').then(res=>{
if(res.code=200){
let arr=[];
res.data.list.forEach(item=>{

View File

@@ -453,7 +453,7 @@
cancelButtonText:this.$t("tip.no"),
type:'warning'
}).then(()=>{
this.$delete("/alert/silence?ids="+row.id).then(response=>{
this.$delete("alert/silence?ids="+row.id).then(response=>{
this.prevent_opt.save=false;
if(response.code===200){
this.$message({type:'success',message:this.$t("tip.deleteSuccess")});
@@ -477,7 +477,7 @@
cancelButtonText:this.$t("tip.no"),
type:'warning'
}).then(()=>{
this.$delete("/alert/silence?ids="+row.id).then(response=>{
this.$delete("alert/silence?ids="+row.id).then(response=>{
this.prevent_opt.save=false;
if(response.code===200){
this.$message({type:'success',message:this.$t("tip.deleteSuccess")});

View File

@@ -323,20 +323,25 @@
></promql-input>
-->
<el-row>
<el-col style="width: 120px; padding-right: 20px; text-align: left; padding-left:10px; color: #666">
{{$t('dashboard.panel.chartForm.legend')}}&nbsp;
<el-popover placement="top" trigger="hover" width="211">
<div style="word-break:keep-all;">{{$t('dashboard.panel.chartForm.legendTip')}}</div>
<i @mouseover="rz" class="nz-icon nz-icon-info-normal" slot="reference" style="font-size: 14px; -webkit-transform:scale(0.75);display:inline-block;"></i>
</el-popover>
</el-col>
<el-col style="width: calc(100% - 120px);">
<el-input size="small" type="text" v-model="legends[index-1]" ></el-input>
</el-col>
<el-col style="width: 120px; padding-right: 20px; text-align: left; padding-left:10px; color: #666">
{{$t('dashboard.panel.chartForm.legend')}}&nbsp;
<el-popover placement="top" trigger="hover" width="211">
<div style="word-break:keep-all;">{{$t('dashboard.panel.chartForm.legendTip')}}</div>
<i @mouseover="rz" class="nz-icon nz-icon-info-normal" slot="reference" style="font-size: 14px; -webkit-transform:scale(0.75);display:inline-block;"></i>
</el-popover>
</el-col>
<el-col style="width: calc(100% - 120px);">
<el-input size="small" type="text" v-model="legends[index-1]" ></el-input>
</el-col>
</el-row>
<span class="nz-icon-minus-medium nz-icon-minus-position">
<i class="nz-icon nz-icon-minus" @click="removeExpression(index - 1)"></i>
</span>
<div class="nz-icon-minus-position">
<span class="nz-icon-minus-medium">
<i @click="removeExpression(index - 1)" class="nz-icon nz-icon-minus"></i>
</span>
<span class="nz-icon-copy" v-if="!isSingleStat">
<i @click="copyExpression(index - 1)" class="nz-icon nz-icon-override"></i>
</span>
</div>
</el-row>
</div>
<!--value mapping start-->
@@ -739,6 +744,20 @@
});
}
},
copyExpression(index) {
this.expressions.push(this.expressions[index]);
this.legends.push(this.legends[index]);
this.promqlKeys.push(getUUID());
this.elementIds.push("");
this.promqlCount++;
this.$nextTick(() => {
this.expressions.forEach((ex, index) => {
if (ex) {
this.$refs[`promql-${index}`][0].metricChange(ex);
}
});
});
},
save() {
this.$refs['chartForm'].validate((valid) => {
if (valid) {