-
-
-
{{key}}
-
{{key}}
+
+
+
+
+
+
{{assetKey[key]}}
+
{{assetKey[key]}}
+
+
+
+
{{value == 1 ? $t('asset.createAssetTab.inStock') : $t('asset.createAssetTab.outStock')}}
+
{{value + ' ' + $t('overall.active')}}
+
+
+ {{value ? value + 'ms' : ''}}
+
+
+ {{_item}}
+
+
+
+
+
+
+
+
+
+
+
{{value ? value : " "}}
+
-
-
-
-
-
- {{value}}
- {{value}}
-
+
+
+
+
+
+ {{projectKey[key]}}
+ {{projectKey[key]}}
+
+
+ {{moduleKey[key]}}
+ {{moduleKey[key]}}
+
+
+
+
+
+ {{value[0]}}
+
+ {{value[1]}}
+
+ {{value[2]}}
+
+
+
+ {{value[0]}}
+
+ {{value[1]}}
+
+
{{value ? value : " "}}
+
{{value ? value : " "}}
+
-
+
+
+
+
+
+ {{projectKey[key]}}
+ {{projectKey[key]}}
+
+
+ {{moduleKey[key]}}
+ {{moduleKey[key]}}
+
+
+
+
+
+ {{value[0]}}
+
+ {{value[1]}}
+
+ {{value[2]}}
+
+
+
+ {{value[0]}}
+
+ {{value[1]}}
+
+
{{value ? value : " "}}
+
{{value ? value : " "}}
+
+
+
@@ -108,6 +203,51 @@
divFirstShow:false,
searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()],//全屏显示的时间
oldSearchTime: [],
+
+ assetKey: {
+ host: this.$t("asset.tableTitle.host"),
+ id: "Id",
+ assetType: this.$t("asset.tableTitle.assetType"),
+ sn: this.$t("asset.tableTitle.device"),
+ state: this.$t("asset.tableTitle.assetState"),
+ pingRtt: this.$t('asset.tableTitle.assetPing'),
+ dataCenter: this.$t("asset.tableTitle.dataCenter"),
+ cabinet: this.$t("asset.tableTitle.cabinet"),
+ model: this.$t("asset.tableTitle.model"),
+ vendor: this.$t("asset.tableTitle.vendor"),
+ purchaseDate: this.$t("asset.tableTitle.procurementDate"),
+ principal: this.$t("asset.tableTitle.principal"),
+ tel: this.$t("asset.tableTitle.principalTel"),
+ pingStatus: this.$t('asset.tableTitle.assetPing'),
+ pingLastReply: this.$t('asset.tableTitle.lastReply'),
+ endpoint: this.$t("asset.tableTitle.modules"),
+ alert: this.$t("asset.tableTitle.alerts")
+ },
+ projectKey: {
+ id: "ID",
+ name: this.$t("overall.name"),
+ remark: this.$t("overall.remark"),
+ alertStat: this.$t("project.chart.alertStat"),
+ },
+ moduleKey: {
+ id: "ID",
+ name: this.$t("overall.name"),
+ type: this.$t("overall.type"),
+ remark: this.$t("overall.remark"),
+ endpointStat: this.$t("project.chart.endpointStat"),
+ alertStat: this.$t("project.chart.alertStat"),
+ },
+ endpointKey: {
+ id: "ID",
+ host: this.$t("project.endpoint.host"),
+ port: this.$t("project.endpoint.port"),
+ path: this.$t("project.endpoint.path"),
+ param: this.$t("project.endpoint.param"),
+ port: this.$t("project.endpoint.port"),
+ state: this.$t("alert.list.state"),
+ project: this.$t("project.project.project"),
+ module: this.$t("project.module.module")
+ },
};
},
methods: {
@@ -133,6 +273,27 @@
let vm = this;
this.$chartResizeTool.start(vm, this.data, e);
},
+ setLabels:function(source){
+ let labels=[];
+ source.forEach(item=>{
+ labels=labels.concat(Object.keys(item))
+ })
+ labels=Array.from(new Set(labels));
+
+ labels=labels.map(item=>{
+ return{
+ label:this.replaceSplit(item),
+ prop:item,
+ show:true,
+ }
+ });
+ return labels;
+ },
+ replaceSplit(key){
+ if(key) {
+ return key.replace(/\$_\$/g,' ')
+ }
+ },
hideElement(index) {
if (this.show.indexOf(index) > -1) {
this.show.splice(this.show.indexOf(index), 1);
diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue
index f233031f9..72acc04e4 100644
--- a/nezha-fronted/src/components/charts/chart-list.vue
+++ b/nezha-fronted/src/components/charts/chart-list.vue
@@ -562,7 +562,7 @@
id: -9,
panelId: 0,
title: this.$t("alert.config.chart.alertNumTrend"),
- span: 4,
+ span: 8,
height: 350,
type: "line",
prev: -10,
@@ -576,6 +576,7 @@
});
this.$nextTick(() => {
this.dataList.forEach((item,index) => {
+ this.$set(item, "from", params.from);
this.setChartSize(item, index);//设置该图表宽度
let chartBox = document.getElementById('chart-' + item.id);
this.handleElementInViewport(chartBox, 0, item, index);
@@ -631,6 +632,7 @@
});
this.$nextTick(() => {
this.dataList.forEach((item,index) => {
+ this.$set(item, "from", params.from);
this.setChartSize(item, index);//设置该图表宽度
let chartBox = document.getElementById('chart-' + item.id);
this.handleElementInViewport(chartBox, 0, item, index);
@@ -671,6 +673,7 @@
if (this.dataList.length > 0 ) {
this.dataList.forEach((item,index) => {
this.setChartSize(item, index);//设置该图表宽度
+ this.$set(item, "from", params.from);
if (param.from == "asset") {
if (item.type == "assetInfo") {
this.$set(item, "draggable", true);
@@ -1229,6 +1232,7 @@
getEndpointInfoChartData(chartInfo) {
let vm = this;
let detail = [];
+ this.$refs['editChart'+chartInfo.id][0].showLoad();
chartInfo.title = this.$t("project.chart.endpointInfo");
detail.push({title: this.$t("project.chart.basicTitle"), data: function() {
let data = {};
@@ -1293,39 +1297,33 @@
this.$refs['editChart'+chartInfo.id][0].setData(chartInfo, detail, this.filter.panelId, this.filter);
});
}else {
- let data={
- Basic:{
- sn:'assetInfo Test',
- host:'192.168.40.42',
- host1:'192.168.40.42',
- host2:'192.168.40.42',
- host3:'192.168.40.42',
- host4:'192.168.40.42',
- host5:'192.168.40.42',
- host6:'192.168.40.42',
- host7:'192.168.40.42',
- host8:'192.168.40.42',
- host9:'192.168.40.42',
- host10:'192.168.40.42',
- pingStatus:1,
- pingRtt:80,
- cpuNum:'8',
- memery:'12GB',
- memery$_$free:'3GB'
- },
- Feature:{
- CPU:"Intel E500",
- Memory:"256GB",
- NetworkInterface:["eth0","eth1"],
- Disk:[{
- mount:"/",
- total:"256GB",
- free:"128GB",
- usageRate:"50%"
+ detail.push({
+ title: vm.$t('asset.createAssetTab.basicTitle'),
+ data: {
+ sn: 'assetInfo Test',
+ host: '192.168.40.42',
+ pingStatus: 1,
+ pingRtt: 80,
+ cpuNum: '8',
+ memery: '12GB',
+ memery$_$free: '3GB'
+ }
+ });
+ detail.push({
+ title: vm.$t('asset.createAssetTab.featureTitle'),
+ data: {
+ CPU: "Intel E500",
+ Memory: "256GB",
+ NetworkInterface: ["eth0", "eth1"],
+ Disk: [{
+ mount: "/",
+ total: "256GB",
+ free: "128GB",
+ usageRate: "50%"
}]
}
- }
- this.$refs['editChart'+chartInfo.id][0].setData(chartInfo, data, this.filter.panelId, this.filter);
+ });
+ this.$refs['editChart'+chartInfo.id][0].setData(chartInfo, detail, this.filter.panelId, this.filter);
}
},
getProjectInfoChartData(chartInfo){
@@ -1338,13 +1336,15 @@
response.data && function() {
response.data.basic && detail.push({
title: vm.$t('project.chart.basicTitle'),
- data: response.data.basic
+ data: response.data.basic,
+ type: "project"
});
response.data.module && function() {
response.data.module.forEach(d => {
detail.push({
title: `${vm.$t('project.module.module')}:${d.name}`,
- data: d
+ data: d,
+ type: "module"
});
});
}();
@@ -1408,16 +1408,17 @@
this.$get("alert/rule/stat?id=" + this.additionalInfo.id).then(response => {
if (response.code == 200) {
response.data && function () {
- for (let type in response.data) {
- if (type == "project" && response.data.project.length > 0) {
- detail.push({title: vm.$t("project.project.project"), data: convert(response.data.project)});
- } else if (type == "module" && response.data.module.length > 0) {
- detail.push({title: vm.$t("project.module.module"), data: convert(response.data.module)});
- } else if (type == "asset" && response.data.asset.length > 0) {
- detail.push({title: vm.$t("asset.asset"), data: convert(response.data.asset)});
- } else if (type == "endpoint" && response.data.endpoint.length > 0) {
- detail.push({title: vm.$t("project.endpoint.endpoint"), data: convert(response.data.endpoint)});
- }
+ if (response.data.project && response.data.project.length > 0) {
+ detail.push({title: vm.$t("project.project.project"), data: convert(response.data.project)});
+ }
+ if (response.data.module && response.data.module.length > 0) {
+ detail.push({title: vm.$t("project.module.module"), data: convert(response.data.module)});
+ }
+ if (response.data.endpoint && response.data.endpoint.length > 0) {
+ detail.push({title: vm.$t("project.endpoint.endpoint"), data: convert(response.data.endpoint)});
+ }
+ if (response.data.asset && response.data.asset.length > 0) {
+ detail.push({title: vm.$t("asset.asset"), data: convert(response.data.asset)});
}
}();
resolve(true);
diff --git a/nezha-fronted/src/components/charts/chart.scss b/nezha-fronted/src/components/charts/chart.scss
index 0aa69b826..8d8ba40c9 100644
--- a/nezha-fronted/src/components/charts/chart.scss
+++ b/nezha-fronted/src/components/charts/chart.scss
@@ -171,6 +171,18 @@
.pagination {
padding-top: 0;
}
+ .success {
+ background-color: #50d050;
+ color: white;
+ padding: 2px 5px;
+ border-radius: 4px;
+ }
+ .danger {
+ background-color: #d64f40;
+ color: white;
+ padding:2px 5px;
+ border-radius: 4px;
+ }
.chart-table, .chart-alert-info {
width: 100%;
.table-container {