Skip to content

Commit 1f62569

Browse files
committed
Disable commands when th previous command is executed
1 parent 6d2b773 commit 1f62569

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dkg-frontend",
3-
"version": "0.7.4",
3+
"version": "0.7.5",
44
"private": true,
55
"scripts": {
66
"dev": "vite",

src/components/Rounds_List.vue

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,46 +147,64 @@ function formatTimeouts(item) {
147147
return tt
148148
}
149149
150+
let isOps = false
151+
152+
150153
async function newRound(maxNodes, timeout2, timeout3, timeoutR) {
154+
if (isUpdating || isOps) {
155+
return
156+
}
151157
const roundSettings = {
152158
maxNodes: maxNodes,
153159
timeout2: timeout2,
154160
timeout3: timeout3,
155161
timeoutR: timeoutR
156162
}
163+
isOps = true
157164
roundsStore.add(roundSettings)
158165
.then(() => {
159166
updateDataGrid()
160167
})
161168
.catch((error) => {
162169
alertStore.error(error)
163170
})
171+
.finally(() => isOps = false)
164172
}
165173
166174
async function cancelRound(id) {
175+
if (isUpdating || isOps) {
176+
return
177+
}
178+
isOps = true
167179
roundsStore.cancel(id)
168180
.then(() => {
169181
updateDataGrid()
170182
})
171183
.catch((error) => {
172184
alertStore.error(error)
173185
})
186+
.finally(() => isOps = false)
174187
}
175188
176189
async function nextRoundStep(id) {
190+
if (isUpdating || isOps) {
191+
return
192+
}
193+
isOps = true
177194
roundsStore.next(id)
178195
.then(() => {
179196
updateDataGrid()
180197
})
181198
.catch((error) => {
182199
alertStore.error(error)
183200
})
201+
.finally(() => isOps = false)
184202
}
185203
186204
let isUpdating = false
187205
188206
const updateDataGrid = async () => {
189-
if (isUpdating) {
207+
if (isUpdating || isOps) {
190208
return
191209
}
192210
@@ -257,7 +275,7 @@ function showCancel(item) {
257275
<hr class="hr" />
258276
259277
<div class="link-crt">
260-
<a class="link" @click="newRound(authStore.max_nodes, authStore.timeout2, authStore.timeout3, authStore.timeoutR)">
278+
<a class="link" @click="newRound(authStore.max_nodes, authStore.timeout2, authStore.timeout3, authStore.timeoutR)" :disabled ="isUpdating || isOps">
261279
<font-awesome-icon size="1x" icon="fa-solid fa-plus" class="link" />
262280
New round
263281
</a>
@@ -311,7 +329,7 @@ function showCancel(item) {
311329
</template>
312330
313331
<template v-slot:[`item.actionNext`]="{ item }">
314-
<button @click="nextRoundStep(item['id'])" class="anti-btn" v-if="showProceed(item)">
332+
<button @click="nextRoundStep(item['id'])" class="anti-btn" v-if="showProceed(item)" :disabled ="isUpdating || isOps">
315333
<font-awesome-icon size="1x" :icon= "'fa-solid ' + item['nextStatus'].actionIcon" class="anti-btn" />
316334
</button>
317335
<v-tooltip v-if="showProceed(item)"
@@ -320,7 +338,7 @@ function showCancel(item) {
320338
</template>
321339
322340
<template v-slot:[`item.actionCancel`]="{ item }">
323-
<button @click="cancelRound(item['id'])" class="anti-btn" v-if="showCancel(item)">
341+
<button @click="cancelRound(item['id'])" class="anti-btn" v-if="showCancel(item)" :disabled ="isUpdating || isOps">
324342
<font-awesome-icon size="1x" :icon= "'fa-solid ' + item['cancelStatus'].actionIcon" class="anti-btn" />
325343
<v-tooltip v-if="showCancel(item)"
326344
activator="parent"

0 commit comments

Comments
 (0)