diff --git a/ui/app/adapters/allocation.js b/ui/app/adapters/allocation.js index 66ba70940..cbba94096 100644 --- a/ui/app/adapters/allocation.js +++ b/ui/app/adapters/allocation.js @@ -41,6 +41,11 @@ export default class AllocationAdapter extends Watchable { `/v1/client/allocation/${model.id}/checks` ); const data = await res.json(); + // Append allocation ID to each check + Object.values(data).forEach((check) => { + check.Alloc = model.id; + check.Timestamp = check.Timestamp * 1000; // Convert to milliseconds + }); return data; } } diff --git a/ui/app/components/allocation-service-sidebar.hbs b/ui/app/components/allocation-service-sidebar.hbs index ada404772..3fac66a0d 100644 --- a/ui/app/components/allocation-service-sidebar.hbs +++ b/ui/app/components/allocation-service-sidebar.hbs @@ -1,3 +1,5 @@ +{{log "TODO: test" @service.healthChecks.length}} + - {{#if @service.mostRecentChecks.length}} - + {{#if this.checks.length}} + Name @@ -103,6 +105,11 @@ {{row.model.Check}} + TODO: TEMP + {{format-ts + row.model.Timestamp + }} + diff --git a/ui/app/components/allocation-service-sidebar.js b/ui/app/components/allocation-service-sidebar.js index a66d3ff62..4e9b2ff7c 100644 --- a/ui/app/components/allocation-service-sidebar.js +++ b/ui/app/components/allocation-service-sidebar.js @@ -38,4 +38,15 @@ export default class AllocationServiceSidebarComponent extends Component { ? 'Unhealthy' : 'Healthy'; } + + get checks() { + if (!this.args.service || !this.args.allocation) return; + console.log('getting checks and', this.args.service); + let allocID = this.args.allocation.id; + return this.args.service.healthChecks + .filterBy('Alloc', allocID) + .sortBy('Timestamp') + .reverse(); + // .uniqBy('Check'); + } } diff --git a/ui/app/controllers/allocations/allocation/index.js b/ui/app/controllers/allocations/allocation/index.js index d3e4d5a9e..d28b77dde 100644 --- a/ui/app/controllers/allocations/allocation/index.js +++ b/ui/app/controllers/allocations/allocation/index.js @@ -88,11 +88,12 @@ export default class IndexController extends Controller.extend(Sortable) { if ( !service.healthChecks.find( (sc) => - sc.Check === check.Check && sc.Timestamp === check.Timestamp + sc.Check === check.Check && + sc.Timestamp === check.Timestamp && + this.model.id === check.Alloc ) ) { service.healthChecks.pushObject(check); - service.healthChecks = [...service.healthChecks.slice(-10)]; } }); } diff --git a/ui/app/serializers/task-group.js b/ui/app/serializers/task-group.js index b98b5cfef..b0d363eb3 100644 --- a/ui/app/serializers/task-group.js +++ b/ui/app/serializers/task-group.js @@ -9,6 +9,7 @@ export default class TaskGroup extends ApplicationSerializer { normalize(typeHash, hash) { if (hash.Services) { + console.log('yeah group has services, but what about allocs', hash); hash.Services.forEach((service) => { service.GroupName = hash.Name; });