Skip to content
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
4 changes: 2 additions & 2 deletions apps/files/src/models/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default class Tab {
* @param {object} options destructuring object
* @param {string} options.id the unique id of this tab
* @param {string} options.name the translated tab name
* @param {?string} options.icon the icon css class
* @param {?string} options.iconSvg the icon in svg format
* @param {string} [options.icon] the icon css class
* @param {string} [options.iconSvg] the icon in svg format
* @param {Function} options.mount function to mount the tab
* @param {Function} [options.setIsActive] function to forward the active state of the tab
* @param {Function} options.update function to update the tab
Expand Down
41 changes: 35 additions & 6 deletions apps/files/src/services/FileInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,43 @@

/* eslint-disable jsdoc/require-jsdoc */

import type { Node } from '@nextcloud/files'
import type { Attribute, Node } from '@nextcloud/files'

export default function(node: Node) {
const fileInfo = new OC.Files.FileInfo({
id: node.fileid,
interface RawLegacyFileInfo {
id: number
path: string
name: string
mtime: number | undefined
etag: string
size: number
hasPreview: boolean
isEncrypted: boolean
isFavourited: boolean
mimetype: string
permissions: number
mountType: null | string
sharePermissions: string
shareAttributes: object
type: 'file' | 'dir'
attributes: Attribute
}

export type LegacyFileInfo = RawLegacyFileInfo & {
get: (key: keyof RawLegacyFileInfo) => unknown
isDirectory: () => boolean
canEdit: () => boolean
node: Node
canDownload: () => boolean
}

export default function(node: Node): LegacyFileInfo {
const rawFileInfo: RawLegacyFileInfo = {
id: node.fileid!,
path: node.dirname,
name: node.basename,
mtime: node.mtime?.getTime(),
etag: node.attributes.etag,
size: node.size,
size: node.size!,
hasPreview: node.attributes.hasPreview,
isEncrypted: node.attributes.isEncrypted === 1,
isFavourited: node.attributes.favorite === 1,
Expand All @@ -25,7 +52,9 @@ export default function(node: Node) {
shareAttributes: JSON.parse(node.attributes['share-attributes'] || '[]'),
type: node.type === 'file' ? 'file' : 'dir',
attributes: node.attributes,
})
}

const fileInfo = new OC.Files.FileInfo(rawFileInfo)

// TODO remove when no more legacy backbone is used
fileInfo.get = (key) => fileInfo[key]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function handle(Event $event): void {

// TODO: make sure to only include the sidebar script when
// we properly split it between files list and sidebar
Util::addScript(Application::APP_ID, 'files_versions');
Util::addStyle(Application::APP_ID, 'sidebar-tab');
Util::addScript(Application::APP_ID, 'sidebar-tab');
}
}
3 changes: 2 additions & 1 deletion apps/files_versions/lib/Listener/LoadSidebarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function handle(Event $event): void {

// TODO: make sure to only include the sidebar script when
// we properly split it between files list and sidebar
Util::addScript(Application::APP_ID, 'files_versions');
Util::addStyle(Application::APP_ID, 'sidebar-tab');
Util::addScript(Application::APP_ID, 'sidebar-tab');
}
}
Loading
Loading