diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-07-05 16:00:31 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-07-05 16:48:26 +0200 |
commit | 19e2aaa5b4f949166a1054bc8a2533cdb8028195 (patch) | |
tree | 56d6779f93e850860f5aaf102a211a3a9b2542bb /apps/files/src/store | |
parent | 9b0e3a97cb2f852188a07c102a6565e609ae1a64 (diff) | |
download | nextcloud-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/store')
-rw-r--r-- | apps/files/src/store/actionsmenu.ts | 1 | ||||
-rw-r--r-- | apps/files/src/store/files.ts | 16 | ||||
-rw-r--r-- | apps/files/src/store/keyboard.ts | 9 | ||||
-rw-r--r-- | apps/files/src/store/paths.ts | 14 | ||||
-rw-r--r-- | apps/files/src/store/renaming.ts | 5 | ||||
-rw-r--r-- | apps/files/src/store/selection.ts | 5 | ||||
-rw-r--r-- | apps/files/src/store/userconfig.ts | 20 | ||||
-rw-r--r-- | apps/files/src/store/viewConfig.ts | 23 |
8 files changed, 39 insertions, 54 deletions
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 } - |