diff --git a/nezha-fronted/src/components/common/popBox/guide.vue b/nezha-fronted/src/components/common/popBox/guide.vue
index 522c3cafa..ac5e961ee 100644
--- a/nezha-fronted/src/components/common/popBox/guide.vue
+++ b/nezha-fronted/src/components/common/popBox/guide.vue
@@ -4,6 +4,7 @@
:visible.sync="visible"
custom-class="guild-pop"
width="1000px"
+ @close="close"
>
@@ -119,7 +120,7 @@ export default {
},
methods: {
close () {
- this.visible = false
+ this.$emit('close')
},
enter (index) {
this.interval = setInterval(() => {
@@ -130,13 +131,27 @@ export default {
this.interval && clearInterval(this.interval)
},
downloadAgent () {
- // TODO
+ this.$emit('close')
+ this.$router.push({
+ path: '/agent',
+ query: {
+ t: +new Date(),
+ download: 'agent'
+ }
+ })
},
openTerminal () {
- // TODO
+ this.$emit('close')
+ this.$router.push({
+ path: '/asset',
+ query: {
+ t: +new Date()
+ }
+ })
+ this.$store.commit('openConsole')
},
jump (route) {
- this.visible = false
+ this.$emit('close')
this.$router.push({
path: route,
query: {
@@ -145,7 +160,7 @@ export default {
})
},
jumpAndOpen (cmd, open) {
- this.visible = false
+ this.$emit('close')
switch (cmd) {
case 'dc': {
this.$router.push({
@@ -177,6 +192,16 @@ export default {
})
break
}
+ case 'importAsset': {
+ this.$router.push({
+ path: '/asset',
+ query: {
+ t: +new Date(),
+ importAsset: 'importAsset'
+ }
+ })
+ break
+ }
case 'project': {
this.$router.push({
path: '/monitor/project',
@@ -207,6 +232,16 @@ export default {
})
break
}
+ case 'importEndpoint': {
+ this.$router.push({
+ path: '/monitor/endpoint',
+ query: {
+ t: +new Date(),
+ importEndpoint: 'importEndpoint'
+ }
+ })
+ break
+ }
case 'panel': {
this.$router.push({
path: '/panel',
@@ -237,12 +272,24 @@ export default {
})
break
}
+ case 'cabinet': {
+ this.$router.push({
+ path: '/dc',
+ query: {
+ t: +new Date(),
+ add: 'cabinet'
+ }
+ })
+ break
+ }
default: break
}
+ // location.reload()
}
},
watch: {
showDialog (n) {
+ console.log(n)
this.visible = n
},
activeIndex (n) {
diff --git a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue
index f9f3e4ce0..adf17065f 100644
--- a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue
@@ -1,16 +1,21 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
-
{{editCabinet.id ? $t("config.dc.editCabinet") : $t("overall.createCabinet")}}
+
@@ -20,10 +25,13 @@
-
+
+
+
+
-
+
@@ -48,15 +56,23 @@ export default {
name: 'cabinetBox',
props: {
obj: { type: Object },
- currentDc: { type: Object }
+ currentDc: { type: Object },
+ dcDisabled: {
+ type: Boolean,
+ default: true
+ }
},
data () {
return {
editCabinet: {},
+ dcData: '',
rules: {
name: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
+ idcId: [
+ { required: true, message: this.$t('validate.required'), trigger: 'change' }
+ ],
uSize: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
{ type: 'number', min: 1, max: 47, message: this.$t('validate.uSize'), trigger: 'blur' }
@@ -75,9 +91,12 @@ export default {
save () {
if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true
+ if (!this.editCabinet.idcId) {
+ this.editCabinet.idcId = this.currentDc.id
+ }
this.$refs.cabinetForm.validate(valid => {
if (valid) {
- this.editCabinet.idcId = this.currentDc.id
+ this.editCabinet.dcId = this.currentDc.id || this.editCabinet.idcId
if (this.editCabinet.id) {
this.$put('/dc/cabinet', this.editCabinet).then(res => {
this.prevent_opt.save = false
@@ -125,6 +144,11 @@ export default {
}).catch(() => {
this.prevent_opt.save = false
})
+ },
+ getDcData () {
+ this.$get('dc', { pageSize: -1 }).then(res => {
+ this.dcData = res.data.list
+ })
}
},
watch: {
@@ -137,6 +161,11 @@ export default {
}
}
}
+ },
+ mounted () {
+ if (!this.dcDisabled) {
+ this.getDcData()
+ }
}
}
diff --git a/nezha-fronted/src/components/common/rightBox/panelBox.vue b/nezha-fronted/src/components/common/rightBox/panelBox.vue
index fb240cdac..395f5b143 100644
--- a/nezha-fronted/src/components/common/rightBox/panelBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/panelBox.vue
@@ -40,7 +40,7 @@ export default {
},
data () {
return {
- url: '/panel',
+ url: 'visual/panel',
editPanel: {},
rules: {
name: [
diff --git a/nezha-fronted/src/components/layout/header.vue b/nezha-fronted/src/components/layout/header.vue
index de11427e2..e67f841b0 100644
--- a/nezha-fronted/src/components/layout/header.vue
+++ b/nezha-fronted/src/components/layout/header.vue
@@ -55,7 +55,7 @@
-
+
diff --git a/nezha-fronted/src/components/page/alert/alertRule.vue b/nezha-fronted/src/components/page/alert/alertRule.vue
index 7c199c25b..ed6038c1a 100644
--- a/nezha-fronted/src/components/page/alert/alertRule.vue
+++ b/nezha-fronted/src/components/page/alert/alertRule.vue
@@ -162,11 +162,17 @@ export default {
}
},
mounted () {
- // 是否弹出侧滑
- const add = this.$route.query.add
- if (add) {
- if (add === 'alertRule') {
- this.add()
+ },
+ watch: {
+ $route: {
+ immediate: true,
+ handler () {
+ const add = this.$route.query.add
+ if (add) {
+ if (add === 'alertRule') {
+ this.add()
+ }
+ }
}
}
}
diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue
index 218aac5d6..34f907ebb 100644
--- a/nezha-fronted/src/components/page/asset/asset.vue
+++ b/nezha-fronted/src/components/page/asset/asset.vue
@@ -14,6 +14,7 @@