open-nomad/ui/app/serializers/task-group.js
Phil Renaud b6f6f4db37 [ui] Service Discovery: Allocation Service fly-out (#14389)
* Bones of a new flyout section

* Basic sidebar behaviour and style edits

* Concept of a refID for service fragments to disambiguate task and group

* A11y audit etc

* Moves health check aggregation to serviceFragment model and retains history

* Has to be a getter

* flyout populated

* Sidebar styling

* Sidebar table and details added

* Mirage fixture

* Active status and table styles

* Unit test mock updated

* Acceptance tests for alloc services table and flyout

* Chart styles closer to mock

* Without a paused test

* Consul and Nomad icons in services table

* Alloc services test updates in light of new column changes

* without using an inherited scenario
2022-09-07 10:24:34 -04:00

26 lines
675 B
JavaScript

import { copy } from 'ember-copy';
import ApplicationSerializer from './application';
import classic from 'ember-classic-decorator';
@classic
export default class TaskGroup extends ApplicationSerializer {
arrayNullOverrides = ['Services'];
mapToArray = ['Volumes'];
normalize(typeHash, hash) {
if (hash.Services) {
hash.Services.forEach((service) => {
service.GroupName = hash.Name;
});
}
// Provide EphemeralDisk to each task
hash.Tasks.forEach((task) => {
task.EphemeralDisk = copy(hash.EphemeralDisk);
});
hash.ReservedEphemeralDisk = hash.EphemeralDisk.SizeMB;
return super.normalize(typeHash, hash);
}
}