diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss
index 3edfd880f..911d125be 100644
--- a/nezha-fronted/src/assets/stylus/main.scss
+++ b/nezha-fronted/src/assets/stylus/main.scss
@@ -1376,14 +1376,14 @@ li{
margin-left: 10px;
}
/* start--param*/
-.param-box {
+.param-box, .tag-edit-box {
border: 1px solid #DCDFE6;
border-radius: 4px;
}
.param-box-endpoint {
height: 325px;
}
-.param-box-module {
+.param-box-module, .tag-edit-box {
height: 140px;
}
.param-box-row {
@@ -2042,3 +2042,35 @@ li{
font-family: NotoSans !important;
font-size: 12px !important;
}
+
+.tag-edit-box {
+ .tag-edit-box-head {
+ display: flex;
+ box-sizing: border-box;
+ >div {
+ font-size: 13px;
+ color: #0275b8;
+ }
+ >div:not(:last-of-type) {
+ width: calc(50% - 25px);
+ padding: 0 10px;
+ }
+ >div:last-of-type {
+ width: 50px;
+ }
+ }
+ .tag-edit-box-body {
+ display: flex;
+ box-sizing: border-box;
+ .tag-edit {
+ padding: 0 10px;
+ }
+ >div:not(:last-of-type) {
+ width: calc(50% - 25px);
+ padding: 0 10px;
+ }
+ >div:last-of-type {
+ width: 50px;
+ }
+ }
+}
diff --git a/nezha-fronted/src/components/charts/chart-detail.vue b/nezha-fronted/src/components/charts/chart-detail.vue
index 49ad1c8bb..9bf205af6 100644
--- a/nezha-fronted/src/components/charts/chart-detail.vue
+++ b/nezha-fronted/src/components/charts/chart-detail.vue
@@ -42,6 +42,19 @@
{{$t('asset.createAssetTab.cli')}}
@@ -229,7 +188,9 @@
-
+
+
+
@@ -291,6 +252,7 @@
passwordTip:'',
reloginPasswordTip:''
}],
+ tags: [],
exporter: 0
},
modelSize:1,
@@ -546,6 +508,18 @@
this.getAssetTypeOptionData();
}
},
+ addTag() {
+ this.assetData.tags.push({tag: "", value: ""});
+ this.$nextTick(() => {
+ this.$refs.tagEditBoxScrollbar.update();
+ });
+ },
+ removeTag: function(index) {
+ this.assetData.tags.splice(index, 1);
+ this.$nextTick(() => {
+ this.$refs.tagEditBoxScrollbar.update();
+ });
+ },
clickOutSide(data) {
if (data) {
this.editQuit();
@@ -593,10 +567,9 @@
},100)
},
modelChange:function(ids){
- let modelId=ids[1];
let model=this.allModelUlData.find((item,index)=>{
- return modelId==item.id;
- })
+ return ids==item.id;
+ });
this.modelSize=model.usize;
},
getAssetData(data) {
@@ -625,7 +598,8 @@
this.assetData.sn = this.obj.sn
this.assetData.host = this.obj.host
this.assetData.state = this.obj.state
- this.assetData.idcId = this.obj.idc.id
+ this.assetData.idcId = this.obj.idc.id;
+ this.assetData.tags = this.obj.tags;
this.assetData.cabinetId = this.obj.cabinet == null ? '' : this.obj.cabinet.id
this.assetData.purchaseDate = this.obj.purchaseDate;
// this.assetData.accounts[0].id = this.obj.accounts[0].id
@@ -828,7 +802,8 @@
userTip:"",
passwordTip:'',
reloginPasswordTip:''
- }]
+ }],
+ tags: []
};
this.assetType = '';
this.idcSelectedData = {
@@ -855,9 +830,6 @@
};
if (data === 'asset') {
- /*if (this.assetData.modelId) {
- this.assetData.modelId = this.assetData.modelId.join(',').split(',')[1];
- }*/
if(this.locationInfo){
if(this.locationInfo.idc){
this.assetData.idcId=this.locationInfo.idc.id;
@@ -871,32 +843,9 @@
}
}
- // let modelId = this.assetData.modelId.join(',').split(',')[1];
- // let form = new FormData();
- // form.append("id", this.pageObj.id);
- // form.append("sn", this.assetData.sn);
- // form.append("host", this.assetData.host);
- // form.append("state", this.assetData.state);
- // form.append("purchaseDate", !this.assetData.purchaseDate?'':this.assetData.purchaseDate);
- // form.append("idcId", this.assetData.idcId);
- // form.append("cabinetId", this.assetData.cabinetId);
- // form.append("modelId", modelId);
if (!this.accountSwitch) {
this.assetData.accounts = [];
}
- // for(let i in this.assetData.accounts){
- // let account=this.assetData.accounts[i];
- // if(account.user){
- // if (account.id) {
- // form.append("accounts["+i+"].id", account.id);
- // }
- // form.append("accounts["+i+"].authType",account.authType);
- // form.append("accounts["+i+"].user", account.user);
- // form.append("accounts["+i+"].port", account.port);
- // form.append("accounts["+i+"].pwd", account.pwd);
- // form.append("accounts["+i+"].privateKey", account.privateKey);
- // }
- // }
if(this.$refs.accountConfigBox&&this.$refs.accountConfigBox.length>0){
this.$refs.accountConfigBox[0].validateAccount();
@@ -907,18 +856,16 @@
if (this.pageObj.id) {
this.assetData.id=this.pageObj.id;
let reqData = JSON.parse(JSON.stringify(this.assetData));
- // if (reqData.modelId) {
- // reqData.modelId = reqData.modelId.join(',').split(',')[1];
- // }
+ if (typeof reqData.modelId == "object") {
+ reqData.modelId = reqData.modelId[1];
+ }
this.$put('asset', reqData).then(res => {
- const h = this.$createElement;
if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.pageObj.id = '';
this.$emit('refreshData', 'true');
this.sendStateData('close');
} else {
- //this.assetData.modelId = tempModelId;
this.$message.error(res.msg);
}
});
@@ -926,53 +873,17 @@
if(this.$refs.accountConfigBox&&this.$refs.accountConfigBox.length>0){
this.$refs.accountConfigBox[0].validateAccount();
}
- let modelId = ''
- // let authType = ''
- // if (this.assetData.modelId !== '') {
- // modelId = this.assetData.modelId.join(',').split(',')[1]
- // } else {
- // this.assetData.modelId = ''
- // }
- // if (this.assetData.accounts[0].user === '') {
- // authType = ''
- // } else {
- // authType = this.assetData.accounts[0].authType
- // }
- // let form = new FormData();
- // form.append("sn", this.assetData.sn);
- // form.append("host", this.assetData.host);
- // form.append("state", this.assetData.state);
- // form.append("purchaseDate", !this.assetData.purchaseDate?'':this.assetData.purchaseDate);
- // form.append("idcId", this.assetData.idcId);
- // form.append("cabinetId", this.assetData.cabinetId);
- // form.append("modelId", modelId);
- // if(this.accountSwitch){
- // for(let i in this.assetData.accounts){
- // let account=this.assetData.accounts[i];
- // if(account.user){
- // form.append("accounts["+i+"].authType",account.authType);
- // form.append("accounts["+i+"].user", account.user);
- // form.append("accounts["+i+"].port", account.port);
- // form.append("accounts["+i+"].pwd", account.pwd);
- // form.append("accounts["+i+"].privateKey", account.privateKey)
- // }
- // }
- // }
- // form.append("exporter",parseInt(this.assetData.exporter));
this.$post('asset', this.assetData).then(res => {
- const h = this.$createElement;
if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.$emit('refreshData', 'true');
this.sendStateData('close');
} else {
- // this.assetData.modelId = tempModelId;
this.$message.error(res.msg);
}
});
}
} else {
- // this.assetData.modelId = tempModelId;
return false;
}
});
diff --git a/nezha-fronted/src/components/page/asset/accountConfig.vue b/nezha-fronted/src/components/page/asset/accountConfig.vue
index 55101957d..8c43186fd 100644
--- a/nezha-fronted/src/components/page/asset/accountConfig.vue
+++ b/nezha-fronted/src/components/page/asset/accountConfig.vue
@@ -1,19 +1,7 @@
-
+
-
-
+
{{$t('asset.createAssetTab.sshProtocol')}}
@@ -21,15 +9,8 @@
{{$t('asset.createAssetTab.telnetProtocol')}}
-
- {{account.protocol=='SSH'?$t('asset.createAssetTab.sshProtocol'):$t('asset.createAssetTab.telnetProtocol')}}
-
-
-
-
-
- {{account.user}}
+
@@ -37,37 +18,16 @@
{{$t('asset.createAssetTab.ssh')}}
-
+
-
-
+
+
-
- {{account.port}}
+
-
-
-
@@ -77,7 +37,6 @@ export default {
name: "accountConfig",
props:{
account:{type:Object},
- isEdit:{type:Boolean,default:true},
isAllowedChangeProtocol:{type:Boolean,default:true}
},
created() {
diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
index fc8d504ba..0124fb84f 100644
--- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
+++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue
@@ -82,18 +82,6 @@
{{$t("dashboard.overview.traffic")}}
-
{this.trendLoading = isLoading}">
-
No Data
@@ -117,8 +104,6 @@
{{$t("dashboard.overview.dataCenter.dataCenter")}}
{this.mapLoading = isLoading}">
-
-
@@ -909,8 +894,6 @@
this.$get('idc/trafficSetting', {pageSize: -1}).then(response => {
if (response.code === 200) {
this.trafficData = this.convertTrafficData(response.data.list);
-
- //console.info(this.trafficData)
}
});
},
@@ -918,28 +901,14 @@
let result = [];
data.forEach(item => {
let hasDc = result.some(dc => { //dc去重
- if (dc.label == item.idc.name) {
+ if (item.idc && dc.label == item.idc.name) {
return true;
}
});
- if (!hasDc) {
+ if (item.idc && !hasDc) {
result.push({label: item.idc.name, value: "$dc$::" + item.idc.name, level: 1});
}
});
- /*data.forEach(item => {
- let hasDc = result.some(dc => { //dc去重
- if (dc.label == item.idc.name) {
- handleTag(dc, item.tags);
- return true;
- }
- return false;
- });
- if (!hasDc) {
- let dc = {label: item.idc.name, value: "$dc$::" + item.idc.name, children: [], level: 1};
- handleTag(dc, item.tags);
- result.push(dc);
- }
- });*/
function handleTag(dc, tagData) { // dc: cascader数据里的第一级;tagData: 原始数据中的tags
if (tagData) {
let tags = dc.children;
@@ -1386,7 +1355,6 @@
}
},
mounted() {
- this.initDate();
this.initData();
window.onresize = () => {
setTimeout(() => {
diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue
index ea11a5c82..4d51d26b1 100644
--- a/nezha-fronted/src/components/page/project/project.vue
+++ b/nezha-fronted/src/components/page/project/project.vue
@@ -105,7 +105,7 @@
min-width="110px"
>