mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
Fix legacy tabs
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
8fc29440f4
commit
4cfb5eac02
29 changed files with 1563 additions and 14513 deletions
22
apps/files/js/dist/personal-settings.js
vendored
22
apps/files/js/dist/personal-settings.js
vendored
File diff suppressed because one or more lines are too long
2
apps/files/js/dist/personal-settings.js.map
vendored
2
apps/files/js/dist/personal-settings.js.map
vendored
File diff suppressed because one or more lines are too long
30
apps/files/js/dist/sidebar.js
vendored
30
apps/files/js/dist/sidebar.js
vendored
File diff suppressed because one or more lines are too long
2
apps/files/js/dist/sidebar.js.map
vendored
2
apps/files/js/dist/sidebar.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -3658,10 +3658,9 @@
|
|||
*/
|
||||
registerTabView: function(tabView) {
|
||||
console.warn('registerTabView is deprecated! It will be removed in nextcloud 20.');
|
||||
const name = tabView.getLabel()
|
||||
const enabled = tabView.canDisplay || undefined
|
||||
if (name) {
|
||||
OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab(name, tabView, enabled, true))
|
||||
if (tabView.id) {
|
||||
OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab(tabView.id, tabView, enabled, true))
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
-->
|
||||
|
||||
<template>
|
||||
<AppSidebarTab :icon="icon"
|
||||
<AppSidebarTab
|
||||
:id="id"
|
||||
:icon="icon"
|
||||
:name="name"
|
||||
:active-tab="activeTab" />
|
||||
</template>
|
||||
|
|
@ -38,7 +40,7 @@ export default {
|
|||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
|
@ -52,9 +54,8 @@ export default {
|
|||
icon() {
|
||||
return this.component.getIcon()
|
||||
},
|
||||
id() {
|
||||
// copied from AppSidebarTab
|
||||
return this.name.toLowerCase().replace(/ /g, '-')
|
||||
name() {
|
||||
return this.component.getLabel()
|
||||
},
|
||||
order() {
|
||||
return this.component.order
|
||||
|
|
|
|||
|
|
@ -24,23 +24,23 @@ export default class Tab {
|
|||
|
||||
#component
|
||||
#legacy
|
||||
#name
|
||||
#id
|
||||
#enabled
|
||||
|
||||
/**
|
||||
* Create a new tab instance
|
||||
*
|
||||
* @param {string} name the name of this tab
|
||||
* @param {string} id the unique id of this tab
|
||||
* @param {Object} component the vue component
|
||||
* @param {Function} [enabled] function that returns if the tab should be shown or not
|
||||
* @param {boolean} [legacy] is this a legacy tab
|
||||
*/
|
||||
constructor(name, component, enabled = () => true, legacy) {
|
||||
constructor(id, component, enabled = () => true, legacy) {
|
||||
if (typeof enabled !== 'function') {
|
||||
throw new Error('The enabled argument should be a function')
|
||||
}
|
||||
|
||||
this.#name = name
|
||||
this.#id = id
|
||||
this.#component = component
|
||||
this.#enabled = enabled
|
||||
this.#legacy = legacy === true
|
||||
|
|
@ -51,8 +51,8 @@ export default class Tab {
|
|||
|
||||
}
|
||||
|
||||
get name() {
|
||||
return this.#name
|
||||
get id() {
|
||||
return this.#id
|
||||
}
|
||||
|
||||
get component() {
|
||||
|
|
|
|||
|
|
@ -56,17 +56,17 @@ export default class Sidebar {
|
|||
* @returns {Boolean}
|
||||
*/
|
||||
registerTab(tab) {
|
||||
const hasDuplicate = this.#state.tabs.findIndex(check => check.name === tab.name) > -1
|
||||
const hasDuplicate = this.#state.tabs.findIndex(check => check.id === tab.id) > -1
|
||||
if (!hasDuplicate) {
|
||||
this.#state.tabs.push(tab)
|
||||
return true
|
||||
}
|
||||
console.error(`An tab with the same name ${tab.name} already exists`, tab)
|
||||
console.error(`An tab with the same id ${tab.id} already exists`, tab)
|
||||
return false
|
||||
}
|
||||
|
||||
registerSecondaryView(view) {
|
||||
const hasDuplicate = this.#state.views.findIndex(check => check.name === view.name) > -1
|
||||
const hasDuplicate = this.#state.views.findIndex(check => check.id === view.id) > -1
|
||||
if (!hasDuplicate) {
|
||||
this.#state.views.push(view)
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
<component
|
||||
:is="tabComponent(tab).is"
|
||||
v-if="canDisplay(tab)"
|
||||
:id="tab.id"
|
||||
:key="tab.id"
|
||||
:component="tabComponent(tab).component"
|
||||
:name="tab.name"
|
||||
|
|
|
|||
78
apps/files_sharing/js/dist/files_sharing_tab.js
vendored
78
apps/files_sharing/js/dist/files_sharing_tab.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue