Skip to content

Commit 8867aae

Browse files
committed
chore: update @nextcloud/files to 4.0.0
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent 590d839 commit 8867aae

File tree

30 files changed

+701
-295
lines changed

30 files changed

+701
-295
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@
9292
<td
9393
v-for="column in columns"
9494
:key="column.id"
95-
:class="`files-list__row-${currentView.id}-${column.id}`"
95+
:class="`files-list__row-${activeView.id}-${column.id}`"
9696
class="files-list__row-column-custom"
9797
:data-cy-files-list-row-column-custom="column.id"
9898
@click="openDetailsIfAvailable">
9999
<CustomElementRender
100-
:current-view="currentView"
100+
:current-view="activeView"
101101
:render="column.render"
102102
:source="source" />
103103
</td>
@@ -116,9 +116,8 @@ import FileEntryCheckbox from './FileEntry/FileEntryCheckbox.vue'
116116
import FileEntryName from './FileEntry/FileEntryName.vue'
117117
import FileEntryPreview from './FileEntry/FileEntryPreview.vue'
118118
import { useFileListWidth } from '../composables/useFileListWidth.ts'
119-
import { useNavigation } from '../composables/useNavigation.ts'
120-
import { useRouteParameters } from '../composables/useRouteParameters.ts'
121119
import { useActionsMenuStore } from '../store/actionsmenu.ts'
120+
import { useActiveStore } from '../store/active.ts'
122121
import { useDragAndDropStore } from '../store/dragging.ts'
123122
import { useFilesStore } from '../store/files.ts'
124123
import { useRenamingStore } from '../store/renaming.ts'
@@ -160,24 +159,23 @@ export default defineComponent({
160159
const renamingStore = useRenamingStore()
161160
const selectionStore = useSelectionStore()
162161
const filesListWidth = useFileListWidth()
163-
// The file list is guaranteed to be only shown with active view - thus we can set the `loaded` flag
164-
const { currentView } = useNavigation(true)
162+
165163
const {
166-
directory: currentDir,
167-
fileId: currentFileId,
168-
} = useRouteParameters()
164+
activeFolder,
165+
activeNode,
166+
activeView,
167+
} = useActiveStore()
169168
170169
return {
171170
actionsMenuStore,
171+
activeFolder,
172+
activeNode,
173+
activeView,
172174
draggingStore,
175+
filesListWidth,
173176
filesStore,
174177
renamingStore,
175178
selectionStore,
176-
177-
currentDir,
178-
currentFileId,
179-
currentView,
180-
filesListWidth,
181179
}
182180
},
183181
@@ -208,7 +206,7 @@ export default defineComponent({
208206
if (this.filesListWidth < 512 || this.compact) {
209207
return []
210208
}
211-
return this.currentView.columns || []
209+
return this.activeView.columns || []
212210
},
213211
214212
mime() {
@@ -281,7 +279,12 @@ export default defineComponent({
281279
return
282280
}
283281
284-
this.defaultFileAction?.exec(this.source, this.currentView, this.currentDir)
282+
this.defaultFileAction?.exec({
283+
nodes: [this.source],
284+
folder: this.activeFolder!,
285+
contents: this.nodes,
286+
view: this.activeView!,
287+
})
285288
},
286289
},
287290
})

apps/files/src/components/FileEntry/FileEntryActions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export default defineComponent({
208208
}
209209
return this.enabledFileActions.filter((action) => {
210210
try {
211-
return action?.inline?.(this.source, this.currentView)
211+
return action?.inline?.({ nodes: [this.source], view: this.currentView }) === true
212212
} catch (error) {
213213
logger.error('Error while checking if action is inline', { action, error })
214214
return false

apps/files/src/components/FileEntryGrid.vue

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
<!-- Actions -->
6666
<FileEntryActions
6767
ref="actions"
68+
v-model:opened="openedMenu"
6869
:class="`files-list__row-actions-${uniqueId}`"
6970
:grid-mode="true"
70-
:opened.sync="openedMenu"
7171
:source="source" />
7272
</tr>
7373
</template>
@@ -79,9 +79,9 @@ import FileEntryActions from './FileEntry/FileEntryActions.vue'
7979
import FileEntryCheckbox from './FileEntry/FileEntryCheckbox.vue'
8080
import FileEntryName from './FileEntry/FileEntryName.vue'
8181
import FileEntryPreview from './FileEntry/FileEntryPreview.vue'
82-
import { useNavigation } from '../composables/useNavigation.ts'
83-
import { useRouteParameters } from '../composables/useRouteParameters.ts'
82+
import { useFileListWidth } from '../composables/useFileListWidth.ts'
8483
import { useActionsMenuStore } from '../store/actionsmenu.ts'
84+
import { useActiveStore } from '../store/active.ts'
8585
import { useDragAndDropStore } from '../store/dragging.ts'
8686
import { useFilesStore } from '../store/files.ts'
8787
import { useRenamingStore } from '../store/renaming.ts'
@@ -111,23 +111,24 @@ export default defineComponent({
111111
const filesStore = useFilesStore()
112112
const renamingStore = useRenamingStore()
113113
const selectionStore = useSelectionStore()
114-
// The file list is guaranteed to be only shown with active view - thus we can set the `loaded` flag
115-
const { currentView } = useNavigation(true)
114+
const filesListWidth = useFileListWidth()
115+
116116
const {
117-
directory: currentDir,
118-
fileId: currentFileId,
119-
} = useRouteParameters()
117+
activeFolder,
118+
activeNode,
119+
activeView,
120+
} = useActiveStore()
120121
121122
return {
122123
actionsMenuStore,
124+
activeFolder,
125+
activeNode,
126+
activeView,
123127
draggingStore,
128+
filesListWidth,
124129
filesStore,
125130
renamingStore,
126131
selectionStore,
127-
128-
currentDir,
129-
currentFileId,
130-
currentView,
131132
}
132133
},
133134

apps/files/src/components/FileEntryMixin.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export default defineComponent({
122122
},
123123

124124
isActive() {
125-
return String(this.fileid) === String(this.currentFileId)
125+
return String(this.fileid) === String(this.activeNode.fileid)
126126
},
127127

128128
/**
@@ -378,14 +378,29 @@ export default defineComponent({
378378
event.preventDefault()
379379
event.stopPropagation()
380380
// Execute the first default action if any
381-
this.defaultFileAction.exec(this.source, this.currentView, this.currentDir)
381+
this.defaultFileAction.exec({
382+
nodes: [this.source],
383+
folder: this.activeFolder!,
384+
contents: this.nodes,
385+
view: this.activeView!,
386+
})
382387
},
383388

384389
openDetailsIfAvailable(event) {
385390
event.preventDefault()
386391
event.stopPropagation()
387-
if (sidebarAction?.enabled?.([this.source], this.currentView)) {
388-
sidebarAction.exec(this.source, this.currentView, this.currentDir)
392+
if (sidebarAction?.enabled?.({
393+
nodes: [this.source],
394+
folder: this.activeFolder!,
395+
contents: this.nodes,
396+
view: this.activeView!,
397+
})) {
398+
sidebarAction.exec({
399+
nodes: [this.source],
400+
folder: this.activeFolder!,
401+
contents: this.nodes,
402+
view: this.activeView!,
403+
})
389404
}
390405
},
391406

apps/files/src/components/FilesListTableHeaderActions.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export default defineComponent({
294294
})
295295
296296
// Dispatch action execution
297-
const results = await action.execBatch(this.nodes, this.currentView, this.directory)
297+
const results = await action.execBatch({ nodes: this.nodes, directory: this.directory })
298298
299299
// Check if all actions returned null
300300
if (!results.some((result) => result !== null)) {

apps/files/src/components/FilesListVirtual.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,19 @@ export default defineComponent({
311311
// Open the sidebar for the given URL fileid
312312
// iif we just loaded the app.
313313
const node = this.nodes.find((n) => n.fileid === fileId) as NcNode
314-
if (node && sidebarAction?.enabled?.([node], this.currentView)) {
314+
if (node && sidebarAction?.enabled?.({
315+
nodes: [node],
316+
folder: this.currentFolder,
317+
view: this.currentView,
318+
contents: this.nodes,
319+
})) {
315320
logger.debug('Opening sidebar on file ' + node.path, { node })
316-
sidebarAction.exec(node, this.currentView, this.currentFolder.path)
321+
sidebarAction.exec({
322+
nodes: [node],
323+
folder: this.currentFolder,
324+
view: this.currentView,
325+
contents: this.nodes,
326+
})
317327
return
318328
}
319329
logger.warn(`Failed to open sidebar on file ${fileId}, file isn't cached yet !`, { fileId, node })
@@ -393,7 +403,12 @@ export default defineComponent({
393403
// So if there is an enabled default action, so execute it
394404
if (defaultAction) {
395405
logger.debug('Opening file ' + node.path, { node })
396-
return await defaultAction.exec(node, this.currentView, this.currentFolder.path)
406+
return await defaultAction.exec({
407+
nodes: [node],
408+
view: this.currentView,
409+
folder: this.currentFolder,
410+
contents: this.nodes,
411+
})
397412
}
398413
}
399414
// The file is either a folder or has no default action other than downloading

apps/files/src/init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { addNewFileMenuEntry, registerDavProperty, registerFileAction } from '@nextcloud/files'
6+
import { addNewFileMenuEntry, registerFileAction } from '@nextcloud/files'
7+
import { registerDavProperty } from '@nextcloud/files/dav'
78
import { isPublicShare } from '@nextcloud/sharing/public'
89
import { registerConvertActions } from './actions/convertAction.ts'
910
import { action as deleteAction } from './actions/deleteAction.ts'

apps/files/src/services/DropService.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import type { Upload } from '@nextcloud/upload'
88
import type { RootDirectory } from './DropServiceUtils.ts'
99

1010
import { showError, showInfo, showSuccess, showWarning } from '@nextcloud/dialogs'
11-
import { davRootPath, NodeStatus } from '@nextcloud/files'
11+
import { NodeStatus } from '@nextcloud/files'
12+
import { getRootPath } from '@nextcloud/files/dav'
1213
import { translate as t } from '@nextcloud/l10n'
1314
import { joinPaths } from '@nextcloud/paths'
1415
import { getUploader, hasConflict } from '@nextcloud/upload'
@@ -125,8 +126,9 @@ export async function onDropExternalFiles(root: RootDirectory, destination: Fold
125126
// If the file is a directory, we need to create it first
126127
// then browse its tree and upload its contents.
127128
if (file instanceof Directory) {
128-
const absolutePath = joinPaths(davRootPath, destination.path, relativePath)
129+
const absolutePath = joinPaths(getRootPath(), destination.path, relativePath)
129130
try {
131+
ge
130132
logger.debug('Processing directory', { relativePath })
131133
await createDirectoryIfNotExists(absolutePath)
132134
await uploadDirectoryContents(file, relativePath)

apps/files/src/services/DropServiceUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
77

88
import { showInfo, showWarning } from '@nextcloud/dialogs'
99
import { emit } from '@nextcloud/event-bus'
10-
import { davGetClient, davGetDefaultPropfind, davResultToNode } from '@nextcloud/files'
10+
import { getClient, getDefaultPropfind, resultToNode } from '@nextcloud/files/dav'
1111
import { translate as t } from '@nextcloud/l10n'
1212
import { openConflictPicker } from '@nextcloud/upload'
1313
import logger from '../logger.ts'
@@ -135,13 +135,13 @@ function readDirectory(directory: FileSystemDirectoryEntry): Promise<FileSystemE
135135
* @param absolutePath
136136
*/
137137
export async function createDirectoryIfNotExists(absolutePath: string) {
138-
const davClient = davGetClient()
138+
const davClient = getClient()
139139
const dirExists = await davClient.exists(absolutePath)
140140
if (!dirExists) {
141141
logger.debug('Directory does not exist, creating it', { absolutePath })
142142
await davClient.createDirectory(absolutePath, { recursive: true })
143-
const stat = await davClient.stat(absolutePath, { details: true, data: davGetDefaultPropfind() }) as ResponseDataDetailed<FileStat>
144-
emit('files:node:created', davResultToNode(stat.data))
143+
const stat = await davClient.stat(absolutePath, { details: true, data: getDefaultPropfind() }) as ResponseDataDetailed<FileStat>
144+
emit('files:node:created', resultToNode(stat.data))
145145
}
146146
}
147147

apps/files/src/services/Favorites.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import type { ContentsWithRoot } from '@nextcloud/files'
66

77
import { getCurrentUser } from '@nextcloud/auth'
8-
import { davRemoteURL, davRootPath, Folder, getFavoriteNodes, Permission } from '@nextcloud/files'
8+
import { Folder, Permission } from '@nextcloud/files'
9+
import { getFavoriteNodes, getRemoteURL, getRootPath } from '@nextcloud/files/dav'
910
import { CancelablePromise } from 'cancelable-promise'
1011
import { getContents as filesContents } from './Files.ts'
1112
import { client } from './WebdavClient.ts'
@@ -32,8 +33,8 @@ export function getContents(path = '/'): CancelablePromise<ContentsWithRoot> {
3233
contents,
3334
folder: new Folder({
3435
id: 0,
35-
source: `${davRemoteURL}${davRootPath}`,
36-
root: davRootPath,
36+
source: `${getRemoteURL()}${getRootPath()}`,
37+
root: getRootPath(),
3738
owner: getCurrentUser()?.uid || null,
3839
permissions: Permission.READ,
3940
}),

0 commit comments

Comments
 (0)