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:
John Molakvoæ 2020-01-30 09:39:30 +01:00 committed by GitHub
commit 2823deae12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 314 additions and 13237 deletions

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

View File

@ -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))
}
},

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -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"

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

View File

@ -21,7 +21,10 @@
-->
<template>
<Tab :icon="icon" :name="name" :class="{ 'icon-loading': loading }">
<Tab :id="id"
:icon="icon"
:name="name"
:class="{ 'icon-loading': loading }">
<!-- error message -->
<div v-if="error" class="emptycontent">
<div class="icon icon-error" />
@ -151,7 +154,7 @@ export default {
* @returns {string}
*/
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

88
package-lock.json generated
View File

@ -3149,9 +3149,9 @@
}
},
"@nextcloud/vue": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-1.2.7.tgz",
"integrity": "sha512-hw6nqP6CpkFdj+o8wwVllSmC2h4f+oE+bSoiynlzHFt+TOxgrxh/wABkafEW7DmSCfTo4cOze9aVyoRU/zu8VA==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-1.3.0.tgz",
"integrity": "sha512-zqSLvrp+pX012qNBbJBuE/Z9MPv/A6fovsro2nkGCoO0ppBD+W9gmjzLa6D9jRHN24+BmDWB3lNGd9T/G0q3Fw==",
"requires": {
"@nextcloud/axios": "^1.1.0",
"@nextcloud/router": "^1.0.0",
@ -3997,6 +3997,15 @@
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
"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": {
"version": "0.0.9",
"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": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
@ -5937,13 +5952,14 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"fsevents": {
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz",
"integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==",
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.11.tgz",
"integrity": "sha512-+ux3lx6peh0BpvY0JebGyZoiR4D+oYzdPZMKJwkZ+sFkNJzpL7tXc/wehS49gUAxg3tmMHPHZkA8JU2rhhgDHw==",
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1",
"node-pre-gyp": "^0.12.0"
"node-pre-gyp": "*"
},
"dependencies": {
"abbrev": {
@ -5985,7 +6001,7 @@
}
},
"chownr": {
"version": "1.1.1",
"version": "1.1.3",
"bundled": true,
"optional": true
},
@ -6010,7 +6026,7 @@
"optional": true
},
"debug": {
"version": "4.1.1",
"version": "3.2.6",
"bundled": true,
"optional": true,
"requires": {
@ -6033,11 +6049,11 @@
"optional": true
},
"fs-minipass": {
"version": "1.2.5",
"version": "1.2.7",
"bundled": true,
"optional": true,
"requires": {
"minipass": "^2.2.1"
"minipass": "^2.6.0"
}
},
"fs.realpath": {
@ -6061,7 +6077,7 @@
}
},
"glob": {
"version": "7.1.3",
"version": "7.1.6",
"bundled": true,
"optional": true,
"requires": {
@ -6087,7 +6103,7 @@
}
},
"ignore-walk": {
"version": "3.0.1",
"version": "3.0.3",
"bundled": true,
"optional": true,
"requires": {
@ -6104,7 +6120,7 @@
}
},
"inherits": {
"version": "2.0.3",
"version": "2.0.4",
"bundled": true,
"optional": true
},
@ -6140,7 +6156,7 @@
"optional": true
},
"minipass": {
"version": "2.3.5",
"version": "2.9.0",
"bundled": true,
"optional": true,
"requires": {
@ -6149,11 +6165,11 @@
}
},
"minizlib": {
"version": "1.2.1",
"version": "1.3.3",
"bundled": true,
"optional": true,
"requires": {
"minipass": "^2.2.1"
"minipass": "^2.9.0"
}
},
"mkdirp": {
@ -6165,22 +6181,22 @@
}
},
"ms": {
"version": "2.1.1",
"version": "2.1.2",
"bundled": true,
"optional": true
},
"needle": {
"version": "2.3.0",
"version": "2.4.0",
"bundled": true,
"optional": true,
"requires": {
"debug": "^4.1.0",
"debug": "^3.2.6",
"iconv-lite": "^0.4.4",
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
"version": "0.12.0",
"version": "0.14.0",
"bundled": true,
"optional": true,
"requires": {
@ -6193,7 +6209,7 @@
"rc": "^1.2.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
"tar": "^4.4.2"
}
},
"nopt": {
@ -6206,12 +6222,20 @@
}
},
"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,
"optional": true
},
"npm-packlist": {
"version": "1.4.1",
"version": "1.4.7",
"bundled": true,
"optional": true,
"requires": {
@ -6273,7 +6297,7 @@
"optional": true
},
"process-nextick-args": {
"version": "2.0.0",
"version": "2.0.1",
"bundled": true,
"optional": true
},
@ -6310,7 +6334,7 @@
}
},
"rimraf": {
"version": "2.6.3",
"version": "2.7.1",
"bundled": true,
"optional": true,
"requires": {
@ -6333,7 +6357,7 @@
"optional": true
},
"semver": {
"version": "5.7.0",
"version": "5.7.1",
"bundled": true,
"optional": true
},
@ -6379,17 +6403,17 @@
"optional": true
},
"tar": {
"version": "4.4.8",
"version": "4.4.13",
"bundled": true,
"optional": true,
"requires": {
"chownr": "^1.1.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.3.4",
"minizlib": "^1.1.1",
"minipass": "^2.8.6",
"minizlib": "^1.2.1",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.2"
"yallist": "^3.0.3"
}
},
"util-deprecate": {
@ -6411,7 +6435,7 @@
"optional": true
},
"yallist": {
"version": "3.0.3",
"version": "3.1.1",
"bundled": true,
"optional": true
}

View File

@ -34,7 +34,7 @@
"@nextcloud/logger": "^1.1.1",
"@nextcloud/paths": "^1.1.0",
"@nextcloud/router": "^1.0.0",
"@nextcloud/vue": "^1.2.7",
"@nextcloud/vue": "^1.3.0",
"autosize": "^4.0.2",
"backbone": "^1.4.0",
"blueimp-md5": "^2.12.0",