Handle resubmission state for app devices errors
This commit is contained in:
@@ -34,7 +34,7 @@ async function onSubmitMemoryLimit() {
|
||||
if (error) return console.error(error);
|
||||
|
||||
// give polling some time
|
||||
setTimeout(() => memoryLimitBusy.value = false, 2000);
|
||||
setTimeout(() => memoryLimitBusy.value = false, 4000);
|
||||
}
|
||||
|
||||
async function onSubmitCpuQuota() {
|
||||
@@ -46,7 +46,7 @@ async function onSubmitCpuQuota() {
|
||||
currentCpuQuota.value = parseInt(cpuQuota.value);
|
||||
|
||||
// give polling some time
|
||||
setTimeout(() => cpuQuotaBusy.value = false, 2000);
|
||||
setTimeout(() => cpuQuotaBusy.value = false, 4000);
|
||||
}
|
||||
|
||||
async function onSubmitDevices() {
|
||||
@@ -62,16 +62,19 @@ async function onSubmitDevices() {
|
||||
const [error] = await appsModel.configure(props.app.id, 'devices', { devices: devs });
|
||||
if (error && error.status === 400) {
|
||||
devicesError.value = error.body.message;
|
||||
return devicesBusy.value = false;
|
||||
devicesBusy.value = false;
|
||||
return;
|
||||
} else if (error) {
|
||||
return console.error(error);
|
||||
devicesBusy.value = false;
|
||||
console.error(error);
|
||||
return;
|
||||
}
|
||||
|
||||
// give polling some time
|
||||
setTimeout(() => {
|
||||
devicesBusy.value = false;
|
||||
currentDevices.value = Object.keys(devs);
|
||||
}, 2000);
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
const devicesChanged = computed(() => {
|
||||
@@ -119,7 +122,7 @@ onMounted(async () => {
|
||||
</datalist>
|
||||
</FormGroup>
|
||||
<br/>
|
||||
<Button @click="onSubmitMemoryLimit()" :loading="memoryLimitBusy" :disabled="memoryLimitBusy || (!app.error && memoryLimit === currentMemoryLimit) || (app.error && app.error.details.installationState !== ISTATES.PENDING_RESIZE) || app.taskId" v-tooltip="app.error ? 'App is in error state' : (app.taskId ? 'App is busy' : '')">{{ $t('app.resources.memory.resizeAction') }}</Button>
|
||||
<Button @click="onSubmitMemoryLimit()" :loading="memoryLimitBusy" :disabled="memoryLimitBusy || (!app.error && memoryLimit === currentMemoryLimit) || (app.error && app.error.details.installationState !== ISTATES.PENDING_RESIZE) || app.taskId">{{ $t('app.resources.memory.resizeAction') }}</Button>
|
||||
|
||||
<hr/>
|
||||
|
||||
@@ -139,8 +142,8 @@ onMounted(async () => {
|
||||
<hr/>
|
||||
|
||||
<form @submit.prevent="onSubmitDevices()" autocomplete="off">
|
||||
<fieldset :disabled="devicesBusy || app.error || app.taskId">
|
||||
<input style="display: none;" type="submit" :disabled="!devicesChanged"/>
|
||||
<fieldset :disabled="devicesBusy || (!app.error && !devicesChanged) || (app.error && app.error.details.installationState !== ISTATES.PENDING_RECREATE_CONTAINER) || app.taskId">
|
||||
<input style="display: none;" type="submit"/>
|
||||
<FormGroup>
|
||||
<!-- TODO translate -->
|
||||
<label for="devicesInput">Devices <sup><a href="https://docs.cloudron.io/apps/#devices" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup></label>
|
||||
@@ -149,6 +152,6 @@ onMounted(async () => {
|
||||
</FormGroup>
|
||||
</fieldset>
|
||||
</form>
|
||||
<Button @click="onSubmitDevices()" :loading="devicesBusy" :disabled="!devicesChanged || devicesBusy || app.error || app.taskId" >Set Devices</Button>
|
||||
<Button @click="onSubmitDevices()" :loading="devicesBusy" :disabled="devicesBusy || (!app.error && !devicesChanged) || (app.error && app.error.details.installationState !== ISTATES.PENDING_RECREATE_CONTAINER) || app.taskId">Set Devices</Button>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user