Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(files): Add support for file list actions #49168

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
multiple
@failed="onUploadFail"
@uploaded="onUpload" />

<NcActions :inline="1" force-name>
<NcActionButton v-for="action in enabledFileListActions"
:key="action.id"
close-after-click
@click="() => action.exec(currentView, dirContents, { folder: currentFolder })">
<template #icon>
<NcIconSvgWrapper :svg="action.iconSvgInline(currentView)" />
</template>
{{ action.displayName(currentView) }}
</NcActionButton>
</NcActions>
</template>
</BreadCrumbs>

Expand Down Expand Up @@ -138,7 +150,7 @@ import type { UserConfig } from '../types.ts'

import { getCapabilities } from '@nextcloud/capabilities'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { Folder, Node, Permission, sortNodes } from '@nextcloud/files'
import { Folder, Node, Permission, sortNodes, getFileListActions } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import { join, dirname, normalize } from 'path'
import { showError, showWarning } from '@nextcloud/dialogs'
Expand All @@ -152,6 +164,8 @@ import IconReload from 'vue-material-design-icons/Reload.vue'
import LinkIcon from 'vue-material-design-icons/Link.vue'
import ListViewIcon from 'vue-material-design-icons/FormatListBulletedSquare.vue'
import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
Expand Down Expand Up @@ -190,6 +204,8 @@ export default defineComponent({
LinkIcon,
ListViewIcon,
NcAppContent,
NcActions,
NcActionButton,
NcButton,
NcEmptyContent,
NcIconSvgWrapper,
Expand Down Expand Up @@ -430,6 +446,19 @@ export default defineComponent({
showCustomEmptyView() {
return !this.loading && this.isEmptyDir && this.currentView?.emptyView !== undefined
},

enabledFileListActions() {
const actions = getFileListActions()
const enabledActions = actions
.filter(action => {
if (action.enabled === undefined) {
return true
}
return action.enabled(this.currentView, this.dirContents, { folder: this.currentFolder })
})
.toSorted((a, b) => a.order - b.order)
return enabledActions
},
},

watch: {
Expand Down
4 changes: 2 additions & 2 deletions dist/1417-1417.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/1417-1417.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Rob Cresswell <[email protected]>
SPDX-FileCopyrightText: Philipp Kewisch
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
Expand Down Expand Up @@ -85,7 +84,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -252,9 +251,6 @@ This file is generated from multiple sources. Included packages:
- vue
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
- nextcloud
- version: 1.0.0
- license: AGPL-3.0-or-later
2 changes: 1 addition & 1 deletion dist/1417-1417.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/1652-1652.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Richie Bendall
SPDX-FileCopyrightText: Philipp Kewisch
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
SPDX-FileCopyrightText: OpenJS Foundation and other contributors
Expand Down Expand Up @@ -106,7 +105,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -483,9 +482,6 @@ This file is generated from multiple sources. Included packages:
- web-namespaces
- version: 2.0.1
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
- zwitch
- version: 2.0.4
- license: MIT
Expand Down
6 changes: 1 addition & 5 deletions dist/5576-5576.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ SPDX-FileCopyrightText: T. Jameson Little <[email protected]>
SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Rob Cresswell <[email protected]>
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
Expand Down Expand Up @@ -64,7 +63,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -198,9 +197,6 @@ This file is generated from multiple sources. Included packages:
- vue
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
- nextcloud
- version: 1.0.0
- license: AGPL-3.0-or-later
6 changes: 1 addition & 5 deletions dist/5828-5828.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ SPDX-FileCopyrightText: Sindre Sorhus
SPDX-FileCopyrightText: Rubén Norte <[email protected]>
SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: Matt Zabriskie
SPDX-FileCopyrightText: Joyent
Expand Down Expand Up @@ -62,7 +61,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -175,6 +174,3 @@ This file is generated from multiple sources. Included packages:
- vue
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
4 changes: 2 additions & 2 deletions dist/6127-6127.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/6127-6127.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Richie Bendall
SPDX-FileCopyrightText: Philipp Kewisch
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
SPDX-FileCopyrightText: OpenJS Foundation and other contributors
Expand Down Expand Up @@ -127,7 +126,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -501,9 +500,6 @@ This file is generated from multiple sources. Included packages:
- web-namespaces
- version: 2.0.1
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
- zwitch
- version: 2.0.4
- license: MIT
2 changes: 1 addition & 1 deletion dist/6127-6127.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions dist/6473-6473.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ SPDX-FileCopyrightText: Sindre Sorhus
SPDX-FileCopyrightText: Rubén Norte <[email protected]>
SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: Matt Zabriskie
SPDX-FileCopyrightText: Joyent
Expand Down Expand Up @@ -62,7 +61,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -175,6 +174,3 @@ This file is generated from multiple sources. Included packages:
- vue
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
6 changes: 1 addition & 5 deletions dist/9087-9087.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ SPDX-FileCopyrightText: Sindre Sorhus
SPDX-FileCopyrightText: Rubén Norte <[email protected]>
SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
SPDX-FileCopyrightText: Roeland Jago Douma
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: Matt Zabriskie
SPDX-FileCopyrightText: Joyent
Expand Down Expand Up @@ -66,7 +65,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.3.1
- license: GPL-3.0-or-later
- @nextcloud/files
- version: 3.9.1
- version: 3.10.0
- license: AGPL-3.0-or-later
- @nextcloud/initial-state
- version: 2.2.0
Expand Down Expand Up @@ -182,9 +181,6 @@ This file is generated from multiple sources. Included packages:
- vue
- version: 2.7.16
- license: MIT
- webdav
- version: 5.7.1
- license: MIT
- nextcloud
- version: 1.0.0
- license: AGPL-3.0-or-later
4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

Loading
Loading