summaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-07-05 16:00:31 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-07-05 16:48:26 +0200
commit19e2aaa5b4f949166a1054bc8a2533cdb8028195 (patch)
tree56d6779f93e850860f5aaf102a211a3a9b2542bb /apps/files/src
parent9b0e3a97cb2f852188a07c102a6565e609ae1a64 (diff)
downloadnextcloud-server-19e2aaa5b4f949166a1054bc8a2533cdb8028195.tar.gz
nextcloud-server-19e2aaa5b4f949166a1054bc8a2533cdb8028195.zip
fix: favorites colour, icon, unwanted eslint-disable, typing and preview
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/components/FilesListVirtual.vue2
-rw-r--r--apps/files/src/services/Favorites.ts5
-rw-r--r--apps/files/src/services/Navigation.ts24
-rw-r--r--apps/files/src/store/actionsmenu.ts1
-rw-r--r--apps/files/src/store/files.ts16
-rw-r--r--apps/files/src/store/keyboard.ts9
-rw-r--r--apps/files/src/store/paths.ts14
-rw-r--r--apps/files/src/store/renaming.ts5
-rw-r--r--apps/files/src/store/selection.ts5
-rw-r--r--apps/files/src/store/userconfig.ts20
-rw-r--r--apps/files/src/store/viewConfig.ts23
-rw-r--r--apps/files/src/types.ts22
-rw-r--r--apps/files/src/views/favorites.ts2
13 files changed, 69 insertions, 79 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue
index 962b7d56263..6484721cfb6 100644
--- a/apps/files/src/components/FilesListVirtual.vue
+++ b/apps/files/src/components/FilesListVirtual.vue
@@ -286,7 +286,7 @@ export default Vue.extend({
position: absolute;
top: 4px;
right: -8px;
- color: #ffcc00;
+ color: #a08b00;
}
}
diff --git a/apps/files/src/services/Favorites.ts b/apps/files/src/services/Favorites.ts
index 75b5580c555..0e5411f08d3 100644
--- a/apps/files/src/services/Favorites.ts
+++ b/apps/files/src/services/Favorites.ts
@@ -20,7 +20,7 @@
*
*/
import { File, Folder, parseWebdavPermissions } from '@nextcloud/files'
-import { generateRemoteUrl, generateUrl } from '@nextcloud/router'
+import { generateRemoteUrl } from '@nextcloud/router'
import { getClient, rootPath } from './WebdavClient'
import { getCurrentUser } from '@nextcloud/auth'
import { getDavNameSpaces, getDavProperties, getDefaultPropfind } from './DavProperties'
@@ -49,7 +49,6 @@ const resultToNode = function(node: FileStat): File | Folder {
const props = node.props as ResponseProps
const permissions = parseWebdavPermissions(props?.permissions)
const owner = getCurrentUser()?.uid as string
- const previewUrl = generateUrl('/core/preview?fileId={fileid}&x=32&y=32&forceIcon=0', props)
const nodeData = {
id: props?.fileid as number || 0,
@@ -63,7 +62,7 @@ const resultToNode = function(node: FileStat): File | Folder {
attributes: {
...node,
...props,
- previewUrl,
+ hasPreview: props?.['has-preview'],
},
}
diff --git a/apps/files/src/services/Navigation.ts b/apps/files/src/services/Navigation.ts
index e85bd39ed81..767ab197c39 100644
--- a/apps/files/src/services/Navigation.ts
+++ b/apps/files/src/services/Navigation.ts
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
+/* eslint-disable no-use-before-define */
import type { Folder, Node } from '@nextcloud/files'
import isSvg from 'is-svg'
@@ -39,8 +39,10 @@ export interface Column {
render: (node: Node, view: Navigation) => HTMLElement
/** Function used to sort Nodes between them */
sort?: (nodeA: Node, nodeB: Node) => number
- /** Custom summary of the column to display at the end of the list.
- Will not be displayed if nothing is provided */
+ /**
+ * Custom summary of the column to display at the end of the list.
+ * Will not be displayed if nothing is provided
+ */
summary?: (node: Node[], view: Navigation) => string
}
@@ -64,8 +66,11 @@ export interface Navigation {
icon: string
/** The view order */
order: number
- /** This view column(s). Name and actions are
- by default always included */
+
+ /**
+ * This view column(s). Name and actions are
+ * by default always included
+ */
columns?: Column[]
/** The empty view element to render your empty content into */
emptyView?: (div: HTMLDivElement) => void
@@ -73,7 +78,9 @@ export interface Navigation {
parent?: string
/** This view is sticky (sent at the bottom) */
sticky?: boolean
- /** This view has children and is expanded or not,
+
+ /**
+ * This view has children and is expanded or not,
* will be overridden by user config.
*/
expanded?: boolean
@@ -81,7 +88,7 @@ export interface Navigation {
/**
* Will be used as default if the user
* haven't customized their sorting column
- * */
+ */
defaultSortKey?: string
/**
@@ -90,8 +97,9 @@ export interface Navigation {
* @deprecated It will be removed in a near future
*/
legacy?: boolean
+
/**
- * An icon class.
+ * An icon class.
* @deprecated It will be removed in a near future
*/
iconClass?: string
diff --git a/apps/files/src/store/actionsmenu.ts b/apps/files/src/store/actionsmenu.ts
index 66b1914ffbd..24689c13f89 100644
--- a/apps/files/src/store/actionsmenu.ts
+++ b/apps/files/src/store/actionsmenu.ts
@@ -19,7 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
import { defineStore } from 'pinia'
import type { ActionsMenuStore } from '../types'
diff --git a/apps/files/src/store/files.ts b/apps/files/src/store/files.ts
index 553df2e79d4..ac62512988b 100644
--- a/apps/files/src/store/files.ts
+++ b/apps/files/src/store/files.ts
@@ -19,17 +19,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
import type { Folder, Node } from '@nextcloud/files'
-import type { FilesStore, RootsStore, RootOptions, Service, FilesState } from '../types'
+import type { FilesStore, RootsStore, RootOptions, Service, FilesState, FileId } from '../types'
import { defineStore } from 'pinia'
import { subscribe } from '@nextcloud/event-bus'
import logger from '../logger'
-import type { FileId } from '../types'
import Vue from 'vue'
-export const useFilesStore = function() {
+export const useFilesStore = function(...args) {
const store = defineStore('files', {
state: (): FilesState => ({
files: {} as FilesStore,
@@ -40,7 +38,7 @@ export const useFilesStore = function() {
/**
* Get a file or folder by id
*/
- getNode: (state) => (id: FileId): Node|undefined => state.files[id],
+ getNode: (state) => (id: FileId): Node|undefined => state.files[id],
/**
* Get a list of files or folders by their IDs
@@ -52,7 +50,7 @@ export const useFilesStore = function() {
/**
* Get a file or folder by id
*/
- getRoot: (state) => (service: Service): Folder|undefined => state.roots[service],
+ getRoot: (state) => (service: Service): Folder|undefined => state.roots[service],
},
actions: {
@@ -67,7 +65,7 @@ export const useFilesStore = function() {
return acc
}, {} as FilesStore)
- Vue.set(this, 'files', {...this.files, ...files})
+ Vue.set(this, 'files', { ...this.files, ...files })
},
deleteNodes(nodes: Node[]) {
@@ -85,10 +83,10 @@ export const useFilesStore = function() {
onDeletedNode(node: Node) {
this.deleteNodes([node])
},
- }
+ },
})
- const fileStore = store(...arguments)
+ const fileStore = store(...args)
// Make sure we only register the listeners once
if (!fileStore._initialized) {
// subscribe('files:node:created', fileStore.onCreatedNode)
diff --git a/apps/files/src/store/keyboard.ts b/apps/files/src/store/keyboard.ts
index bdce7d55075..6bd40a6dfa7 100644
--- a/apps/files/src/store/keyboard.ts
+++ b/apps/files/src/store/keyboard.ts
@@ -19,7 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
import { defineStore } from 'pinia'
import Vue from 'vue'
@@ -28,9 +27,9 @@ import Vue from 'vue'
* special keys states. Useful for checking the
* current status of a key when executing a method.
*/
-export const useKeyboardStore = function() {
+export const useKeyboardStore = function(...args) {
const store = defineStore('keyboard', {
- state: () => ({
+ state: () => ({
altKey: false,
ctrlKey: false,
metaKey: false,
@@ -47,10 +46,10 @@ export const useKeyboardStore = function() {
Vue.set(this, 'metaKey', !!event.metaKey)
Vue.set(this, 'shiftKey', !!event.shiftKey)
},
- }
+ },
})
- const keyboardStore = store(...arguments)
+ const keyboardStore = store(...args)
// Make sure we only register the listeners once
if (!keyboardStore._initialized) {
window.addEventListener('keydown', keyboardStore.onEvent)
diff --git a/apps/files/src/store/paths.ts b/apps/files/src/store/paths.ts
index 60f4e6c08c5..6164e664498 100644
--- a/apps/files/src/store/paths.ts
+++ b/apps/files/src/store/paths.ts
@@ -19,18 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
-import type { PathOptions, ServicesState } from '../types'
-
+import type { FileId, PathsStore, PathOptions, ServicesState } from '../types'
import { defineStore } from 'pinia'
-import { subscribe } from '@nextcloud/event-bus'
-import type { FileId, PathsStore } from '../types'
import Vue from 'vue'
-export const usePathsStore = function() {
+export const usePathsStore = function(...args) {
const store = defineStore('paths', {
state: () => ({
- paths: {} as ServicesState
+ paths: {} as ServicesState,
} as PathsStore),
getters: {
@@ -54,10 +50,10 @@ export const usePathsStore = function() {
// Now we can set the provided path
Vue.set(this.paths[payload.service], payload.path, payload.fileid)
},
- }
+ },
})
- const pathsStore = store(...arguments)
+ const pathsStore = store(...args)
// Make sure we only register the listeners once
if (!pathsStore._initialized) {
// TODO: watch folders to update paths?
diff --git a/apps/files/src/store/renaming.ts b/apps/files/src/store/renaming.ts
index 6754d577607..6ba024f18b0 100644
--- a/apps/files/src/store/renaming.ts
+++ b/apps/files/src/store/renaming.ts
@@ -19,13 +19,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
import { defineStore } from 'pinia'
import { subscribe } from '@nextcloud/event-bus'
import type { Node } from '@nextcloud/files'
import type { RenamingStore } from '../types'
-export const useRenamingStore = function() {
+export const useRenamingStore = function(...args) {
const store = defineStore('renaming', {
state: () => ({
renamingNode: undefined,
@@ -33,7 +32,7 @@ export const useRenamingStore = function() {
} as RenamingStore),
})
- const renamingStore = store(...arguments)
+ const renamingStore = store(...args)
// Make sure we only register the listeners once
if (!renamingStore._initialized) {
diff --git a/apps/files/src/store/selection.ts b/apps/files/src/store/selection.ts
index 0d67420e963..251bb804b9a 100644
--- a/apps/files/src/store/selection.ts
+++ b/apps/files/src/store/selection.ts
@@ -19,7 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
import { defineStore } from 'pinia'
import Vue from 'vue'
import { FileId, SelectionStore } from '../types'
@@ -55,6 +54,6 @@ export const useSelectionStore = defineStore('selection', {
Vue.set(this, 'selected', [])
Vue.set(this, 'lastSelection', [])
Vue.set(this, 'lastSelectedIndex', null)
- }
- }
+ },
+ },
})
diff --git a/apps/files/src/store/userconfig.ts b/apps/files/src/store/userconfig.ts
index 3115eff9b7f..42530a3b54d 100644
--- a/apps/files/src/store/userconfig.ts
+++ b/apps/files/src/store/userconfig.ts
@@ -19,14 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
-import { loadState } from '@nextcloud/initial-state'
-import { generateUrl } from '@nextcloud/router'
-import { defineStore } from 'pinia'
-import Vue from 'vue'
-import axios from '@nextcloud/axios'
import type { UserConfig, UserConfigStore } from '../types'
+import { defineStore } from 'pinia'
import { emit, subscribe } from '@nextcloud/event-bus'
+import { generateUrl } from '@nextcloud/router'
+import { loadState } from '@nextcloud/initial-state'
+import axios from '@nextcloud/axios'
+import Vue from 'vue'
const userConfig = loadState('files', 'config', {
show_hidden: false,
@@ -34,7 +33,7 @@ const userConfig = loadState('files', 'config', {
sort_favorites_first: true,
}) as UserConfig
-export const useUserConfigStore = function() {
+export const useUserConfigStore = function(...args) {
const store = defineStore('userconfig', {
state: () => ({
userConfig,
@@ -57,11 +56,11 @@ export const useUserConfigStore = function() {
})
emit('files:config:updated', { key, value })
- }
- }
+ },
+ },
})
- const userConfigStore = store(...arguments)
+ const userConfigStore = store(...args)
// Make sure we only register the listeners once
if (!userConfigStore._initialized) {
@@ -73,4 +72,3 @@ export const useUserConfigStore = function() {
return userConfigStore
}
-
diff --git a/apps/files/src/store/viewConfig.ts b/apps/files/src/store/viewConfig.ts
index 607596dfd68..7cc0818f8a4 100644
--- a/apps/files/src/store/viewConfig.ts
+++ b/apps/files/src/store/viewConfig.ts
@@ -19,7 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
import { defineStore } from 'pinia'
import { emit, subscribe } from '@nextcloud/event-bus'
import { generateUrl } from '@nextcloud/router'
@@ -27,12 +26,11 @@ import { loadState } from '@nextcloud/initial-state'
import axios from '@nextcloud/axios'
import Vue from 'vue'
-import type { ViewConfigs, ViewConfigStore, ViewId } from '../types'
-import type { ViewConfig } from '../types'
+import type { ViewConfigs, ViewConfigStore, ViewId, ViewConfig } from '../types'
const viewConfig = loadState('files', 'viewConfigs', {}) as ViewConfigs
-export const useViewConfigStore = function() {
+export const useViewConfigStore = function(...args) {
const store = defineStore('viewconfig', {
state: () => ({
viewConfig,
@@ -69,26 +67,26 @@ export const useViewConfigStore = function() {
* The key param must be a valid key of a File object
* If not found, will be searched within the File attributes
*/
- setSortingBy(key: string = 'basename', view: string = 'files') {
+ setSortingBy(key = 'basename', view = 'files') {
// Save new config
this.update(view, 'sorting_mode', key)
this.update(view, 'sorting_direction', 'asc')
},
-
+
/**
* Toggle the sorting direction
*/
- toggleSortingDirection(view: string = 'files') {
- const config = this.getConfig(view) || { 'sorting_direction': 'asc' }
+ toggleSortingDirection(view = 'files') {
+ const config = this.getConfig(view) || { sorting_direction: 'asc' }
const newDirection = config.sorting_direction === 'asc' ? 'desc' : 'asc'
-
+
// Save new config
this.update(view, 'sorting_direction', newDirection)
- }
- }
+ },
+ },
})
- const viewConfigStore = store(...arguments)
+ const viewConfigStore = store(...args)
// Make sure we only register the listeners once
if (!viewConfigStore._initialized) {
@@ -100,4 +98,3 @@ export const useViewConfigStore = function() {
return viewConfigStore
}
-
diff --git a/apps/files/src/types.ts b/apps/files/src/types.ts
index c4f2afc3a65..8035d9dc198 100644
--- a/apps/files/src/types.ts
+++ b/apps/files/src/types.ts
@@ -19,9 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-/* eslint-disable */
-import type { Folder } from '@nextcloud/files'
-import type { Node } from '@nextcloud/files'
+import type { Folder, Node } from '@nextcloud/files'
// Global definitions
export type Service = string
@@ -29,11 +27,6 @@ export type FileId = number
export type ViewId = string
// Files store
-export type FilesState = {
- files: FilesStore,
- roots: RootsStore,
-}
-
export type FilesStore = {
[fileid: FileId]: Node
}
@@ -42,20 +35,25 @@ export type RootsStore = {
[service: Service]: Folder
}
+export type FilesState = {
+ files: FilesStore,
+ roots: RootsStore,
+}
+
export interface RootOptions {
root: Folder
service: Service
}
// Paths store
-export type ServicesState = {
- [service: Service]: PathConfig
-}
-
export type PathConfig = {
[path: string]: number
}
+export type ServicesState = {
+ [service: Service]: PathConfig
+}
+
export type PathsStore = {
paths: ServicesState
}
diff --git a/apps/files/src/views/favorites.ts b/apps/files/src/views/favorites.ts
index 86424f1785a..73293668664 100644
--- a/apps/files/src/views/favorites.ts
+++ b/apps/files/src/views/favorites.ts
@@ -59,7 +59,7 @@ export const generateIdFromPath = function(path: string): string {
export default () => {
// Load state in function for mock testing purposes
- const favoriteFolders = loadState('files', 'favoriteFolders', []) as string[]
+ const favoriteFolders = loadState<string[]>('files', 'favoriteFolders', [])
const favoriteFoldersViews = favoriteFolders.map((folder, index) => generateFolderView(folder, index))
const Navigation = window.OCP.Files.Navigation as NavigationService