diff --git a/ui/app/templates/nodes/index.hbs b/ui/app/templates/nodes/index.hbs index 580adbbae..1b324c69e 100644 --- a/ui/app/templates/nodes/index.hbs +++ b/ui/app/templates/nodes/index.hbs @@ -3,9 +3,11 @@ {{/global-header}} {{#gutter-menu class="page-body"}}
-
-
{{search-box searchTerm=(mut searchTerm) placeholder="Search nodes..."}}
-
+ {{#if nodes.length}} +
+
{{search-box searchTerm=(mut searchTerm) placeholder="Search nodes..."}}
+
+ {{/if}} {{#list-pagination source=sortedNodes size=pageSize @@ -38,6 +40,18 @@ + {{else}} +
+ {{#if (eq nodes.length 0)}} +

No Clients

+

+ 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}}. +

+ {{else if searchTerm}} +

No Matches

+

No clients match the term {{searchTerm}}

+ {{/if}} +
{{/list-pagination}}
{{/gutter-menu}} diff --git a/ui/tests/acceptance/nodes-list-test.js b/ui/tests/acceptance/nodes-list-test.js index 4a6ee0301..81cb509e6 100644 --- a/ui/tests/acceptance/nodes-list-test.js +++ b/ui/tests/acceptance/nodes-list-test.js @@ -1,5 +1,5 @@ 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 moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance'; import { findLeader } from '../../mirage/config'; @@ -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) { const agentsCount = 10; const pageSize = 8;