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] Jobs/jobid/services table sorting #14410

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 18 additions & 1 deletion ui/app/controllers/jobs/job/services/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
import Controller from '@ember/controller';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
import Sortable from 'nomad-ui/mixins/sortable';
import { alias } from '@ember/object/computed';
import { computed } from '@ember/object';
import { union } from '@ember/object/computed';

export default class JobsJobServicesIndexController extends Controller.extend(
WithNamespaceResetting
WithNamespaceResetting,
Sortable
) {
@alias('model') job;
@alias('job.taskGroups') taskGroups;

queryParams = [
{
sortProperty: 'sort',
},
{
sortDescending: 'desc',
},
];

sortProperty = 'name';
sortDescending = false;

@alias('services') listToSort;
@alias('listSorted') sortedServices;

@computed('taskGroups.@each.tasks')
get tasks() {
return this.taskGroups.map((group) => group.tasks.toArray()).flat();
Expand Down
23 changes: 14 additions & 9 deletions ui/app/styles/components/services.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
.service-list {
.title {
.back-link {
text-decoration: none;
color: #363636;
position: relative;
top: 4px;
}
}
}
.title {
.back-link {
text-decoration: none;
color: #363636;
position: relative;
top: 4px;
}
}
td svg {
position: relative;
top: 3px;
margin-right: 5px;
}
}
9 changes: 2 additions & 7 deletions ui/app/templates/components/job-service-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@
{{on "click" (fn this.gotoService @service)}}
class={{if (eq @service.provider "nomad") "is-interactive"}}
>
<td>
{{#if (eq @service.provider "nomad")}}
<FlightIcon @name="nomad-color" />
{{else if (eq @service.provider "consul")}}
<FlightIcon @name="consul-color" />
{{/if}}
</td>
<td
{{keyboard-shortcut
enumerated=true
action=(action "gotoService" @service)
}}
>
{{#if (eq @service.provider "nomad")}}
<FlightIcon @name="nomad-color" />
<LinkTo class="is-primary" @route="jobs.job.services.service" @model={{@service}} @query={{hash level=@service.level}}>{{@service.name}}</LinkTo>
{{else}}
<FlightIcon @name="consul-color" />
{{@service.name}}
{{/if}}
</td>
Expand Down
7 changes: 3 additions & 4 deletions ui/app/templates/jobs/job/services/index.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<section class="section service-list">
{{#if this.services.length}}
{{#if this.sortedServices.length}}
<ListTable
@source={{this.services}}
@source={{this.sortedServices}}
@sortProperty={{this.sortProperty}}
@sortDescending={{this.sortDescending}}
as |t|
>
<t.head>
<t.sort-by @prop="provider">Provider</t.sort-by>
<t.sort-by @prop="name">Name</t.sort-by>
<t.sort-by @prop="provider">Level</t.sort-by>
<t.sort-by @prop="level">Level</t.sort-by>
<t.sort-by @prop="client">Client</t.sort-by>
<th>Tags</th>
<t.sort-by @prop="numAllocs">Number of Alocations</t.sort-by>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/templates/jobs/job/services/service.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
as |t|
>
<t.head>
<t.sort-by @prop="allocation">Allocation</t.sort-by>
<t.sort-by @prop="address">IP Address &amp; Port</t.sort-by>
<th>Allocation</th>
<th>IP Address &amp; Port</th>
</t.head>
<t.body as |row|>
<tr data-test-service-row>
Expand Down