Merge branch 'dev-3.6' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.6

This commit is contained in:
Xiao Bai
2022-11-22 17:30:08 +08:00
6 changed files with 59 additions and 17 deletions

View File

@@ -9,7 +9,7 @@
</span>
</div>
<div class="file-directory-content" v-my-loading="fileDirectoryLoading">
<div v-if="fileDirectory !== '/'" @click="backFileDirectory" class="file-item"><i class="nz-icon nz-icon-a-upperlevel"/>{{$t('terminal.back')}}</div>
<div v-if="fileDirectory !== '/'" @click="backFileDirectory" class="file-item"><i class="nz-icon nz-icon-a-upperlevel" style="margin-right: 10px"/>{{$t('terminal.back')}}</div>
<div v-for="(item,index) in fileList" :key="index" class="file-item" @click="selectFile(item)">
<div class="text-ellipsis file-name">
<i class="nz-icon" :class="selIcon(item)"/>
@@ -58,7 +58,16 @@ export default {
fileList: [],
newFolderBoxShow: false,
folder: '',
fileDirectoryLoading: false
fileDirectoryLoading: false,
timer: ''
}
},
computed: {
updateUuid () {
return this.$store.getters.getUpdateUuid
},
updateIndex () {
return this.$store.getters.getUpdateIndex
}
},
mounted () {
@@ -69,6 +78,17 @@ export default {
if (n) {
this.init()
}
},
updateIndex (n) {
if (this.updateUuid == this.uuid) {
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
this.getSftpPath(this.fileDirectory)
this.timer = null
}, 200)
}
}
},
methods: {
@@ -169,6 +189,7 @@ export default {
if (res.code == 200) {
this.getSftpPath(this.fileDirectory)
} else {
this.getSftpPath(this.fileDirectory)
this.$message.error(res.msg)
}
})

View File

@@ -177,12 +177,14 @@ export default {
item.cancel.cancel('operation canceled by the user.')
if (item.done || (item.fileLength === item.total)) { // 取消 上传 50-100
clearInterval(item.timer)
this.$delete('/terminal/sftp/cancel/' + item.tid).then(res => {
if (res.code === 200) {
} else {
this.$message.error(res.msg)
}
})
if (item.tid) {
this.$delete('/terminal/sftp/cancel/' + item.tid).then(res => {
if (res.code === 200) {
} else {
this.$message.error(res.msg)
}
})
}
}
}
this.$store.dispatch('dispatchDelFileList', item)
@@ -234,6 +236,7 @@ export default {
item.isFinish = true
clearInterval(item.timer)
// todo 上传成功后 刷新对应terminal
this.$store.dispatch('upDateConsole', item.uuid)
}
})
}, 200)

View File

@@ -245,13 +245,13 @@ export default {
{ prop: 'ipam', name: this.$t('ipam.subnet.ipDetails'), active: true }
],
recordRule: {
evalLog: [
{ prop: 'recordRule', name: this.$t('overall.alertRuleEvalLog'), active: true },
{ prop: 'Metrics', name: this.$t('overall.metric'), active: false }
],
Metrics: [
{ prop: 'recordRule', name: this.$t('overall.alertRuleEvalLog'), active: false },
{ prop: 'Metrics', name: this.$t('overall.metric'), active: true }
{ prop: 'Metrics', name: this.$t('overall.metric'), active: true },
{ prop: 'recordRule', name: this.$t('overall.alertRuleEvalLog'), active: false }
],
evalLog: [
{ prop: 'Metrics', name: this.$t('overall.metric'), active: false },
{ prop: 'recordRule', name: this.$t('overall.alertRuleEvalLog'), active: true }
]
},
alertSilence: [

View File

@@ -101,7 +101,7 @@ export default {
const vars = this.$store.getters.getVariablesArr.map(item => {
return {
name: item.name,
value: item.checked.join('|')
values: item.checked
}
})
const params = {

View File

@@ -108,7 +108,7 @@
{{ $t("overall.option") }}
</div>
<div slot-scope="scope" class="table-operation-items">
<button class="table-operation-item" @click="showBottomBox('recordRule', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
<button class="table-operation-item" @click="showBottomBox('Metrics', scope.row)" :title="$t('overall.view')"><i class="nz-icon nz-icon-view1"></i></button>
<el-dropdown size="medium" v-has="['record_rule_edit','record_rule_delete']" trigger="click" @command="tableOperation">
<div class="table-operation-item table-operation-item--more" :title="$t('overall.moreOperations')">
<i class="nz-icon nz-icon-more3"></i>

View File

@@ -1,7 +1,9 @@
const terminalFile = {
state: {
fileList: [],
uploadItem: {}
uploadItem: {},
updateUuid: '', // 根据uuid的变化 判断页面是否需要刷新
updateIndex: 1
},
mutations: {
setFileList (state, arr) {
@@ -15,6 +17,13 @@ const terminalFile = {
},
setUploadItem (state, item) {
state.uploadItem = item
},
setUpdateUuid (state, uuid) {
state.updateUuid = uuid
state.updateIndex++
if (state.updateIndex == 10) {
state.updateIndex = 1
}
}
},
getters: {
@@ -23,6 +32,12 @@ const terminalFile = {
},
getUploadItem (state) {
return state.uploadItem
},
getUpdateUuid (state) {
return state.updateUuid
},
getUpdateIndex (state) {
return state.updateIndex
}
},
actions: {
@@ -37,6 +52,9 @@ const terminalFile = {
},
uploadFile (store, item) {
store.commit('setUploadItem', item)
},
upDateConsole (store, uuid) {
store.commit('setUpdateUuid', uuid)
}
}
}