-
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: Redesign - Service Detail Page (#7655)
* Create ConsulServiceInstanceList with styling and test * Implement ConsulServiceInstanceList to Service Detail page * Implement ConsulExternalSource to Services Show page header * Update services/show page object * Update the styling of CompositeRow * Refactor ConsulServiceList component and styling * Update ConsulExternalSource to say 'Registered via...' * Upgrade consul-api-double to patch 2.14.1 * Fix up tests to not use Kind in service models * Update ListCollection with clickFirstAnchor action * Add $typo-size-450 to typography base variables
- Loading branch information
Showing
43 changed files
with
403 additions
and
291 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
{{#let (if _externalSource _externalSource (service/external-source item)) as |externalSource|}} | ||
{{#if externalSource}} | ||
{{#if (has-block)}} | ||
{{yield | ||
(component 'consul-external-source' item=item _externalSource=externalSource) | ||
}} | ||
{{else}} | ||
<span data-test-external-source={{externalSource}} class="consul-external-source source-{{externalSource}}"> | ||
{{#if (eq externalSource 'aws')}} | ||
<span>Synced from {{uppercase externalSource}}</span> | ||
{{else}} | ||
<span>Synced from {{capitalize externalSource}}</span> | ||
{{/if}} | ||
</span> | ||
{{#if item}} | ||
{{#let (if _externalSource _externalSource (service/external-source item)) as |externalSource|}} | ||
{{#if externalSource}} | ||
{{#if (has-block)}} | ||
{{yield | ||
(component 'consul-external-source' item=item _externalSource=externalSource) | ||
}} | ||
{{else}} | ||
<span data-test-external-source={{externalSource}} class="consul-external-source source-{{externalSource}}"> | ||
{{#if (eq externalSource 'aws')}} | ||
<span>Registered via {{uppercase externalSource}}</span> | ||
{{else}} | ||
<span>Registered via {{capitalize externalSource}}</span> | ||
{{/if}} | ||
</span> | ||
{{/if}} | ||
{{/if}} | ||
{{/if}} | ||
{{/let}} | ||
{{/let}} | ||
{{/if}} |
47 changes: 47 additions & 0 deletions
47
ui-v2/app/components/consul-service-instance-list/index.hbs
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,47 @@ | ||
{{yield}} | ||
{{#if (gt items.length 0)}} | ||
<ListCollection @cellHeight={{73}} @items={{items}} class="consul-service-instance-list" as |item index|> | ||
<a href={{href-to routeName item.Service.Service item.Node.Node (or item.Service.ID item.Service.Service)}}> | ||
{{item.Service.ID}} | ||
</a> | ||
<ul> | ||
<ConsulExternalSource @item={{item.Service}} as |ExternalSource|> | ||
<li> | ||
<ExternalSource /> | ||
</li> | ||
</ConsulExternalSource> | ||
{{#with (reject-by 'ServiceID' '' item.Checks) as |checks|}} | ||
<li class={{service/instance-checks checks}}> | ||
{{checks.length}} service checks | ||
</li> | ||
{{/with}} | ||
{{#with (filter-by 'ServiceID' '' item.Checks) as |checks|}} | ||
<li class={{service/instance-checks checks}}> | ||
{{checks.length}} node checks | ||
</li> | ||
{{/with}} | ||
{{#if (get proxies item.Service.ID)}} | ||
<li class="proxy"> | ||
connected with proxy | ||
</li> | ||
{{/if}} | ||
{{#if (gt item.Node.Node.length 0)}} | ||
<li class="node"> | ||
<a href={{href-to 'dc.nodes.show' item.Node.Node}}>{{item.Node.Node}}</a> | ||
</li> | ||
{{/if}} | ||
<li class="address" data-test-address> | ||
{{#if (not-eq item.Service.Address '')}} | ||
{{item.Service.Address}}:{{item.Service.Port}} | ||
{{else}} | ||
{{item.Node.Address}}:{{item.Service.Port}} | ||
{{/if}} | ||
</li> | ||
{{#if (gt item.Service.Tags.length 0)}} | ||
<li> | ||
<TagList @items={{item.Service.Tags}}/> | ||
</li> | ||
{{/if}} | ||
</ul> | ||
</ListCollection> | ||
{{/if}} |
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,5 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
}); |
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,14 +1,30 @@ | ||
{{yield}} | ||
{{#if (gt items.length 0)}} | ||
<ListCollection @cellHeight={{73}} @items={{items}} class="consul-service-list" as |item index|> | ||
<a href={{href-to routeName item.Name}}> | ||
<span class={{service/health-checks item}}></span> | ||
<span> | ||
{{item.Name}} | ||
</span> | ||
<YieldSlot @name="metadata" @params={{block-params item}}> | ||
{{yield}} | ||
</YieldSlot> | ||
<a href={{href-to routeName item.Name}} class={{service/health-checks item}}> | ||
{{item.Name}} | ||
</a> | ||
<ul> | ||
<ConsulExternalSource @item={{item}} as |ExternalSource|> | ||
<li> | ||
<ExternalSource /> | ||
</li> | ||
</ConsulExternalSource> | ||
{{#if (not-eq item.InstanceCount 0)}} | ||
<li> | ||
{{format-number item.InstanceCount}} {{pluralize item.InstanceCount 'Instance' without-count=true}} | ||
</li> | ||
{{/if}} | ||
{{#if (get proxies item.Name)}} | ||
<li class="proxy"> | ||
connected with proxy | ||
</li> | ||
{{/if}} | ||
{{#if (gt items.Tags.length 0)}} | ||
<li> | ||
<TagList @items={{item.Tags}}/> | ||
</li> | ||
{{/if}} | ||
</ul> | ||
</ListCollection> | ||
{{/if}} |
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,6 +1,5 @@ | ||
import Component from '@ember/component'; | ||
import Slotted from 'block-slots'; | ||
|
||
export default Component.extend(Slotted, { | ||
export default Component.extend({ | ||
tagName: '', | ||
}); |
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,6 +1,6 @@ | ||
<EmberNativeScrollable @tagName="ul" @content-size={{_contentSize}} @scroll-left={{_scrollLeft}} @scroll-top={{_scrollTop}} @scrollChange={{action "scrollChange"}} @clientSizeChange={{action "clientSizeChange"}}> | ||
<li></li> | ||
{{~#each _cells as |cell|~}} | ||
<li style={{{cell.style}}}>{{yield cell.item cell.index }}</li> | ||
<li onclick={{action 'click'}} style={{{cell.style}}}>{{yield cell.item cell.index }}</li> | ||
{{~/each~}} | ||
</EmberNativeScrollable> |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
export function healthChecks([items], hash) { | ||
let ChecksCritical = 0; | ||
let ChecksWarning = 0; | ||
let ChecksPassing = 0; | ||
|
||
items.forEach(item => { | ||
switch (item.Status) { | ||
case 'critical': | ||
ChecksCritical += 1; | ||
break; | ||
case 'warning': | ||
ChecksWarning += 1; | ||
break; | ||
case 'passing': | ||
ChecksPassing += 1; | ||
break; | ||
default: | ||
break; | ||
} | ||
}); | ||
|
||
switch (true) { | ||
case ChecksCritical !== 0: | ||
return 'critical'; | ||
case ChecksWarning !== 0: | ||
return 'warning'; | ||
case ChecksPassing !== 0: | ||
return 'passing'; | ||
default: | ||
return 'empty'; | ||
} | ||
} | ||
|
||
export default helper(healthChecks); |
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,13 +1,13 @@ | ||
@import './layout'; | ||
@import './skin'; | ||
%composite-row a:hover, | ||
%composite-row a:focus, | ||
%composite-row a:active { | ||
%composite-row:hover, | ||
%composite-row:focus, | ||
%composite-row:active { | ||
@extend %composite-row-intent; | ||
} | ||
%composite-row > a > span { | ||
%composite-row > a { | ||
@extend %composite-row-header; | ||
} | ||
%composite-row > a > ul { | ||
%composite-row > ul { | ||
@extend %composite-row-detail; | ||
} |
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
Oops, something went wrong.