add ability to uninstall an app again
This commit is contained in:
@@ -6,7 +6,7 @@ import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, onMounted, onUnmounted, useTemplateRef } from 'vue';
|
||||
import { ref, onMounted, onUnmounted, useTemplateRef, computed } from 'vue';
|
||||
import { Button, ButtonGroup, TabView } from 'pankow';
|
||||
import Info from '../components/app/Info.vue';
|
||||
import Uninstall from '../components/app/Uninstall.vue';
|
||||
@@ -41,12 +41,25 @@ const link = ref('');
|
||||
const infoMenu = ref([]);
|
||||
const hasLocalStorage = ref(false);
|
||||
|
||||
let refreshTimer = null;
|
||||
const isAppStopped = computed(() => {
|
||||
return appsModel.isStopped(app.value);
|
||||
});
|
||||
|
||||
function onTabChanged(tab) {
|
||||
window.location.hash = `/app/${id.value}/${tab}`;
|
||||
}
|
||||
|
||||
async function onToggleRunState() {
|
||||
if (isAppStopped.value) {
|
||||
const [error] = await appsModel.start(app.value.id);
|
||||
if (error) return console.error(error);
|
||||
} else {
|
||||
const [error] = await appsModel.stop(app.value.id);
|
||||
if (error) return console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
let refreshTimer = null;
|
||||
async function refresh() {
|
||||
const [error, result] = await appsModel.get(id.value);
|
||||
if (error) return console.error(error);
|
||||
@@ -57,6 +70,7 @@ async function refresh() {
|
||||
link.value = result.fqdn.indexOf('http') !== 0 ? 'https://' + result.fqdn : result.fqdn;
|
||||
hasLocalStorage.value = result.manifest && result.manifest.addons && result.manifest.addons.localstorage;
|
||||
|
||||
// TODO info menu will likely not change during polling
|
||||
infoMenu.value = [];
|
||||
infoMenu.value.push({
|
||||
label: t('app.docsAction'),
|
||||
@@ -129,7 +143,7 @@ onUnmounted(() => {
|
||||
<div class="content">
|
||||
<div style="display: flex; margin-bottom: 20px; justify-content: space-between;">
|
||||
<div style="display: flex;">
|
||||
<img :src="API_ORIGIN + app.iconUrl" v-fallback-image="API_ORIGIN + '/img/appicon_fallback.png'" style="width: 64px"/>
|
||||
<img :src="API_ORIGIN + app.iconUrl" v-fallback-image="API_ORIGIN + '/img/appicon_fallback.png'" style="width: 64px; margin-right: 10px;"/>
|
||||
<h2>{{ app.label || app.fqdn }}</h2>
|
||||
</div>
|
||||
|
||||
@@ -137,9 +151,9 @@ onUnmounted(() => {
|
||||
<Button outline tool
|
||||
@click="onToggleRunState()"
|
||||
:disabled="app.taskId || app.error || app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
v-tooltip="$t(app.runState === 'stopped' ? 'app.uninstall.startStop.startAction' : 'app.uninstall.startStop.stopAction')"
|
||||
v-tooltip="$t(isAppStopped ? 'app.uninstall.startStop.startAction' : 'app.uninstall.startStop.stopAction')"
|
||||
:loading="app.installationState === 'pending_start' || app.installationState === 'pending_stop'"
|
||||
:icon="app.installationState === 'pending_start' || app.installationState === 'pending_stop' ? '' : (app.runState === 'stopped' ? 'fa-solid fa-play' : 'fa-solid fa-power-off')"
|
||||
:icon="isAppStopped ? 'fa-solid fa-play' : 'fa-solid fa-power-off'"
|
||||
/>
|
||||
<ButtonGroup>
|
||||
<Button outline tool :href="`/logs.html?appId=${app.id}`" target="_blank" v-tooltip="$t('app.logsActionTooltip')" icon="fa-solid fa-align-left" />
|
||||
|
||||
Reference in New Issue
Block a user