feat: alert-trend step & dc/tag过滤
This commit is contained in:
@@ -1855,6 +1855,14 @@ li{
|
|||||||
.dropdown-content{
|
.dropdown-content{
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
}
|
}
|
||||||
|
.dropdown-item-active {
|
||||||
|
color: $global-text-color-active !important;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #FAFAFA;
|
||||||
|
}
|
||||||
|
.el-dropdown-multi .el-dropdown-menu__item:focus {
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
/*一些单选label宽度设为一样*/
|
/*一些单选label宽度设为一样*/
|
||||||
.same-label-width .el-radio-button__inner {
|
.same-label-width .el-radio-button__inner {
|
||||||
width: 90px;
|
width: 90px;
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ const cn = {
|
|||||||
reset: "重置",
|
reset: "重置",
|
||||||
submit: "提交",
|
submit: "提交",
|
||||||
noData:'没有数据',
|
noData:'没有数据',
|
||||||
|
tag: '标签'
|
||||||
},
|
},
|
||||||
webshell: {
|
webshell: {
|
||||||
shellTitle: "本地 Shell",
|
shellTitle: "本地 Shell",
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ const en = {
|
|||||||
},
|
},
|
||||||
reset:'Reset',
|
reset:'Reset',
|
||||||
submit:'Submit',
|
submit:'Submit',
|
||||||
noData:'No data'
|
noData:'No data',
|
||||||
|
tag: 'Tag'
|
||||||
},
|
},
|
||||||
pageSize: '/page',
|
pageSize: '/page',
|
||||||
webshell:{
|
webshell:{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="top-tool-main-right">
|
<div class="top-tool-main-right">
|
||||||
<div class="top-tool-search">
|
<div class="top-tool-search host-input">
|
||||||
<el-autocomplete
|
<el-autocomplete
|
||||||
v-model="searchParam.host"
|
v-model="searchParam.host"
|
||||||
:fetch-suggestions="assetSuggestion"
|
:fetch-suggestions="assetSuggestion"
|
||||||
@@ -137,8 +137,8 @@
|
|||||||
<span>SNMP MIBs</span>
|
<span>SNMP MIBs</span>
|
||||||
<el-dropdown trigger="click" v-scrollBar:el-dropdown="'small'" :hide-on-click="false" @command="selectModel" ref="modelDropdown">
|
<el-dropdown trigger="click" v-scrollBar:el-dropdown="'small'" :hide-on-click="false" @command="selectModel" ref="modelDropdown">
|
||||||
<span class="mib-browser-table-op" @click="scrollbarHeightHandler">{{$t("config.model.model") + " "}}<i class="nz-icon nz-icon-funnel"></i></span>
|
<span class="mib-browser-table-op" @click="scrollbarHeightHandler">{{$t("config.model.model") + " "}}<i class="nz-icon nz-icon-funnel"></i></span>
|
||||||
<el-dropdown-menu slot="dropdown" class="mib-browser-model-dropdown">
|
<el-dropdown-menu slot="dropdown" class="mib-browser-model-dropdown el-dropdown-multi">
|
||||||
<el-dropdown-item :class="{'mib-browser-model-dropdown-item-active': walkParam.models.indexOf(item.id) > -1}" :command="item" v-for="item, index in modelData" :key="index">{{item.name}}</el-dropdown-item>
|
<el-dropdown-item :class="{'dropdown-item-active': walkParam.models.indexOf(item.id) > -1}" :command="item" v-for="item, index in modelData" :key="index">{{item.name}}</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
@@ -391,7 +391,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
selectModel(model) {
|
selectModel(model) {
|
||||||
let index = this.walkParam.models.indexOf(model.id);
|
let index = this.walkParam.models.indexOf(parseInt(model.id));
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
this.walkParam.models.push(parseInt(model.id));
|
this.walkParam.models.push(parseInt(model.id));
|
||||||
} else {
|
} else {
|
||||||
@@ -606,14 +606,6 @@
|
|||||||
.mib-browser-model-dropdown {
|
.mib-browser-model-dropdown {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
.mib-browser-model-dropdown .el-dropdown-menu__item:focus {
|
|
||||||
color: #606266;
|
|
||||||
}
|
|
||||||
.mib-browser-model-dropdown-item-active {
|
|
||||||
color: $global-text-color-active !important;
|
|
||||||
font-weight: bold;
|
|
||||||
background-color: #FAFAFA;
|
|
||||||
}
|
|
||||||
.mib-browser {
|
.mib-browser {
|
||||||
.top-tool-search .el-input__inner {
|
.top-tool-search .el-input__inner {
|
||||||
height: 25px;
|
height: 25px;
|
||||||
@@ -627,7 +619,10 @@
|
|||||||
border-right: 1px solid rgba(162,162,162,0.50);
|
border-right: 1px solid rgba(162,162,162,0.50);
|
||||||
}
|
}
|
||||||
.oid-input.top-tool-search {
|
.oid-input.top-tool-search {
|
||||||
width: 500px;
|
width: 380px;
|
||||||
|
}
|
||||||
|
.host-input.top-tool-search {
|
||||||
|
width: 160px;
|
||||||
}
|
}
|
||||||
.mib-browser-btn-group {
|
.mib-browser-btn-group {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.nz-tab-chart-style-left{
|
.nz-tab-chart-style-left{
|
||||||
margin-left:40px;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.dashboard-metric-dropdown .el-scrollbar__wrap{
|
.dashboard-metric-dropdown .el-scrollbar__wrap{
|
||||||
margin-bottom: 0px !important;
|
margin-bottom: 0px !important;
|
||||||
|
|||||||
@@ -97,6 +97,19 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
.content-col-title .el-dropdown {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.content-col-title-tools {
|
||||||
|
display: flex;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.content-col-title-tool {
|
||||||
|
cursor: pointer;
|
||||||
|
padding-left: 7px;
|
||||||
|
border-left: 1px solid #dadada;
|
||||||
|
margin-left: 7px;
|
||||||
|
}
|
||||||
.content-col-box .content-col-title .nz-dashboard-picker {
|
.content-col-box .content-col-title .nz-dashboard-picker {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,21 @@
|
|||||||
<div class="content-col-box">
|
<div class="content-col-box">
|
||||||
<div class="content-col-title">
|
<div class="content-col-title">
|
||||||
<span>{{$t("dashboard.overview.alert.chart.chartTitle")}}</span>
|
<span>{{$t("dashboard.overview.alert.chart.chartTitle")}}</span>
|
||||||
|
<span class="content-col-title-tools">
|
||||||
<time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange"></time-picker>
|
<time-picker ref="calendarPanel" class="nz-dashboard-picker" @change="dateChange"></time-picker>
|
||||||
|
<el-dropdown trigger="hover" :show-timeout="0" size="small" :hide-on-click="false" @command="selectDatacenter">
|
||||||
|
<span class="content-col-title-tool">{{$t("dashboard.overview.dataCenter.dataCenter")}} <i class="el-icon-arrow-down"></i></span>
|
||||||
|
<el-dropdown-menu slot="dropdown" class="el-dropdown-multi">
|
||||||
|
<el-dropdown-item :class="{'dropdown-item-active': trendSearchParam.dc.indexOf(item.id) > -1}" :command="item" v-for="(item,index) in trafficDatacenterData" :key="index">{{item.name}}</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
<el-dropdown trigger="hover" :show-timeout="0" size="small" :hide-on-click="false" @command="selectTag">
|
||||||
|
<span class="content-col-title-tool">{{$t("overall.tag")}} <i class="el-icon-arrow-down"></i></span>
|
||||||
|
<el-dropdown-menu slot="dropdown" class="el-dropdown-multi">
|
||||||
|
<el-dropdown-item :class="{'dropdown-item-active': trendSearchParam.tag.some(tag => {return item.name == tag.name && item.value == tag.value;})}" :command="item" v-for="(item,index) in trafficTagData" :key="index">{{item.name}} : {{item.value}}</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-col-content">
|
<div class="content-col-content">
|
||||||
<chart-box chart-type="overviewLine" ref="chartbox" :show-toolbox="false" name="trend"></chart-box>
|
<chart-box chart-type="overviewLine" ref="chartbox" :show-toolbox="false" name="trend"></chart-box>
|
||||||
@@ -152,6 +166,7 @@
|
|||||||
import chart from "./chart";
|
import chart from "./chart";
|
||||||
import chartDataFormat from "../../../charts/chartDataFormat";
|
import chartDataFormat from "../../../charts/chartDataFormat";
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import bus from '../../../../libs/bus';
|
||||||
import timePicker from '../../../common/timePicker'
|
import timePicker from '../../../common/timePicker'
|
||||||
var timeout;
|
var timeout;
|
||||||
|
|
||||||
@@ -190,8 +205,10 @@
|
|||||||
messageByModuleSeries: [],
|
messageByModuleSeries: [],
|
||||||
alertRuleStatData: {},
|
alertRuleStatData: {},
|
||||||
dataCenterMapSeries: [],
|
dataCenterMapSeries: [],
|
||||||
|
trafficDatacenterData: [],
|
||||||
|
trafficTagData: [],
|
||||||
|
|
||||||
trendSearchTime: {start: '', end: ''},
|
trendSearchParam: {start: '', end: '', dc: [], tag: []},
|
||||||
|
|
||||||
alertMessageShow: 'asset', //asset/module
|
alertMessageShow: 'asset', //asset/module
|
||||||
bottom3DropdownShow: false, //最底部行第三列的下拉选择框
|
bottom3DropdownShow: false, //最底部行第三列的下拉选择框
|
||||||
@@ -237,6 +254,7 @@
|
|||||||
this.queryMapChartGeoJson();
|
this.queryMapChartGeoJson();
|
||||||
this.queryAlertStatByRule();
|
this.queryAlertStatByRule();
|
||||||
this.queryAlertStatByAsset();
|
this.queryAlertStatByAsset();
|
||||||
|
this.getDcTrafficData();
|
||||||
},
|
},
|
||||||
queryAssetData() {
|
queryAssetData() {
|
||||||
this.assetLoading = true;
|
this.assetLoading = true;
|
||||||
@@ -420,15 +438,15 @@
|
|||||||
this.$refs.chartbox.startLoading();
|
this.$refs.chartbox.startLoading();
|
||||||
let before;
|
let before;
|
||||||
let end;
|
let end;
|
||||||
if (this.trendSearchTime.start) {
|
if (this.trendSearchParam.start) {
|
||||||
before = this.trendSearchTime.start;
|
before = this.trendSearchParam.start;
|
||||||
} else {
|
} else {
|
||||||
before = new Date();
|
before = new Date();
|
||||||
before.setMinutes(new Date().getMinutes()-5);
|
before.setHours(new Date().getHours()-1);
|
||||||
before = this.dateFormat('yyyy-mm-dd HH:MM:SS', before);
|
before = this.dateFormat('yyyy-mm-dd HH:MM:SS', before);
|
||||||
}
|
}
|
||||||
if (this.trendSearchTime.end) {
|
if (this.trendSearchParam.end) {
|
||||||
end = this.trendSearchTime.end;
|
end = this.trendSearchParam.end;
|
||||||
} else {
|
} else {
|
||||||
end = new Date();
|
end = new Date();
|
||||||
end = this.dateFormat('yyyy-mm-dd HH:MM:SS', end);
|
end = this.dateFormat('yyyy-mm-dd HH:MM:SS', end);
|
||||||
@@ -437,7 +455,11 @@
|
|||||||
query: 'sum(nz_alert_nums)',
|
query: 'sum(nz_alert_nums)',
|
||||||
start: before,
|
start: before,
|
||||||
end: end,
|
end: end,
|
||||||
step: '15s'
|
step: bus.getStep(before, end),
|
||||||
|
dc: this.trendSearchParam.dc.join(","),
|
||||||
|
tag: this.trendSearchParam.tag.map(item => {
|
||||||
|
return "{" + item.name + ":" + item.value + "}"
|
||||||
|
}).join(",")
|
||||||
};
|
};
|
||||||
this.$get('/prom/api/v1/query_range',params).then(response=>{
|
this.$get('/prom/api/v1/query_range',params).then(response=>{
|
||||||
if(response.status == 'success'){
|
if(response.status == 'success'){
|
||||||
@@ -449,9 +471,11 @@
|
|||||||
data: [],
|
data: [],
|
||||||
type:'line',
|
type:'line',
|
||||||
};
|
};
|
||||||
|
if (response.data.result.length > 0) {
|
||||||
series.data=response.data.result[0].values.map((item)=>{
|
series.data=response.data.result[0].values.map((item)=>{
|
||||||
return [item[0]*1000,item[1]];
|
return [item[0]*1000,item[1]];
|
||||||
});
|
});
|
||||||
|
}
|
||||||
this.chartSeries = [series];
|
this.chartSeries = [series];
|
||||||
this.$refs.chartbox.setSeries(this.chartSeries);
|
this.$refs.chartbox.setSeries(this.chartSeries);
|
||||||
this.$refs.chartbox.endLoading();
|
this.$refs.chartbox.endLoading();
|
||||||
@@ -618,10 +642,37 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getDcTrafficData() {
|
||||||
|
this.$get('idc/trafficSetting', {pageSize: -1}).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.trafficTagData = [];
|
||||||
|
response.data.list.forEach(item => {
|
||||||
|
if (!(this.trafficDatacenterData.some(idc => {
|
||||||
|
return item.idc.id == idc.id;
|
||||||
|
}))) {
|
||||||
|
this.trafficDatacenterData.push(item.idc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
response.data.list.forEach(item => {
|
||||||
|
if (item.tags) {
|
||||||
|
for (let key in item.tags) {
|
||||||
|
//过滤重复的tag(key、value同时相等)
|
||||||
|
if (!(this.trafficTagData.some(tag => {
|
||||||
|
return tag.name == key && tag.value == item.tags[key];
|
||||||
|
}))) {
|
||||||
|
this.trafficTagData.push({name: key, value: item.tags[key]});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
/*初始化数据 end*/
|
/*初始化数据 end*/
|
||||||
|
|
||||||
dateChange(val) {
|
dateChange(val) {
|
||||||
this.trendSearchTime.start = val[0];
|
this.trendSearchParam.start = val[0];
|
||||||
this.trendSearchTime.end = val[1];
|
this.trendSearchParam.end = val[1];
|
||||||
this.queryAlertTrendData();
|
this.queryAlertTrendData();
|
||||||
},
|
},
|
||||||
topNChange(type, top) {
|
topNChange(type, top) {
|
||||||
@@ -634,6 +685,31 @@
|
|||||||
this.queryAlertStatByRule();
|
this.queryAlertStatByRule();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
selectDatacenter(dc) {
|
||||||
|
let index = this.trendSearchParam.dc.indexOf(parseInt(dc.id));
|
||||||
|
if (index == -1) {
|
||||||
|
this.trendSearchParam.dc.push(parseInt(dc.id));
|
||||||
|
} else {
|
||||||
|
this.trendSearchParam.dc.splice(index, 1);
|
||||||
|
}
|
||||||
|
this.queryAlertTrendData();
|
||||||
|
},
|
||||||
|
selectTag(tag) {
|
||||||
|
let index = -1;
|
||||||
|
this.trendSearchParam.tag.some((item, i) => {
|
||||||
|
if (item.name == tag.name && item.value == tag.value) {
|
||||||
|
index = i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if (index == -1) {
|
||||||
|
this.trendSearchParam.tag.push(tag);
|
||||||
|
} else {
|
||||||
|
this.trendSearchParam.tag.splice(index, 1);
|
||||||
|
}
|
||||||
|
this.queryAlertTrendData();
|
||||||
|
},
|
||||||
alertMessageChange(type) {
|
alertMessageChange(type) {
|
||||||
this.bottom3DropdownShow = false;
|
this.bottom3DropdownShow = false;
|
||||||
this.alertMessageShow = type;
|
this.alertMessageShow = type;
|
||||||
|
|||||||
Reference in New Issue
Block a user