Skip to content

Commit

Permalink
fix(systemtags): single-node bulk tagging action
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Oct 25, 2024
1 parent 0479863 commit d6aac06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/systemtags/src/components/SystemTagPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export default defineComponent({
this.status = Status.DONE
setTimeout(() => {
this.opened = false
this.$emit('close', null)
this.$emit('close', true)
}, 2000)
},

Expand Down
26 changes: 14 additions & 12 deletions apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ import { t } from '@nextcloud/l10n'

import TagMultipleSvg from '@mdi/svg/svg/tag-multiple.svg?raw'

async function execBatch(nodes: Node[]): Promise<(null|boolean)[]> {
const response = await new Promise<null|boolean>((resolve) => {
spawnDialog(defineAsyncComponent(() => import('../components/SystemTagPicker.vue')), {
nodes,
}, (status) => {
resolve(status as null|boolean)
})
})
return Array(nodes.length).fill(response)
}

export const action = new FileAction({
id: 'systemtags:bulk',
displayName: () => t('systemtags', 'Manage tags'),
Expand All @@ -25,18 +36,9 @@ export const action = new FileAction({
return true
},

async exec() {
return null
async exec(node: Node) {
return execBatch([node])[0]
},

async execBatch(nodes: Node[]) {
const response = await new Promise<null|boolean>((resolve) => {
spawnDialog(defineAsyncComponent(() => import('../components/SystemTagPicker.vue')), {
nodes,
}, (status) => {
resolve(status as null|boolean)
})
})
return Array(nodes.length).fill(response)
},
execBatch,
})

0 comments on commit d6aac06

Please sign in to comment.