ui: Fix Health Checks in K/V form Lock Sessions Info section (#10767)

This commit is contained in:
Kenia 2021-08-04 12:41:41 -04:00 committed by GitHub
parent 57aabe3455
commit 1927ada2e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

3
.changelog/10767.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Fix Health Checks in K/V form Lock Sessions Info section
```

View File

@ -32,7 +32,7 @@
<dd>{{or api.data.TTL '-'}}</dd> <dd>{{or api.data.TTL '-'}}</dd>
<dt>Behavior</dt> <dt>Behavior</dt>
<dd>{{api.data.Behavior}}</dd> <dd>{{api.data.Behavior}}</dd>
{{#let (union api.data.NodeChecks api.data.ServiceChecks) as |checks|}} {{#let api.data.checks as |checks|}}
<dt>Health Checks</dt> <dt>Health Checks</dt>
<dd> <dd>
{{#if (gt checks.length 0)}} {{#if (gt checks.length 0)}}

View File

@ -1,4 +1,5 @@
import Model, { attr } from '@ember-data/model'; import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { nullValue } from 'consul-ui/decorators/replace'; import { nullValue } from 'consul-ui/decorators/replace';
export const PRIMARY_KEY = 'uid'; export const PRIMARY_KEY = 'uid';
@ -23,4 +24,9 @@ export default class Session extends Model {
@nullValue([]) @attr({ defaultValue: () => [] }) ServiceChecks; @nullValue([]) @attr({ defaultValue: () => [] }) ServiceChecks;
@attr({ defaultValue: () => [] }) Resources; // [] @attr({ defaultValue: () => [] }) Resources; // []
@computed('NodeChecks', 'ServiceChecks')
get checks() {
return [...this.NodeChecks, ...this.ServiceChecks.map(({ ID }) => ID)];
}
} }

View File

@ -8,7 +8,15 @@
}", }",
"Node":"node-1", "Node":"node-1",
"NodeChecks":["serfHealth"], "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, "LockDelay":15000000000,
"Behavior":"${fake.helpers.randomize(['release', 'delete'])}", "Behavior":"${fake.helpers.randomize(['release', 'delete'])}",
"TTL":"", "TTL":"",