Give early busy feedback on app start/stop
This commit is contained in:
@@ -55,7 +55,9 @@ function onSetView(newView) {
|
||||
window.location.hash = `/app/${id.value}/${newView}`;
|
||||
}
|
||||
|
||||
const toggleRunStateBusy = ref(false);
|
||||
async function onToggleRunState() {
|
||||
toggleRunStateBusy.value = true;
|
||||
if (isAppStopped.value) {
|
||||
const [error] = await appsModel.start(app.value.id);
|
||||
if (error) return console.error(error);
|
||||
@@ -63,6 +65,7 @@ async function onToggleRunState() {
|
||||
const [error] = await appsModel.stop(app.value.id);
|
||||
if (error) return console.error(error);
|
||||
}
|
||||
setTimeout(() => toggleRunStateBusy.value = false, 2000);
|
||||
}
|
||||
|
||||
let refreshTimer = null;
|
||||
@@ -188,9 +191,9 @@ onBeforeUnmount(() => {
|
||||
<Button v-if="app.taskId" danger tool plain icon="fa-solid fa-xmark" v-tooltip="'Cancel Task'" :loading="busyStopTask" :disabled="busyStopTask" @click="onStopAppTask()"/>
|
||||
<Button secondary tool
|
||||
@click="onToggleRunState()"
|
||||
:disabled="app.taskId || app.error || app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
:disabled="toggleRunStateBusy || app.taskId || app.error || app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
v-tooltip="$t(isAppStopped ? 'app.uninstall.startStop.startAction' : 'app.uninstall.startStop.stopAction')"
|
||||
:loading="app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
:loading="toggleRunStateBusy || app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
:icon="isAppStopped ? 'fa-solid fa-play' : 'fa-solid fa-power-off'"
|
||||
/>
|
||||
<ButtonGroup>
|
||||
|
||||
Reference in New Issue
Block a user