-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Leader icon for node listing view (#6265)
- yarn upgrade consul-api-double which includes `status/leader` - add all the ember-data things required to call a new endpoint - Pass the new leader variable through to the template - use the new leader variable in the template to set a leader - add acceptance testing to verify leaders are highlighted - Change testing navigation/api requests to status/leader (on the node listing page, status/leader is now the last get request to be called). - Template whitespace commit (less indenting) - adds a test to to assert no errors happen with an unelected leader
- Loading branch information
Showing
14 changed files
with
217 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import RepositoryService from 'consul-ui/services/repository'; | ||
import { inject as service } from '@ember/service'; | ||
import { get } from '@ember/object'; | ||
|
||
const modelName = 'node'; | ||
export default RepositoryService.extend({ | ||
coordinates: service('repository/coordinate'), | ||
getModelName: function() { | ||
return modelName; | ||
}, | ||
findByLeader: function(dc) { | ||
const query = { | ||
dc: dc, | ||
}; | ||
return get(this, 'store').queryLeader(this.getModelName(), query); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,84 @@ | ||
{{#app-view class="node list"}} | ||
{{#block-slot 'header'}} | ||
<h1> | ||
Nodes <em>{{format-number items.length}} total</em> | ||
</h1> | ||
<label for="toolbar-toggle"></label> | ||
{{/block-slot}} | ||
{{#block-slot 'toolbar'}} | ||
{{#block-slot 'header'}} | ||
<h1> | ||
Nodes <em>{{format-number items.length}} total</em> | ||
</h1> | ||
<label for="toolbar-toggle"></label> | ||
{{/block-slot}} | ||
{{#block-slot 'toolbar'}} | ||
{{#if (gt items.length 0) }} | ||
{{catalog-filter searchable=(array searchableHealthy searchableUnhealthy) search=s status=filters.status onchange=(action 'filter')}} | ||
{{catalog-filter searchable=(array searchableHealthy searchableUnhealthy) search=s status=filters.status onchange=(action 'filter')}} | ||
{{/if}} | ||
{{/block-slot}} | ||
{{#block-slot 'content'}} | ||
{{/block-slot}} | ||
{{#block-slot 'content'}} | ||
{{#if (gt unhealthy.length 0) }} | ||
<div class="unhealthy"> | ||
<h2>Unhealthy Nodes</h2> | ||
<div> | ||
{{! think about 2 differing views here }} | ||
<ul> | ||
{{#changeable-set dispatcher=searchableUnhealthy}} | ||
{{#block-slot 'set' as |unhealthy|}} | ||
{{#each unhealthy as |item|}} | ||
{{healthchecked-resource | ||
tagName='li' | ||
data-test-node=item.Node | ||
href=(href-to 'dc.nodes.show' item.Node) | ||
name=item.Node | ||
address=item.Address | ||
checks=item.Checks | ||
}} | ||
{{/each}} | ||
<div class="unhealthy"> | ||
<h2>Unhealthy Nodes</h2> | ||
<div> | ||
{{! think about 2 differing views here }} | ||
<ul> | ||
{{#changeable-set dispatcher=searchableUnhealthy}} | ||
{{#block-slot 'set' as |unhealthy|}} | ||
{{#each unhealthy as |item|}} | ||
{{#healthchecked-resource | ||
tagName='li' | ||
data-test-node=item.Node | ||
href=(href-to 'dc.nodes.show' item.Node) | ||
name=item.Node | ||
address=item.Address | ||
checks=item.Checks | ||
}} | ||
{{#block-slot 'icon'}} | ||
{{#if (eq item.Address leader.Address)}} | ||
<span data-test-leader={{leader.Address}} data-tooltip="Leader">Leader</span> | ||
{{/if}} | ||
{{/block-slot}} | ||
{{#block-slot 'empty'}} | ||
<p> | ||
There are no unhealthy nodes for that search. | ||
</p> | ||
{{/block-slot}} | ||
{{/changeable-set}} | ||
</ul> | ||
</div> | ||
</div> | ||
{{/if}} | ||
{{#if (gt healthy.length 0) }} | ||
<div class="healthy"> | ||
<h2>Healthy Nodes</h2> | ||
{{#changeable-set dispatcher=searchableHealthy}} | ||
{{#block-slot 'set' as |healthy|}} | ||
{{#list-collection cellHeight=92 items=healthy as |item index|}} | ||
{{healthchecked-resource | ||
data-test-node=item.Node | ||
href=(href-to 'dc.nodes.show' item.Node) | ||
name=item.Node | ||
address=item.Address | ||
checks=item.Checks | ||
}} | ||
{{/list-collection}} | ||
{{/healthchecked-resource}} | ||
{{/each}} | ||
{{/block-slot}} | ||
{{#block-slot 'empty'}} | ||
<p> | ||
There are no healthy nodes for that search. | ||
There are no unhealthy nodes for that search. | ||
</p> | ||
{{/block-slot}} | ||
{{/changeable-set}} | ||
</ul> | ||
</div> | ||
</div> | ||
{{/if}} | ||
{{#if (gt healthy.length 0) }} | ||
<div class="healthy"> | ||
<h2>Healthy Nodes</h2> | ||
{{#changeable-set dispatcher=searchableHealthy}} | ||
{{#block-slot 'set' as |healthy|}} | ||
{{#list-collection cellHeight=92 items=healthy as |item index|}} | ||
{{#healthchecked-resource | ||
data-test-node=item.Node | ||
href=(href-to 'dc.nodes.show' item.Node) | ||
name=item.Node | ||
address=item.Address | ||
checks=item.Checks | ||
}} | ||
{{#block-slot 'icon'}} | ||
{{#if (eq item.Address leader.Address)}} | ||
<span data-test-leader={{leader.Address}} data-tooltip="Leader">Leader</span> | ||
{{/if}} | ||
{{/block-slot}} | ||
{{/healthchecked-resource}} | ||
{{/list-collection}} | ||
{{/block-slot}} | ||
{{#block-slot 'empty'}} | ||
<p> | ||
There are no healthy nodes for that search. | ||
</p> | ||
{{/block-slot}} | ||
{{/changeable-set}} | ||
</div> | ||
{{/if}} | ||
{{#if (and (eq healthy.length 0) (eq unhealthy.length 0)) }} | ||
<p> | ||
There are no nodes. | ||
</p> | ||
<p> | ||
There are no nodes. | ||
</p> | ||
{{/if}} | ||
{{/block-slot}} | ||
{{/block-slot}} | ||
{{/app-view}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,51 @@ | ||
@setupApplicationTest | ||
Feature: Nodes | ||
Scenario: | ||
Feature: dc / nodes / index | ||
Background: | ||
Given 1 datacenter model with the value "dc-1" | ||
And 3 node models | ||
And the url "/v1/status/leader" responds with from yaml | ||
--- | ||
body: | | ||
"211.245.86.75:8500" | ||
--- | ||
Scenario: Viewing nodes in the listing | ||
Given 3 node models | ||
When I visit the nodes page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/nodes | ||
Then I see 3 node models | ||
Scenario: Seeing the leader in unhealthy listing | ||
Given 3 node models from yaml | ||
--- | ||
- Address: 211.245.86.75 | ||
Checks: | ||
- Status: warning | ||
Name: Warning check | ||
- Address: 10.0.0.1 | ||
- Address: 10.0.0.3 | ||
--- | ||
When I visit the nodes page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/nodes | ||
Then I see 3 node models | ||
And I see leader on the unHealthyNodes | ||
Scenario: Seeing the leader in healthy listing | ||
Given 3 node models from yaml | ||
--- | ||
- Address: 211.245.86.75 | ||
Checks: | ||
- Status: passing | ||
Name: Passing check | ||
- Address: 10.0.0.1 | ||
- Address: 10.0.0.3 | ||
--- | ||
When I visit the nodes page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/nodes | ||
Then I see 3 node models | ||
And I see leader on the healthyNodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@setupApplicationTest | ||
Feature: dc / nodes / no-leader | ||
Scenario: Leader hasn't been elected | ||
Given 1 datacenter model with the value "dc-1" | ||
And 3 node models | ||
And the url "/v1/status/leader" responds with from yaml | ||
--- | ||
body: | | ||
"" | ||
--- | ||
When I visit the nodes page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/nodes | ||
Then I see 3 node models | ||
And I don't see leader on the nodes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import steps from '../../steps'; | ||
|
||
// step definitions that are shared between features should be moved to the | ||
// tests/acceptance/steps/steps.js file | ||
|
||
export default function(assert) { | ||
return steps(assert).then('I should find a file', function() { | ||
assert.ok(true, this.step); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
export default function(visitable, clickable, attribute, collection, filter) { | ||
const node = { | ||
name: attribute('data-test-node'), | ||
leader: attribute('data-test-leader', '[data-test-leader]'), | ||
node: clickable('header a'), | ||
}; | ||
return { | ||
visit: visitable('/:dc/nodes'), | ||
nodes: collection('[data-test-node]', { | ||
name: attribute('data-test-node'), | ||
node: clickable('header a'), | ||
}), | ||
nodes: collection('[data-test-node]', node), | ||
healthyNodes: collection('.healthy [data-test-node]', node), | ||
unHealthyNodes: collection('.unhealthy [data-test-node]', node), | ||
filter: filter, | ||
}; | ||
} |
Oops, something went wrong.