Skip to content

Commit d6bc6bd

Browse files
feat(archive): add archive/unarchive action/section to context navigation
AI-assistant: Claude Code 2.1.101 (Claude Sonnet 4.6) Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 177242e commit d6bc6bd

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

src/modules/navigation/partials/NavigationContextItem.vue

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@
3535
</template>
3636
{{ t('tables', 'Delete application') }}
3737
</NcActionButton>
38+
<!-- ARCHIVE -->
39+
<NcActionButton v-if="!context.archived" :close-after-click="true" @click="toggleArchiveContext(true)">
40+
<template #icon>
41+
<ArchiveArrowDown :size="20" />
42+
</template>
43+
{{ t('tables', 'Archive application') }}
44+
</NcActionButton>
45+
46+
<!-- UNARCHIVE -->
47+
<NcActionButton v-if="context.archived" :close-after-click="true" @click="toggleArchiveContext(false)">
48+
<template #icon>
49+
<ArchiveArrowUpOutline :size="20" />
50+
</template>
51+
{{ t('tables', 'Unarchive application') }}
52+
</NcActionButton>
53+
3854
<NcActionCheckbox :checked="showInNavigation" data-cy="navigationContextShowInNavSwitch" @change="changeDisplayMode">
3955
{{ t('tables', 'Show in app list') }}
4056
</NcActionCheckbox>
@@ -50,6 +66,8 @@ import { emit } from '@nextcloud/event-bus'
5066
import PlaylistEdit from 'vue-material-design-icons/PlaylistEdit.vue'
5167
import FileSwapOutline from 'vue-material-design-icons/FileSwapOutline.vue'
5268
import DeleteOutline from 'vue-material-design-icons/TrashCanOutline.vue'
69+
import ArchiveArrowDown from 'vue-material-design-icons/ArchiveArrowDown.vue'
70+
import ArchiveArrowUpOutline from 'vue-material-design-icons/ArchiveArrowUpOutline.vue'
5371
import permissionsMixin from '../../../shared/components/ncTable/mixins/permissionsMixin.js'
5472
import svgHelper from '../../../shared/components/ncIconPicker/mixins/svgHelper.js'
5573
import { NAV_ENTRY_MODE } from '../../../shared/constants.ts'
@@ -64,6 +82,8 @@ export default {
6482
FileSwapOutline,
6583
TableIcon,
6684
DeleteOutline,
85+
ArchiveArrowDown,
86+
ArchiveArrowUpOutline,
6787
NcIconSvgWrapper,
6888
NcAppNavigationItem,
6989
NcActionButton,
@@ -99,7 +119,7 @@ export default {
99119
},
100120
101121
methods: {
102-
...mapActions(useTablesStore, ['updateDisplayMode']),
122+
...mapActions(useTablesStore, ['updateDisplayMode', 'archiveContext', 'unarchiveContext']),
103123
emit,
104124
async editContext() {
105125
emit('tables:context:edit', this.context.id)
@@ -118,6 +138,13 @@ export default {
118138
}
119139
return false
120140
},
141+
async toggleArchiveContext(archived) {
142+
if (archived) {
143+
await this.archiveContext({ id: this.context.id })
144+
} else {
145+
await this.unarchiveContext({ id: this.context.id })
146+
}
147+
},
121148
async changeDisplayMode() {
122149
const value = !this.showInNavigation
123150
const displayMode = value ? NAV_ENTRY_MODE.NAV_ENTRY_MODE_ALL : NAV_ENTRY_MODE.NAV_ENTRY_MODE_HIDDEN

src/modules/navigation/sections/Navigation.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,26 @@
6868
</template>
6969
</NcAppNavigationCaption>
7070

71-
<template v-for="node in getAllContexts">
71+
<template v-for="node in getActiveContexts">
7272
<NavigationContextItem :key="node.id" :context="node" />
7373
</template>
74+
75+
<!-- ARCHIVED APPLICATIONS -->
76+
<NcAppNavigationItem v-if="getArchivedContexts.length > 0" :name="t('tables', 'Archived applications')"
77+
:allow-collapse="true" :open="false">
78+
<template #icon>
79+
<ArchiveOutline :size="20" />
80+
</template>
81+
82+
<template #counter>
83+
<NcCounterBubble>
84+
{{ getArchivedContexts.length }}
85+
</NcCounterBubble>
86+
</template>
87+
88+
<NavigationContextItem v-for="context in getArchivedContexts" :key="context.id"
89+
:context="context" />
90+
</NcAppNavigationItem>
7491
</ul>
7592

7693
<div v-if="filterString !== ''" class="search-info">
@@ -183,6 +200,12 @@ export default {
183200
getAllContexts() {
184201
return this.contexts.filter(context => context.name.toLowerCase().includes(this.filterString.toLowerCase()))
185202
},
203+
getActiveContexts() {
204+
return this.getAllContexts.filter(context => !context.archived)
205+
},
206+
getArchivedContexts() {
207+
return this.getAllContexts.filter(context => context.archived)
208+
},
186209
isStandaloneContext() {
187210
try {
188211
// this state is only set by the PageController.context route

0 commit comments

Comments
 (0)