mirror of https://github.com/status-im/consul.git
ui: [Bugfix] - Sticky KV Sessions (#6166)
Initialize session value to `null` to prevent stickiness from a session the previous KV
This commit is contained in:
parent
3a0d0833fc
commit
e636a72ffd
|
@ -17,6 +17,7 @@ export default Route.extend(WithKvActions, {
|
|||
isLoading: false,
|
||||
parent: repo.findBySlug(ascend(key, 1) || '/', dc),
|
||||
item: repo.findBySlug(key, dc),
|
||||
session: null,
|
||||
}).then(model => {
|
||||
// TODO: Consider loading this after initial page load
|
||||
const session = get(model.item, 'Session');
|
||||
|
|
|
@ -23,12 +23,16 @@
|
|||
{{/block-slot}}
|
||||
{{#block-slot 'content'}}
|
||||
{{#if session}}
|
||||
<p class="notice warning"><strong>Warning.</strong> This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see <a href="{{env 'CONSUL_DOCUMENTATION_URL'}}/internals/sessions.html" target="_blank" rel="noopener noreferrer">our documentation</a> for more information.</p>
|
||||
<p class="notice warning">
|
||||
<strong>Warning.</strong> This KV has a lock session. You can edit KV's with lock sessions, but we recommend doing so with care, or not doing so at all. It may negatively impact the active node it's associated with. See below for more details on the Lock Session and see <a href="{{env 'CONSUL_DOCUMENTATION_URL'}}/internals/sessions.html" target="_blank" rel="noopener noreferrer">our documentation</a> for more information.
|
||||
</p>
|
||||
{{/if}}
|
||||
{{partial 'dc/kv/form'}}
|
||||
{{#if session}}
|
||||
<div data-test-session>
|
||||
<h2><a href="{{env 'CONSUL_DOCUMENTATION_URL'}}/internals/sessions.html#session-design" rel="help noopener noreferrer" target="_blank">Lock Session</a></h2>
|
||||
<div data-test-session={{session.ID}}>
|
||||
<h2>
|
||||
<a href="{{env 'CONSUL_DOCUMENTATION_URL'}}/internals/sessions.html#session-design" rel="help noopener noreferrer" target="_blank">Lock Session</a>
|
||||
</h2>
|
||||
<dl>
|
||||
<dt>Name</dt>
|
||||
<dd>{{session.Name}}</dd>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
@setupApplicationTest
|
||||
Feature: dc / kvs / edit: KV Viewing
|
||||
Scenario:
|
||||
Given 1 datacenter model with the value "datacenter"
|
||||
And 1 kv model from yaml
|
||||
---
|
||||
Key: key
|
||||
Session: session-id
|
||||
---
|
||||
When I visit the kv page for yaml
|
||||
---
|
||||
dc: datacenter
|
||||
kv: key
|
||||
---
|
||||
Then the url should be /datacenter/kv/key/edit
|
||||
And I see ID on the session like "session-id"
|
||||
Given 1 kv model from yaml
|
||||
---
|
||||
Key: another-key
|
||||
Session: ~
|
||||
---
|
||||
When I visit the kv page for yaml
|
||||
---
|
||||
dc: datacenter
|
||||
kv: another-key
|
||||
---
|
||||
Then I don't see ID on the session
|
|
@ -0,0 +1,10 @@
|
|||
import steps from '../../steps';
|
||||
|
||||
// step definitions that are shared between features should be moved to the
|
||||
// tests/acceptance/steps/steps.js file
|
||||
|
||||
export default function(assert) {
|
||||
return steps(assert).then('I should find a file', function() {
|
||||
assert.ok(true, this.step);
|
||||
});
|
||||
}
|
|
@ -63,7 +63,7 @@ export default {
|
|||
nodes: create(nodes(visitable, clickable, attribute, collection, catalogFilter)),
|
||||
node: create(node(visitable, deletable, clickable, attribute, collection, radiogroup)),
|
||||
kvs: create(kvs(visitable, deletable, creatable, clickable, attribute, collection)),
|
||||
kv: create(kv(visitable, submitable, deletable, cancelable, clickable)),
|
||||
kv: create(kv(visitable, attribute, submitable, deletable, cancelable, clickable)),
|
||||
acls: create(acls(visitable, deletable, creatable, clickable, attribute, collection, aclFilter)),
|
||||
acl: create(acl(visitable, submitable, deletable, cancelable, clickable)),
|
||||
policies: create(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
export default function(visitable, submitable, deletable, cancelable) {
|
||||
return submitable(
|
||||
cancelable(
|
||||
deletable({
|
||||
export default function(visitable, attribute, submitable, deletable, cancelable) {
|
||||
return {
|
||||
visit: visitable(['/:dc/kv/:kv/edit', '/:dc/kv/create'], function(str) {
|
||||
// this will encode the parts of the key path but means you can no longer
|
||||
// visit with path parts containing slashes
|
||||
|
@ -10,8 +8,12 @@ export default function(visitable, submitable, deletable, cancelable) {
|
|||
.map(encodeURIComponent)
|
||||
.join('/');
|
||||
}),
|
||||
session: deletable({}, '[data-test-session]'),
|
||||
})
|
||||
)
|
||||
);
|
||||
...submitable(),
|
||||
...cancelable(),
|
||||
...deletable(),
|
||||
session: {
|
||||
ID: attribute('data-test-session', '[data-test-session]'),
|
||||
...deletable({}, '[data-test-session]'),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue