Use ActionBar in remaining lists
This commit is contained in:
@@ -5,10 +5,11 @@ const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, onMounted, useTemplateRef } from 'vue';
|
||||
import { Button, Menu, TableView, InputDialog } from '@cloudron/pankow';
|
||||
import { TableView, InputDialog } from '@cloudron/pankow';
|
||||
import { prettyLongDate } from '@cloudron/pankow/utils';
|
||||
import { API_ORIGIN } from '../constants.js';
|
||||
import AppRestoreDialog from '../components/AppRestoreDialog.vue';
|
||||
import ActionBar from '../components/ActionBar.vue';
|
||||
import Section from '../components/Section.vue';
|
||||
import ArchivesModel from '../models/ArchivesModel.js';
|
||||
import { download } from '../utils.js';
|
||||
@@ -36,12 +37,11 @@ const columns = {
|
||||
actions: {}
|
||||
};
|
||||
|
||||
const actionMenuModel = ref([]);
|
||||
const actionMenuElement = useTemplateRef('actionMenuElement');
|
||||
function onActionMenu(archive, event) {
|
||||
actionMenuModel.value = [{
|
||||
function createActionMenu(archive) {
|
||||
return [{
|
||||
icon: 'fa-solid fa-history',
|
||||
label: t('backups.restoreArchiveDialog.restoreAction'),
|
||||
quickAction: true,
|
||||
action: onRestore.bind(null, archive),
|
||||
}, {
|
||||
separator: true,
|
||||
@@ -56,8 +56,6 @@ function onActionMenu(archive, event) {
|
||||
label: t('main.action.remove'),
|
||||
action: onRemove.bind(null, archive),
|
||||
}];
|
||||
|
||||
actionMenuElement.value.open(event, event.currentTarget);
|
||||
}
|
||||
|
||||
const busy = ref(true);
|
||||
@@ -117,8 +115,6 @@ onMounted(async () => {
|
||||
|
||||
<template>
|
||||
<div class="content">
|
||||
<Menu ref="actionMenuElement" :model="actionMenuModel" />
|
||||
|
||||
<Section :title="$t('backups.archives.title')">
|
||||
<InputDialog ref="inputDialog"/>
|
||||
<AppRestoreDialog ref="restoreDialog"/>
|
||||
@@ -138,9 +134,7 @@ onMounted(async () => {
|
||||
<template #creationTime="archive">{{ prettyLongDate(archive.creationTime) }}</template>
|
||||
|
||||
<template #actions="archive">
|
||||
<div style="text-align: right;">
|
||||
<Button tool plain secondary @click.capture="onActionMenu(archive, $event)" icon="fa-solid fa-ellipsis" />
|
||||
</div>
|
||||
<ActionBar :actions="createActionMenu(archive)"/>
|
||||
</template>
|
||||
</TableView>
|
||||
</Section>
|
||||
|
||||
@@ -5,10 +5,11 @@ const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { computed, reactive, onMounted, ref, useTemplateRef, nextTick, onUnmounted } from 'vue';
|
||||
import { Button, Menu, TableView, ProgressBar, FormGroup, Checkbox, Dialog } from '@cloudron/pankow';
|
||||
import { Button, TableView, ProgressBar, FormGroup, Checkbox, Dialog } from '@cloudron/pankow';
|
||||
import { prettyBinarySize } from '@cloudron/pankow/utils';
|
||||
import { each } from 'async';
|
||||
import Section from '../components/Section.vue';
|
||||
import ActionBar from '../components/ActionBar.vue';
|
||||
import StateLED from '../components/StateLED.vue';
|
||||
import ServicesModel from '../models/ServicesModel.js';
|
||||
import SystemModel from '../models/SystemModel.js';
|
||||
@@ -34,17 +35,18 @@ const columns = {
|
||||
sort: true,
|
||||
hideMobile: true,
|
||||
},
|
||||
actions: {}
|
||||
actions: {
|
||||
width: '100px',
|
||||
}
|
||||
};
|
||||
|
||||
const actionMenuModel = ref([]);
|
||||
const actionMenuElement = useTemplateRef('actionMenuElement');
|
||||
function onActionMenu(id, event) {
|
||||
actionMenuModel.value = [{
|
||||
function createActionMenu(id) {
|
||||
return [{
|
||||
icon: 'fa-solid fa-pencil-alt',
|
||||
label: t('main.action.configure'),
|
||||
disabled() { return refreshBusy.value; },
|
||||
disabled: refreshBusy.value,
|
||||
visible: services[id].status !== 'disabled' && services[id].memoryLimit,
|
||||
quickAction: true,
|
||||
action: onEdit.bind(null, id),
|
||||
}, {
|
||||
separator: true,
|
||||
@@ -61,8 +63,6 @@ function onActionMenu(id, event) {
|
||||
target: '_blank',
|
||||
href: `/logs.html?id=${id}`,
|
||||
}];
|
||||
|
||||
actionMenuElement.value.open(event, event.currentTarget);
|
||||
}
|
||||
|
||||
const services = reactive({
|
||||
@@ -230,7 +230,6 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<div class="content">
|
||||
<Menu ref="actionMenuElement" :model="actionMenuModel" />
|
||||
<Dialog ref="dialog"
|
||||
:title="$t('services.configure.title')"
|
||||
:confirm-busy="editBusy"
|
||||
@@ -276,9 +275,7 @@ onUnmounted(() => {
|
||||
<span v-show="service.memoryLimit">{{ prettyBinarySize(service.memoryLimit) }}</span>
|
||||
</template>
|
||||
<template #actions="service">
|
||||
<div style="text-align: right;">
|
||||
<Button tool plain secondary @click.capture="onActionMenu(service.id, $event)" icon="fa-solid fa-ellipsis" />
|
||||
</div>
|
||||
<ActionBar :actions="createActionMenu(service.id)"/>
|
||||
</template>
|
||||
</TableView>
|
||||
</Section>
|
||||
|
||||
@@ -5,7 +5,8 @@ const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, useTemplateRef, onMounted } from 'vue';
|
||||
import { Button, Menu, Checkbox, Dialog, SingleSelect, FormGroup, InputDialog, NumberInput, TableView, TextInput, MaskedInput } from '@cloudron/pankow';
|
||||
import { Button, Checkbox, Dialog, SingleSelect, FormGroup, InputDialog, NumberInput, TableView, TextInput, MaskedInput } from '@cloudron/pankow';
|
||||
import ActionBar from '../components/ActionBar.vue';
|
||||
import Section from '../components/Section.vue';
|
||||
import StateLED from '../components/StateLED.vue';
|
||||
import VolumesModel from '../models/VolumesModel.js';
|
||||
@@ -28,16 +29,17 @@ const columns = {
|
||||
sort: true,
|
||||
hideMobile: true,
|
||||
},
|
||||
actions: {}
|
||||
actions: {
|
||||
width: '100px',
|
||||
}
|
||||
};
|
||||
|
||||
const actionMenuModel = ref([]);
|
||||
const actionMenuElement = useTemplateRef('actionMenuElement');
|
||||
function onActionMenu(volume, event) {
|
||||
actionMenuModel.value = [{
|
||||
function createActionMenu(volume) {
|
||||
return [{
|
||||
icon: 'fa-solid fa-pencil-alt',
|
||||
label: t('main.action.edit'),
|
||||
visible: volume.mountType === 'sshfs' || volume.mountType === 'cifs' || volume.mountType === 'nfs',
|
||||
quickAction: true,
|
||||
action: openVolumeDialog.bind(null, volume),
|
||||
}, {
|
||||
separator: true,
|
||||
@@ -59,8 +61,6 @@ function onActionMenu(volume, event) {
|
||||
label: t('main.action.remove'),
|
||||
action: onRemove.bind(null, volume),
|
||||
}];
|
||||
|
||||
actionMenuElement.value.open(event, event.currentTarget);
|
||||
}
|
||||
|
||||
const busy = ref(true);
|
||||
@@ -231,7 +231,6 @@ onMounted(async () =>{
|
||||
|
||||
<template>
|
||||
<div class="content">
|
||||
<Menu ref="actionMenuElement" :model="actionMenuModel" />
|
||||
<InputDialog ref="inputDialog" />
|
||||
|
||||
<!-- width is to fix the 70 characters per line for ssh key -->
|
||||
@@ -335,9 +334,7 @@ onMounted(async () =>{
|
||||
</div>
|
||||
</template>
|
||||
<template #actions="volume">
|
||||
<div style="text-align: right;">
|
||||
<Button tool plain secondary @click.capture="onActionMenu(volume, $event)" icon="fa-solid fa-ellipsis" />
|
||||
</div>
|
||||
<ActionBar :actions="createActionMenu(volume)"/>
|
||||
</template>
|
||||
</TableView>
|
||||
</Section>
|
||||
|
||||
Reference in New Issue
Block a user