-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Port files_versions to vue #34769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Port files_versions to vue #34769
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2c50153
Port files_versions to vue
CarlSchwan 7888aaf
Handle case with empty version list
CarlSchwan 3487968
Use NcListItem
CarlSchwan 8829019
Add support for Material icon in files sidebar
CarlSchwan a28838b
Use svg icons
artonge a32c25e
Extract logic into separate files
artonge 173c053
Hide version tab for folders
artonge ea946cc
Lint and remove file_versions tests
artonge 9d54b60
Compile assets
artonge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /** | ||
| * @copyright 2022 Carl Schwan <[email protected]> | ||
| * @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 Vue from 'vue' | ||
| import { translate as t, translatePlural as n } from '@nextcloud/l10n' | ||
|
|
||
| import VersionTab from './views/VersionTab.vue' | ||
| import VTooltip from 'v-tooltip' | ||
| // eslint-disable-next-line node/no-missing-import, import/no-unresolved | ||
| import BackupRestore from '@mdi/svg/svg/backup-restore.svg?raw' | ||
|
|
||
| Vue.prototype.t = t | ||
| Vue.prototype.n = n | ||
|
|
||
| Vue.use(VTooltip) | ||
|
|
||
| // Init Sharing tab component | ||
| const View = Vue.extend(VersionTab) | ||
| let TabInstance = null | ||
|
|
||
| window.addEventListener('DOMContentLoaded', function() { | ||
| if (OCA.Files?.Sidebar === undefined) { | ||
| return | ||
| } | ||
|
|
||
| OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab({ | ||
| id: 'version_vue', | ||
| name: t('files_versions', 'Version'), | ||
| iconSvg: BackupRestore, | ||
|
|
||
| async mount(el, fileInfo, context) { | ||
| if (TabInstance) { | ||
| TabInstance.$destroy() | ||
| } | ||
| TabInstance = new View({ | ||
| // Better integration with vue parent component | ||
| parent: context, | ||
| }) | ||
| // Only mount after we have all the info we need | ||
| await TabInstance.update(fileInfo) | ||
| TabInstance.$mount(el) | ||
| }, | ||
| update(fileInfo) { | ||
| TabInstance.update(fileInfo) | ||
| }, | ||
| destroy() { | ||
| TabInstance.$destroy() | ||
| TabInstance = null | ||
| }, | ||
| enabled(fileInfo) { | ||
| return !(fileInfo?.isDirectory() ?? true) | ||
| }, | ||
| })) | ||
| }) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| /** | ||
| * Copyright (c) 2015 | ||
| * @copyright 2022 Louis Chemineau <[email protected]> | ||
| * | ||
| * @author John Molakvoæ <[email protected]> | ||
| * @author Vincent Petry <[email protected]> | ||
| * @author Louis Chemineau <[email protected]> | ||
| * | ||
| * @license AGPL-3.0-or-later | ||
| * | ||
|
|
@@ -18,29 +17,18 @@ | |
| * | ||
| * 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/>. | ||
| * | ||
| */ | ||
|
|
||
| (function() { | ||
| OCA.Versions = OCA.Versions || {} | ||
| import { createClient, getPatcher } from 'webdav' | ||
| import { generateRemoteUrl } from '@nextcloud/router' | ||
| import axios from '@nextcloud/axios' | ||
|
|
||
| /** | ||
| * @namespace | ||
| */ | ||
| OCA.Versions.Util = { | ||
| /** | ||
| * Initialize the versions plugin. | ||
| * | ||
| * @param {OCA.Files.FileList} fileList file list to be extended | ||
| */ | ||
| attach(fileList) { | ||
| if (fileList.id === 'trashbin' || fileList.id === 'files.public') { | ||
| return | ||
| } | ||
| const rootPath = 'dav' | ||
|
|
||
| fileList.registerTabView(new OCA.Versions.VersionsTabView('versionsTabView', { order: -10 })) | ||
| }, | ||
| } | ||
| })() | ||
| // force our axios | ||
| const patcher = getPatcher() | ||
| patcher.patch('request', axios) | ||
|
|
||
| OC.Plugins.register('OCA.Files.FileList', OCA.Versions.Util) | ||
| // init webdav client on default dav endpoint | ||
| const remote = generateRemoteUrl(rootPath) | ||
| export default createClient(remote) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.