Merge pull request #19125 from nextcloud/bugfix/noid/tab-id
Give the sharing tab a unique id so it also opens properly on other languages
This commit is contained in:
commit
2823deae12
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
|
@ -3658,10 +3658,9 @@
|
||||||
*/
|
*/
|
||||||
registerTabView: function(tabView) {
|
registerTabView: function(tabView) {
|
||||||
console.warn('registerTabView is deprecated! It will be removed in nextcloud 20.');
|
console.warn('registerTabView is deprecated! It will be removed in nextcloud 20.');
|
||||||
const name = tabView.getLabel()
|
|
||||||
const enabled = tabView.canDisplay || undefined
|
const enabled = tabView.canDisplay || undefined
|
||||||
if (name) {
|
if (tabView.id) {
|
||||||
OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab(name, tabView, enabled, true))
|
OCA.Files.Sidebar.registerTab(new OCA.Files.Sidebar.Tab(tabView.id, tabView, enabled, true))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppSidebarTab :icon="icon"
|
<AppSidebarTab
|
||||||
|
:id="id"
|
||||||
|
:icon="icon"
|
||||||
:name="name"
|
:name="name"
|
||||||
:active-tab="activeTab" />
|
:active-tab="activeTab" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -38,7 +40,7 @@ export default {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
name: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
@ -52,9 +54,8 @@ export default {
|
||||||
icon() {
|
icon() {
|
||||||
return this.component.getIcon()
|
return this.component.getIcon()
|
||||||
},
|
},
|
||||||
id() {
|
name() {
|
||||||
// copied from AppSidebarTab
|
return this.component.getLabel()
|
||||||
return this.name.toLowerCase().replace(/ /g, '-')
|
|
||||||
},
|
},
|
||||||
order() {
|
order() {
|
||||||
return this.component.order
|
return this.component.order
|
||||||
|
|
|
@ -24,23 +24,23 @@ export default class Tab {
|
||||||
|
|
||||||
#component
|
#component
|
||||||
#legacy
|
#legacy
|
||||||
#name
|
#id
|
||||||
#enabled
|
#enabled
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new tab instance
|
* 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 {Object} component the vue component
|
||||||
* @param {Function} [enabled] function that returns if the tab should be shown or not
|
* @param {Function} [enabled] function that returns if the tab should be shown or not
|
||||||
* @param {boolean} [legacy] is this a legacy tab
|
* @param {boolean} [legacy] is this a legacy tab
|
||||||
*/
|
*/
|
||||||
constructor(name, component, enabled = () => true, legacy) {
|
constructor(id, component, enabled = () => true, legacy) {
|
||||||
if (typeof enabled !== 'function') {
|
if (typeof enabled !== 'function') {
|
||||||
throw new Error('The enabled argument should be a function')
|
throw new Error('The enabled argument should be a function')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#name = name
|
this.#id = id
|
||||||
this.#component = component
|
this.#component = component
|
||||||
this.#enabled = enabled
|
this.#enabled = enabled
|
||||||
this.#legacy = legacy === true
|
this.#legacy = legacy === true
|
||||||
|
@ -51,8 +51,8 @@ export default class Tab {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get id() {
|
||||||
return this.#name
|
return this.#id
|
||||||
}
|
}
|
||||||
|
|
||||||
get component() {
|
get component() {
|
||||||
|
|
|
@ -56,17 +56,17 @@ export default class Sidebar {
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
registerTab(tab) {
|
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) {
|
if (!hasDuplicate) {
|
||||||
this.#state.tabs.push(tab)
|
this.#state.tabs.push(tab)
|
||||||
return true
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
registerSecondaryView(view) {
|
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) {
|
if (!hasDuplicate) {
|
||||||
this.#state.views.push(view)
|
this.#state.views.push(view)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
<component
|
<component
|
||||||
:is="tabComponent(tab).is"
|
:is="tabComponent(tab).is"
|
||||||
v-if="canDisplay(tab)"
|
v-if="canDisplay(tab)"
|
||||||
|
:id="tab.id"
|
||||||
:key="tab.id"
|
:key="tab.id"
|
||||||
:component="tabComponent(tab).component"
|
:component="tabComponent(tab).component"
|
||||||
:name="tab.name"
|
:name="tab.name"
|
||||||
|
|
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
|
@ -21,7 +21,10 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Tab :icon="icon" :name="name" :class="{ 'icon-loading': loading }">
|
<Tab :id="id"
|
||||||
|
:icon="icon"
|
||||||
|
:name="name"
|
||||||
|
:class="{ 'icon-loading': loading }">
|
||||||
<!-- error message -->
|
<!-- error message -->
|
||||||
<div v-if="error" class="emptycontent">
|
<div v-if="error" class="emptycontent">
|
||||||
<div class="icon icon-error" />
|
<div class="icon icon-error" />
|
||||||
|
@ -151,7 +154,7 @@ export default {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
id() {
|
id() {
|
||||||
return this.name.toLowerCase().replace(/ /g, '-')
|
return 'sharing'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
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
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
|
@ -3149,9 +3149,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@nextcloud/vue": {
|
"@nextcloud/vue": {
|
||||||
"version": "1.2.7",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-1.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-1.3.0.tgz",
|
||||||
"integrity": "sha512-hw6nqP6CpkFdj+o8wwVllSmC2h4f+oE+bSoiynlzHFt+TOxgrxh/wABkafEW7DmSCfTo4cOze9aVyoRU/zu8VA==",
|
"integrity": "sha512-zqSLvrp+pX012qNBbJBuE/Z9MPv/A6fovsro2nkGCoO0ppBD+W9gmjzLa6D9jRHN24+BmDWB3lNGd9T/G0q3Fw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@nextcloud/axios": "^1.1.0",
|
"@nextcloud/axios": "^1.1.0",
|
||||||
"@nextcloud/router": "^1.0.0",
|
"@nextcloud/router": "^1.0.0",
|
||||||
|
@ -3997,6 +3997,15 @@
|
||||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
|
||||||
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
|
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
|
||||||
},
|
},
|
||||||
|
"bindings": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"file-uri-to-path": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"block-stream": {
|
"block-stream": {
|
||||||
"version": "0.0.9",
|
"version": "0.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
|
||||||
|
@ -5755,6 +5764,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"file-uri-to-path": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"fill-range": {
|
"fill-range": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
|
||||||
|
@ -5937,13 +5952,14 @@
|
||||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
},
|
},
|
||||||
"fsevents": {
|
"fsevents": {
|
||||||
"version": "1.2.9",
|
"version": "1.2.11",
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz",
|
||||||
"integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==",
|
"integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
"nan": "^2.12.1",
|
"nan": "^2.12.1",
|
||||||
"node-pre-gyp": "^0.12.0"
|
"node-pre-gyp": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"abbrev": {
|
"abbrev": {
|
||||||
|
@ -5985,7 +6001,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chownr": {
|
"chownr": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -6010,7 +6026,7 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "4.1.1",
|
"version": "3.2.6",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6033,11 +6049,11 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"fs-minipass": {
|
"fs-minipass": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.7",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"minipass": "^2.2.1"
|
"minipass": "^2.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fs.realpath": {
|
"fs.realpath": {
|
||||||
|
@ -6061,7 +6077,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.3",
|
"version": "7.1.6",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6087,7 +6103,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ignore-walk": {
|
"ignore-walk": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6104,7 +6120,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -6140,7 +6156,7 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.3.5",
|
"version": "2.9.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6149,11 +6165,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minizlib": {
|
"minizlib": {
|
||||||
"version": "1.2.1",
|
"version": "1.3.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"minipass": "^2.2.1"
|
"minipass": "^2.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
|
@ -6165,22 +6181,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"needle": {
|
"needle": {
|
||||||
"version": "2.3.0",
|
"version": "2.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.0",
|
"debug": "^3.2.6",
|
||||||
"iconv-lite": "^0.4.4",
|
"iconv-lite": "^0.4.4",
|
||||||
"sax": "^1.2.4"
|
"sax": "^1.2.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node-pre-gyp": {
|
"node-pre-gyp": {
|
||||||
"version": "0.12.0",
|
"version": "0.14.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6193,7 +6209,7 @@
|
||||||
"rc": "^1.2.7",
|
"rc": "^1.2.7",
|
||||||
"rimraf": "^2.6.1",
|
"rimraf": "^2.6.1",
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.3.0",
|
||||||
"tar": "^4"
|
"tar": "^4.4.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nopt": {
|
"nopt": {
|
||||||
|
@ -6206,12 +6222,20 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npm-bundled": {
|
"npm-bundled": {
|
||||||
"version": "1.0.6",
|
"version": "1.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"npm-normalize-package-bin": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"npm-normalize-package-bin": {
|
||||||
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"npm-packlist": {
|
"npm-packlist": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.7",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6273,7 +6297,7 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -6310,7 +6334,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rimraf": {
|
"rimraf": {
|
||||||
"version": "2.6.3",
|
"version": "2.7.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -6333,7 +6357,7 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "5.7.0",
|
"version": "5.7.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -6379,17 +6403,17 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"tar": {
|
"tar": {
|
||||||
"version": "4.4.8",
|
"version": "4.4.13",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chownr": "^1.1.1",
|
"chownr": "^1.1.1",
|
||||||
"fs-minipass": "^1.2.5",
|
"fs-minipass": "^1.2.5",
|
||||||
"minipass": "^2.3.4",
|
"minipass": "^2.8.6",
|
||||||
"minizlib": "^1.1.1",
|
"minizlib": "^1.2.1",
|
||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
"safe-buffer": "^5.1.2",
|
"safe-buffer": "^5.1.2",
|
||||||
"yallist": "^3.0.2"
|
"yallist": "^3.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"util-deprecate": {
|
"util-deprecate": {
|
||||||
|
@ -6411,7 +6435,7 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.3",
|
"version": "3.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
"@nextcloud/logger": "^1.1.1",
|
"@nextcloud/logger": "^1.1.1",
|
||||||
"@nextcloud/paths": "^1.1.0",
|
"@nextcloud/paths": "^1.1.0",
|
||||||
"@nextcloud/router": "^1.0.0",
|
"@nextcloud/router": "^1.0.0",
|
||||||
"@nextcloud/vue": "^1.2.7",
|
"@nextcloud/vue": "^1.3.0",
|
||||||
"autosize": "^4.0.2",
|
"autosize": "^4.0.2",
|
||||||
"backbone": "^1.4.0",
|
"backbone": "^1.4.0",
|
||||||
"blueimp-md5": "^2.12.0",
|
"blueimp-md5": "^2.12.0",
|
||||||
|
|
Loading…
Reference in New Issue