diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index fdfd6b4a4..2a9e98767 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -556,6 +556,7 @@ const cn = { confirmExpired: '确认失效吗?', confirmOvertime: '确定关闭吗?', // Are you sure you want to delete? killTerm: '确认关闭 terminal 吗?', + resetPrompt: '确认重置吗?', confirmBatchDelete: '确定删除这{0}条数据吗?', assetConfirmDelete: '关联的Endpoint和告警将会被删除,确认删除吗?', yes: '是', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 30aeaf4e8..4b2b18611 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -563,6 +563,7 @@ const en = { confirmExpired: 'Are you sure you want to expired?', confirmOvertime: "Are you sure it's off?", killTerm: 'Are you sure you want to kill terminal?', + resetPrompt: 'Are you sure to reset?', confirmBatchDelete: 'Are you sure to delete these {0} pieces of data', assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?', // Related endpoints and alerts will be removed, are you sure you want to delete this asset? yes: 'Yes', // "是" diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index 9cfeeb1b0..ef970635a 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue @@ -152,7 +152,7 @@ diff --git a/nezha-fronted/src/components/page/config/system.vue b/nezha-fronted/src/components/page/config/system.vue index b01a1ef24..5d486a383 100644 --- a/nezha-fronted/src/components/page/config/system.vue +++ b/nezha-fronted/src/components/page/config/system.vue @@ -225,7 +225,7 @@ @@ -233,7 +233,7 @@ - + {{$t('overall.reset')}} @@ -801,6 +801,34 @@ export default { const minute = offsetHour == 0 && offsetMinute == 0 ? '' : (offsetMinute == 0 ? ':00' : (Math.abs(offsetMinute) > 9 ? ':' + Math.abs(offsetMinute) : ':0' + Math.abs(offsetMinute))) return 'UTC' + hour + minute + }, + resetSys () { + if (this.prevent_opt.save) { return } ; + this.prevent_opt.save = true + const resetParmas = { + type: this.reset.type, + pin: this.reset.pin + } + if (resetParmas.type && resetParmas.pin) { + this.$confirm(this.$t('tip.resetPrompt'), { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$put('/sys/config/reset', resetParmas).then(response => { + if (response.code == 200) { + this.$message({ duration: 2000, type: 'success', message: this.$t('tip.resetSuccess') }) + this.reset.type = '' + this.reset.pin = '' + } else { + this.$message.error(response.msg) + } + }) + }) + } else { + this.prevent_opt.save = false + return false + } } }, mounted () {