Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Allocation route services table: show task-level services #14199

Merged
merged 6 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/14199.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
[ui] Services table: Display task-level services in addition to group-level services.
```
15 changes: 14 additions & 1 deletion ui/app/controllers/allocations/allocation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { lazyClick } from 'nomad-ui/helpers/lazy-click';
import { watchRecord } from 'nomad-ui/utils/properties/watch';
import messageForError from 'nomad-ui/utils/message-from-adapter-error';
import classic from 'ember-classic-decorator';
import { union } from '@ember/object/computed';

@classic
export default class IndexController extends Controller.extend(Sortable) {
Expand Down Expand Up @@ -47,10 +48,22 @@ export default class IndexController extends Controller.extend(Sortable) {
}

@computed('[email protected]')
get services() {
get groupServices() {
return (this.get('model.taskGroup.services') || []).sortBy('name');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This is an asynchronous request. allocations.allocation does not load the TaskGroup and this should trigger a fetch request. TaskGroup can fail as a request here and we won't notify the user.

}

@computed('[email protected]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this the correct dependent key?

get taskServices() {
const allTaskServicesFragments =
this.get('model.states').mapBy('task.services').compact() || [];
const allTaskServices = allTaskServicesFragments
.map((frag) => frag.toArray())
.flat();
return allTaskServices.sortBy('name');
}

@union('taskServices', 'groupServices') services;
philrenaud marked this conversation as resolved.
Show resolved Hide resolved

onDismiss() {
this.set('error', null);
}
Expand Down
1 change: 1 addition & 0 deletions ui/app/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class Task extends Fragment {
@attr('number') reservedCPU;
@attr('number') reservedDisk;
@attr('number') reservedEphemeralDisk;
@fragmentArray('service') services;

@fragmentArray('volume-mount', { defaultValue: () => [] }) volumeMounts;

Expand Down