diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-17 19:05:54 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-18 15:33:21 +0200 |
commit | 2845319187c6ae118338575798a3413b4613ecb6 (patch) | |
tree | 7c4ed385a4be2ddd68d810a4e84fbefa9ea67d6a /apps/files | |
parent | e0c778f769a10a1f3edc365cc7aa115f119937aa (diff) | |
download | nextcloud-server-2845319187c6ae118338575798a3413b4613ecb6.tar.gz nextcloud-server-2845319187c6ae118338575798a3413b4613ecb6.zip |
feat(files): add systemtags view
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 7 | ||||
-rw-r--r-- | apps/files/src/services/Favorites.ts | 29 | ||||
-rw-r--r-- | apps/files/src/services/Files.ts | 2 | ||||
-rw-r--r-- | apps/files/src/services/Recent.ts | 29 | ||||
-rw-r--r-- | apps/files/src/views/FilesList.vue | 12 |
5 files changed, 21 insertions, 58 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 30ab98c9dc6..81a61843db0 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -190,6 +190,7 @@ import AccountGroupIcon from 'vue-material-design-icons/AccountGroup.vue' import FileIcon from 'vue-material-design-icons/File.vue' import FolderIcon from 'vue-material-design-icons/Folder.vue' import KeyIcon from 'vue-material-design-icons/Key.vue' +import TagIcon from 'vue-material-design-icons/Tag.vue' import LinkIcon from 'vue-material-design-icons/Link.vue' import NetworkIcon from 'vue-material-design-icons/Network.vue' import AccountPlusIcon from 'vue-material-design-icons/AccountPlus.vue' @@ -237,6 +238,7 @@ export default Vue.extend({ NcLoadingIcon, NcTextField, NetworkIcon, + TagIcon, }, props: { @@ -381,6 +383,11 @@ export default Vue.extend({ return KeyIcon } + // System tags + if (this.source?.attributes?.['is-tag']) { + return TagIcon + } + // Link and mail shared folders const shareTypes = Object.values(this.source?.attributes?.['share-types'] || {}).flat() as number[] if (shareTypes.some(type => type === ShareType.SHARE_TYPE_LINK || type === ShareType.SHARE_TYPE_EMAIL)) { diff --git a/apps/files/src/services/Favorites.ts b/apps/files/src/services/Favorites.ts index c993ef57d33..633ba718560 100644 --- a/apps/files/src/services/Favorites.ts +++ b/apps/files/src/services/Favorites.ts @@ -28,6 +28,7 @@ import { getCurrentUser } from '@nextcloud/auth' import { getClient, rootPath } from './WebdavClient' import { getDavNameSpaces, getDavProperties, getDefaultPropfind } from './DavProperties' +import { resultToNode } from './Files' const client = getClient() @@ -47,34 +48,6 @@ interface ResponseProps extends DAVResultResponseProps { size: number, } -const resultToNode = function(node: FileStat): File | Folder { - const props = node.props as ResponseProps - const permissions = davParsePermissions(props?.permissions) - const owner = getCurrentUser()?.uid as string - - const nodeData = { - id: props?.fileid as number || 0, - source: generateRemoteUrl('dav' + rootPath + node.filename), - mtime: new Date(node.lastmod), - mime: node.mime as string, - size: props?.size as number || 0, - permissions, - owner, - root: rootPath, - attributes: { - ...node, - ...props, - hasPreview: props?.['has-preview'], - }, - } - - delete nodeData.attributes.props - - return node.type === 'file' - ? new File(nodeData) - : new Folder(nodeData) -} - export const getContents = async (path = '/'): Promise<ContentsWithRoot> => { const propfindPayload = getDefaultPropfind() diff --git a/apps/files/src/services/Files.ts b/apps/files/src/services/Files.ts index d392dbb7751..fba65ac44ae 100644 --- a/apps/files/src/services/Files.ts +++ b/apps/files/src/services/Files.ts @@ -40,7 +40,7 @@ interface ResponseProps extends DAVResultResponseProps { size: number, } -const resultToNode = function(node: FileStat): File | Folder { +export const resultToNode = function(node: FileStat): File | Folder { const props = node.props as ResponseProps const permissions = davParsePermissions(props?.permissions) const owner = getCurrentUser()?.uid as string diff --git a/apps/files/src/services/Recent.ts b/apps/files/src/services/Recent.ts index cec604ba855..7a585d28fc5 100644 --- a/apps/files/src/services/Recent.ts +++ b/apps/files/src/services/Recent.ts @@ -28,6 +28,7 @@ import { getCurrentUser } from '@nextcloud/auth' import { getClient, rootPath } from './WebdavClient' import { getDavNameSpaces, getDavProperties } from './DavProperties' +import { resultToNode } from './Files' const client = getClient(generateRemoteUrl('dav')) @@ -94,34 +95,6 @@ interface ResponseProps extends DAVResultResponseProps { size: number, } -const resultToNode = function(node: FileStat): File | Folder { - const props = node.props as ResponseProps - const permissions = davParsePermissions(props?.permissions) - const owner = getCurrentUser()?.uid as string - - const nodeData = { - id: props?.fileid as number || 0, - source: generateRemoteUrl('dav' + node.filename), - mtime: new Date(node.lastmod), - mime: node.mime as string, - size: props?.size as number || 0, - permissions, - owner, - root: rootPath, - attributes: { - ...node, - ...props, - hasPreview: props?.['has-preview'], - }, - } - - delete nodeData.attributes.props - - return node.type === 'file' - ? new File(nodeData) - : new Folder(nodeData) -} - export const getContents = async (path = '/'): Promise<ContentsWithRoot> => { const contentsResponse = await client.getDirectoryContents(path, { details: true, diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue index 0b858a15e4d..d08f5a11874 100644 --- a/apps/files/src/views/FilesList.vue +++ b/apps/files/src/views/FilesList.vue @@ -328,12 +328,21 @@ export default Vue.extend({ }, }, + mounted() { + this.fetchContent() + }, + methods: { async fetchContent() { this.loading = true const dir = this.dir const currentView = this.currentView + if (!currentView) { + logger.debug('The current view doesn\'t exists or is not ready.', { currentView }) + return + } + // If we have a cancellable promise ongoing, cancel it if (typeof this.promise?.cancel === 'function') { this.promise.cancel() @@ -373,7 +382,8 @@ export default Vue.extend({ this.pathsStore.addPath({ service: currentView.id, fileid: node.fileid, path: join(dir, node.basename) }) }) } catch (error) { - logger.error('Error while fetching content', { error }) + throw error + // logger.error('Error while fetching content', { error }) } finally { this.loading = false } |