diff --git a/.changelog/10225.txt b/.changelog/10225.txt
new file mode 100644
index 0000000000..c3c017c29d
--- /dev/null
+++ b/.changelog/10225.txt
@@ -0,0 +1,3 @@
+```release-note:bug
+ui: Reflect the change of Session API response shape for Checks in post 1.7 Consul
+```
diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/form/index.hbs b/ui/packages/consul-ui/app/components/consul/lock-session/form/index.hbs
index 70a9d6809d..955fa98f52 100644
--- a/ui/packages/consul-ui/app/components/consul/lock-session/form/index.hbs
+++ b/ui/packages/consul-ui/app/components/consul/lock-session/form/index.hbs
@@ -16,30 +16,32 @@
Lock Session
+{{#if api.data.Name}}
- Name
- {{api.data.Name}}
- - Agent
+{{/if}}
+ - ID
+ - {{api.data.ID}}
+ - Node
-
{{api.data.Node}}
- - ID
- - {{api.data.ID}}
- - Behavior
- - {{api.data.Behavior}}
-{{#if form.data.Delay }}
- Delay
- {{duration-from api.data.LockDelay}}
-{{/if}}
-{{#if form.data.TTL }}
- TTL
- - {{api.data.TTL}}
-{{/if}}
-{{#if (gt api.data.Checks.length 0)}}
+ - {{or api.data.TTL '-'}}
+ - Behavior
+ - {{api.data.Behavior}}
+{{#let (union api.data.NodeChecks api.data.ServiceChecks) as |checks|}}
- Health Checks
-
- {{ join ', ' api.data.Checks}}
+ {{#if (gt checks.length 0)}}
+ {{ join ', ' checks}}
+ {{else}}
+ -
+ {{/if}}
-{{/if}}
+{{/let}}
{{#if (can 'delete session' item=api.data)}}
diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/list/index.hbs b/ui/packages/consul-ui/app/components/consul/lock-session/list/index.hbs
index 4957468e56..90d177525c 100644
--- a/ui/packages/consul-ui/app/components/consul/lock-session/list/index.hbs
+++ b/ui/packages/consul-ui/app/components/consul/lock-session/list/index.hbs
@@ -17,27 +17,26 @@
{{#if item.Name}}
-
+ ID
+
+ -
-
-
- {{item.ID}}
+ {{item.ID}}
+
{{/if}}
- -
-
- Delay
-
+
-
+ Delay
- {{duration-from item.LockDelay}}
- -
-
- TTL
-
+
-
+ TTL
{{#if (eq item.TTL "")}}
- -
@@ -46,25 +45,27 @@
{{/if}}
- -
-
- Behavior
-
+
-
+ Behavior
- {{item.Behavior}}
+{{#let (union item.NodeChecks item.ServiceChecks) as |checks|}}
- -
-
- Checks
-
+
-
+ Checks
-
- {{#each item.Checks as |item|}}
+{{#if (gt checks.length 0)}}
+ {{#each checks as |item|}}
{{item}}
{{/each}}
+{{else}}
+ -
+{{/if}}
+{{/let}}
{{#if (can "delete sessions")}}
diff --git a/ui/packages/consul-ui/app/components/consul/lock-session/list/index.scss b/ui/packages/consul-ui/app/components/consul/lock-session/list/index.scss
new file mode 100644
index 0000000000..a557380100
--- /dev/null
+++ b/ui/packages/consul-ui/app/components/consul/lock-session/list/index.scss
@@ -0,0 +1,11 @@
+.consul-lock-session-list .checks dd {
+ display: inline-flex;
+ flex-wrap: wrap;
+ padding-left: 0px;
+}
+.consul-lock-session-list .checks dd > *:not(:last-child)::after {
+ content: ',';
+ margin-right: 0.3em;
+ display: inline;
+}
+
diff --git a/ui/packages/consul-ui/app/models/session.js b/ui/packages/consul-ui/app/models/session.js
index 0645d55bf7..9f50d1d0bb 100644
--- a/ui/packages/consul-ui/app/models/session.js
+++ b/ui/packages/consul-ui/app/models/session.js
@@ -1,4 +1,5 @@
import Model, { attr } from '@ember-data/model';
+import { nullValue } from 'consul-ui/decorators/replace';
export const PRIMARY_KEY = 'uid';
export const SLUG_KEY = 'ID';
@@ -18,6 +19,8 @@ export default class Session extends Model {
@attr('number') CreateIndex;
@attr('number') ModifyIndex;
- @attr({ defaultValue: () => [] }) Checks;
+ @nullValue([]) @attr({ defaultValue: () => [] }) NodeChecks;
+ @nullValue([]) @attr({ defaultValue: () => [] }) ServiceChecks;
+
@attr({ defaultValue: () => [] }) Resources; // []
}
diff --git a/ui/packages/consul-ui/app/styles/components.scss b/ui/packages/consul-ui/app/styles/components.scss
index 313b7cf2e7..4d79762ce0 100644
--- a/ui/packages/consul-ui/app/styles/components.scss
+++ b/ui/packages/consul-ui/app/styles/components.scss
@@ -68,6 +68,7 @@
@import 'consul-ui/components/consul/external-source';
@import 'consul-ui/components/consul/kind';
@import 'consul-ui/components/consul/intention';
+@import 'consul-ui/components/consul/lock-session/list';
@import 'consul-ui/components/consul/lock-session/form';
@import 'consul-ui/components/consul/auth-method';
diff --git a/ui/packages/consul-ui/app/styles/components/composite-row.scss b/ui/packages/consul-ui/app/styles/components/composite-row.scss
index c971cd2404..cb0d76559a 100644
--- a/ui/packages/consul-ui/app/styles/components/composite-row.scss
+++ b/ui/packages/consul-ui/app/styles/components/composite-row.scss
@@ -18,6 +18,7 @@
}
// TODO: This hides the iconless dt's in the below lists as they don't have
// tooltips the todo would be to wrap these texts in spans
+.consul-lock-session-list ul > li:not(:first-child) dl:not([class]) dt,
.consul-nspace-list > ul > li:not(:first-child) dt,
.consul-token-list > ul > li:not(:first-child) dt,
.consul-policy-list > ul li:not(:first-child) dl:not(.datacenter) dt,
diff --git a/ui/packages/consul-ui/mock-api/v1/session/info/_ b/ui/packages/consul-ui/mock-api/v1/session/info/_
index e70261964c..a20d41a862 100644
--- a/ui/packages/consul-ui/mock-api/v1/session/info/_
+++ b/ui/packages/consul-ui/mock-api/v1/session/info/_
@@ -7,7 +7,8 @@
typeof http.body.Namespace !== 'undefined' ? http.body.Namespace : 'default'
}",
"Node":"node-1",
- "Checks":["serfHealth"],
+ "NodeChecks":["serfHealth"],
+ "ServiceChecks": ["${fake.hacker.noun()}Health"],
"LockDelay":15000000000,
"Behavior":"${fake.helpers.randomize(['release', 'delete'])}",
"TTL":"",
diff --git a/ui/packages/consul-ui/mock-api/v1/session/node/_ b/ui/packages/consul-ui/mock-api/v1/session/node/_
index 0346f4f085..3f2dca4d40 100644
--- a/ui/packages/consul-ui/mock-api/v1/session/node/_
+++ b/ui/packages/consul-ui/mock-api/v1/session/node/_
@@ -19,7 +19,8 @@ ${typeof location.search.ns !== 'undefined' ? `
"Namespace": "${location.search.ns}",
` : ``}
"Node":"${location.pathname.get(3)}",
- "Checks":["serfHealth"],
+ "NodeChecks":["serfHealth"],
+ "ServiceChecks": ["${fake.hacker.noun()}Health"],
"LockDelay":15000000000,
"Behavior":"${fake.helpers.randomize(['release', 'delete'])}",
"TTL":"",