Commit 7cae2e92 authored by Michael Lange's avatar Michael Lange
Browse files

Empty states for clients

parent 080ebec7
Showing with 47 additions and 4 deletions
+47 -4
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
{{/global-header}} {{/global-header}}
{{#gutter-menu class="page-body"}} {{#gutter-menu class="page-body"}}
<section class="section"> <section class="section">
<div class="content"> {{#if nodes.length}}
<div>{{search-box searchTerm=(mut searchTerm) placeholder="Search nodes..."}}</div> <div class="content">
</div> <div>{{search-box searchTerm=(mut searchTerm) placeholder="Search nodes..."}}</div>
</div>
{{/if}}
{{#list-pagination {{#list-pagination
source=sortedNodes source=sortedNodes
size=pageSize size=pageSize
...@@ -38,6 +40,18 @@ ...@@ -38,6 +40,18 @@
<ul class="pagination-list"></ul> <ul class="pagination-list"></ul>
</nav> </nav>
</div> </div>
{{else}}
<div class="empty-message">
{{#if (eq nodes.length 0)}}
<h3 class="empty-message-headline">No Clients</h3>
<p class="empty-message-body">
There are currently no visible nodes in the cluster. This could mean that the cluster is bootstrapped with no clients. It could also mean {{#link-to "settings.tokens"}}you don't have access to see any clients{{/link-to}}.
</p>
{{else if searchTerm}}
<h3 class="empty-message-headline">No Matches</h3>
<p class="empty-message-body">No clients match the term <strong>{{searchTerm}}</strong></p>
{{/if}}
</div>
{{/list-pagination}} {{/list-pagination}}
</section> </section>
{{/gutter-menu}} {{/gutter-menu}}
import Ember from 'ember'; import Ember from 'ember';
import { click, findAll, currentURL, visit } from 'ember-native-dom-helpers'; import { click, find, findAll, currentURL, visit } from 'ember-native-dom-helpers';
import { test } from 'qunit'; import { test } from 'qunit';
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance'; import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
import { findLeader } from '../../mirage/config'; import { findLeader } from '../../mirage/config';
...@@ -75,6 +75,35 @@ test('each client should link to the client detail page', function(assert) { ...@@ -75,6 +75,35 @@ test('each client should link to the client detail page', function(assert) {
}); });
}); });
test('when there are no clients, there is an empty message', function(assert) {
server.createList('agent', 1);
visit('/nodes');
andThen(() => {
assert.ok(find('.empty-message'));
assert.equal(find('.empty-message-headline').textContent, 'No Clients');
});
});
test('when there are clients, but no matches for a search term, there is an empty message', function(
assert
) {
server.createList('agent', 1);
server.create('node', { name: 'node' });
visit('/nodes');
andThen(() => {
fillIn('.search-box input', 'client');
});
andThen(() => {
assert.ok(find('.empty-message'));
assert.equal(find('.empty-message-headline').textContent, 'No Matches');
});
});
test('/servers should list all servers', function(assert) { test('/servers should list all servers', function(assert) {
const agentsCount = 10; const agentsCount = 10;
const pageSize = 8; const pageSize = 8;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment