Remove app start/stop button from toolbar
This commit is contained in:
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, onMounted, onBeforeUnmount, computed, useTemplateRef } from 'vue';
|
||||
import { ref, onMounted, onBeforeUnmount, useTemplateRef } from 'vue';
|
||||
import { Button, ButtonGroup, SingleSelect, InputDialog } from '@cloudron/pankow';
|
||||
import PostInstallDialog from '../components/PostInstallDialog.vue';
|
||||
import SftpInfoDialog from '../components/SftpInfoDialog.vue';
|
||||
@@ -47,10 +47,6 @@ const postInstallDialog = useTemplateRef('postInstallDialog');
|
||||
const sftpInfoDialog = useTemplateRef('sftpInfoDialog');
|
||||
const inputDialog = useTemplateRef('inputDialog');
|
||||
|
||||
const isAppStopped = computed(() => {
|
||||
return appsModel.isStopped(app.value);
|
||||
});
|
||||
|
||||
function onSetView(newView) {
|
||||
if (!isViewEnabled(newView, app.value.error?.details?.installationState)) {
|
||||
currentView.value = 'info';
|
||||
@@ -62,30 +58,6 @@ function onSetView(newView) {
|
||||
window.location.hash = `/app/${id.value}/${newView}`;
|
||||
}
|
||||
|
||||
const toggleRunStateBusy = ref(false);
|
||||
async function onToggleRunState() {
|
||||
if (isAppStopped.value) {
|
||||
toggleRunStateBusy.value = true;
|
||||
const [error] = await appsModel.start(app.value.id);
|
||||
if (error) return console.error(error);
|
||||
} else {
|
||||
const confirmed = await inputDialog.value.confirm({
|
||||
message: t('app.stopDialog.title', { app: app.value.label || app.value.fqdn }),
|
||||
confirmStyle: 'danger',
|
||||
confirmLabel: t('main.dialog.yes'),
|
||||
rejectLabel: t('main.dialog.no'),
|
||||
rejectStyle: 'secondary',
|
||||
});
|
||||
|
||||
if (!confirmed) return;
|
||||
|
||||
toggleRunStateBusy.value = true;
|
||||
const [error] = await appsModel.stop(app.value.id);
|
||||
if (error) return console.error(error);
|
||||
}
|
||||
setTimeout(() => toggleRunStateBusy.value = false, 2000);
|
||||
}
|
||||
|
||||
let refreshTimer = null;
|
||||
async function refresh() {
|
||||
const [error, result] = await appsModel.get(id.value);
|
||||
@@ -270,13 +242,6 @@ onBeforeUnmount(() => {
|
||||
<SingleSelect class="pankow-no-desktop" v-model="currentView" :options="views" optionKey="id" optionLabel="display" @select="onSetView"/>
|
||||
<div style="display: flex; gap: 10px">
|
||||
<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="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="toggleRunStateBusy || app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
:icon="isAppStopped ? 'fa-solid fa-play' : 'fa-solid fa-power-off'"
|
||||
/>
|
||||
<ButtonGroup>
|
||||
<Button secondary tool :href="`/logs.html?appId=${app.id}`" target="_blank" v-tooltip="$t('app.logsActionTooltip')" icon="fa-solid fa-align-left" />
|
||||
<Button secondary tool v-if="app.type !== APP_TYPES.PROXIED" :href="`/terminal.html?id=${app.id}`" target="_blank" v-tooltip="$t('app.terminalActionTooltip')" icon="fa fa-terminal" />
|
||||
|
||||
Reference in New Issue
Block a user