ui: [BUGFIX] Ensure in-folder KVs are created in the correct folder (#10569)
When clicking to create a KV within folder name, would would be viewing a form that was a form for creating a KV in the root, which when the user clicked to save, saved the KV in the root. For the moment at least I've removed the code that strips double slashes, and whilst this isn't ideal, it looks like we've picked up one of those bugs that turns into a 'feature', and completely reworking KV to not rely on the double slashes is not really an option right now.
This commit is contained in:
parent
ffb7e92aa7
commit
398db1339b
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
ui: Ensure in-folder KVs are created in the correct folder
|
||||
```
|
|
@ -54,7 +54,7 @@
|
|||
<div>
|
||||
<div>
|
||||
{{#if authorized}}
|
||||
<nav aria-label="Breadcrumb">
|
||||
<nav aria-label="Breadcrumb" data-test-breadcrumbs>
|
||||
<YieldSlot @name="breadcrumbs">
|
||||
{{document-attrs class="with-breadcrumbs"}}
|
||||
{{yield}}
|
||||
|
|
|
@ -9,7 +9,9 @@ if (env('CONSUL_NSPACES_ENABLED')) {
|
|||
}
|
||||
|
||||
const trailingSlashRe = /\/$/;
|
||||
const moreThan1SlashRe = /\/{2,}/g;
|
||||
|
||||
// see below re: ember double slashes
|
||||
// const moreThan1SlashRe = /\/{2,}/g;
|
||||
|
||||
const _uuid = function() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||
|
@ -123,15 +125,16 @@ export default class FSMWithOptionalLocation {
|
|||
}
|
||||
|
||||
getURLFrom(url) {
|
||||
// remove trailing slashes if they exists
|
||||
// remove trailing slashes if they exist
|
||||
url = url || this.location.pathname;
|
||||
this.rootURL = this.rootURL.replace(trailingSlashRe, '');
|
||||
this.baseURL = this.baseURL.replace(trailingSlashRe, '');
|
||||
// remove baseURL and rootURL from start of path
|
||||
return url
|
||||
.replace(new RegExp(`^${this.baseURL}(?=/|$)`), '')
|
||||
.replace(new RegExp(`^${this.rootURL}(?=/|$)`), '')
|
||||
.replace(moreThan1SlashRe, '/'); // remove extra slashes
|
||||
.replace(new RegExp(`^${this.rootURL}(?=/|$)`), '');
|
||||
// ember default locations remove double slashes here e.g. '//'
|
||||
// .replace(moreThan1SlashRe, '/'); // remove extra slashes
|
||||
}
|
||||
|
||||
getURLForTransition(url) {
|
||||
|
|
|
@ -48,3 +48,4 @@ Feature: dc / kvs / create
|
|||
And I click kv on the kvs
|
||||
And I click create
|
||||
And I see the text "New Key / Value" in "h1"
|
||||
And I see the text "key-value" in "[data-test-breadcrumbs] li:nth-child(2) a"
|
||||
|
|
Loading…
Reference in New Issue