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

Change nodes to clients in the ui #3466

Merged
merged 3 commits into from
Nov 9, 2017
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
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Searchable from 'nomad-ui/mixins/searchable';
const { Controller, computed, inject } = Ember;

export default Controller.extend(Sortable, Searchable, {
nodesController: inject.controller('nodes'),
clientsController: inject.controller('clients'),

nodes: computed.alias('model.nodes'),
agents: computed.alias('model.agents'),
Expand All @@ -29,11 +29,11 @@ export default Controller.extend(Sortable, Searchable, {
listToSearch: computed.alias('listSorted'),
sortedNodes: computed.alias('listSearched'),

isForbidden: computed.alias('nodesController.isForbidden'),
isForbidden: computed.alias('clientsController.isForbidden'),

actions: {
gotoNode(node) {
this.transitionToRoute('nodes.node', node);
this.transitionToRoute('clients.client', node);
},
},
});
4 changes: 2 additions & 2 deletions ui/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Router.map(function() {
});
});

this.route('nodes', function() {
this.route('node', { path: '/:node_id' });
this.route('clients', function() {
this.route('client', { path: '/:node_id' });
});

this.route('servers', function() {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/app/templates/allocations/allocation.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1 class="title">Allocation {{model.name}}</h1>
<h3 class="subtitle">
For job {{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id)}}{{model.job.name}}{{/link-to}}
on node {{#link-to "nodes.node" model.node}}{{model.node.shortId}}{{/link-to}}
on client {{#link-to "clients.client" model.node}}{{model.node.shortId}}{{/link-to}}
</h3>

<div class="message">
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#global-header class="page-header"}}
{{#link-to "nodes" class="breadcrumb"}}Nodes{{/link-to}}
{{#link-to "clients" class="breadcrumb"}}Clients{{/link-to}}
<span class="breadcrumb">{{model.shortId}}</span>
{{/global-header}}
{{#gutter-menu class="page-body"}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#global-header class="page-header"}}
Nodes
Clients
{{/global-header}}
{{#gutter-menu class="page-body"}}
<section class="section">
Expand All @@ -8,7 +8,7 @@
{{else}}
{{#if nodes.length}}
<div class="content">
<div>{{search-box searchTerm=(mut searchTerm) placeholder="Search nodes..."}}</div>
<div>{{search-box searchTerm=(mut searchTerm) placeholder="Search clients..."}}</div>
</div>
{{/if}}
{{#list-pagination
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#global-header class="page-header"}}
Nodes
Clients
{{/global-header}}
{{#gutter-menu class="page-body"}}
<section class="section has-text-centered">{{partial "partials/loading-spinner"}}</section>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/allocation-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</td>
{{#if (eq context "job")}}
<td>{{allocation.jobVersion}}</td>
<td>{{#link-to "nodes.node" allocation.node}}{{allocation.node.shortId}}{{/link-to}}</td>
<td>{{#link-to "clients.client" allocation.node}}{{allocation.node.shortId}}{{/link-to}}</td>
{{else if (eq context "node")}}
<td>
{{#if (or allocation.job.isPending allocation.job.isReloading)}}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/client-node-row.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td>{{#link-to "nodes.node" node.id class="is-primary"}}{{node.shortId}}{{/link-to}}</td>
<td>{{#link-to "clients.client" 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>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/gutter-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Cluster
</p>
<ul class="menu-list">
<li>{{#link-to "nodes" activeClass="is-active"}}Clients{{/link-to}}</li>
<li>{{#link-to "clients" activeClass="is-active"}}Clients{{/link-to}}</li>
<li>{{#link-to "servers" activeClass="is-active"}}Servers{{/link-to}}</li>
</ul>
</aside>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/jobs/job/task-group.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{{#t.sort-by prop="name"}}Name{{/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"}}Node{{/t.sort-by}}
{{#t.sort-by prop="node.shortId"}}Client{{/t.sort-by}}
<th>CPU</th>
<th>Memory</th>
{{/t.head}}
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/allocation-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('/allocation/:id should name the allocation and link to the corresponding j
});

andThen(() => {
assert.equal(currentURL(), `/nodes/${node.id}`, 'Node link navigates to the node');
assert.equal(currentURL(), `/clients/${node.id}`, 'Client link navigates to the client');
});
});

Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/application-errors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ moduleForAcceptance('Acceptance | application errors ', {
test('transitioning away from an error page resets the global error', function(assert) {
server.pretender.get('/v1/nodes', () => [500, {}, null]);

visit('/nodes');
visit('/clients');

andThen(() => {
assert.ok(find('.error-message'), 'Application has errored');
Expand Down
40 changes: 20 additions & 20 deletions ui/tests/acceptance/client-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ moduleForAcceptance('Acceptance | client detail', {
},
});

test('/nodes/:id should have a breadrcumb trail linking back to nodes', function(assert) {
visit(`/nodes/${node.id}`);
test('/clients/:id should have a breadrcumb trail linking back to clients', function(assert) {
visit(`/clients/${node.id}`);

andThen(() => {
assert.equal(findAll('.breadcrumb')[0].textContent, 'Nodes', 'First breadcrumb says nodes');
assert.equal(findAll('.breadcrumb')[0].textContent, 'Clients', 'First breadcrumb says clients');
assert.equal(
findAll('.breadcrumb')[1].textContent,
node.id.split('-')[0],
Expand All @@ -37,12 +37,12 @@ test('/nodes/:id should have a breadrcumb trail linking back to nodes', function
});

andThen(() => {
assert.equal(currentURL(), '/nodes', 'First breadcrumb links back to nodes');
assert.equal(currentURL(), '/clients', 'First breadcrumb links back to clients');
});
});

test('/nodes/:id should list immediate details for the node in the title', function(assert) {
visit(`/nodes/${node.id}`);
test('/clients/:id should list immediate details for the node in the title', function(assert) {
visit(`/clients/${node.id}`);

andThen(() => {
assert.ok(find('.title').textContent.includes(node.name), 'Title includes name');
Expand All @@ -54,8 +54,8 @@ test('/nodes/:id should list immediate details for the node in the title', funct
});
});

test('/nodes/:id should list additional detail for the node below the title', function(assert) {
visit(`/nodes/${node.id}`);
test('/clients/:id should list additional detail for the node below the title', function(assert) {
visit(`/clients/${node.id}`);

andThen(() => {
assert.equal(
Expand All @@ -80,10 +80,10 @@ test('/nodes/:id should list additional detail for the node below the title', fu
});
});

test('/nodes/:id should list all allocations on the node', function(assert) {
test('/clients/:id should list all allocations on the node', function(assert) {
const allocationsCount = server.db.allocations.where({ nodeId: node.id }).length;

visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

andThen(() => {
assert.equal(
Expand All @@ -110,7 +110,7 @@ test('each allocation should have high-level details for the allocation', functi
const cpuUsed = tasks.reduce((sum, task) => sum + task.Resources.CPU, 0);
const memoryUsed = tasks.reduce((sum, task) => sum + task.Resources.MemoryMB, 0);

visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

andThen(() => {
const allocationRow = $(findAll('.allocations tbody tr')[0]);
Expand Down Expand Up @@ -199,10 +199,10 @@ test('each allocation should have high-level details for the allocation', functi
test('each allocation should show job information even if the job is incomplete and already in the store', function(
assert
) {
// First, visit nodes to load the allocations for each visible node.
// First, visit clients to load the allocations for each visible node.
// Don't load the job belongsTo of the allocation! Leave it unfulfilled.

visit('/nodes');
visit('/clients');

// Then, visit jobs to load all jobs, which should implicitly fulfill
// the job belongsTo of each allocation pointed at each job.
Expand All @@ -213,7 +213,7 @@ test('each allocation should show job information even if the job is incomplete
// present. This will require reloading the job, since task groups aren't a
// part of the jobs list response.

visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

andThen(() => {
const allocationRow = $(findAll('.allocations tbody tr')[0]);
Expand Down Expand Up @@ -245,7 +245,7 @@ test('each allocation should link to the allocation detail page', function(asser
.sortBy('modifyIndex')
.reverse()[0];

visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

andThen(() => {
click($('.allocations tbody tr:eq(0) td:eq(0) a').get(0));
Expand All @@ -261,7 +261,7 @@ test('each allocation should link to the allocation detail page', function(asser
});

test('each allocation should link to the job the allocation belongs to', function(assert) {
visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

const allocation = server.db.allocations.where({ nodeId: node.id })[0];
const job = server.db.jobs.find(allocation.jobId);
Expand All @@ -279,8 +279,8 @@ test('each allocation should link to the job the allocation belongs to', functio
});
});

test('/nodes/:id should list all attributes for the node', function(assert) {
visit(`/nodes/${node.id}`);
test('/clients/:id should list all attributes for the node', function(assert) {
visit(`/clients/${node.id}`);

andThen(() => {
assert.ok(find('.attributes-table'), 'Attributes table is on the page');
Expand All @@ -290,15 +290,15 @@ test('/nodes/:id should list all attributes for the node', function(assert) {
test('when the node is not found, an error message is shown, but the URL persists', function(
assert
) {
visit('/nodes/not-a-real-node');
visit('/clients/not-a-real-node');

andThen(() => {
assert.equal(
server.pretender.handledRequests.findBy('status', 404).url,
'/v1/node/not-a-real-node',
'A request to the non-existent node is made'
);
assert.equal(currentURL(), '/nodes/not-a-real-node', 'The URL persists');
assert.equal(currentURL(), '/clients/not-a-real-node', 'The URL persists');
assert.ok(find('.error-message'), 'Error message is shown');
assert.equal(
find('.error-message .title').textContent,
Expand Down
20 changes: 10 additions & 10 deletions ui/tests/acceptance/nodes-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ function minimumSetup() {
server.createList('agent', 1);
}

moduleForAcceptance('Acceptance | nodes list');
moduleForAcceptance('Acceptance | clients list');

test('/nodes should list one page of clients', function(assert) {
test('/clients should list one page of clients', function(assert) {
// Make sure to make more nodes than 1 page to assert that pagination is working
const nodesCount = 10;
const pageSize = 8;

server.createList('node', nodesCount);
server.createList('agent', 1);

visit('/nodes');
visit('/clients');

andThen(() => {
assert.equal(findAll('.client-node-row').length, pageSize);
Expand All @@ -34,7 +34,7 @@ test('/nodes should list one page of clients', function(assert) {
assert.equal(
$(`.client-node-row:eq(${nodeNumber}) td:eq(0)`).text(),
sortedNodes[nodeNumber].id.split('-')[0],
'Nodes are ordered'
'Clients are ordered'
);
}
});
Expand All @@ -44,7 +44,7 @@ test('each client record should show high-level info of the client', function(as
minimumSetup();
const node = server.db.nodes[0];

visit('/nodes');
visit('/clients');

andThen(() => {
const nodeRow = $(findAll('.client-node-row')[0]);
Expand All @@ -65,20 +65,20 @@ test('each client should link to the client detail page', function(assert) {
minimumSetup();
const node = server.db.nodes[0];

visit('/nodes');
visit('/clients');
andThen(() => {
click(findAll('.client-node-row')[0]);
});

andThen(() => {
assert.equal(currentURL(), `/nodes/${node.id}`);
assert.equal(currentURL(), `/clients/${node.id}`);
});
});

test('when there are no clients, there is an empty message', function(assert) {
server.createList('agent', 1);

visit('/nodes');
visit('/clients');

andThen(() => {
assert.ok(find('.empty-message'));
Expand All @@ -92,7 +92,7 @@ test('when there are clients, but no matches for a search term, there is an empt
server.createList('agent', 1);
server.create('node', { name: 'node' });

visit('/nodes');
visit('/clients');

andThen(() => {
fillIn('.search-box input', 'client');
Expand All @@ -111,7 +111,7 @@ test('when accessing clients is forbidden, show a message with a link to the tok
server.create('node', { name: 'node' });
server.pretender.get('/v1/nodes', () => [403, {}, null]);

visit('/nodes');
visit('/clients');

andThen(() => {
assert.equal(find('.empty-message-headline').textContent, 'Not Authorized');
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/task-group-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ test('each allocation should show basic information about the allocation', funct
click(allocationRow.find('td:eq(5) a').get(0));

andThen(() => {
assert.equal(currentURL(), `/nodes/${allocation.nodeId}`, 'Node links to node page');
assert.equal(currentURL(), `/clients/${allocation.nodeId}`, 'Node links to node page');
});
});

Expand Down
4 changes: 2 additions & 2 deletions ui/tests/acceptance/token-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ skip('the X-Nomad-Token header gets sent with requests once it is set', function
let requestPosition = 0;

visit(`/jobs/${job.id}`);
visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

andThen(() => {
assert.ok(server.pretender.handledRequests.length > 1, 'Requests have been made');
Expand All @@ -62,7 +62,7 @@ skip('the X-Nomad-Token header gets sent with requests once it is set', function
});

visit(`/jobs/${job.id}`);
visit(`/nodes/${node.id}`);
visit(`/clients/${node.id}`);

andThen(() => {
const newRequests = server.pretender.handledRequests.slice(requestPosition);
Expand Down
Binary file modified website/source/assets/images/guide-ui-client-detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/source/assets/images/guide-ui-clients-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/source/assets/images/guide-ui-server-detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.