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

add refreshModel to namespace query param #11326

Closed
wants to merge 5 commits into from
Closed
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
10 changes: 10 additions & 0 deletions ui/app/components/list-table/sort-by.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ export default class SortBy extends Component {
get shouldSortDescending() {
return !this.isActive || !this.sortDescending;
}

@computed('addToQuery', 'prop', 'shouldSortDescending')
get query() {
const addToQuery = this.addToQuery || {};
return {
sortProperty: this.prop,
sortDescending: this.shouldSortDescending,
...addToQuery,
};
}
}
2 changes: 1 addition & 1 deletion ui/app/components/search-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export default class SearchBox extends Component {
function updateSearch() {
const newTerm = this._searchTerm;
this.onChange(newTerm);
this.set('searchTerm', newTerm);
this.setProperties({ searchTerm: newTerm, namespace: this._target.job.namespace.get('id') });
}
4 changes: 3 additions & 1 deletion ui/app/controllers/jobs/job.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';

export default class JobController extends Controller {
queryParams = [
{
jobNamespace: 'namespace',
},
];
jobNamespace = 'default';

@tracked jobNamespace = 'default';
}
15 changes: 8 additions & 7 deletions ui/app/templates/components/list-table.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{yield (hash
head=(component "list-table/table-head")
body=(component "list-table/table-body" rows=this.decoratedSource)
sort-by=(component "list-table/sort-by"
currentProp=this.sortProperty
sortDescending=this.sortDescending
{{yield
(hash
head=(component "list-table/table-head")
body=(component "list-table/table-body" rows=this.decoratedSource)
sort-by=(component
"list-table/sort-by" currentProp=this.sortProperty sortDescending=this.sortDescending
)
)
)}}
}}
6 changes: 2 additions & 4 deletions ui/app/templates/components/list-table/sort-by.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<LinkTo
@query={{hash sortProperty=this.prop sortDescending=this.shouldSortDescending}}
data-test-sort-by={{this.prop}}>
<LinkTo class="is-selectable" @query={{this.query}} data-test-sort-by={{this.prop}}>
{{yield}}
</LinkTo>
</LinkTo>
96 changes: 74 additions & 22 deletions ui/app/templates/jobs/job/allocations.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,118 @@
data-test-allocations-search
@searchTerm={{mut this.searchTerm}}
@onChange={{action this.resetPagination}}
@placeholder="Search allocations..." />
@placeholder="Search allocations..."
/>
</div>
</div>
{{#if this.sortedAllocations}}
<ListPagination
@source={{this.sortedAllocations}}
@size={{this.pageSize}}
@page={{this.currentPage}}
@class="allocations" as |p|>
@class="allocations" as |p|
>
<ListTable
@source={{p.list}}
@sortProperty={{this.sortProperty}}
@sortDescending={{this.sortDescending}}
@class="with-foot" as |t|>
@class="with-foot" as |t|
>
<t.head>
<th class="is-narrow"></th>
<t.sort-by @prop="shortId">ID</t.sort-by>
<t.sort-by @prop="taskGroupName">Task Group</t.sort-by>
<t.sort-by @prop="createIndex" @title="Create Index">Created</t.sort-by>
<t.sort-by @prop="modifyIndex" @title="Modify Index">Modified</t.sort-by>
<t.sort-by @prop="statusIndex">Status</t.sort-by>
<t.sort-by @prop="jobVersion">Version</t.sort-by>
<t.sort-by @prop="node.shortId">Client</t.sort-by>
<th>Volume</th>
<th>CPU</th>
<th>Memory</th>
<t.sort-by @addToQuery={{hash jobNamespace=this.job.namespace.id}} @prop="shortId">
ID
</t.sort-by>
<t.sort-by
@addToQuery={{hash jobNamespace=this.job.namespace.id}}
@prop="taskGroupName"
>
Task Group
</t.sort-by>
<t.sort-by
@addToQuery={{hash jobNamespace=this.job.namespace.id}}
@prop="createIndex"
@title="Create Index"
>
Created
</t.sort-by>
<t.sort-by
@addToQuery={{hash jobNamespace=this.job.namespace.id}}
@prop="modifyIndex"
@title="Modify Index"
>
Modified
</t.sort-by>
<t.sort-by @addToQuery={{hash jobNamespace=this.job.namespace.id}} @prop="statusIndex">
Status
</t.sort-by>
<t.sort-by @addToQuery={{hash jobNamespace=this.job.namespace.id}} @prop="jobVersion">
Version
</t.sort-by>
<t.sort-by @addToQuery={{hash jobNamespace=this.job.namespace.id}} @prop="node.shortId">
Client
</t.sort-by>
<th>
Volume
</th>
<th>
CPU
</th>
<th>
Memory
</th>
</t.head>
<t.body as |row|>
<AllocationRow
@data-test-allocation={{row.model.id}}
@allocation={{row.model}}
@context="job"
@onClick={{action "gotoAllocation" row.model}} />
@onClick={{action "gotoAllocation" row.model}}
/>
</t.body>
</ListTable>
<div class="table-foot">
<nav class="pagination">
<div class="pagination-numbers">
{{p.startsAt}}&ndash;{{p.endsAt}} of {{this.sortedAllocations.length}}
{{p.startsAt}}
{{p.endsAt}}
of
{{this.sortedAllocations.length}}
</div>
<p.prev @class="pagination-previous"> &lt; </p.prev>
<p.next @class="pagination-next"> &gt; </p.next>
<p.prev @class="pagination-previous" />
<p.next @class="pagination-next">
>
</p.next>
<ul class="pagination-list"></ul>
</nav>
</div>
</ListPagination>
{{else}}
<div class="boxed-section-body">
<div class="empty-message" data-test-empty-allocations-list>
<h3 class="empty-message-headline" data-test-empty-allocations-list-headline>No Matches</h3>
<p class="empty-message-body">No allocations match the term <strong>{{this.searchTerm}}</strong></p>
<h3 class="empty-message-headline" data-test-empty-allocations-list-headline>
No Matches
</h3>
<p class="empty-message-body">
No allocations match the term
<strong>
{{this.searchTerm}}
</strong>
</p>
</div>
</div>
{{/if}}
{{else}}
<div class="boxed-section-body">
<div class="empty-message" data-test-empty-allocations-list>
<h3 class="empty-message-headline" data-test-empty-allocations-list-headline>No Allocations</h3>
<p class="empty-message-body">No allocations have been placed.</p>
<h3 class="empty-message-headline" data-test-empty-allocations-list-headline>
No Allocations
</h3>
<p class="empty-message-body">
No allocations have been placed.
</p>
</div>
</div>
{{/if}}
</section>
</section>
53 changes: 40 additions & 13 deletions ui/app/templates/jobs/job/clients.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,54 @@
@class="with-foot" as |t|
>
<t.head>
<t.sort-by @prop="node.id">Client ID</t.sort-by>
<t.sort-by @prop="node.name" class="is-200px is-truncatable">Client Name</t.sort-by>
<t.sort-by @prop="createTime" @title="Create Time">Created</t.sort-by>
<t.sort-by @prop="modifyTime" @title="Modify Time">Modified</t.sort-by>
<t.sort-by @prop="jobStatus">Job Status</t.sort-by>
<th class="is-3">Allocation Summary</th>
<t.sort-by @addToQuery={{hash jobNamespace=this.job.namespace.id}} @prop="node.id">
Client ID
</t.sort-by>
<t.sort-by
@addToQuery={{hash jobNamespace=this.job.namespace.id}}
@prop="node.name"
class="is-200px is-truncatable"
>
Client Name
</t.sort-by>
<t.sort-by
@addToQuery={{hash jobNamespace=this.job.namespace.id}}
@prop="createTime"
@title="Create Time"
>
Created
</t.sort-by>
<t.sort-by
@addToQuery={{hash jobNamespace=this.job.namespace.id}}
@prop="modifyTime"
@title="Modify Time"
>
Modified
</t.sort-by>
<t.sort-by @addToQuery={{hash jobNamespace=this.job.namespace.id}} @prop="jobStatus">
Job Status
</t.sort-by>
<th class="is-3">
Allocation Summary
</th>
</t.head>
<t.body as |row|>
<JobClientStatusRow
@row={{row}}
@onClick={{this.gotoClient}}
/>
<JobClientStatusRow @row={{row}} @onClick={{this.gotoClient}} />
</t.body>
</ListTable>
<div class="table-foot">
<nav class="pagination">
<div class="pagination-numbers">
{{p.startsAt}}&ndash;{{p.endsAt}} of {{this.sortedClients.length}}
{{p.startsAt}}
{{p.endsAt}}
of
{{this.sortedClients.length}}
</div>
<p.prev @class="pagination-previous"> &lt; </p.prev>
<p.next @class="pagination-next"> &gt; </p.next>
<p.prev @class="pagination-previous" />
<p.next @class="pagination-next">
>
</p.next>
<ul class="pagination-list"></ul>
</nav>
</div>
Expand Down