Skip to content

Commit 3481ebf

Browse files
authored
Merge pull request #49168 from nextcloud/feat/file-list-actions
feat(files): Add support for file list actions
2 parents 22e2419 + ed796d5 commit 3481ebf

File tree

129 files changed

+220
-267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+220
-267
lines changed

apps/files/src/views/FilesList.vue

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@
4545
multiple
4646
@failed="onUploadFail"
4747
@uploaded="onUpload" />
48+
49+
<NcActions :inline="1" force-name>
50+
<NcActionButton v-for="action in enabledFileListActions"
51+
:key="action.id"
52+
close-after-click
53+
@click="() => action.exec(currentView, dirContents, { folder: currentFolder })">
54+
<template #icon>
55+
<NcIconSvgWrapper :svg="action.iconSvgInline(currentView)" />
56+
</template>
57+
{{ action.displayName(currentView) }}
58+
</NcActionButton>
59+
</NcActions>
4860
</template>
4961
</BreadCrumbs>
5062

@@ -138,7 +150,7 @@ import type { UserConfig } from '../types.ts'
138150
139151
import { getCapabilities } from '@nextcloud/capabilities'
140152
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
141-
import { Folder, Node, Permission, sortNodes } from '@nextcloud/files'
153+
import { Folder, Node, Permission, sortNodes, getFileListActions } from '@nextcloud/files'
142154
import { translate as t } from '@nextcloud/l10n'
143155
import { join, dirname, normalize } from 'path'
144156
import { showError, showWarning } from '@nextcloud/dialogs'
@@ -152,6 +164,8 @@ import IconReload from 'vue-material-design-icons/Reload.vue'
152164
import LinkIcon from 'vue-material-design-icons/Link.vue'
153165
import ListViewIcon from 'vue-material-design-icons/FormatListBulletedSquare.vue'
154166
import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
167+
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
168+
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
155169
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
156170
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
157171
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
@@ -190,6 +204,8 @@ export default defineComponent({
190204
LinkIcon,
191205
ListViewIcon,
192206
NcAppContent,
207+
NcActions,
208+
NcActionButton,
193209
NcButton,
194210
NcEmptyContent,
195211
NcIconSvgWrapper,
@@ -430,6 +446,19 @@ export default defineComponent({
430446
showCustomEmptyView() {
431447
return !this.loading && this.isEmptyDir && this.currentView?.emptyView !== undefined
432448
},
449+
450+
enabledFileListActions() {
451+
const actions = getFileListActions()
452+
const enabledActions = actions
453+
.filter(action => {
454+
if (action.enabled === undefined) {
455+
return true
456+
}
457+
return action.enabled(this.currentView, this.dirContents, { folder: this.currentFolder })
458+
})
459+
.toSorted((a, b) => a.order - b.order)
460+
return enabledActions
461+
},
433462
},
434463
435464
watch: {

dist/1417-1417.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/1417-1417.js.license

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
1919
SPDX-FileCopyrightText: Roeland Jago Douma
2020
SPDX-FileCopyrightText: Rob Cresswell <[email protected]>
2121
SPDX-FileCopyrightText: Philipp Kewisch
22-
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
2322
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
2423
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
2524
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
@@ -85,7 +84,7 @@ This file is generated from multiple sources. Included packages:
8584
- version: 3.3.1
8685
- license: GPL-3.0-or-later
8786
- @nextcloud/files
88-
- version: 3.9.1
87+
- version: 3.10.0
8988
- license: AGPL-3.0-or-later
9089
- @nextcloud/initial-state
9190
- version: 2.2.0
@@ -252,9 +251,6 @@ This file is generated from multiple sources. Included packages:
252251
- vue
253252
- version: 2.7.16
254253
- license: MIT
255-
- webdav
256-
- version: 5.7.1
257-
- license: MIT
258254
- nextcloud
259255
- version: 1.0.0
260256
- license: AGPL-3.0-or-later

dist/1417-1417.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/1652-1652.js.license

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
2727
SPDX-FileCopyrightText: Roeland Jago Douma
2828
SPDX-FileCopyrightText: Richie Bendall
2929
SPDX-FileCopyrightText: Philipp Kewisch
30-
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
3130
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
3231
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
3332
SPDX-FileCopyrightText: OpenJS Foundation and other contributors
@@ -106,7 +105,7 @@ This file is generated from multiple sources. Included packages:
106105
- version: 3.3.1
107106
- license: GPL-3.0-or-later
108107
- @nextcloud/files
109-
- version: 3.9.1
108+
- version: 3.10.0
110109
- license: AGPL-3.0-or-later
111110
- @nextcloud/initial-state
112111
- version: 2.2.0
@@ -483,9 +482,6 @@ This file is generated from multiple sources. Included packages:
483482
- web-namespaces
484483
- version: 2.0.1
485484
- license: MIT
486-
- webdav
487-
- version: 5.7.1
488-
- license: MIT
489485
- zwitch
490486
- version: 2.0.4
491487
- license: MIT

dist/5576-5576.js.license

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ SPDX-FileCopyrightText: T. Jameson Little <[email protected]>
1414
SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
1515
SPDX-FileCopyrightText: Roeland Jago Douma
1616
SPDX-FileCopyrightText: Rob Cresswell <[email protected]>
17-
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
1817
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
1918
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
2019
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
@@ -64,7 +63,7 @@ This file is generated from multiple sources. Included packages:
6463
- version: 3.3.1
6564
- license: GPL-3.0-or-later
6665
- @nextcloud/files
67-
- version: 3.9.1
66+
- version: 3.10.0
6867
- license: AGPL-3.0-or-later
6968
- @nextcloud/initial-state
7069
- version: 2.2.0
@@ -198,9 +197,6 @@ This file is generated from multiple sources. Included packages:
198197
- vue
199198
- version: 2.7.16
200199
- license: MIT
201-
- webdav
202-
- version: 5.7.1
203-
- license: MIT
204200
- nextcloud
205201
- version: 1.0.0
206202
- license: AGPL-3.0-or-later

dist/5828-5828.js.license

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ SPDX-FileCopyrightText: Sindre Sorhus
1616
SPDX-FileCopyrightText: Rubén Norte <[email protected]>
1717
SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
1818
SPDX-FileCopyrightText: Roeland Jago Douma
19-
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
2019
SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
2120
SPDX-FileCopyrightText: Matt Zabriskie
2221
SPDX-FileCopyrightText: Joyent
@@ -62,7 +61,7 @@ This file is generated from multiple sources. Included packages:
6261
- version: 3.3.1
6362
- license: GPL-3.0-or-later
6463
- @nextcloud/files
65-
- version: 3.9.1
64+
- version: 3.10.0
6665
- license: AGPL-3.0-or-later
6766
- @nextcloud/initial-state
6867
- version: 2.2.0
@@ -175,6 +174,3 @@ This file is generated from multiple sources. Included packages:
175174
- vue
176175
- version: 2.7.16
177176
- license: MIT
178-
- webdav
179-
- version: 5.7.1
180-
- license: MIT

dist/6127-6127.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/6127-6127.js.license

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ SPDX-FileCopyrightText: Roman Shtylman <[email protected]>
2727
SPDX-FileCopyrightText: Roeland Jago Douma
2828
SPDX-FileCopyrightText: Richie Bendall
2929
SPDX-FileCopyrightText: Philipp Kewisch
30-
SPDX-FileCopyrightText: Perry Mitchell <[email protected]>
3130
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://paul.vorba.ch)
3231
SPDX-FileCopyrightText: Paul Vorbach <[email protected]> (http://vorb.de)
3332
SPDX-FileCopyrightText: OpenJS Foundation and other contributors
@@ -127,7 +126,7 @@ This file is generated from multiple sources. Included packages:
127126
- version: 3.3.1
128127
- license: GPL-3.0-or-later
129128
- @nextcloud/files
130-
- version: 3.9.1
129+
- version: 3.10.0
131130
- license: AGPL-3.0-or-later
132131
- @nextcloud/initial-state
133132
- version: 2.2.0
@@ -501,9 +500,6 @@ This file is generated from multiple sources. Included packages:
501500
- web-namespaces
502501
- version: 2.0.1
503502
- license: MIT
504-
- webdav
505-
- version: 5.7.1
506-
- license: MIT
507503
- zwitch
508504
- version: 2.0.4
509505
- license: MIT

dist/6127-6127.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)