mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 17:05:43 +03:00
Midway point on only showing alloc-specific checks
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{{log "TODO: test" @service.healthChecks.length}}
|
||||
|
||||
<div
|
||||
class="sidebar has-subnav service-sidebar {{if this.isSideBarOpen "open"}}"
|
||||
{{on-click-outside
|
||||
@@ -86,8 +88,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if @service.mostRecentChecks.length}}
|
||||
<ListTable class="health-checks" @source={{@service.mostRecentChecks}} as |t|>
|
||||
{{#if this.checks.length}}
|
||||
<ListTable class="health-checks" @source={{this.checks}} as |t|>
|
||||
<t.head>
|
||||
<th>
|
||||
Name
|
||||
@@ -103,6 +105,11 @@
|
||||
<tr data-service-health={{row.model.Status}}>
|
||||
<td class="name">
|
||||
<span title={{row.model.Check}}>{{row.model.Check}}</span>
|
||||
TODO: TEMP
|
||||
{{format-ts
|
||||
row.model.Timestamp
|
||||
}}
|
||||
|
||||
</td>
|
||||
<td class="status">
|
||||
<span>
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user