diff options
author | Eduardo Morales <emoral435@gmail.com> | 2024-01-30 09:00:15 -0600 |
---|---|---|
committer | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-02-15 09:03:11 +0100 |
commit | 7dd4ff58272b238471048fb73c0ae3c5e97d8e91 (patch) | |
tree | 336ade432a054b9c3e1ee8006459112dd16a27e5 /apps/files | |
parent | c83a657652eec8f0055caa85402cd1373b63761f (diff) | |
download | nextcloud-server-7dd4ff58272b238471048fb73c0ae3c5e97d8e91.tar.gz nextcloud-server-7dd4ff58272b238471048fb73c0ae3c5e97d8e91.zip |
feature: personal views
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/src/init.ts | 4 | ||||
-rw-r--r-- | apps/files/src/services/PersonalFiles.ts | 43 | ||||
-rw-r--r-- | apps/files/src/views/personal-files.ts | 70 |
3 files changed, 116 insertions, 1 deletions
diff --git a/apps/files/src/init.ts b/apps/files/src/init.ts index c3b4b570e12..6cd2d7dcc0b 100644 --- a/apps/files/src/init.ts +++ b/apps/files/src/init.ts @@ -37,6 +37,7 @@ import { registerTemplateEntries } from './newMenu/newFromTemplate.ts' import registerFavoritesView from './views/favorites' import registerRecentView from './views/recent' +import registerPersonalFilesView from './views/personal-files' import registerFilesView from './views/files' import registerPreviewServiceWorker from './services/ServiceWorker.js' @@ -62,8 +63,9 @@ registerTemplateEntries() // Register files views registerFavoritesView() -registerFilesView() registerRecentView() +registerPersonalFilesView() +registerFilesView() // Register preview service worker registerPreviewServiceWorker() diff --git a/apps/files/src/services/PersonalFiles.ts b/apps/files/src/services/PersonalFiles.ts new file mode 100644 index 00000000000..431d8a1f021 --- /dev/null +++ b/apps/files/src/services/PersonalFiles.ts @@ -0,0 +1,43 @@ +/** + * @copyright Copyright (c) 2024 Eduardo Morales <emoral435@gmail.com> + * + * @author Eduardo Morales <emoral435@gmail.com> + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +/** + * @types + */ +import type { ContentsWithRoot } from '@nextcloud/files' + +import { CancelablePromise } from 'cancelable-promise' +import { davGetClient } from "@nextcloud/files"; + +const client = davGetClient() + +// TODO filter out the root file path for personal / non shared / non group folder files and nodes +export const getContents = (path: string = "/"): Promise<ContentsWithRoot> => { + const controller = new AbortController() + return new CancelablePromise(async (resolve, reject, onCancel) => { + onCancel(() => controller.abort()) + try { + + } catch (error) { + reject(error) + } + }) +}
\ No newline at end of file diff --git a/apps/files/src/views/personal-files.ts b/apps/files/src/views/personal-files.ts new file mode 100644 index 00000000000..ea9fafc800c --- /dev/null +++ b/apps/files/src/views/personal-files.ts @@ -0,0 +1,70 @@ +/** + * @copyright Copyright (c) 2024 Eduardo Morales <emoral435@gmail.com> + * + * @author Eduardo Morales <emoral435@gmail.com> + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +import { translate as t } from '@nextcloud/l10n' +import type { Folder, Node } from '@nextcloud/files' + +import FolderHome from '@mdi/svg/svg/folder-home.svg?raw' +import { View, getNavigation } from '@nextcloud/files' +import { loadState } from '@nextcloud/initial-state' + +import { getContents } from '../services/PersonalFiles' +import logger from '../logger' +import { subscribe } from '@nextcloud/event-bus' + +/** + * NOTE since we are only filtering at the root level, we only need to use the + * getContents methods only on this default folder view / route / path. +*/ +export default () => { + logger.debug("Loading root level personal files view...") + + const Navigation = getNavigation() + Navigation.register(new View({ + id: 'personal-files', + name: t('files', 'Personal Files'), + caption: t('files', 'List of your files and folders that are not shared.'), + + emptyTitle: t('files', 'No personal files found.'), + emptyCaption: t('files', 'Files that are not shared will show up here.'), + + icon: FolderHome, + order: 1, + + getContents, + })) + + /** + * Update root personal files navigation when a folder is no longer shared + */ + // subscribe() + + /** + * Remove root personal files navigation when a folder is shared + */ + // subscribe() + + /** + * Sort the personal files paths array and + * update the order property of the existing views + */ + // const updateAndSortViews = () => {} +} |