Split recovery mode into repair and restart

recovery mode is not a 'setting'
This commit is contained in:
Girish Ramakrishnan
2025-09-25 15:46:36 +02:00
parent 7701b41af4
commit 9a3a78c96c
12 changed files with 40 additions and 44 deletions
+26 -16
View File
@@ -1,7 +1,7 @@
<script setup>
import { ref, onMounted } from 'vue';
import { Button, Switch } from '@cloudron/pankow';
import { Button } from '@cloudron/pankow';
import { taskNameFromInstallationState } from '../../utils.js';
import { ISTATES } from '../../constants.js';
import AppsModel from '../../models/AppsModel.js';
@@ -11,10 +11,10 @@ const props = defineProps([ 'app' ]);
const appsModel = AppsModel.create();
const busyRepair = ref(false);
const busyRestart = ref(false);
const debugMode = ref(false);
const debugModeBusy = ref(false);
async function onDebugMode(newValue) {
async function onToggleDebugMode() {
const newValue = !props.app.debugMode;
debugModeBusy.value = true;
const data = newValue ? {
@@ -25,7 +25,6 @@ async function onDebugMode(newValue) {
const [error] = await appsModel.configure(props.app.id, 'debug_mode', { debugMode: data });
if (error) {
debugModeBusy.value = false;
debugMode.value = !newValue;
return console.error(error);
}
@@ -56,28 +55,39 @@ async function onRestart() {
}
onMounted(() => {
debugMode.value = !!props.app.debugMode;
});
</script>
<template>
<div>
<label>{{ $t('app.repair.recovery.title') }}</label>
<div v-html="$t('app.repair.recovery.description', { docsLink: 'https://docs.cloudron.io/troubleshooting/#unresponsive-app' })"></div>
<br/>
<div style="display: flex; justify-content: space-between;">
<Switch v-model="debugMode" @change="onDebugMode" :disabled="debugModeBusy || (app.error && app.error.details.installationState !== ISTATES.PENDING_DEBUG) || app.taskId" label="Recovery Mode"/>
<div>
<label>{{ $t('app.repair.restart.title') }}</label>
<div>{{ $t('app.repair.restart.description') }}</div>
<br/>
<div v-if="app.error">An error occurred during the <b>{{ taskNameFromInstallationState(app.error.details.installationState) }}</b> operation: <span class="text-danger"><b>{{ app.error.reason + ': ' + app.error.message }}</b></span></div>
<Button @click="onRestart()" :disabled="busyRestart || app.taskId || !!app.error" :loading="busyRestart || app.installationState === 'pending_restart'">{{ $t('app.repair.recovery.restartAction') }}</Button>
</div>
<hr style="margin-top: 20px"/>
<div>
<label>{{ $t('app.repair.recovery.title') }}</label>
<div v-html="$t('app.repair.recovery.description', { docsLink: 'https://docs.cloudron.io/apps/#recovery-mode' })"></div>
<br/>
<Button @click="onToggleDebugMode" :disabled="debugModeBusy || (app.error && app.error.details.installationState !== ISTATES.PENDING_DEBUG) || app.taskId">
<span v-if="app.debugMode">{{ $t('app.repair.recovery.disableAction') }}</span>
<span v-else>{{ $t('app.repair.recovery.enableAction') }}</span>
</Button>
</div>
<hr style="margin-top: 20px"/>
<label>{{ $t('app.repair.taskError.title') }}</label>
<div>{{ $t('app.repair.taskError.description') }}</div>
<br/>
<div v-if="app.error">An error occurred during the <b>{{ taskNameFromInstallationState(app.error.details.installationState) }}</b> operation: <span class="text-danger"><b>{{ app.error.reason + ': ' + app.error.message }}</b></span></div>
<Button @click="onRepair()" :disabled="busyRepair || app.taskId || !app.error" :loading="busyRepair">{{ $t('app.repair.taskError.retryAction', { task: app.error ? taskNameFromInstallationState(app.error.details.installationState) : '' }) }}</Button>
<div>
<label>{{ $t('app.repair.taskError.title') }}</label>
<div>{{ $t('app.repair.taskError.description') }}</div>
<br/>
<div v-if="app.error">An error occurred during the <b>{{ taskNameFromInstallationState(app.error.details.installationState) }}</b> operation: <span class="text-danger"><b>{{ app.error.reason + ': ' + app.error.message }}</b></span></div>
<Button @click="onRepair()" :disabled="busyRepair || app.taskId || !app.error" :loading="busyRepair">{{ $t('app.repair.taskError.retryAction', { task: app.error ? taskNameFromInstallationState(app.error.details.installationState) : '' }) }}</Button>
</div>
</div>
</template>
+1 -1
View File
@@ -2,7 +2,7 @@
import { ref, onMounted, useTemplateRef } from 'vue';
import { marked } from 'marked';
import { Button, Switch, Dialog, Checkbox, FormGroup } from '@cloudron/pankow';
import { Button, Switch, Dialog, Checkbox } from '@cloudron/pankow';
import { ISTATES } from '../../constants.js';
import SettingsItem from '../SettingsItem.vue';
import AppsModel from '../../models/AppsModel.js';