Switch from href-to to link-to for QP persistence

See this issue: https://github.com/intercom/ember-href-to/issues/62
This commit is contained in:
Michael Lange 2017-10-19 22:30:10 -07:00
parent a4b7b58dd5
commit a475d59513
15 changed files with 37 additions and 37 deletions

View File

@ -1,18 +0,0 @@
import Ember from 'ember';
import hrefTo from 'ember-href-to/helpers/href-to';
const { Helper } = Ember;
/**
* Href-to Spread
*
* Usage: {{href-to-spread hrefToPositionalParamsAsArray query=whatever}}
*
* Does the same thing as href-to but takes an array of arguments instead of a static list.
* This way arguments can be managed in js and provided to the template.
*/
export default Helper.extend({
compute([params], options = {}) {
return hrefTo.create().compute.call(this, params, options);
},
});

View File

@ -1,8 +1,8 @@
<section class="section">
<h1 class="title">Allocation {{model.name}}</h1>
<h3 class="subtitle">
For job <a href="{{href-to "jobs.job" model.job}}">{{model.job.name}}</a>
on node <a href="{{href-to "nodes.node" model.node}}">{{model.node.shortId}}</a>
For job {{#link-to "jobs.job" model.job}}{{model.job.name}}{{/link-to}}
on node {{#link-to "nodes.node" model.node}}{{model.node.shortId}}{{/link-to}}
</h3>
<div class="message">

View File

@ -1,7 +1,7 @@
<td>
<a href="{{href-to "allocations.allocation" allocation}}" class="is-primary">
{{#link-to "allocations.allocation" allocation class="is-primary"}}
{{allocation.shortId}}
</a>
{{/link-to}}
</td>
<td>{{allocation.modifyIndex}}</td>
<td>{{allocation.name}}</td>
@ -10,13 +10,13 @@
</td>
{{#if (eq context "job")}}
<td>{{allocation.jobVersion}}</td>
<td><a href="{{href-to "nodes.node" allocation.node}}">{{allocation.node.shortId}}</a></td>
<td>{{#link-to "nodes.node" allocation.node}}{{allocation.node.shortId}}{{/link-to}}</td>
{{else if (eq context "node")}}
<td>
{{#if (or allocation.job.isPending allocation.job.isReloading)}}
...
{{else}}
<a href="{{href-to "jobs.job" allocation.job}}">{{allocation.job.name}}</a>
{{#link-to "jobs.job" allocation.job}}{{allocation.job.name}}{{/link-to}}
<span class="is-faded">/ {{allocation.taskGroup.name}}</span>
{{/if}}
</td>

View File

@ -1,4 +1,4 @@
<td><a href="{{href-to "nodes.node" node.id}}" class="is-primary">{{node.shortId}}</a></td>
<td>{{#link-to "nodes.node" node.id class="is-primary"}}{{node.shortId}}{{/link-to}}</td>
<td class="is-200px is-truncatable" title="{{node.name}}">{{node.name}}</td>
<td>{{node.status}}</td>
<td>{{node.address}}</td>

View File

@ -1,4 +1,4 @@
<td><a href="{{href-to "jobs.job" job.id}}" class="is-primary">{{job.name}}</a></td>
<td>{{#link-to "jobs.job" job.id class="is-primary"}}{{job.name}}{{/link-to}}</td>
<td>
<span class="tag {{job.statusClass}}">{{job.status}}</span>
</td>

View File

@ -1,4 +1,4 @@
<td><a href="{{href-to "servers.server" agent.id}}" class="is-primary">{{agent.name}}</a></td>
<td>{{#link-to "servers.server" agent.id class="is-primary"}}{{agent.name}}{{/link-to}}</td>
<td>{{agent.status}}</td>
<td>{{if agent.isLeader "True" "False"}}</td>
<td>{{agent.address}}</td>

View File

@ -1,4 +1,8 @@
<td><a href="{{href-to "jobs.job.task-group" taskGroup.job taskGroup}}" class="is-primary">{{taskGroup.name}}</a></td>
<td>
{{#link-to "jobs.job.task-group" taskGroup.job taskGroup class="is-primary"}}
{{taskGroup.name}}
{{/link-to}}
</td>
<td>{{taskGroup.count}}</td>
<td>
<div class="inline-chart">{{allocation-status-bar allocationContainer=taskGroup.summary isNarrow=true}}</div>

View File

@ -1,6 +1,6 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
<a href="{{href-to-spread breadcrumb.args}}" class="breadcrumb">{{breadcrumb.label}}</a>
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -1,6 +1,6 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
<a href="{{href-to-spread breadcrumb.args}}" class="breadcrumb">{{breadcrumb.label}}</a>
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -1,6 +1,6 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
<a href="{{href-to-spread breadcrumb.args}}" class="breadcrumb">{{breadcrumb.label}}</a>
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -1,6 +1,6 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
<a href="{{href-to-spread breadcrumb.args}}" class="breadcrumb">{{breadcrumb.label}}</a>
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -1,6 +1,6 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
<a href="{{href-to-spread breadcrumb.args}}" class="breadcrumb">{{breadcrumb.label}}</a>
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -1,6 +1,6 @@
{{#global-header class="page-header"}}
{{#each breadcrumbs as |breadcrumb|}}
<a href="{{href-to-spread breadcrumb.args}}" class="breadcrumb">{{breadcrumb.label}}</a>
{{#link-to params=breadcrumb.args class="breadcrumb"}}{{breadcrumb.label}}{{/link-to}}
{{/each}}
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -1,5 +1,5 @@
{{#global-header class="page-header"}}
<a href="{{href-to "nodes"}}" class="breadcrumb">Nodes</a>
{{#link-to "nodes" class="breadcrumb"}}Nodes{{/link-to}}
<span class="breadcrumb">{{model.shortId}}</span>
{{/global-header}}
{{#gutter-menu class="page-body"}}

View File

@ -58,8 +58,22 @@ test('each row in the task group table should show basic information about the t
const tasks = server.db.tasks.where({ taskGroupId: taskGroup.id });
const sum = (list, key) => list.reduce((sum, item) => sum + get(item, key), 0);
assert.equal(taskGroupRow.find('td:eq(0)').text(), taskGroup.name, 'Name');
assert.equal(taskGroupRow.find('td:eq(1)').text(), taskGroup.count, 'Count');
assert.equal(
taskGroupRow
.find('td:eq(0)')
.text()
.trim(),
taskGroup.name,
'Name'
);
assert.equal(
taskGroupRow
.find('td:eq(1)')
.text()
.trim(),
taskGroup.count,
'Count'
);
assert.equal(
taskGroupRow.find('td:eq(3)').text(),
`${sum(tasks, 'Resources.CPU')} MHz`,