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: Refactor page chrome #4533

Merged
merged 8 commits into from
Aug 6, 2018
9 changes: 8 additions & 1 deletion ui/app/components/gutter-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { computed } from '@ember/object';

export default Component.extend({
system: service(),
router: service(),

sortedNamespaces: computed('system.namespaces.@each.name', function() {
const namespaces = this.get('system.namespaces').toArray() || [];
Expand Down Expand Up @@ -31,5 +32,11 @@ export default Component.extend({
});
}),

onNamespaceChange() {},
gotoJobsForNamespace(namespace) {
if (!namespace || !namespace.get('id')) return;

this.get('router').transitionTo('jobs', {
queryParams: { namespace: namespace.get('id') },
});
},
});
1 change: 0 additions & 1 deletion ui/app/components/job-page/abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default Component.extend({
sortDescending: null,

// Provide actions that require routing
onNamespaceChange() {},
gotoTaskGroup() {},
gotoJob() {},

Expand Down
5 changes: 5 additions & 0 deletions ui/app/components/page-layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Component from '@ember/component';

export default Component.extend({
classNames: ['page-layout'],
});
6 changes: 0 additions & 6 deletions ui/app/controllers/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ export default Controller.extend({
// But query param defaults can't be CPs: https://github.com/emberjs/ember.js/issues/9819
syncNamespaceService: forwardNamespace('jobNamespace', 'system.activeNamespace'),
syncNamespaceParam: forwardNamespace('system.activeNamespace', 'jobNamespace'),

actions: {
refreshRoute() {
return true;
},
},
});

function forwardNamespace(source, destination) {
Expand Down
4 changes: 0 additions & 4 deletions ui/app/controllers/jobs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,5 @@ export default Controller.extend(Sortable, Searchable, {
gotoJob(job) {
this.transitionToRoute('jobs.job', job.get('plainId'));
},

refresh() {
this.send('refreshRoute');
},
},
});
2 changes: 1 addition & 1 deletion ui/app/routes/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default Route.extend(WithForbiddenState, {

model() {
return this.get('store')
.findAll('job')
.findAll('job', { reload: true })
.catch(notifyForbidden(this));
},

Expand Down
6 changes: 0 additions & 6 deletions ui/app/routes/jobs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,4 @@ export default Route.extend(WithWatchers, {

watch: watchAll('job'),
watchers: collect('watch'),

actions: {
refreshRoute() {
return true;
},
},
});
7 changes: 2 additions & 5 deletions ui/app/templates/allocations.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<div class="page-layout">
{{#global-header class="page-header"}}
{{app-breadcrumbs}}
{{/global-header}}
{{#page-layout}}
{{outlet}}
</div>
{{/page-layout}}
186 changes: 92 additions & 94 deletions ui/app/templates/allocations/allocation/index.hbs
Original file line number Diff line number Diff line change
@@ -1,100 +1,98 @@
{{#gutter-menu class="page-body"}}
<section class="section">
<h1 data-test-title class="title">
Allocation {{model.name}}
<span class="bumper-left tag {{model.statusClass}}">{{model.clientStatus}}</span>
<span class="tag is-hollow is-small no-text-transform">{{model.id}}</span>
</h1>
<section class="section">
<h1 data-test-title class="title">
Allocation {{model.name}}
<span class="bumper-left tag {{model.statusClass}}">{{model.clientStatus}}</span>
<span class="tag is-hollow is-small no-text-transform">{{model.id}}</span>
</h1>

<div class="boxed-section is-small">
<div data-test-allocation-details class="boxed-section-body inline-definitions">
<span class="label">Allocation Details</span>
<span class="pair job-link"><span class="term">Job</span>
{{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id) data-test-job-link}}{{model.job.name}}{{/link-to}}
</span>
<span class="pair node-link"><span class="term">Client</span>
{{#link-to "clients.client" model.node data-test-client-link}}{{model.node.shortId}}{{/link-to}}
</span>
</div>
<div class="boxed-section is-small">
<div data-test-allocation-details class="boxed-section-body inline-definitions">
<span class="label">Allocation Details</span>
<span class="pair job-link"><span class="term">Job</span>
{{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id) data-test-job-link}}{{model.job.name}}{{/link-to}}
</span>
<span class="pair node-link"><span class="term">Client</span>
{{#link-to "clients.client" model.node data-test-client-link}}{{model.node.shortId}}{{/link-to}}
</span>
</div>
</div>

<div class="boxed-section">
<div class="boxed-section-head">
Tasks
</div>
<div class="boxed-section-body is-full-bleed">
{{#list-table
source=sortedStates
sortProperty=sortProperty
sortDescending=sortDescending
class="is-striped" as |t|}}
{{#t.head}}
<th class="is-narrow"></th>
{{#t.sort-by prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="state"}}State{{/t.sort-by}}
<th>Last Event</th>
{{#t.sort-by prop="events.lastObject.time"}}Time{{/t.sort-by}}
<th>Addresses</th>
{{/t.head}}
{{#t.body as |row|}}
<tr
data-test-task-row={{row.model.task.name}}
onclick={{action "taskClick" row.model.allocation row.model}}
class="is-interactive">
<td class="is-narrow">
{{#if (not row.model.driverStatus.healthy)}}
<span data-test-icon="unhealthy-driver" class="tooltip text-center" aria-label="{{row.model.driver}} is unhealthy">
{{x-icon "warning" class="is-warning"}}
</span>
{{/if}}
</td>
<td data-test-name>
{{#link-to "allocations.allocation.task" row.model.allocation row.model class="is-primary"}}
{{row.model.name}}
{{/link-to}}
</td>
<td data-test-state>{{row.model.state}}</td>
<td data-test-message>
{{#if row.model.events.lastObject.message}}
{{row.model.events.lastObject.message}}
{{else}}
<em>No message</em>
{{/if}}
</td>
<td data-test-time>{{moment-format row.model.events.lastObject.time "MM/DD/YY HH:mm:ss"}}</td>
<td data-test-ports>
<ul>
{{#with row.model.resources.networks.firstObject as |network|}}
{{#each network.reservedPorts as |port|}}
<li data-test-port>
<strong>{{port.Label}}:</strong>
<a href="http://{{network.ip}}:{{port.Value}}" target="_blank">{{network.ip}}:{{port.Value}}</a>
</li>
{{/each}}
{{#each network.dynamicPorts as |port|}}
<li>
<strong>{{port.Label}}:</strong>
<a href="http://{{network.ip}}:{{port.Value}}" target="_blank">{{network.ip}}:{{port.Value}}</a>
</li>
{{/each}}
{{/with}}
</ul>
</td>
</tr>
{{/t.body}}
{{/list-table}}
</div>
<div class="boxed-section">
<div class="boxed-section-head">
Tasks
</div>
<div class="boxed-section-body is-full-bleed">
{{#list-table
source=sortedStates
sortProperty=sortProperty
sortDescending=sortDescending
class="is-striped" as |t|}}
{{#t.head}}
<th class="is-narrow"></th>
{{#t.sort-by prop="name"}}Name{{/t.sort-by}}
{{#t.sort-by prop="state"}}State{{/t.sort-by}}
<th>Last Event</th>
{{#t.sort-by prop="events.lastObject.time"}}Time{{/t.sort-by}}
<th>Addresses</th>
{{/t.head}}
{{#t.body as |row|}}
<tr
data-test-task-row={{row.model.task.name}}
onclick={{action "taskClick" row.model.allocation row.model}}
class="is-interactive">
<td class="is-narrow">
{{#if (not row.model.driverStatus.healthy)}}
<span data-test-icon="unhealthy-driver" class="tooltip text-center" aria-label="{{row.model.driver}} is unhealthy">
{{x-icon "warning" class="is-warning"}}
</span>
{{/if}}
</td>
<td data-test-name>
{{#link-to "allocations.allocation.task" row.model.allocation row.model class="is-primary"}}
{{row.model.name}}
{{/link-to}}
</td>
<td data-test-state>{{row.model.state}}</td>
<td data-test-message>
{{#if row.model.events.lastObject.message}}
{{row.model.events.lastObject.message}}
{{else}}
<em>No message</em>
{{/if}}
</td>
<td data-test-time>{{moment-format row.model.events.lastObject.time "MM/DD/YY HH:mm:ss"}}</td>
<td data-test-ports>
<ul>
{{#with row.model.resources.networks.firstObject as |network|}}
{{#each network.reservedPorts as |port|}}
<li data-test-port>
<strong>{{port.Label}}:</strong>
<a href="http://{{network.ip}}:{{port.Value}}" target="_blank">{{network.ip}}:{{port.Value}}</a>
</li>
{{/each}}
{{#each network.dynamicPorts as |port|}}
<li>
<strong>{{port.Label}}:</strong>
<a href="http://{{network.ip}}:{{port.Value}}" target="_blank">{{network.ip}}:{{port.Value}}</a>
</li>
{{/each}}
{{/with}}
</ul>
</td>
</tr>
{{/t.body}}
{{/list-table}}
</div>
</div>

{{#if model.hasRescheduleEvents}}
<div class="boxed-section" data-test-reschedule-events>
<div class="boxed-section-head is-hollow">
Reschedule Events
</div>
<div class="boxed-section-body">
{{reschedule-event-timeline allocation=model}}
</div>
{{#if model.hasRescheduleEvents}}
<div class="boxed-section" data-test-reschedule-events>
<div class="boxed-section-head is-hollow">
Reschedule Events
</div>
<div class="boxed-section-body">
{{reschedule-event-timeline allocation=model}}
</div>
{{/if}}
</section>
{{/gutter-menu}}
</div>
{{/if}}
</section>
Loading