diff --git a/ui-v2/app/routes/dc/kv/edit.js b/ui-v2/app/routes/dc/kv/edit.js
index 44c13a5f1553..37581dc02900 100644
--- a/ui-v2/app/routes/dc/kv/edit.js
+++ b/ui-v2/app/routes/dc/kv/edit.js
@@ -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');
diff --git a/ui-v2/app/templates/dc/kv/edit.hbs b/ui-v2/app/templates/dc/kv/edit.hbs
index cfcb18de9281..bc8a0c2771f3 100644
--- a/ui-v2/app/templates/dc/kv/edit.hbs
+++ b/ui-v2/app/templates/dc/kv/edit.hbs
@@ -1,73 +1,77 @@
{{#app-view class="kv edit" loading=isLoading}}
- {{#block-slot 'notification' as |status type|}}
- {{partial 'dc/kv/notifications'}}
- {{/block-slot}}
- {{#block-slot 'breadcrumbs'}}
-
- Key / Values
-{{#if (not-eq parent.Key '/') }}
-{{#each (slice 0 -1 (split parent.Key '/')) as |breadcrumb index|}}
- {{breadcrumb}}
-{{/each}}
+ {{#block-slot 'notification' as |status type|}}
+ {{partial 'dc/kv/notifications'}}
+ {{/block-slot}}
+ {{#block-slot 'breadcrumbs'}}
+
+ Key / Values
+{{#if (not-eq parent.Key '/')}}
+ {{#each (slice 0 -1 (split parent.Key '/')) as |breadcrumb index|}}
+ {{breadcrumb}}
+ {{/each}}
{{/if}}
-
- {{/block-slot}}
- {{#block-slot 'header'}}
-
-{{#if item.Key }}
- {{left-trim item.Key parent.Key }}
+
+ {{/block-slot}}
+ {{#block-slot 'header'}}
+
+{{#if item.Key}}
+ {{left-trim item.Key parent.Key}}
{{else}}
- New Key / Value
+ New Key / Value
{{/if}}
-
- {{/block-slot}}
- {{#block-slot 'content'}}
- {{#if session}}
- Warning. 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 our documentation for more information.
- {{/if}}
- {{partial 'dc/kv/form'}}
- {{#if session}}
-
-
-
- Name
- {{session.Name}}
- Agent
-
- {{session.Node}}
-
- ID
- {{session.ID}}
- Behavior
- {{session.Behavior}}
+
+ {{/block-slot}}
+ {{#block-slot 'content'}}
+ {{#if session}}
+
+ Warning. 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 our documentation for more information.
+
+ {{/if}}
+ {{partial 'dc/kv/form'}}
+ {{#if session}}
+
+
+
+ Name
+ {{session.Name}}
+ Agent
+
+ {{session.Node}}
+
+ ID
+ {{session.ID}}
+ Behavior
+ {{session.Behavior}}
{{#if session.Delay }}
- Delay
- {{session.LockDelay}}
+ Delay
+ {{session.LockDelay}}
{{/if}}
{{#if session.TTL }}
- TTL
- {{session.TTL}}
+ TTL
+ {{session.TTL}}
{{/if}}
{{#if (gt session.Checks.length 0)}}
- Health Checks
-
- {{ join ', ' session.Checks}}
-
+ Health Checks
+
+ {{ join ', ' session.Checks}}
+
{{/if}}
-
- {{#confirmation-dialog message='Are you sure you want to invalidate this session?'}}
- {{#block-slot 'action' as |confirm|}}
-
Invalidate Session
- {{/block-slot}}
- {{#block-slot 'dialog' as |execute cancel message|}}
-
- {{message}}
-
-
Confirm Invalidation
-
Cancel
- {{/block-slot}}
- {{/confirmation-dialog}}
-
- {{/if}}
- {{/block-slot}}
+
+ {{#confirmation-dialog message='Are you sure you want to invalidate this session?'}}
+ {{#block-slot 'action' as |confirm|}}
+
Invalidate Session
+ {{/block-slot}}
+ {{#block-slot 'dialog' as |execute cancel message|}}
+
+ {{message}}
+
+
Confirm Invalidation
+
Cancel
+ {{/block-slot}}
+ {{/confirmation-dialog}}
+
+ {{/if}}
+ {{/block-slot}}
{{/app-view}}
\ No newline at end of file
diff --git a/ui-v2/tests/acceptance/dc/kvs/edit.feature b/ui-v2/tests/acceptance/dc/kvs/edit.feature
new file mode 100644
index 000000000000..b750e3ffc4aa
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/kvs/edit.feature
@@ -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
diff --git a/ui-v2/tests/acceptance/steps/dc/kvs/edit-steps.js b/ui-v2/tests/acceptance/steps/dc/kvs/edit-steps.js
new file mode 100644
index 000000000000..a7eff3228bf4
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/kvs/edit-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/pages.js b/ui-v2/tests/pages.js
index 7b069db8240e..f7d3ec52494f 100644
--- a/ui-v2/tests/pages.js
+++ b/ui-v2/tests/pages.js
@@ -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(
diff --git a/ui-v2/tests/pages/dc/kv/edit.js b/ui-v2/tests/pages/dc/kv/edit.js
index 3fd310af2250..872579e71b5d 100644
--- a/ui-v2/tests/pages/dc/kv/edit.js
+++ b/ui-v2/tests/pages/dc/kv/edit.js
@@ -1,17 +1,19 @@
-export default function(visitable, submitable, deletable, cancelable) {
- return submitable(
- cancelable(
- deletable({
- 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
- return str
- .split('/')
- .map(encodeURIComponent)
- .join('/');
- }),
- session: deletable({}, '[data-test-session]'),
- })
- )
- );
+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
+ return str
+ .split('/')
+ .map(encodeURIComponent)
+ .join('/');
+ }),
+ ...submitable(),
+ ...cancelable(),
+ ...deletable(),
+ session: {
+ ID: attribute('data-test-session', '[data-test-session]'),
+ ...deletable({}, '[data-test-session]'),
+ },
+ };
}