Skip to content

Commit

Permalink
Use new API to register Files view
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Nov 28, 2023
1 parent 18aaebc commit 5620c1a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/actions/openGroupfolderAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import { translate as t } from '@nextcloud/l10n'
import type { Node } from '@nextcloud/files'

import { registerFileAction, FileAction } from '@nextcloud/files'
import { registerFileAction, FileAction, DefaultType } from '@nextcloud/files'

registerFileAction(new FileAction({
id: 'open-group-folders',
Expand All @@ -41,7 +41,7 @@ registerFileAction(new FileAction({
return null as any as boolean
},

default: true,
default: DefaultType.DEFAULT,
// Before openFolderAction
order: -1000,
}))
10 changes: 7 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
/* eslint-disable */
import { translate as t } from '@nextcloud/l10n'
import { View, getNavigation } from '@nextcloud/files'
import FolderSvg from '@mdi/svg/svg/folder-account.svg?raw'
import { getContents } from './services/groupfolders'
import './actions/openGroupfolderAction'
Expand All @@ -33,16 +34,19 @@ declare global {
const appName: string
}

const Navigation = window.OCP.Files.Navigation
Navigation.register({
const Navigation = getNavigation()
Navigation.register(new View({
id: appName,
name: t('groupfolders', 'Group folders'),
caption: t('groupfolders', 'List of group folders.'),

emptyTitle: t('files', 'No group folders yet'),
emptyCaption: t('files', 'Group folders will show up here'),

icon: FolderSvg,
order: 20,

columns: [],

getContents,
})
}))
2 changes: 1 addition & 1 deletion src/services/groupfolders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import type { DAVResultResponseProps, FileStat, ResponseDataDetailed } from 'webdav'

import { getCurrentUser } from '@nextcloud/auth'
import { File, Folder, Permission, parseWebdavPermissions } from '@nextcloud/files'
import { File, Folder, Permission } from '@nextcloud/files'
import { generateRemoteUrl, generateUrl } from '@nextcloud/router'

import client, { rootPath } from './client'
Expand Down

0 comments on commit 5620c1a

Please sign in to comment.