From e0fabcb9a7404615801002cd03cd752af437dafd Mon Sep 17 00:00:00 2001 From: Drew Bailey Date: Thu, 11 Mar 2021 12:28:38 -0500 Subject: [PATCH] add on update to services table in allocation details (#10153) * add on update to services table in allocation details * populate onupdate test data --- ui/app/models/service.js | 1 + ui/app/templates/allocations/allocation/index.hbs | 2 ++ ui/mirage/factories/service.js | 3 +++ ui/tests/acceptance/allocation-detail-test.js | 1 + ui/tests/pages/allocations/detail.js | 1 + 5 files changed, 8 insertions(+) diff --git a/ui/app/models/service.js b/ui/app/models/service.js index 19bf599a4..55bff86c1 100644 --- a/ui/app/models/service.js +++ b/ui/app/models/service.js @@ -6,5 +6,6 @@ export default class Service extends Fragment { @attr('string') name; @attr('string') portLabel; @attr() tags; + @attr('string') onUpdate; @fragment('consul-connect') connect; } diff --git a/ui/app/templates/allocations/allocation/index.hbs b/ui/app/templates/allocations/allocation/index.hbs index da7f5789e..b7c6a5ffd 100644 --- a/ui/app/templates/allocations/allocation/index.hbs +++ b/ui/app/templates/allocations/allocation/index.hbs @@ -165,6 +165,7 @@ Name Port Tags + On Update Connect? Upstreams @@ -173,6 +174,7 @@ {{row.model.name}} {{row.model.portLabel}} {{join ", " row.model.tags}} + {{row.model.onUpdate}} {{if row.model.connect "Yes" "No"}} {{#each row.model.connect.sidecarService.proxy.upstreams as |upstream|}} diff --git a/ui/mirage/factories/service.js b/ui/mirage/factories/service.js index b6ac0961f..adedf5594 100644 --- a/ui/mirage/factories/service.js +++ b/ui/mirage/factories/service.js @@ -2,9 +2,12 @@ import { Factory } from 'ember-cli-mirage'; import faker from 'nomad-ui/mirage/faker'; import { provide } from '../utils'; +const ON_UPDATE = ['default', 'ignore', 'ignore_warnings']; + export default Factory.extend({ name: id => `${faker.hacker.noun().dasherize()}-${id}-service`, portLabel: () => faker.hacker.noun().dasherize(), + onUpdate: faker.helpers.randomize(ON_UPDATE), tags: () => { if (!faker.random.boolean()) { return provide( diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index bb68f394e..af0d97292 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -240,6 +240,7 @@ module('Acceptance | allocation detail', function(hooks) { assert.equal(renderedService.name, serverService.name); assert.equal(renderedService.port, serverService.portLabel); + assert.equal(renderedService.onUpdate, serverService.onUpdate); assert.equal(renderedService.tags, (serverService.tags || []).join(', ')); assert.equal(renderedService.connect, serverService.Connect ? 'Yes' : 'No'); diff --git a/ui/tests/pages/allocations/detail.js b/ui/tests/pages/allocations/detail.js index de10a1088..b08b90eb8 100644 --- a/ui/tests/pages/allocations/detail.js +++ b/ui/tests/pages/allocations/detail.js @@ -93,6 +93,7 @@ export default create({ name: text('[data-test-service-name]'), port: text('[data-test-service-port]'), tags: text('[data-test-service-tags]'), + onUpdate: text('[data-test-service-onupdate]'), connect: text('[data-test-service-connect]'), upstreams: text('[data-test-service-upstreams]'), }),