diff --git a/frontend/components/connections/HostTree.vue b/frontend/components/connections/HostTree.vue index 28a37c9..c3e9bc4 100644 --- a/frontend/components/connections/HostTree.vue +++ b/frontend/components/connections/HostTree.vue @@ -24,6 +24,7 @@ const props = defineProps<{ const emit = defineEmits<{ (e: 'select-host', host: Host): void (e: 'new-host', groupId?: number): void + (e: 'delete-group', groupId: number): void }>() const expanded = ref>(new Set()) @@ -57,15 +58,20 @@ function countHosts(group: HostGroup): number {
{{ isExpanded(group.id) ? '▾' : '▸' }} {{ group.name }} {{ countHosts(group) }} +
@@ -78,6 +84,7 @@ function countHosts(group: HostGroup): number { :groups="group.children" @select-host="(h) => emit('select-host', h)" @new-host="(gid) => emit('new-host', gid)" + @delete-group="(gid) => emit('delete-group', gid)" /> diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 6cdc29e..befa0e7 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -154,6 +154,13 @@ const recentHosts = computed(() => { .slice(0, 5) }) +async function deleteGroup(groupId: number) { + const group = connections.groups.find((g: any) => g.id === groupId) + const name = group?.name || 'this group' + if (!confirm(`Delete "${name}"? Hosts in this group will become ungrouped.`)) return + await connections.deleteGroup(groupId) +} + async function deleteSelectedHost() { if (!selectedHost.value) return if (!confirm(`Delete "${selectedHost.value.name}"?`)) return @@ -185,7 +192,7 @@ async function deleteSelectedHost() {
- +