summaryrefslogtreecommitdiffstats
path: root/apps/files/src/models
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-12-17 17:27:36 +0100
committernpmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>2019-12-19 07:51:49 +0000
commit27dc4ef268722f525b3ce1f1fe72f0b17531ad6a (patch)
treeaf9805a09da26470c40da19ea3373c0b161b0333 /apps/files/src/models
parentac045a2461c3532d6c6ca6c33033871b1b0e1dc1 (diff)
downloadnextcloud-server-27dc4ef268722f525b3ce1f1fe72f0b17531ad6a.tar.gz
nextcloud-server-27dc4ef268722f525b3ce1f1fe72f0b17531ad6a.zip
Fix Sidebar enabled check
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/files/src/models')
-rw-r--r--apps/files/src/models/Tab.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/files/src/models/Tab.js b/apps/files/src/models/Tab.js
index 28902b0e754..2a045551c54 100644
--- a/apps/files/src/models/Tab.js
+++ b/apps/files/src/models/Tab.js
@@ -22,20 +22,27 @@
export default class Tab {
- #component;
- #legacy;
- #name;
+ #component
+ #legacy
+ #name
+ #enabled
/**
* Create a new tab instance
*
* @param {string} name the name 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, legacy) {
+ constructor(name, component, enabled = () => true, legacy) {
+ if (typeof enabled !== 'function') {
+ throw new Error('The enabled argument should be a function')
+ }
+
this.#name = name
this.#component = component
+ this.#enabled = enabled
this.#legacy = legacy === true
if (this.#legacy) {
@@ -52,6 +59,10 @@ export default class Tab {
return this.#component
}
+ get isEnabled() {
+ return this.#enabled
+ }
+
get isLegacyTab() {
return this.#legacy === true
}