fix(systemtags): single-node bulk tagging action

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
skjnldsv 2024-10-24 15:46:22 +02:00
parent d51cf4536c
commit a4d7518e36
2 changed files with 15 additions and 13 deletions

View file

@ -409,7 +409,7 @@ export default defineComponent({
this.status = Status.DONE
setTimeout(() => {
this.opened = false
this.$emit('close', null)
this.$emit('close', true)
}, 2000)
},

View file

@ -12,6 +12,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'),
@ -27,18 +38,9 @@ export const action = new FileAction({
return getCurrentUser() !== null
},
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,
})