summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-11-10 10:07:07 +0100
committerLouis Chemineau <louis@chmn.me>2022-11-28 17:31:27 +0100
commit173c053d41c9494e56d3301ff2a8c7ce13b79387 (patch)
treecd2a858198668241e87ac09398048f6c7b2ca073 /apps/files_versions
parenta32c25e1c8870bf751ed5b3fb7efe94a2d0302d6 (diff)
downloadnextcloud-server-173c053d41c9494e56d3301ff2a8c7ce13b79387.tar.gz
nextcloud-server-173c053d41c9494e56d3301ff2a8c7ce13b79387.zip
Hide version tab for folders
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/src/files_versions_tab.js55
1 files changed, 30 insertions, 25 deletions
diff --git a/apps/files_versions/src/files_versions_tab.js b/apps/files_versions/src/files_versions_tab.js
index b4ab075b7a8..28113d49c74 100644
--- a/apps/files_versions/src/files_versions_tab.js
+++ b/apps/files_versions/src/files_versions_tab.js
@@ -34,31 +34,36 @@ const View = Vue.extend(VersionTab)
let TabInstance = null
window.addEventListener('DOMContentLoaded', function () {
- if (OCA.Files && OCA.Files.Sidebar) {
- OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab({
- id: 'version_vue',
- name: t('files_versions', 'Version'),
- iconSvg: BackupRestore,
+ 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() {
+ async mount(el, fileInfo, context) {
+ if (TabInstance) {
TabInstance.$destroy()
- TabInstance = null
- },
- }))
- }
+ }
+ 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)
+ },
+ }))
})