diff --git a/.changelog/10767.txt b/.changelog/10767.txt new file mode 100644 index 000000000..47d4716b8 --- /dev/null +++ b/.changelog/10767.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix Health Checks in K/V form Lock Sessions Info section +``` \ No newline at end of file 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 955fa98f5..9a2e023b1 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 @@ -32,7 +32,7 @@
{{or api.data.TTL '-'}}
Behavior
{{api.data.Behavior}}
-{{#let (union api.data.NodeChecks api.data.ServiceChecks) as |checks|}} +{{#let api.data.checks as |checks|}}
Health Checks
{{#if (gt checks.length 0)}} diff --git a/ui/packages/consul-ui/app/models/session.js b/ui/packages/consul-ui/app/models/session.js index 9f50d1d0b..719836278 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 { computed } from '@ember/object'; import { nullValue } from 'consul-ui/decorators/replace'; export const PRIMARY_KEY = 'uid'; @@ -23,4 +24,9 @@ export default class Session extends Model { @nullValue([]) @attr({ defaultValue: () => [] }) ServiceChecks; @attr({ defaultValue: () => [] }) Resources; // [] + + @computed('NodeChecks', 'ServiceChecks') + get checks() { + return [...this.NodeChecks, ...this.ServiceChecks.map(({ ID }) => ID)]; + } } diff --git a/ui/packages/consul-ui/mock-api/v1/session/info/_ b/ui/packages/consul-ui/mock-api/v1/session/info/_ index a20d41a86..77a1f99e4 100644 --- a/ui/packages/consul-ui/mock-api/v1/session/info/_ +++ b/ui/packages/consul-ui/mock-api/v1/session/info/_ @@ -8,7 +8,15 @@ }", "Node":"node-1", "NodeChecks":["serfHealth"], - "ServiceChecks": ["${fake.hacker.noun()}Health"], + "ServiceChecks": [ + { + "ID": "${fake.hacker.noun()}Health", + "Namespace": "${ + typeof location.search.ns !== 'undefined' ? location.search.ns : + typeof http.body.Namespace !== 'undefined' ? http.body.Namespace : 'default' + }" + } + ], "LockDelay":15000000000, "Behavior":"${fake.helpers.randomize(['release', 'delete'])}", "TTL":"",