fix: prevent disk monitor action overlap
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
<DiskMonitorPolicyForm
|
||||
v-model="policyForm"
|
||||
:disabled="loading.init"
|
||||
:disabled="formBusy"
|
||||
:save-loading="loading.save"
|
||||
:run-loading="loading.run"
|
||||
@save="handleSave"
|
||||
@@ -22,7 +22,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
@@ -51,6 +51,7 @@ const loading = reactive({
|
||||
run: false,
|
||||
jobs: false
|
||||
})
|
||||
const formBusy = computed(() => loading.init || loading.save || loading.run)
|
||||
|
||||
const handleBack = async () => {
|
||||
await router.push('/systemMonitor')
|
||||
@@ -90,6 +91,8 @@ const loadPageData = async () => {
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
if (formBusy.value) return
|
||||
|
||||
const errorMessage = validatePolicy(policyForm.value)
|
||||
if (errorMessage) {
|
||||
ElMessage.warning(errorMessage)
|
||||
@@ -111,6 +114,8 @@ const handleSave = async () => {
|
||||
}
|
||||
|
||||
const handleRun = async () => {
|
||||
if (formBusy.value) return
|
||||
|
||||
loading.run = true
|
||||
try {
|
||||
await runDiskMonitorJob({
|
||||
|
||||
Reference in New Issue
Block a user