) */
-html.template-service.template-list td:first-child a span,
-html.template-node.template-show #services td:first-child a span {
- @extend %with-external-source-icon;
- float: left;
- margin-right: 10px;
- margin-top: 2px;
-}
/*TODO: trs only live in tables, get rid of table */
html.template-service.template-list main table tr {
@extend %services-row;
}
+html.template-service.template-show #instances table tr {
+ @extend %instances-row;
+}
+html.template-instance.template-show #upstreams table tr {
+ @extend %upstreams-row;
+}
html.template-intention.template-list main table tr {
@extend %intentions-row;
}
@@ -146,6 +145,12 @@ html.template-node.template-show main table.sessions tr {
html.template-token.template-list main table tr td.me ~ td:nth-of-type(5) {
display: none;
}
+ html.template-service.template-show #instances tr > :nth-child(3) {
+ display: none;
+ }
+ %instances-row > * {
+ width: calc(100% / 4);
+ }
}
%kvs-row > *:first-child {
@@ -155,7 +160,7 @@ html.template-node.template-show main table.sessions tr {
@extend %table-actions;
}
%node-services-row > * {
- width: 33%;
+ width: calc(100% / 3);
}
%policies-row > * {
width: calc(33% - 20px);
@@ -172,3 +177,9 @@ html.template-node.template-show main table.sessions tr {
%services-row > * {
width: auto;
}
+%instances-row > * {
+ width: calc(100% / 5);
+}
+%upstreams-row > * {
+ width: calc(100% / 3);
+}
diff --git a/ui-v2/app/styles/components/tag-list.scss b/ui-v2/app/styles/components/tag-list.scss
new file mode 100644
index 0000000000..6bc2ea8e70
--- /dev/null
+++ b/ui-v2/app/styles/components/tag-list.scss
@@ -0,0 +1,5 @@
+@import './tag-list/index';
+.tag-list,
+td.tags {
+ @extend %tag-list;
+}
diff --git a/ui-v2/app/styles/components/tag-list/index.scss b/ui-v2/app/styles/components/tag-list/index.scss
new file mode 100644
index 0000000000..bc18252196
--- /dev/null
+++ b/ui-v2/app/styles/components/tag-list/index.scss
@@ -0,0 +1,2 @@
+@import './skin';
+@import './layout';
diff --git a/ui-v2/app/styles/components/tag-list/layout.scss b/ui-v2/app/styles/components/tag-list/layout.scss
new file mode 100644
index 0000000000..2590f8b4c1
--- /dev/null
+++ b/ui-v2/app/styles/components/tag-list/layout.scss
@@ -0,0 +1,10 @@
+%tag-list dt {
+ display: none;
+}
+// TODO: Currently this is here to overwrite
+// the default definition list layout used in edit pages
+// ideally we'd be more specific with those to say
+// only add padding to dl's in edit pages
+%tag-list dd {
+ padding-left: 0;
+}
diff --git a/ui-v2/app/styles/components/tag-list/skin.scss b/ui-v2/app/styles/components/tag-list/skin.scss
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/ui-v2/app/styles/core/typography.scss b/ui-v2/app/styles/core/typography.scss
index 2331c49c90..bc945842a8 100644
--- a/ui-v2/app/styles/core/typography.scss
+++ b/ui-v2/app/styles/core/typography.scss
@@ -36,10 +36,10 @@ h1,
h2,
%header-nav,
%healthchecked-resource header span,
-%healthcheck-status dt,
+%healthcheck-output dt,
%copy-button,
%app-content div > dl > dt,
-td a {
+td:first-child a {
font-weight: $typo-weight-semibold;
}
%form-element > span,
@@ -51,7 +51,7 @@ caption {
font-weight: $typo-weight-semibold !important;
}
th,
-%breadcrumbs a,
+%breadcrumbs li > *,
%action-group-action,
%tab-nav,
%tooltip-bubble {
diff --git a/ui-v2/app/styles/routes/dc/service/index.scss b/ui-v2/app/styles/routes/dc/service/index.scss
index c38a957a9d..e69de29bb2 100644
--- a/ui-v2/app/styles/routes/dc/service/index.scss
+++ b/ui-v2/app/styles/routes/dc/service/index.scss
@@ -1,17 +0,0 @@
-@import '../../../components/pill/index';
-html.template-service.template-show main dl {
- display: flex;
- margin-bottom: 1.4em;
-}
-html.template-service.template-show main dt {
- display: none;
-}
-// TODO: Generalize this, also see nodes/index
-html.template-service.template-list td.tags span,
-html.template-service.template-show main dd span {
- @extend %pill;
-}
-html.template-node.template-show #services th:first-child,
-html.template-service.template-list main th:first-child {
- text-indent: 28px;
-}
diff --git a/ui-v2/app/styles/variables/custom-query.scss b/ui-v2/app/styles/variables/custom-query.scss
index 56895ef266..8e7160e678 100644
--- a/ui-v2/app/styles/variables/custom-query.scss
+++ b/ui-v2/app/styles/variables/custom-query.scss
@@ -26,8 +26,8 @@ $--lt-wide-footer: '(max-width: 420px)';
$--spacious-page-header: '(min-width: 850px)';
$--lt-spacious-page-header: '(max-width: 849px)';
-$--spacious-healthcheck-status: '(min-width: 421px)';
-$--lt-spacious-healthcheck-status: '(max-width: 420px)';
+$--spacious-healthcheck-output: '(min-width: 421px)';
+$--lt-spacious-healthcheck-output: '(max-width: 420px)';
$--wide-form: '(min-width: 421px)';
$--lt-wide-form: '(max-width: 420px)';
diff --git a/ui-v2/app/templates/components/healthcheck-info.hbs b/ui-v2/app/templates/components/healthcheck-info.hbs
new file mode 100644
index 0000000000..13b62ac08c
--- /dev/null
+++ b/ui-v2/app/templates/components/healthcheck-info.hbs
@@ -0,0 +1,9 @@
+{{#if (and (lt passing 1) (lt warning 1) (lt critical 1) )}}
+ 0
+{{else}}
+
+ {{healthcheck-status width=passingWidth name='passing' value=passing}}
+ {{healthcheck-status width=warningWidth name='warning' value=warning}}
+ {{healthcheck-status width=criticalWidth name='critical' value=critical}}
+
+{{/if}}
diff --git a/ui-v2/app/templates/components/healthcheck-list.hbs b/ui-v2/app/templates/components/healthcheck-list.hbs
new file mode 100644
index 0000000000..4b5774588e
--- /dev/null
+++ b/ui-v2/app/templates/components/healthcheck-list.hbs
@@ -0,0 +1,5 @@
+
+{{#each (sort-by (action 'sortChecksByImportance') items) as |check| }}
+ {{healthcheck-output data-test-node-healthcheck=check.Name tagName='li' name=check.Name class=check.Status status=check.Status notes=check.Notes output=check.Output}}
+{{/each}}
+
diff --git a/ui-v2/app/templates/components/healthcheck-output.hbs b/ui-v2/app/templates/components/healthcheck-output.hbs
new file mode 100644
index 0000000000..05a75e40a2
--- /dev/null
+++ b/ui-v2/app/templates/components/healthcheck-output.hbs
@@ -0,0 +1,25 @@
+{{#feedback-dialog type='inline'}}
+ {{#block-slot 'action' as |success error|}}
+ {{#copy-button success=(action success) error=(action error) clipboardText=output title='copy output to clipboard'}}
+ Copy Output
+ {{/copy-button}}
+ {{/block-slot}}
+ {{#block-slot 'success' as |transition|}}
+
+ Copied IP Address!
+
+ {{/block-slot}}
+ {{#block-slot 'error' as |transition|}}
+
+ Sorry, something went wrong!
+
+ {{/block-slot}}
+{{/feedback-dialog}}
+
+ {{name}}
+ {{notes}}
+ Output
+
+ {{output}}
+
+
\ No newline at end of file
diff --git a/ui-v2/app/templates/components/healthcheck-status.hbs b/ui-v2/app/templates/components/healthcheck-status.hbs
index 05a75e40a2..383f67386c 100644
--- a/ui-v2/app/templates/components/healthcheck-status.hbs
+++ b/ui-v2/app/templates/components/healthcheck-status.hbs
@@ -1,25 +1,3 @@
-{{#feedback-dialog type='inline'}}
- {{#block-slot 'action' as |success error|}}
- {{#copy-button success=(action success) error=(action error) clipboardText=output title='copy output to clipboard'}}
- Copy Output
- {{/copy-button}}
- {{/block-slot}}
- {{#block-slot 'success' as |transition|}}
-
- Copied IP Address!
-
- {{/block-slot}}
- {{#block-slot 'error' as |transition|}}
-
- Sorry, something went wrong!
-
- {{/block-slot}}
-{{/feedback-dialog}}
-
- {{name}}
- {{notes}}
- Output
-
- {{output}}
-
-
\ No newline at end of file
+{{!-- we use concat here to avoid ember adding returns between words, which causes a layout issue--}}
+{{ concat 'Healthchecks ' (capitalize name) }}
+{{format-number count}}
\ No newline at end of file
diff --git a/ui-v2/app/templates/components/tag-list.hbs b/ui-v2/app/templates/components/tag-list.hbs
new file mode 100644
index 0000000000..c51ea2a418
--- /dev/null
+++ b/ui-v2/app/templates/components/tag-list.hbs
@@ -0,0 +1,8 @@
+{{#if (gt items.length 0)}}
+ Tags
+
+ {{#each items as |item|}}
+ {{item}}
+ {{/each}}
+
+{{/if}}
diff --git a/ui-v2/app/templates/dc/nodes/-healthchecks.hbs b/ui-v2/app/templates/dc/nodes/-healthchecks.hbs
index a956fad631..19acae8c38 100644
--- a/ui-v2/app/templates/dc/nodes/-healthchecks.hbs
+++ b/ui-v2/app/templates/dc/nodes/-healthchecks.hbs
@@ -1,9 +1,5 @@
{{#if (gt item.Checks.length 0) }}
-
-{{#each (sort-by (action 'sortChecksByImportance') item.Checks) as |check| }}
- {{healthcheck-status data-test-node-healthcheck=check.Name tagName='li' name=check.Name class=check.Status status=check.Status notes=check.Notes output=check.Output}}
-{{/each}}
-
+ {{healthcheck-list items=item.Checks}}
{{else}}
This node has no health checks.
diff --git a/ui-v2/app/templates/dc/nodes/-services.hbs b/ui-v2/app/templates/dc/nodes/-services.hbs
index 856e51b172..e692bb0d52 100644
--- a/ui-v2/app/templates/dc/nodes/-services.hbs
+++ b/ui-v2/app/templates/dc/nodes/-services.hbs
@@ -19,7 +19,7 @@
- {{item.Service}}{{#if (not-eq item.ID item.Service) }}({{item.ID}}) {{/if}}
+ {{item.Service}}{{#if (not-eq item.ID item.Service) }} ({{item.ID}}) {{/if}}
diff --git a/ui-v2/app/templates/dc/services/-instances.hbs b/ui-v2/app/templates/dc/services/-instances.hbs
new file mode 100644
index 0000000000..7ef34c3400
--- /dev/null
+++ b/ui-v2/app/templates/dc/services/-instances.hbs
@@ -0,0 +1,55 @@
+{{#if (gt items.length 0) }}
+
+
+{{/if}}
+ {{#changeable-set dispatcher=searchable}}
+ {{#block-slot 'set' as |filtered|}}
+ {{#tabular-collection
+ data-test-instances
+ items=filtered as |item index|
+ }}
+ {{#block-slot 'header'}}
+ ID
+ Node
+ Address
+ Node Checks
+ Service Checks
+ {{/block-slot}}
+ {{#block-slot 'row'}}
+
+
+
+ {{ or item.Service.ID item.Service.Service }}
+
+
+
+ {{item.Node.Node}}
+
+
+ {{item.Service.Address}}:{{item.Service.Port}}
+
+
+ {{#with (reject-by 'ServiceID' '' item.Checks) as |checks|}}
+ {{healthcheck-info
+ passing=(filter-by 'Status' 'passing' checks) warning=(filter-by 'Status' 'warning' checks) critical=(filter-by 'Status' 'critical' checks)
+ }}
+ {{/with}}
+
+
+ {{#with (filter-by 'ServiceID' '' item.Checks) as |checks|}}
+ {{healthcheck-info
+ passing=(filter-by 'Status' 'passing' checks) warning=(filter-by 'Status' 'warning' checks) critical=(filter-by 'Status' 'critical' checks)
+ }}
+ {{/with}}
+
+ {{/block-slot}}
+ {{/tabular-collection}}
+ {{/block-slot}}
+ {{#block-slot 'empty'}}
+
+ There are no services.
+
+ {{/block-slot}}
+ {{/changeable-set}}
diff --git a/ui-v2/app/templates/dc/services/-nodechecks.hbs b/ui-v2/app/templates/dc/services/-nodechecks.hbs
new file mode 100644
index 0000000000..487db34fc9
--- /dev/null
+++ b/ui-v2/app/templates/dc/services/-nodechecks.hbs
@@ -0,0 +1,8 @@
+{{#if (gt item.NodeChecks.length 0) }}
+ {{healthcheck-list items=item.NodeChecks}}
+{{else}}
+
+ This instance has no node health checks.
+
+{{/if}}
+
diff --git a/ui-v2/app/templates/dc/services/-servicechecks.hbs b/ui-v2/app/templates/dc/services/-servicechecks.hbs
new file mode 100644
index 0000000000..424772e705
--- /dev/null
+++ b/ui-v2/app/templates/dc/services/-servicechecks.hbs
@@ -0,0 +1,8 @@
+{{#if (gt item.ServiceChecks.length 0) }}
+ {{healthcheck-list items=item.ServiceChecks}}
+{{else}}
+
+ This instance has no service health checks.
+
+{{/if}}
+
diff --git a/ui-v2/app/templates/dc/services/-tags.hbs b/ui-v2/app/templates/dc/services/-tags.hbs
new file mode 100644
index 0000000000..c0a3a0f783
--- /dev/null
+++ b/ui-v2/app/templates/dc/services/-tags.hbs
@@ -0,0 +1,7 @@
+{{#if (gt item.Tags.length 0) }}
+{{tag-list items=item.Tags}}
+{{else}}
+
+ There are no tags.
+
+{{/if}}
diff --git a/ui-v2/app/templates/dc/services/-upstreams.hbs b/ui-v2/app/templates/dc/services/-upstreams.hbs
new file mode 100644
index 0000000000..f4ad6fcc81
--- /dev/null
+++ b/ui-v2/app/templates/dc/services/-upstreams.hbs
@@ -0,0 +1,27 @@
+{{#if (gt item.Proxy.Upstreams.length 0) }}
+{{#tabular-collection
+ data-test-upstreams
+ items=item.Proxy.Upstreams as |item index|
+}}
+ {{#block-slot 'header'}}
+ Destination Name
+ Destination Type
+ Local Bind Port
+ {{/block-slot}}
+ {{#block-slot 'row'}}
+
+ {{item.DestinationName}}
+
+
+ {{item.DestinationType}}
+
+
+ {{item.LocalBindPort}}
+
+ {{/block-slot}}
+{{/tabular-collection}}
+{{else}}
+
+ There are no upstreams.
+
+{{/if}}
diff --git a/ui-v2/app/templates/dc/services/index.hbs b/ui-v2/app/templates/dc/services/index.hbs
index aee20a9718..7306ea10f3 100644
--- a/ui-v2/app/templates/dc/services/index.hbs
+++ b/ui-v2/app/templates/dc/services/index.hbs
@@ -35,18 +35,10 @@
- {{#if (and (lt item.ChecksPassing 1) (lt item.ChecksWarning 1) (lt item.ChecksCritical 1) )}}
- 0
- {{else}}
-
- Healthchecks Passing
- {{format-number item.ChecksPassing}}
- Healthchecks Warning
- {{format-number item.ChecksWarning}}
- Healthchecks Critical
- {{format-number item.ChecksCritical}}
-
- {{/if}}
+ {{healthcheck-info
+ passing=item.ChecksPassing warning=item.ChecksWarning critical=item.ChecksCritical
+ passingWidth=passingWidth warningWidth=warningWidth criticalWidth=criticalWidth
+ }}
{{#if (gt item.Tags.length 0)}}
diff --git a/ui-v2/app/templates/dc/services/instance.hbs b/ui-v2/app/templates/dc/services/instance.hbs
new file mode 100644
index 0000000000..0638552104
--- /dev/null
+++ b/ui-v2/app/templates/dc/services/instance.hbs
@@ -0,0 +1,72 @@
+{{#app-view class="instance show"}}
+ {{#block-slot 'breadcrumbs'}}
+
+ All Services
+ Service ({{item.Service}})
+ Instance
+
+ {{/block-slot}}
+ {{#block-slot 'header'}}
+
+ {{ item.ID }}
+{{#with (service/external-source item) as |externalSource| }}
+ {{#with (css-var (concat '--' externalSource '-color-svg') 'none') as |bg| }}
+ {{#if (not-eq bg 'none') }}
+ Registered via {{externalSource}}
+ {{/if}}
+ {{/with}}
+{{/with}}
+
+
+ Service Name
+ {{item.Service}}
+
+
+ Node Name
+ {{item.Node.Node}}
+
+{{#if proxy}}
+
+ Sidecar Proxy
+ {{proxy.ServiceID}}
+
+{{/if}}
+{{#if (eq item.Kind 'connect-proxy')}}
+
+ Dest. Service Instance
+ {{item.Proxy.DestinationServiceID}}
+
+
+ Local Service Address
+ {{item.Proxy.LocalServiceAddress}}:{{item.Proxy.LocalServicePort}}
+
+{{/if}}
+ {{/block-slot}}
+ {{#block-slot 'content'}}
+ {{tab-nav
+ items=(compact
+ (array
+ 'Service Checks'
+ 'Node Checks'
+(if (eq item.Kind 'connect-proxy') 'Upstreams' '')
+ 'Tags'
+ )
+ )
+ selected=selectedTab
+ }}
+ {{#each
+ (compact
+ (array
+ (hash id=(slugify 'Service Checks') partial='dc/services/servicechecks')
+ (hash id=(slugify 'Node Checks') partial='dc/services/nodechecks')
+(if (eq item.Kind 'connect-proxy') (hash id=(slugify 'Upstreams') partial='dc/services/upstreams') '')
+ (hash id=(slugify 'Tags') partial='dc/services/tags')
+ )
+ ) as |panel|
+ }}
+ {{#tab-section id=panel.id selected=(eq (if selectedTab selectedTab '') panel.id) onchange=(action "change")}}
+ {{partial panel.partial}}
+ {{/tab-section}}
+ {{/each}}
+ {{/block-slot}}
+{{/app-view}}
\ No newline at end of file
diff --git a/ui-v2/app/templates/dc/services/show.hbs b/ui-v2/app/templates/dc/services/show.hbs
index 5a75f0055f..bd693d9b85 100644
--- a/ui-v2/app/templates/dc/services/show.hbs
+++ b/ui-v2/app/templates/dc/services/show.hbs
@@ -15,76 +15,29 @@
{{/with}}
{{/with}}
- {{/block-slot}}
- {{#block-slot 'toolbar'}}
-{{#if (gt items.length 0) }}
- {{catalog-filter searchable=(array searchableHealthy searchableUnhealthy) filters=healthFilters search=s status=filters.status onchange=(action 'filter')}}
-{{/if}}
+
+ {{tab-nav
+ items=(compact
+ (array
+ 'Instances'
+ 'Tags'
+ )
+ )
+ selected=selectedTab
+ }}
{{/block-slot}}
{{#block-slot 'content'}}
-{{#if (gt item.Tags.length 0)}}
-
- Tags
-
- {{#each item.Tags as |item|}}
- {{item}}
- {{/each}}
-
-
-{{/if}}
-{{#if (gt unhealthy.length 0) }}
-
-{{/if}}
-{{#if (gt healthy.length 0) }}
-
-
Healthy Nodes
- {{#changeable-set dispatcher=searchableHealthy}}
- {{#block-slot 'set' as |healthy|}}
- {{#list-collection cellHeight=113 items=healthy as |item index|}}
- {{healthchecked-resource
- href=(href-to 'dc.nodes.show' item.Node.Node)
- data-test-node=item.Node.Node
- name=item.Node.Node
- service=item.Service.ID
- address=(concat (default item.Service.Address item.Node.Address) ':' item.Service.Port)
- checks=item.Checks
- status=item.Checks.[0].Status
- }}
- {{/list-collection}}
- {{/block-slot}}
- {{#block-slot 'empty'}}
-
- There are no healthy nodes for that search.
-
- {{/block-slot}}
- {{/changeable-set}}
-
-{{/if}}
+ {{#each
+ (compact
+ (array
+ (hash id=(slugify 'Instances') partial='dc/services/instances')
+ (hash id=(slugify 'Tags') partial='dc/services/tags')
+ )
+ ) as |panel|
+ }}
+ {{#tab-section id=panel.id selected=(eq (if selectedTab selectedTab '') panel.id) onchange=(action "change")}}
+ {{partial panel.partial}}
+ {{/tab-section}}
+ {{/each}}
{{/block-slot}}
{{/app-view}}
diff --git a/ui-v2/app/utils/computed/purify.js b/ui-v2/app/utils/computed/purify.js
index 3c9eba3410..1008ed8c47 100644
--- a/ui-v2/app/utils/computed/purify.js
+++ b/ui-v2/app/utils/computed/purify.js
@@ -1,4 +1,4 @@
-import { get } from '@ember/object';
+import { get, computed } from '@ember/object';
/**
* Converts a conventional non-pure Ember `computed` function into a pure one
@@ -8,20 +8,18 @@ import { get } from '@ember/object';
* @param {function} filter - Optional string filter function to pre-process the names of computed properties
* @returns {function} - A pure `computed` function
*/
-
-export default function(computed, filter) {
+const _success = function(value) {
+ return value;
+};
+const purify = function(computed, filter = args => args) {
return function() {
let args = [...arguments];
- let success = function(value) {
- return value;
- };
+ let success = _success;
// pop the user function off the end
if (typeof args[args.length - 1] === 'function') {
success = args.pop();
}
- if (typeof filter === 'function') {
- args = filter(args);
- }
+ args = filter(args);
// this is the 'conventional' `computed`
const cb = function(name) {
return success.apply(
@@ -39,4 +37,6 @@ export default function(computed, filter) {
// concat/push the user function back on
return computed(...args.concat([cb]));
};
-}
+};
+export const subscribe = purify(computed);
+export default purify;
diff --git a/ui-v2/tests/acceptance/components/catalog-filter.feature b/ui-v2/tests/acceptance/components/catalog-filter.feature
index ed11e247bd..3b5dad1177 100644
--- a/ui-v2/tests/acceptance/components/catalog-filter.feature
+++ b/ui-v2/tests/acceptance/components/catalog-filter.feature
@@ -123,31 +123,6 @@ Feature: components / catalog-filter
| Model | Page | Url |
| service | node | /dc-1/nodes/node-0 |
-------------------------------------------------
- Scenario: Filtering [Model] in [Page]
- Given 1 datacenter model with the value "dc1"
- And 2 [Model] models from yaml
- ---
- - ID: node-0
- ---
- When I visit the [Page] page for yaml
- ---
- dc: dc1
- service: service-0
- ---
- Then I fill in with yaml
- ---
- s: service-0-with-id
- ---
- And I see 1 [Model] model
- Then I see id on the unhealthy like yaml
- ---
- - service-0-with-id
- ---
- Where:
- -------------------------------------------------
- | Model | Page | Url |
- | nodes | service | /dc-1/services/service-0 |
- -------------------------------------------------
Scenario:
Given 1 datacenter model with the value "dc-1"
And 3 service models from yaml
diff --git a/ui-v2/tests/acceptance/dc/services/show.feature b/ui-v2/tests/acceptance/dc/services/show.feature
index 5fa48f0def..0c707f31b9 100644
--- a/ui-v2/tests/acceptance/dc/services/show.feature
+++ b/ui-v2/tests/acceptance/dc/services/show.feature
@@ -52,7 +52,7 @@ Feature: dc / services / show: Show Service
Then I see the text "Tag1" in "[data-test-tags] span:nth-child(1)"
Then I see the text "Tag2" in "[data-test-tags] span:nth-child(2)"
Then I see the text "Tag3" in "[data-test-tags] span:nth-child(3)"
- Scenario: Given various services the various ports on their nodes are displayed
+ Scenario: Given various services the various nodes on their instances are displayed
Given 1 datacenter model with the value "dc1"
And 3 node models
And 1 service model from yaml
@@ -83,21 +83,9 @@ Feature: dc / services / show: Show Service
dc: dc1
service: service-0
---
- Then I see address on the healthy like yaml
+ Then I see address on the instances like yaml
---
- "1.1.1.1:8080"
- ---
- Then I see address on the unhealthy like yaml
- ---
- "2.2.2.2:8000"
- "3.3.3.3:8888"
---
- Then I see id on the healthy like yaml
- ---
- - "passing-service-8080"
- ---
- Then I see id on the unhealthy like yaml
- ---
- - "service-8000"
- - "service-8888"
- ---
diff --git a/ui-v2/tests/integration/components/healthcheck-info-test.js b/ui-v2/tests/integration/components/healthcheck-info-test.js
new file mode 100644
index 0000000000..613a650657
--- /dev/null
+++ b/ui-v2/tests/integration/components/healthcheck-info-test.js
@@ -0,0 +1,22 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('healthcheck-info', 'Integration | Component | healthcheck info', {
+ integration: true,
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{healthcheck-info}}`);
+
+ assert.equal(this.$('dl').length, 1);
+
+ // Template block usage:
+ this.render(hbs`
+ {{#healthcheck-info}}
+ {{/healthcheck-info}}
+ `);
+ assert.equal(this.$('dl').length, 1);
+});
diff --git a/ui-v2/tests/integration/components/healthcheck-list-test.js b/ui-v2/tests/integration/components/healthcheck-list-test.js
new file mode 100644
index 0000000000..a85c4866de
--- /dev/null
+++ b/ui-v2/tests/integration/components/healthcheck-list-test.js
@@ -0,0 +1,23 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('healthcheck-list', 'Integration | Component | healthcheck list', {
+ integration: true,
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{healthcheck-list}}`);
+
+ assert.equal(this.$('ul').length, 1);
+
+ // Template block usage:
+ this.render(hbs`
+ {{#healthcheck-list}}
+ {{/healthcheck-list}}
+ `);
+
+ assert.equal(this.$('ul').length, 1);
+});
diff --git a/ui-v2/tests/integration/components/healthcheck-output-test.js b/ui-v2/tests/integration/components/healthcheck-output-test.js
new file mode 100644
index 0000000000..b72e7412f9
--- /dev/null
+++ b/ui-v2/tests/integration/components/healthcheck-output-test.js
@@ -0,0 +1,34 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('healthcheck-output', 'Integration | Component | healthcheck output', {
+ integration: true,
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{healthcheck-output}}`);
+
+ assert.notEqual(
+ this.$()
+ .text()
+ .trim()
+ .indexOf('Output'),
+ -1
+ );
+
+ // Template block usage:
+ this.render(hbs`
+ {{#healthcheck-output}}{{/healthcheck-output}}
+ `);
+
+ assert.notEqual(
+ this.$()
+ .text()
+ .trim()
+ .indexOf('Output'),
+ -1
+ );
+});
diff --git a/ui-v2/tests/integration/components/healthcheck-status-test.js b/ui-v2/tests/integration/components/healthcheck-status-test.js
index b19207e5a4..f4e9bd78ff 100644
--- a/ui-v2/tests/integration/components/healthcheck-status-test.js
+++ b/ui-v2/tests/integration/components/healthcheck-status-test.js
@@ -10,25 +10,11 @@ test('it renders', function(assert) {
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{healthcheck-status}}`);
-
- assert.notEqual(
- this.$()
- .text()
- .trim()
- .indexOf('Output'),
- -1
- );
+ assert.equal(this.$('dt').length, 1);
// Template block usage:
this.render(hbs`
{{#healthcheck-status}}{{/healthcheck-status}}
`);
-
- assert.notEqual(
- this.$()
- .text()
- .trim()
- .indexOf('Output'),
- -1
- );
+ assert.equal(this.$('dt').length, 1);
});
diff --git a/ui-v2/tests/integration/components/tag-list-test.js b/ui-v2/tests/integration/components/tag-list-test.js
new file mode 100644
index 0000000000..6924c8562c
--- /dev/null
+++ b/ui-v2/tests/integration/components/tag-list-test.js
@@ -0,0 +1,33 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('tag-list', 'Integration | Component | tag list', {
+ integration: true,
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{tag-list}}`);
+
+ assert.equal(
+ this.$()
+ .text()
+ .trim(),
+ ''
+ );
+
+ // Template block usage:
+ this.render(hbs`
+ {{#tag-list}}
+ {{/tag-list}}
+ `);
+
+ assert.equal(
+ this.$()
+ .text()
+ .trim(),
+ ''
+ );
+});
diff --git a/ui-v2/tests/pages/dc/services/show.js b/ui-v2/tests/pages/dc/services/show.js
index f50c60c834..5b5fb2e381 100644
--- a/ui-v2/tests/pages/dc/services/show.js
+++ b/ui-v2/tests/pages/dc/services/show.js
@@ -2,18 +2,8 @@ export default function(visitable, attribute, collection, text, filter) {
return {
visit: visitable('/:dc/services/:service'),
externalSource: attribute('data-test-external-source', 'h1 span'),
- nodes: collection('[data-test-node]', {
- name: attribute('data-test-node'),
- }),
- healthy: collection('[data-test-healthy] [data-test-node]', {
- name: attribute('data-test-node'),
- address: text('header strong'),
- id: text('header em'),
- }),
- unhealthy: collection('[data-test-unhealthy] [data-test-node]', {
- name: attribute('data-test-node'),
- address: text('header strong'),
- id: text('header em'),
+ instances: collection('#instances [data-test-tabular-row]', {
+ address: text('[data-test-address]'),
}),
filter: filter,
};
diff --git a/ui-v2/tests/unit/adapters/proxy-test.js b/ui-v2/tests/unit/adapters/proxy-test.js
new file mode 100644
index 0000000000..13859457ed
--- /dev/null
+++ b/ui-v2/tests/unit/adapters/proxy-test.js
@@ -0,0 +1,12 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Adapter | proxy', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function(assert) {
+ let adapter = this.owner.lookup('adapter:proxy');
+ assert.ok(adapter);
+ });
+});
diff --git a/ui-v2/tests/unit/controllers/dc/services/instance-test.js b/ui-v2/tests/unit/controllers/dc/services/instance-test.js
new file mode 100644
index 0000000000..2b0693934f
--- /dev/null
+++ b/ui-v2/tests/unit/controllers/dc/services/instance-test.js
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('controller:dc/services/instance', 'Unit | Controller | dc/services/instance', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let controller = this.subject();
+ assert.ok(controller);
+});
diff --git a/ui-v2/tests/unit/models/proxy-test.js b/ui-v2/tests/unit/models/proxy-test.js
new file mode 100644
index 0000000000..b37e80f56d
--- /dev/null
+++ b/ui-v2/tests/unit/models/proxy-test.js
@@ -0,0 +1,14 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+import { run } from '@ember/runloop';
+
+module('Unit | Model | proxy', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function(assert) {
+ let store = this.owner.lookup('service:store');
+ let model = run(() => store.createRecord('proxy', {}));
+ assert.ok(model);
+ });
+});
diff --git a/ui-v2/tests/unit/routes/dc/services/instance-test.js b/ui-v2/tests/unit/routes/dc/services/instance-test.js
new file mode 100644
index 0000000000..122dc9ee16
--- /dev/null
+++ b/ui-v2/tests/unit/routes/dc/services/instance-test.js
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:dc/services/instance', 'Unit | Route | dc/services/instance', {
+ // Specify the other units that are required for this test.
+ needs: ['service:repository/service', 'service:repository/proxy'],
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
diff --git a/ui-v2/tests/unit/serializers/proxy-test.js b/ui-v2/tests/unit/serializers/proxy-test.js
new file mode 100644
index 0000000000..44090cfe02
--- /dev/null
+++ b/ui-v2/tests/unit/serializers/proxy-test.js
@@ -0,0 +1,24 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+import { run } from '@ember/runloop';
+
+module('Unit | Serializer | proxy', function(hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function(assert) {
+ let store = this.owner.lookup('service:store');
+ let serializer = store.serializerFor('proxy');
+
+ assert.ok(serializer);
+ });
+
+ test('it serializes records', function(assert) {
+ let store = this.owner.lookup('service:store');
+ let record = run(() => store.createRecord('proxy', {}));
+
+ let serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+ });
+});
From 8f35715e47208bb39516e084ff94087ebb518362 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Thu, 21 Feb 2019 13:57:13 +0000
Subject: [PATCH 28/52] UI: Service Numbers (#5348)
Add totals to some listing views, remove healthcheck totals
1. Adds markup to render totals for Services, Nodes, Intentions and v1
ACLs
2. Removes counts from healthcheck filters, and therefore simplify text,
moving the copy to the templates
3. Alter test to reflect the fact that the text of the buttons are no
static in the component template rather than a dynamic attribute
---
ui-v2/app/mixins/with-health-filtering.js | 37 -------------------
ui-v2/app/styles/components/app-view.scss | 3 ++
ui-v2/app/styles/core/typography.scss | 9 +++--
.../templates/components/catalog-filter.hbs | 7 +++-
ui-v2/app/templates/dc/acls/index.hbs | 2 +-
ui-v2/app/templates/dc/intentions/index.hbs | 2 +-
ui-v2/app/templates/dc/nodes/index.hbs | 4 +-
ui-v2/app/templates/dc/services/index.hbs | 4 +-
.../components/catalog-filter-test.js | 14 +------
9 files changed, 23 insertions(+), 59 deletions(-)
diff --git a/ui-v2/app/mixins/with-health-filtering.js b/ui-v2/app/mixins/with-health-filtering.js
index 06ad378261..ee20846897 100644
--- a/ui-v2/app/mixins/with-health-filtering.js
+++ b/ui-v2/app/mixins/with-health-filtering.js
@@ -1,25 +1,6 @@
import Mixin from '@ember/object/mixin';
import WithFiltering from 'consul-ui/mixins/with-filtering';
-import { computed, get } from '@ember/object';
-import ucfirst from 'consul-ui/utils/ucfirst';
-const countStatus = function(items, status) {
- if (status === '') {
- return get(items, 'length');
- }
- const key = `Checks${ucfirst(status)}`;
- return items.reduce(function(prev, item, i, arr) {
- const num = get(item, key);
- return (
- prev +
- (typeof num !== 'undefined'
- ? num
- : get(item, 'Checks').filter(function(item) {
- return item.Status === status;
- }).length) || 0
- );
- }, 0);
-};
export default Mixin.create(WithFiltering, {
queryParams: {
status: {
@@ -29,22 +10,4 @@ export default Mixin.create(WithFiltering, {
as: 'filter',
},
},
- healthFilters: computed('items.[]', function() {
- const items = get(this, 'items');
- const objs = ['', 'passing', 'warning', 'critical'].map(function(item) {
- const count = countStatus(items, item);
- return {
- count: count,
- label: `${item === '' ? 'All' : ucfirst(item)} (${count.toLocaleString()})`,
- value: item,
- };
- });
- objs[0].label = `All (${objs
- .slice(1)
- .reduce(function(prev, item, i, arr) {
- return prev + item.count;
- }, 0)
- .toLocaleString()})`;
- return objs;
- }),
});
diff --git a/ui-v2/app/styles/components/app-view.scss b/ui-v2/app/styles/components/app-view.scss
index 8b4c559755..2ddc65d217 100644
--- a/ui-v2/app/styles/components/app-view.scss
+++ b/ui-v2/app/styles/components/app-view.scss
@@ -18,6 +18,9 @@ main {
%app-view h1 span {
@extend %with-external-source-icon;
}
+%app-view h1 em {
+ color: $gray-600;
+}
%app-view header .actions a,
%app-view header .actions button {
@extend %button-compact;
diff --git a/ui-v2/app/styles/core/typography.scss b/ui-v2/app/styles/core/typography.scss
index bc945842a8..5f01d4be8e 100644
--- a/ui-v2/app/styles/core/typography.scss
+++ b/ui-v2/app/styles/core/typography.scss
@@ -61,12 +61,14 @@ main label a[rel*='help'],
td:first-child em,
%pill,
%form-element > strong,
-%healthchecked-resource strong {
+%healthchecked-resource strong,
+%app-view h1 em {
font-weight: $typo-weight-normal;
}
%form-element > em,
td:first-child em,
-%healthchecked-resource header em {
+%healthchecked-resource header em,
+%app-view h1 em {
font-style: normal;
}
%footer > * {
@@ -76,7 +78,8 @@ h1 {
font-size: $typo-header-100;
}
h2,
-%header-drop-nav .is-active {
+%header-drop-nav .is-active,
+%app-view h1 em {
font-size: $typo-size-500;
}
body,
diff --git a/ui-v2/app/templates/components/catalog-filter.hbs b/ui-v2/app/templates/components/catalog-filter.hbs
index 9d95acc258..5185b0921e 100644
--- a/ui-v2/app/templates/components/catalog-filter.hbs
+++ b/ui-v2/app/templates/components/catalog-filter.hbs
@@ -1,4 +1,9 @@
{{!}}
diff --git a/ui-v2/app/templates/dc/acls/index.hbs b/ui-v2/app/templates/dc/acls/index.hbs
index 3617db3c93..497ec5bffa 100644
--- a/ui-v2/app/templates/dc/acls/index.hbs
+++ b/ui-v2/app/templates/dc/acls/index.hbs
@@ -4,7 +4,7 @@
{{/block-slot}}
{{#block-slot 'header'}}
- ACL Tokens
+ ACL Tokens {{format-number items.length}} total
{{/block-slot}}
diff --git a/ui-v2/app/templates/dc/intentions/index.hbs b/ui-v2/app/templates/dc/intentions/index.hbs
index db4540389f..b521d8b6e7 100644
--- a/ui-v2/app/templates/dc/intentions/index.hbs
+++ b/ui-v2/app/templates/dc/intentions/index.hbs
@@ -4,7 +4,7 @@
{{/block-slot}}
{{#block-slot 'header'}}
- Intentions
+ Intentions {{format-number items.length}} total
{{/block-slot}}
diff --git a/ui-v2/app/templates/dc/nodes/index.hbs b/ui-v2/app/templates/dc/nodes/index.hbs
index 0d9ca57ed4..82d93a5260 100644
--- a/ui-v2/app/templates/dc/nodes/index.hbs
+++ b/ui-v2/app/templates/dc/nodes/index.hbs
@@ -1,13 +1,13 @@
{{#app-view class="node list"}}
{{#block-slot 'header'}}
- Nodes
+ Nodes {{format-number items.length}} total
{{/block-slot}}
{{#block-slot 'toolbar'}}
{{#if (gt items.length 0) }}
- {{catalog-filter searchable=(array searchableHealthy searchableUnhealthy) filters=healthFilters 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'}}
diff --git a/ui-v2/app/templates/dc/services/index.hbs b/ui-v2/app/templates/dc/services/index.hbs
index 7306ea10f3..16f287eb4d 100644
--- a/ui-v2/app/templates/dc/services/index.hbs
+++ b/ui-v2/app/templates/dc/services/index.hbs
@@ -5,13 +5,13 @@
{{/block-slot}}
{{#block-slot 'header'}}
- Services
+ Services {{format-number items.length}} total
{{/block-slot}}
{{#block-slot 'toolbar'}}
{{#if (gt items.length 0) }}
- {{catalog-filter searchable=searchable filters=healthFilters search=filters.s status=filters.status onchange=(action 'filter')}}
+ {{catalog-filter searchable=searchable search=filters.s status=filters.status onchange=(action 'filter')}}
{{/if}}
{{/block-slot}}
{{#block-slot 'content'}}
diff --git a/ui-v2/tests/integration/components/catalog-filter-test.js b/ui-v2/tests/integration/components/catalog-filter-test.js
index e4ba4793f9..df2e4fd750 100644
--- a/ui-v2/tests/integration/components/catalog-filter-test.js
+++ b/ui-v2/tests/integration/components/catalog-filter-test.js
@@ -11,22 +11,12 @@ test('it renders', function(assert) {
this.render(hbs`{{catalog-filter}}`);
- assert.equal(
- this.$()
- .text()
- .trim(),
- 'Search'
- );
+ assert.equal(this.$().find('form').length, 1);
// Template block usage:
this.render(hbs`
{{#catalog-filter}}{{/catalog-filter}}
`);
- assert.equal(
- this.$()
- .text()
- .trim(),
- 'Search'
- );
+ assert.equal(this.$().find('form').length, 1);
});
From 18b0de2785e61b176855c44d45158763846b5cf7 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Thu, 21 Feb 2019 16:25:20 +0000
Subject: [PATCH 29/52] UI: Use custom block-slots for changeableset
---
ui-v2/app/components/changeable-set.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui-v2/app/components/changeable-set.js b/ui-v2/app/components/changeable-set.js
index f9d88d91c4..9a50c24293 100644
--- a/ui-v2/app/components/changeable-set.js
+++ b/ui-v2/app/components/changeable-set.js
@@ -1,6 +1,6 @@
import Component from '@ember/component';
import { get, set } from '@ember/object';
-import SlotsMixin from 'ember-block-slots';
+import SlotsMixin from 'block-slots';
import WithListeners from 'consul-ui/mixins/with-listeners';
export default Component.extend(WithListeners, SlotsMixin, {
From 11ccea88e16fa2d3fe2405778717dc0394dda8d8 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Thu, 7 Mar 2019 10:19:48 +0100
Subject: [PATCH 30/52] ui: Amend breakpoints for new numberless filter buttons
(#5381)
---
ui-v2/app/styles/variables/custom-query.scss | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui-v2/app/styles/variables/custom-query.scss b/ui-v2/app/styles/variables/custom-query.scss
index 8e7160e678..3f31e55818 100644
--- a/ui-v2/app/styles/variables/custom-query.scss
+++ b/ui-v2/app/styles/variables/custom-query.scss
@@ -1,9 +1,9 @@
$ideal-width: 1260px;
-$--horizontal-filters: '(min-width: 850px)';
-$--lt-horizontal-filters: '(max-width: 849px)';
+$--horizontal-filters: '(min-width: 910px)';
+$--lt-horizontal-filters: '(max-width: 909px)';
-$--horizontal-selects: '(min-width: 615px)';
-$--lt-horizontal-selects: '(max-width: 614px)';
+$--horizontal-selects: '(min-width: 670px)';
+$--lt-horizontal-selects: '(max-width: 669px)';
$--horizontal-nav: '(min-width: 850px)';
$--lt-horizontal-nav: '(max-width: 849px)';
From 20e1a39aef9e96e88e4669ca4d94c20219ded137 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Thu, 7 Mar 2019 10:20:54 +0100
Subject: [PATCH 31/52] ui: remove call to super in setupController (#5383)
---
ui-v2/app/routes/dc.js | 1 -
ui-v2/app/routes/dc/acls/create.js | 1 -
ui-v2/app/routes/dc/acls/edit.js | 1 -
ui-v2/app/routes/dc/acls/index.js | 1 -
ui-v2/app/routes/dc/acls/policies/edit.js | 1 -
ui-v2/app/routes/dc/acls/policies/index.js | 1 -
ui-v2/app/routes/dc/acls/tokens/edit.js | 1 -
ui-v2/app/routes/dc/acls/tokens/index.js | 1 -
ui-v2/app/routes/dc/intentions/create.js | 1 -
ui-v2/app/routes/dc/intentions/edit.js | 1 -
ui-v2/app/routes/dc/intentions/index.js | 1 -
ui-v2/app/routes/dc/kv/create.js | 1 -
ui-v2/app/routes/dc/kv/edit.js | 1 -
ui-v2/app/routes/dc/kv/index.js | 1 -
ui-v2/app/routes/dc/nodes/index.js | 1 -
ui-v2/app/routes/dc/nodes/show.js | 1 -
ui-v2/app/routes/dc/services/index.js | 1 -
ui-v2/app/routes/dc/services/instance.js | 1 -
ui-v2/app/routes/dc/services/show.js | 1 -
ui-v2/app/routes/settings.js | 1 -
20 files changed, 20 deletions(-)
diff --git a/ui-v2/app/routes/dc.js b/ui-v2/app/routes/dc.js
index 6b8f466a46..b795f8f773 100644
--- a/ui-v2/app/routes/dc.js
+++ b/ui-v2/app/routes/dc.js
@@ -19,7 +19,6 @@ export default Route.extend({
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/acls/create.js b/ui-v2/app/routes/dc/acls/create.js
index 315a07fb60..a424260e88 100644
--- a/ui-v2/app/routes/dc/acls/create.js
+++ b/ui-v2/app/routes/dc/acls/create.js
@@ -22,7 +22,6 @@ export default Route.extend(WithAclActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
deactivate: function() {
diff --git a/ui-v2/app/routes/dc/acls/edit.js b/ui-v2/app/routes/dc/acls/edit.js
index 565f90bbe7..d016c15bf8 100644
--- a/ui-v2/app/routes/dc/acls/edit.js
+++ b/ui-v2/app/routes/dc/acls/edit.js
@@ -16,7 +16,6 @@ export default Route.extend(WithAclActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/acls/index.js b/ui-v2/app/routes/dc/acls/index.js
index b36a9e3527..b7e521b8e3 100644
--- a/ui-v2/app/routes/dc/acls/index.js
+++ b/ui-v2/app/routes/dc/acls/index.js
@@ -36,7 +36,6 @@ export default Route.extend(WithAclActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/acls/policies/edit.js b/ui-v2/app/routes/dc/acls/policies/edit.js
index 3e09d345e8..0940813c4f 100644
--- a/ui-v2/app/routes/dc/acls/policies/edit.js
+++ b/ui-v2/app/routes/dc/acls/policies/edit.js
@@ -31,7 +31,6 @@ export default SingleRoute.extend(WithPolicyActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/acls/policies/index.js b/ui-v2/app/routes/dc/acls/policies/index.js
index 6ab9d1a704..094b4a1457 100644
--- a/ui-v2/app/routes/dc/acls/policies/index.js
+++ b/ui-v2/app/routes/dc/acls/policies/index.js
@@ -23,7 +23,6 @@ export default Route.extend(WithPolicyActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/acls/tokens/edit.js b/ui-v2/app/routes/dc/acls/tokens/edit.js
index 8371f86ab5..384a521337 100644
--- a/ui-v2/app/routes/dc/acls/tokens/edit.js
+++ b/ui-v2/app/routes/dc/acls/tokens/edit.js
@@ -38,7 +38,6 @@ export default SingleRoute.extend(WithTokenActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
getEmptyPolicy: function() {
diff --git a/ui-v2/app/routes/dc/acls/tokens/index.js b/ui-v2/app/routes/dc/acls/tokens/index.js
index 757871e013..2f3e21afcb 100644
--- a/ui-v2/app/routes/dc/acls/tokens/index.js
+++ b/ui-v2/app/routes/dc/acls/tokens/index.js
@@ -36,7 +36,6 @@ export default Route.extend(WithTokenActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/intentions/create.js b/ui-v2/app/routes/dc/intentions/create.js
index a52a8429d5..cf49eac252 100644
--- a/ui-v2/app/routes/dc/intentions/create.js
+++ b/ui-v2/app/routes/dc/intentions/create.js
@@ -32,7 +32,6 @@ export default Route.extend(WithIntentionActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
deactivate: function() {
diff --git a/ui-v2/app/routes/dc/intentions/edit.js b/ui-v2/app/routes/dc/intentions/edit.js
index 16b085dbe9..138ead24e5 100644
--- a/ui-v2/app/routes/dc/intentions/edit.js
+++ b/ui-v2/app/routes/dc/intentions/edit.js
@@ -26,7 +26,6 @@ export default Route.extend(WithAclActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/intentions/index.js b/ui-v2/app/routes/dc/intentions/index.js
index ec41bf54aa..750f11c0cc 100644
--- a/ui-v2/app/routes/dc/intentions/index.js
+++ b/ui-v2/app/routes/dc/intentions/index.js
@@ -19,7 +19,6 @@ export default Route.extend(WithIntentionActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/kv/create.js b/ui-v2/app/routes/dc/kv/create.js
index 44ec169e58..d63ce89338 100644
--- a/ui-v2/app/routes/dc/kv/create.js
+++ b/ui-v2/app/routes/dc/kv/create.js
@@ -24,7 +24,6 @@ export default Route.extend(WithKvActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
deactivate: function() {
diff --git a/ui-v2/app/routes/dc/kv/edit.js b/ui-v2/app/routes/dc/kv/edit.js
index 170e512f6a..44c13a5f15 100644
--- a/ui-v2/app/routes/dc/kv/edit.js
+++ b/ui-v2/app/routes/dc/kv/edit.js
@@ -32,7 +32,6 @@ export default Route.extend(WithKvActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/kv/index.js b/ui-v2/app/routes/dc/kv/index.js
index 21ef89dc05..ad2a8a7b73 100644
--- a/ui-v2/app/routes/dc/kv/index.js
+++ b/ui-v2/app/routes/dc/kv/index.js
@@ -55,7 +55,6 @@ export default Route.extend(WithKvActions, {
},
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/nodes/index.js b/ui-v2/app/routes/dc/nodes/index.js
index 5488397458..8cbd56ecdc 100644
--- a/ui-v2/app/routes/dc/nodes/index.js
+++ b/ui-v2/app/routes/dc/nodes/index.js
@@ -17,7 +17,6 @@ export default Route.extend({
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/nodes/show.js b/ui-v2/app/routes/dc/nodes/show.js
index 9d9f344588..0449afc2df 100644
--- a/ui-v2/app/routes/dc/nodes/show.js
+++ b/ui-v2/app/routes/dc/nodes/show.js
@@ -41,7 +41,6 @@ export default Route.extend(WithBlockingActions, {
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
actions: {
diff --git a/ui-v2/app/routes/dc/services/index.js b/ui-v2/app/routes/dc/services/index.js
index 7b74816dbd..2b900f502e 100644
--- a/ui-v2/app/routes/dc/services/index.js
+++ b/ui-v2/app/routes/dc/services/index.js
@@ -18,7 +18,6 @@ export default Route.extend({
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/services/instance.js b/ui-v2/app/routes/dc/services/instance.js
index da863ba418..b358fdd396 100644
--- a/ui-v2/app/routes/dc/services/instance.js
+++ b/ui-v2/app/routes/dc/services/instance.js
@@ -23,7 +23,6 @@ export default Route.extend({
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/dc/services/show.js b/ui-v2/app/routes/dc/services/show.js
index 9376abdbc1..3757421cd8 100644
--- a/ui-v2/app/routes/dc/services/show.js
+++ b/ui-v2/app/routes/dc/services/show.js
@@ -26,7 +26,6 @@ export default Route.extend({
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
});
diff --git a/ui-v2/app/routes/settings.js b/ui-v2/app/routes/settings.js
index 0dc59dc02c..d62cb6b9c8 100644
--- a/ui-v2/app/routes/settings.js
+++ b/ui-v2/app/routes/settings.js
@@ -21,7 +21,6 @@ export default Route.extend({
});
},
setupController: function(controller, model) {
- this._super(...arguments);
controller.setProperties(model);
},
actions: {
From 5dd9cd2d2e3991425e1baef0431cb15226ad6803 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Thu, 7 Mar 2019 11:51:39 +0100
Subject: [PATCH 32/52] UI: Add forking based on service instance id existence
(#5392)
* ui: Add forking based on service instance id existence
Proxies come in 2 flavours, 'normal' and sidecar. We know when a proxy
is a sidecar proxy based on whether a DestinationServiceID is set.
LocalServiceAddress and LocalServicePort are only relevant for sidecar
proxies.
This adds template logic to show different text depending on this
information.
Additionally adds test around connect proxies (#5418)
1. Adds page object for the instance detail page
2. Adds further scenario steps used in the tests
3. Adds acceptance testing around the instance detail page. Services
with proxies and the sidecar proxies and proxies themselves
4. Adds datacenter column for upstreams
5. Fixes bug routing bug for decision as to whether to request proxy
information or not
---
ui-v2/app/models/proxy.js | 2 +-
ui-v2/app/routes/dc/services/instance.js | 6 +-
ui-v2/app/services/repository/proxy.js | 6 +-
ui-v2/app/services/repository/service.js | 10 ++-
.../styles/components/tabular-collection.scss | 2 +-
.../templates/components/healthcheck-list.hbs | 2 +-
.../app/templates/dc/services/-upstreams.hbs | 18 +++--
ui-v2/app/templates/dc/services/instance.hbs | 11 ++-
.../dc/services/instances/error.feature | 15 ++++
.../dc/services/instances/proxy.feature | 48 +++++++++++++
.../dc/services/instances/show.feature | 68 +++++++++++++++++++
.../services/instances/sidecar-proxy.feature | 29 ++++++++
.../dc/services/instances/with-proxy.feature | 20 ++++++
.../services/instances/with-sidecar.feature | 22 ++++++
.../dc/services/instances/error-steps.js | 10 +++
.../dc/services/instances/proxy-steps.js | 10 +++
.../steps/dc/services/instances/show-steps.js | 10 +++
.../services/instances/sidecar-proxy-steps.js | 10 +++
.../dc/services/instances/with-proxy-steps.js | 10 +++
.../services/instances/with-sidecar-steps.js | 10 +++
ui-v2/tests/helpers/type-to-url.js | 3 +
ui-v2/tests/pages.js | 2 +
ui-v2/tests/pages/dc/services/instance.js | 19 ++++++
ui-v2/tests/steps/assertions/dom.js | 6 ++
ui-v2/tests/steps/assertions/model.js | 5 +-
ui-v2/tests/steps/assertions/page.js | 24 +++++--
ui-v2/yarn.lock | 6 +-
27 files changed, 356 insertions(+), 28 deletions(-)
create mode 100644 ui-v2/tests/acceptance/dc/services/instances/error.feature
create mode 100644 ui-v2/tests/acceptance/dc/services/instances/proxy.feature
create mode 100644 ui-v2/tests/acceptance/dc/services/instances/show.feature
create mode 100644 ui-v2/tests/acceptance/dc/services/instances/sidecar-proxy.feature
create mode 100644 ui-v2/tests/acceptance/dc/services/instances/with-proxy.feature
create mode 100644 ui-v2/tests/acceptance/dc/services/instances/with-sidecar.feature
create mode 100644 ui-v2/tests/acceptance/steps/dc/services/instances/error-steps.js
create mode 100644 ui-v2/tests/acceptance/steps/dc/services/instances/proxy-steps.js
create mode 100644 ui-v2/tests/acceptance/steps/dc/services/instances/show-steps.js
create mode 100644 ui-v2/tests/acceptance/steps/dc/services/instances/sidecar-proxy-steps.js
create mode 100644 ui-v2/tests/acceptance/steps/dc/services/instances/with-proxy-steps.js
create mode 100644 ui-v2/tests/acceptance/steps/dc/services/instances/with-sidecar-steps.js
create mode 100644 ui-v2/tests/pages/dc/services/instance.js
diff --git a/ui-v2/app/models/proxy.js b/ui-v2/app/models/proxy.js
index 9e08582199..3e4fb58228 100644
--- a/ui-v2/app/models/proxy.js
+++ b/ui-v2/app/models/proxy.js
@@ -8,5 +8,5 @@ export default Model.extend({
[SLUG_KEY]: attr('string'),
ServiceName: attr('string'),
ServiceID: attr('string'),
- ServiceProxyDestination: attr('string'),
+ ServiceProxy: attr(),
});
diff --git a/ui-v2/app/routes/dc/services/instance.js b/ui-v2/app/routes/dc/services/instance.js
index b358fdd396..b4d0f1c5b9 100644
--- a/ui-v2/app/routes/dc/services/instance.js
+++ b/ui-v2/app/routes/dc/services/instance.js
@@ -15,9 +15,9 @@ export default Route.extend({
}).then(function(model) {
return hash({
proxy:
- get(service, 'Kind') !== 'connect-proxy'
- ? proxyRepo.findInstanceBySlug(params.id, params.name, dc)
- : null,
+ get(model.item, 'Kind') === 'connect-proxy'
+ ? null
+ : proxyRepo.findInstanceBySlug(params.id, params.name, dc),
...model,
});
});
diff --git a/ui-v2/app/services/repository/proxy.js b/ui-v2/app/services/repository/proxy.js
index ce8c055d83..41f1207b4e 100644
--- a/ui-v2/app/services/repository/proxy.js
+++ b/ui-v2/app/services/repository/proxy.js
@@ -22,7 +22,11 @@ export default RepositoryService.extend({
findInstanceBySlug: function(id, slug, dc, configuration) {
return this.findAllBySlug(slug, dc, configuration).then(function(items) {
if (get(items, 'length') > 0) {
- const instance = items.findBy('ServiceProxyDestination', id);
+ let instance = items.findBy('ServiceProxy.DestinationServiceID', id);
+ if (instance) {
+ return instance;
+ }
+ instance = items.findBy('ServiceProxy.DestinationServiceName', slug);
if (instance) {
return instance;
}
diff --git a/ui-v2/app/services/repository/service.js b/ui-v2/app/services/repository/service.js
index 2da90a3c72..61ef1d61cd 100644
--- a/ui-v2/app/services/repository/service.js
+++ b/ui-v2/app/services/repository/service.js
@@ -35,7 +35,15 @@ export default RepositoryService.extend({
});
return service;
}
- // TODO: probably need to throw a 404 here?
+ // TODO: Add an store.error("404", "message") or similar
+ const e = new Error();
+ e.errors = [
+ {
+ status: '404',
+ title: 'Unable to find instance',
+ },
+ ];
+ throw e;
});
},
});
diff --git a/ui-v2/app/styles/components/tabular-collection.scss b/ui-v2/app/styles/components/tabular-collection.scss
index 53d6678ef6..d26b72e656 100644
--- a/ui-v2/app/styles/components/tabular-collection.scss
+++ b/ui-v2/app/styles/components/tabular-collection.scss
@@ -181,5 +181,5 @@ html.template-node.template-show main table.sessions tr {
width: calc(100% / 5);
}
%upstreams-row > * {
- width: calc(100% / 3);
+ width: calc(100% / 4);
}
diff --git a/ui-v2/app/templates/components/healthcheck-list.hbs b/ui-v2/app/templates/components/healthcheck-list.hbs
index 4b5774588e..babca35d74 100644
--- a/ui-v2/app/templates/components/healthcheck-list.hbs
+++ b/ui-v2/app/templates/components/healthcheck-list.hbs
@@ -1,4 +1,4 @@
-
+
{{#each (sort-by (action 'sortChecksByImportance') items) as |check| }}
{{healthcheck-output data-test-node-healthcheck=check.Name tagName='li' name=check.Name class=check.Status status=check.Status notes=check.Notes output=check.Output}}
{{/each}}
diff --git a/ui-v2/app/templates/dc/services/-upstreams.hbs b/ui-v2/app/templates/dc/services/-upstreams.hbs
index f4ad6fcc81..62031ba28e 100644
--- a/ui-v2/app/templates/dc/services/-upstreams.hbs
+++ b/ui-v2/app/templates/dc/services/-upstreams.hbs
@@ -4,19 +4,23 @@
items=item.Proxy.Upstreams as |item index|
}}
{{#block-slot 'header'}}
- Destination Name
- Destination Type
- Local Bind Port
+ Upstream
+ Datacenter
+ Type
+ Local Bind Address
{{/block-slot}}
{{#block-slot 'row'}}
-
- {{item.DestinationName}}
+
+ {{item.DestinationName}}
+
+
+ {{item.Datacenter}}
{{item.DestinationType}}
-
- {{item.LocalBindPort}}
+
+ {{item.LocalBindAddress}}:{{item.LocalBindPort}}
{{/block-slot}}
{{/tabular-collection}}
diff --git a/ui-v2/app/templates/dc/services/instance.hbs b/ui-v2/app/templates/dc/services/instance.hbs
index 0638552104..9b3a286ba4 100644
--- a/ui-v2/app/templates/dc/services/instance.hbs
+++ b/ui-v2/app/templates/dc/services/instance.hbs
@@ -27,19 +27,26 @@
{{#if proxy}}
- Sidecar Proxy
+ {{if proxy.ServiceProxy.DestinationServiceID "Sidecar " ""}}Proxy
{{proxy.ServiceID}}
{{/if}}
{{#if (eq item.Kind 'connect-proxy')}}
+ {{#if item.Proxy.DestinationServiceID}}
- Dest. Service Instance
+ Dest. Service Instance
{{item.Proxy.DestinationServiceID}}
Local Service Address
{{item.Proxy.LocalServiceAddress}}:{{item.Proxy.LocalServicePort}}
+ {{else}}
+
+ Dest. Service
+ {{item.Proxy.DestinationServiceName}}
+
+ {{/if}}
{{/if}}
{{/block-slot}}
{{#block-slot 'content'}}
diff --git a/ui-v2/tests/acceptance/dc/services/instances/error.feature b/ui-v2/tests/acceptance/dc/services/instances/error.feature
new file mode 100644
index 0000000000..bf4ef1dc6e
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/instances/error.feature
@@ -0,0 +1,15 @@
+@setupApplicationTest
+Feature: dc / services / instances / error: Visit Service Instance what doesn't exist
+ Scenario: No instance can be found in the API response
+ Given 1 datacenter model with the value "dc1"
+ And 1 service model
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0
+ id: id-that-doesnt-exist
+ ---
+ Then the url should be /dc1/services/service-0/id-that-doesnt-exist
+ And I see the text "404 (Unable to find instance)" in "[data-test-error]"
+
+
diff --git a/ui-v2/tests/acceptance/dc/services/instances/proxy.feature b/ui-v2/tests/acceptance/dc/services/instances/proxy.feature
new file mode 100644
index 0000000000..1d69efb6b2
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/instances/proxy.feature
@@ -0,0 +1,48 @@
+@setupApplicationTest
+Feature: dc / services / instances / proxy: Show Proxy Service Instance
+ Scenario: A Proxy Service instance
+ Given 1 datacenter model with the value "dc1"
+ And 1 service model from yaml
+ ---
+ - Service:
+ Kind: connect-proxy
+ Name: service-0-proxy
+ ID: service-0-proxy-with-id
+ Proxy:
+ DestinationServiceName: service-0
+ Upstreams:
+ - DestinationType: service
+ DestinationName: service-1
+ LocalBindAddress: 127.0.0.1
+ LocalBindPort: 1111
+ - DestinationType: prepared_query
+ DestinationName: service-group
+ LocalBindAddress: 127.0.0.1
+ LocalBindPort: 1112
+ ---
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0-proxy
+ id: service-0-proxy-with-id
+ ---
+ Then the url should be /dc1/services/service-0-proxy/service-0-proxy-with-id
+ And I see destination on the proxy like "service"
+
+ And I see serviceChecksIsSelected on the tabs
+
+ When I click upstreams on the tabs
+ And I see upstreamsIsSelected on the tabs
+ And I see 2 of the upstreams object
+ And I see name on the upstreams like yaml
+ ---
+ - service-1
+ - service-group
+ ---
+ And I see type on the upstreams like yaml
+ ---
+ - service
+ - prepared_query
+ ---
+
+
diff --git a/ui-v2/tests/acceptance/dc/services/instances/show.feature b/ui-v2/tests/acceptance/dc/services/instances/show.feature
new file mode 100644
index 0000000000..bf3f64971c
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/instances/show.feature
@@ -0,0 +1,68 @@
+@setupApplicationTest
+Feature: dc / services / instances / show: Show Service Instance
+ Scenario: A Service instance has no Proxy
+ Given 1 datacenter model with the value "dc1"
+ And 1 service model from yaml
+ ---
+ - Service:
+ ID: service-0-with-id
+ Tags: ['Tag1', 'Tag2']
+ Meta:
+ external-source: nomad
+ Checks:
+ - Name: Service check
+ ServiceID: service-0
+ Output: Output of check
+ Status: passing
+ - Name: Service check
+ ServiceID: service-0
+ Output: Output of check
+ Status: warning
+ - Name: Service check
+ ServiceID: service-0
+ Output: Output of check
+ Status: critical
+ - Name: Node check
+ ServiceID: ""
+ Output: Output of check
+ Status: passing
+ - Name: Node check
+ ServiceID: ""
+ Output: Output of check
+ Status: warning
+ - Name: Node check
+ ServiceID: ""
+ Output: Output of check
+ Status: critical
+ ---
+ And 1 proxy model from yaml
+ ---
+ - ServiceProxy:
+ DestinationServiceName: service-1
+ DestinationServiceID: ~
+ ---
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0
+ id: service-0-with-id
+ ---
+ Then the url should be /dc1/services/service-0/service-0-with-id
+ Then I don't see type on the proxy
+
+ Then I see externalSource like "nomad"
+
+ And I don't see upstreams on the tabs
+ And I see serviceChecksIsSelected on the tabs
+ And I see 3 of the serviceChecks object
+
+ When I click nodeChecks on the tabs
+ And I see nodeChecksIsSelected on the tabs
+ And I see 3 of the nodeChecks object
+
+ When I click tags on the tabs
+ And I see tagsIsSelected on the tabs
+
+ Then I see the text "Tag1" in "[data-test-tags] span:nth-child(1)"
+ Then I see the text "Tag2" in "[data-test-tags] span:nth-child(2)"
+
diff --git a/ui-v2/tests/acceptance/dc/services/instances/sidecar-proxy.feature b/ui-v2/tests/acceptance/dc/services/instances/sidecar-proxy.feature
new file mode 100644
index 0000000000..3a650565d9
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/instances/sidecar-proxy.feature
@@ -0,0 +1,29 @@
+@setupApplicationTest
+Feature: dc / services / instances / sidecar-proxy: Show Sidecar Proxy Service Instance
+ Scenario: A Sidecar Proxy Service instance
+ Given 1 datacenter model with the value "dc1"
+ And 1 service model from yaml
+ ---
+ - Service:
+ Kind: connect-proxy
+ Name: service-0-sidecar-proxy
+ ID: service-0-sidecar-proxy-with-id
+ Proxy:
+ DestinationServiceName: service-0
+ DestinationServiceID: service-0-with-id
+ ---
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0-sidecar-proxy
+ id: service-0-sidecar-proxy-with-id
+ ---
+ Then the url should be /dc1/services/service-0-sidecar-proxy/service-0-sidecar-proxy-with-id
+ And I see destination on the proxy like "instance"
+
+ And I see serviceChecksIsSelected on the tabs
+
+ When I click upstreams on the tabs
+ And I see upstreamsIsSelected on the tabs
+
+
diff --git a/ui-v2/tests/acceptance/dc/services/instances/with-proxy.feature b/ui-v2/tests/acceptance/dc/services/instances/with-proxy.feature
new file mode 100644
index 0000000000..145bf95cdd
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/instances/with-proxy.feature
@@ -0,0 +1,20 @@
+@setupApplicationTest
+Feature: dc / services / instances / with-proxy: Show Service Instance with a proxy
+ Scenario: A Service instance has a Proxy (no DestinationServiceID)
+ Given 1 datacenter model with the value "dc1"
+ And 1 proxy model from yaml
+ ---
+ - ServiceProxy:
+ DestinationServiceID: ~
+ ---
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0
+ id: service-0-with-id
+ ---
+ Then the url should be /dc1/services/service-0/service-0-with-id
+ And I see type on the proxy like "proxy"
+
+ And I see serviceChecksIsSelected on the tabs
+ And I don't see upstreams on the tabs
diff --git a/ui-v2/tests/acceptance/dc/services/instances/with-sidecar.feature b/ui-v2/tests/acceptance/dc/services/instances/with-sidecar.feature
new file mode 100644
index 0000000000..5e7c6c3f5c
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/instances/with-sidecar.feature
@@ -0,0 +1,22 @@
+@setupApplicationTest
+Feature: dc / services / instances / with-sidecar: Show Service Instance with a Sidecar Proxy
+ Scenario: A Service instance has a Sidecar Proxy (a DestinationServiceID)
+ Given 1 datacenter model with the value "dc1"
+ And 1 proxy model from yaml
+ ---
+ - ServiceProxy:
+ DestinationServiceID: service-1
+ ---
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0
+ id: service-0-with-id
+ ---
+ Then the url should be /dc1/services/service-0/service-0-with-id
+ And I see type on the proxy like "sidecar-proxy"
+
+ And I see serviceChecksIsSelected on the tabs
+ And I don't see upstreams on the tabs
+
+
diff --git a/ui-v2/tests/acceptance/steps/dc/services/instances/error-steps.js b/ui-v2/tests/acceptance/steps/dc/services/instances/error-steps.js
new file mode 100644
index 0000000000..9bfbe9ac9b
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/instances/error-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/acceptance/steps/dc/services/instances/proxy-steps.js b/ui-v2/tests/acceptance/steps/dc/services/instances/proxy-steps.js
new file mode 100644
index 0000000000..9bfbe9ac9b
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/instances/proxy-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/acceptance/steps/dc/services/instances/show-steps.js b/ui-v2/tests/acceptance/steps/dc/services/instances/show-steps.js
new file mode 100644
index 0000000000..9bfbe9ac9b
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/instances/show-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/acceptance/steps/dc/services/instances/sidecar-proxy-steps.js b/ui-v2/tests/acceptance/steps/dc/services/instances/sidecar-proxy-steps.js
new file mode 100644
index 0000000000..9bfbe9ac9b
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/instances/sidecar-proxy-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/acceptance/steps/dc/services/instances/with-proxy-steps.js b/ui-v2/tests/acceptance/steps/dc/services/instances/with-proxy-steps.js
new file mode 100644
index 0000000000..9bfbe9ac9b
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/instances/with-proxy-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/acceptance/steps/dc/services/instances/with-sidecar-steps.js b/ui-v2/tests/acceptance/steps/dc/services/instances/with-sidecar-steps.js
new file mode 100644
index 0000000000..3231912b98
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/instances/with-sidecar-steps.js
@@ -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);
+ });
+}
diff --git a/ui-v2/tests/helpers/type-to-url.js b/ui-v2/tests/helpers/type-to-url.js
index 1b217dcb4d..72c648f64d 100644
--- a/ui-v2/tests/helpers/type-to-url.js
+++ b/ui-v2/tests/helpers/type-to-url.js
@@ -7,6 +7,9 @@ export default function(type) {
case 'service':
requests = ['/v1/internal/ui/services', '/v1/health/service/'];
break;
+ case 'proxy':
+ requests = ['/v1/catalog/connect'];
+ break;
case 'node':
requests = ['/v1/internal/ui/nodes', '/v1/internal/ui/node/'];
break;
diff --git a/ui-v2/tests/pages.js b/ui-v2/tests/pages.js
index 69e890b32a..389df60470 100644
--- a/ui-v2/tests/pages.js
+++ b/ui-v2/tests/pages.js
@@ -19,6 +19,7 @@ import dcs from 'consul-ui/tests/pages/dc';
import settings from 'consul-ui/tests/pages/settings';
import services from 'consul-ui/tests/pages/dc/services/index';
import service from 'consul-ui/tests/pages/dc/services/show';
+import instance from 'consul-ui/tests/pages/dc/services/instance';
import nodes from 'consul-ui/tests/pages/dc/nodes/index';
import node from 'consul-ui/tests/pages/dc/nodes/show';
import kvs from 'consul-ui/tests/pages/dc/kv/index';
@@ -41,6 +42,7 @@ export default {
dcs: create(dcs(visitable, clickable, attribute, collection)),
services: create(services(visitable, clickable, attribute, collection, page, catalogFilter)),
service: create(service(visitable, attribute, collection, text, catalogFilter)),
+ instance: create(instance(visitable, attribute, collection, text, radiogroup)),
nodes: create(nodes(visitable, clickable, attribute, collection, catalogFilter)),
node: create(node(visitable, deletable, clickable, attribute, collection, radiogroup)),
kvs: create(kvs(visitable, deletable, creatable, clickable, attribute, collection)),
diff --git a/ui-v2/tests/pages/dc/services/instance.js b/ui-v2/tests/pages/dc/services/instance.js
new file mode 100644
index 0000000000..69a707780d
--- /dev/null
+++ b/ui-v2/tests/pages/dc/services/instance.js
@@ -0,0 +1,19 @@
+export default function(visitable, attribute, collection, text, radiogroup) {
+ return {
+ visit: visitable('/:dc/services/:service/:id'),
+ externalSource: attribute('data-test-external-source', 'h1 span'),
+ tabs: radiogroup('tab', ['service-checks', 'node-checks', 'upstreams', 'tags']),
+ serviceChecks: collection('#service-checks [data-test-healthchecks] li', {}),
+ nodeChecks: collection('#node-checks [data-test-healthchecks] li', {}),
+ upstreams: collection('#upstreams [data-test-tabular-row]', {
+ name: text('[data-test-destination-name]'),
+ datacenter: text('[data-test-destination-datacenter]'),
+ type: text('[data-test-destination-type]'),
+ address: text('[data-test-local-bind-address]'),
+ }),
+ proxy: {
+ type: attribute('data-test-proxy-type', '[data-test-proxy-type]'),
+ destination: attribute('data-test-proxy-destination', '[data-test-proxy-destination]'),
+ },
+ };
+}
diff --git a/ui-v2/tests/steps/assertions/dom.js b/ui-v2/tests/steps/assertions/dom.js
index ec26e165d2..519ed3ab7a 100644
--- a/ui-v2/tests/steps/assertions/dom.js
+++ b/ui-v2/tests/steps/assertions/dom.js
@@ -6,6 +6,12 @@ export default function(scenario, assert, find, currentURL) {
`Expected to see "${text}" in "${selector}"`
);
})
+ .then(['I see the exact text "$text" in "$selector"'], function(text, selector) {
+ assert.ok(
+ find(selector).textContent.trim() === text,
+ `Expected to see the exact "${text}" in "${selector}"`
+ );
+ })
// TODO: Think of better language
// TODO: These should be mergeable
.then(['"$selector" has the "$class" class'], function(selector, cls) {
diff --git a/ui-v2/tests/steps/assertions/model.js b/ui-v2/tests/steps/assertions/model.js
index 82e11f6470..7019c086ea 100644
--- a/ui-v2/tests/steps/assertions/model.js
+++ b/ui-v2/tests/steps/assertions/model.js
@@ -20,10 +20,7 @@ export default function(scenario, assert, currentPage, pluralize) {
}, 100);
});
})
- .then(['I see $num $model', 'I see $num $model model', 'I see $num $model models'], function(
- num,
- model
- ) {
+ .then(['I see $num $model model[s]?'], function(num, model) {
const len = currentPage()[pluralize(model)].filter(function(item) {
return item.isVisible;
}).length;
diff --git a/ui-v2/tests/steps/assertions/page.js b/ui-v2/tests/steps/assertions/page.js
index 043a6f4bb9..d0bf6d838d 100644
--- a/ui-v2/tests/steps/assertions/page.js
+++ b/ui-v2/tests/steps/assertions/page.js
@@ -56,6 +56,13 @@ export default function(scenario, assert, currentPage) {
}
assert.ok(_component[property], `Expected to see ${property} on ${component}`);
})
+ .then(['I see $num of the $component object'], function(num, component) {
+ assert.equal(
+ currentPage()[component].length,
+ num,
+ `Expected to see ${num} items in the ${component} object`
+ );
+ })
.then(["I don't see $property on the $component"], function(property, component) {
// Collection
var obj;
@@ -64,9 +71,9 @@ export default function(scenario, assert, currentPage) {
} else {
obj = currentPage()[component];
}
- const func = obj[property].bind(obj);
assert.throws(
function() {
+ const func = obj[property].bind(obj);
func();
},
function(e) {
@@ -89,11 +96,20 @@ export default function(scenario, assert, currentPage) {
.then(['I see $property'], function(property) {
assert.ok(currentPage()[property], `Expected to see ${property}`);
})
- .then(['I see $property like "$value"'], function(property, value) {
+ .then(['I see $property on the $component like "$value"'], function(
+ property,
+ component,
+ value
+ ) {
+ const target = currentPage()[component][property];
assert.equal(
- currentPage()[property],
+ target,
value,
- `Expected to see ${property}, was ${currentPage()[property]}`
+ `Expected to see ${property} on ${component} as ${value}, was ${target}`
);
+ })
+ .then(['I see $property like "$value"'], function(property, value) {
+ const target = currentPage()[property];
+ assert.equal(target, value, `Expected to see ${property} as ${value}, was ${target}`);
});
}
diff --git a/ui-v2/yarn.lock b/ui-v2/yarn.lock
index 705593f057..8790b5031c 100644
--- a/ui-v2/yarn.lock
+++ b/ui-v2/yarn.lock
@@ -690,9 +690,9 @@
js-yaml "^3.10.0"
"@hashicorp/consul-api-double@^2.0.1":
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-2.1.0.tgz#511e6a48842ad31133e2070f3b2307568539b10e"
- integrity sha512-cyW7TiKQylrWzVUORT1e6m4SU8tQ1V5BYEKW2th7QwHP8OFazn/+om9hud/9X5YtjEuSPIQCmFIvhEVwZgLVpQ==
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-2.2.0.tgz#b72b086dd4c88485f83b6f2fe30c5cb45b8d0e6a"
+ integrity sha512-9U+pqdBJn/ZruUYg7J2A3k9FS44FZQsMGBfKQSxaBRU50dgkpGLtOyOOFUqgi/RCAwn4GUOzgXgHRRs5TAeStg==
"@hashicorp/ember-cli-api-double@^1.3.0":
version "1.7.0"
From 3d7654029753081062b16934edf724cfd36bc862 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Thu, 21 Mar 2019 15:46:12 +0000
Subject: [PATCH 33/52] ui: Fix erroneous HTML that was being fixed by either
browser/ember (#5530)
The resulting DOM from this template was actually correct, we'd assume
it was being fixed by the browser
---
ui-v2/app/templates/dc/kv/edit.hbs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui-v2/app/templates/dc/kv/edit.hbs b/ui-v2/app/templates/dc/kv/edit.hbs
index 7bf538afb7..cfcb18de92 100644
--- a/ui-v2/app/templates/dc/kv/edit.hbs
+++ b/ui-v2/app/templates/dc/kv/edit.hbs
@@ -39,10 +39,10 @@
ID
{{session.ID}}
Behavior
- <{{session.Behavior}}/dd>
+ {{session.Behavior}}
{{#if session.Delay }}
Delay
- <{{session.LockDelay}}/dd>
+ {{session.LockDelay}}
{{/if}}
{{#if session.TTL }}
TTL
From 10c1f29ffaca65e88a95ee470b77e4759007590a Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Fri, 22 Mar 2019 17:01:10 +0000
Subject: [PATCH 34/52] ui: Add proxy icons to proxy services and instances
where appropriate (#5463)
---
ui-v2/app/controllers/dc/services/index.js | 7 ++++++-
ui-v2/app/styles/components/app-view.scss | 7 ++++++-
ui-v2/app/styles/components/icons/index.scss | 10 ++++++++++
ui-v2/app/styles/components/table.scss | 8 ++++++++
ui-v2/app/styles/components/table/layout.scss | 3 +++
ui-v2/app/styles/components/tabular-collection.scss | 3 +++
ui-v2/app/styles/components/type-icon/index.scss | 2 ++
ui-v2/app/styles/components/type-icon/layout.scss | 5 +++++
ui-v2/app/styles/components/type-icon/skin.scss | 6 ++++++
ui-v2/app/styles/components/with-tooltip.scss | 2 +-
ui-v2/app/styles/components/with-tooltip/index.scss | 2 +-
ui-v2/app/styles/core/typography.scss | 6 ++++--
ui-v2/app/templates/dc/services/index.hbs | 8 ++++++++
ui-v2/app/templates/dc/services/instance.hbs | 3 +++
ui-v2/app/templates/dc/services/show.hbs | 3 +++
15 files changed, 69 insertions(+), 6 deletions(-)
create mode 100644 ui-v2/app/styles/components/type-icon/index.scss
create mode 100644 ui-v2/app/styles/components/type-icon/layout.scss
create mode 100644 ui-v2/app/styles/components/type-icon/skin.scss
diff --git a/ui-v2/app/controllers/dc/services/index.js b/ui-v2/app/controllers/dc/services/index.js
index 6da28085fc..912a5316b3 100644
--- a/ui-v2/app/controllers/dc/services/index.js
+++ b/ui-v2/app/controllers/dc/services/index.js
@@ -51,7 +51,12 @@ export default Controller.extend(WithEventSource, WithSearching, WithHealthFilte
return widthDeclaration(get(this, 'maxWidth'));
}),
remainingWidth: computed('maxWidth', function() {
- return htmlSafe(`width: calc(50% - ${Math.round(get(this, 'maxWidth') / 2)}px)`);
+ // maxWidth is the maximum width of the healthchecks column
+ // there are currently 2 other columns so divide it by 2 and
+ // take that off 50% (100% / number of fluid columns)
+ // also we added a Type column which we've currently fixed to 100px
+ // so again divide that by 2 and take it off each fluid column
+ return htmlSafe(`width: calc(50% - 50px - ${Math.round(get(this, 'maxWidth') / 2)}px)`);
}),
maxPassing: computed('filtered', function() {
return max(get(this, 'filtered'), 'ChecksPassing');
diff --git a/ui-v2/app/styles/components/app-view.scss b/ui-v2/app/styles/components/app-view.scss
index 2ddc65d217..11f634561a 100644
--- a/ui-v2/app/styles/components/app-view.scss
+++ b/ui-v2/app/styles/components/app-view.scss
@@ -1,6 +1,7 @@
@import './app-view/index';
@import './filter-bar/index';
@import './buttons/index';
+@import './type-icon/index';
main {
@extend %app-view;
}
@@ -15,9 +16,13 @@ main {
margin-top: 5px;
}
}
-%app-view h1 span {
+// TODO: This should be its own component
+%app-view h1 span[data-tooltip] {
@extend %with-external-source-icon;
}
+%app-view h1 span.kind-proxy {
+ @extend %type-icon, %with-proxy;
+}
%app-view h1 em {
color: $gray-600;
}
diff --git a/ui-v2/app/styles/components/icons/index.scss b/ui-v2/app/styles/components/icons/index.scss
index 4c61d11f3c..13e9751672 100644
--- a/ui-v2/app/styles/components/icons/index.scss
+++ b/ui-v2/app/styles/components/icons/index.scss
@@ -54,6 +54,7 @@
%with-folder {
text-indent: 30px;
}
+%with-proxy,
%with-hashicorp,
%with-folder,
%with-chevron,
@@ -79,6 +80,15 @@
margin-top: -10px;
background-color: $color-transparent;
}
+%with-proxy::before {
+ @extend %pseudo-icon;
+ background-image: url('data:image/svg+xml;charset=UTF-8, ');
+ width: 18px;
+ height: 18px;
+ left: 3px;
+ margin-top: -9px;
+ background-color: $color-transparent;
+}
%with-clipboard {
padding-left: 38px !important;
}
diff --git a/ui-v2/app/styles/components/table.scss b/ui-v2/app/styles/components/table.scss
index 749774ad1a..1a98bbc998 100644
--- a/ui-v2/app/styles/components/table.scss
+++ b/ui-v2/app/styles/components/table.scss
@@ -1,5 +1,6 @@
@import './icons/index';
@import './table/index';
+@import './type-icon/index';
html.template-service.template-list td:first-child a span,
html.template-node.template-show #services td:first-child a span,
@@ -19,6 +20,13 @@ html.template-service.template-list main th:first-child {
td.folder {
@extend %with-folder;
}
+td .kind-proxy {
+ @extend %type-icon, %with-proxy;
+ text-indent: -9000px !important;
+ width: 24px;
+ margin-top: -8px;
+ transform: scale(0.7);
+}
table:not(.sessions) tr {
cursor: pointer;
}
diff --git a/ui-v2/app/styles/components/table/layout.scss b/ui-v2/app/styles/components/table/layout.scss
index 2706e64dc5..6cf8ef1ccd 100644
--- a/ui-v2/app/styles/components/table/layout.scss
+++ b/ui-v2/app/styles/components/table/layout.scss
@@ -65,6 +65,9 @@ td:not(.actions) a {
html.template-policy.template-list tr > :nth-child(2) {
display: none;
}
+ html.template-service.template-list tr > :nth-child(2) {
+ display: none;
+ }
}
@media #{$--lt-wide-table} {
html.template-intention.template-list tr > :nth-last-child(2) {
diff --git a/ui-v2/app/styles/components/tabular-collection.scss b/ui-v2/app/styles/components/tabular-collection.scss
index d26b72e656..c90adf3f9b 100644
--- a/ui-v2/app/styles/components/tabular-collection.scss
+++ b/ui-v2/app/styles/components/tabular-collection.scss
@@ -174,6 +174,9 @@ html.template-node.template-show main table.sessions tr {
// (100% / 2) - (160px / 2)
// width: calc(50% - 160px);
// }
+%services-row > *:nth-child(2) {
+ width: 100px;
+}
%services-row > * {
width: auto;
}
diff --git a/ui-v2/app/styles/components/type-icon/index.scss b/ui-v2/app/styles/components/type-icon/index.scss
new file mode 100644
index 0000000000..bc18252196
--- /dev/null
+++ b/ui-v2/app/styles/components/type-icon/index.scss
@@ -0,0 +1,2 @@
+@import './skin';
+@import './layout';
diff --git a/ui-v2/app/styles/components/type-icon/layout.scss b/ui-v2/app/styles/components/type-icon/layout.scss
new file mode 100644
index 0000000000..a88b65d79e
--- /dev/null
+++ b/ui-v2/app/styles/components/type-icon/layout.scss
@@ -0,0 +1,5 @@
+%type-icon {
+ display: inline-block;
+ text-indent: 20px;
+ padding: 3px;
+}
diff --git a/ui-v2/app/styles/components/type-icon/skin.scss b/ui-v2/app/styles/components/type-icon/skin.scss
new file mode 100644
index 0000000000..b6d0be1129
--- /dev/null
+++ b/ui-v2/app/styles/components/type-icon/skin.scss
@@ -0,0 +1,6 @@
+%type-icon {
+ border-radius: 4px;
+
+ background: $gray-100;
+ color: $gray-400;
+}
diff --git a/ui-v2/app/styles/components/with-tooltip.scss b/ui-v2/app/styles/components/with-tooltip.scss
index df1a62d51a..c4e536ff12 100644
--- a/ui-v2/app/styles/components/with-tooltip.scss
+++ b/ui-v2/app/styles/components/with-tooltip.scss
@@ -1,4 +1,4 @@
@import './with-tooltip/index';
-%app-view h1 span {
+%app-view h1 span[data-tooltip] {
@extend %with-pseudo-tooltip;
}
diff --git a/ui-v2/app/styles/components/with-tooltip/index.scss b/ui-v2/app/styles/components/with-tooltip/index.scss
index 3ee08c67cb..bca4c98e29 100644
--- a/ui-v2/app/styles/components/with-tooltip/index.scss
+++ b/ui-v2/app/styles/components/with-tooltip/index.scss
@@ -12,7 +12,7 @@
%with-pseudo-tooltip {
text-indent: -9000px;
font-size: 0;
- top: -9px;
+ top: -7px;
}
%with-pseudo-tooltip::after,
diff --git a/ui-v2/app/styles/core/typography.scss b/ui-v2/app/styles/core/typography.scss
index 5f01d4be8e..298874a035 100644
--- a/ui-v2/app/styles/core/typography.scss
+++ b/ui-v2/app/styles/core/typography.scss
@@ -54,7 +54,8 @@ th,
%breadcrumbs li > *,
%action-group-action,
%tab-nav,
-%tooltip-bubble {
+%tooltip-bubble,
+%type-icon {
font-weight: $typo-weight-medium;
}
main label a[rel*='help'],
@@ -96,7 +97,8 @@ caption,
%form-element > span,
%tooltip-bubble,
%healthchecked-resource strong,
-%footer {
+%footer,
+%type-icon {
font-size: $typo-size-700;
}
%toggle label span {
diff --git a/ui-v2/app/templates/dc/services/index.hbs b/ui-v2/app/templates/dc/services/index.hbs
index 16f287eb4d..25885f12e5 100644
--- a/ui-v2/app/templates/dc/services/index.hbs
+++ b/ui-v2/app/templates/dc/services/index.hbs
@@ -24,6 +24,7 @@
}}
{{#block-slot 'header'}}
Service
+ Type
Health ChecksThe number of health checks for the service on all nodes
Tags
{{/block-slot}}
@@ -34,6 +35,13 @@
{{item.Name}}
+
+{{#if (eq item.Kind 'connect-proxy')}}
+ Proxy
+{{else}}
+
+{{/if}}
+
{{healthcheck-info
passing=item.ChecksPassing warning=item.ChecksWarning critical=item.ChecksCritical
diff --git a/ui-v2/app/templates/dc/services/instance.hbs b/ui-v2/app/templates/dc/services/instance.hbs
index 9b3a286ba4..76a0b95d26 100644
--- a/ui-v2/app/templates/dc/services/instance.hbs
+++ b/ui-v2/app/templates/dc/services/instance.hbs
@@ -16,6 +16,9 @@
{{/if}}
{{/with}}
{{/with}}
+{{#if (eq item.Kind 'connect-proxy')}}
+ Proxy
+{{/if}}
Service Name
diff --git a/ui-v2/app/templates/dc/services/show.hbs b/ui-v2/app/templates/dc/services/show.hbs
index bd693d9b85..07f19a0690 100644
--- a/ui-v2/app/templates/dc/services/show.hbs
+++ b/ui-v2/app/templates/dc/services/show.hbs
@@ -14,6 +14,9 @@
{{/if}}
{{/with}}
{{/with}}
+{{#if (eq item.Service.Kind 'connect-proxy')}}
+ Proxy
+{{/if}}
{{tab-nav
From 83cd4684c6b575ca9a12de670784540935a57681 Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Fri, 22 Mar 2019 17:08:18 +0000
Subject: [PATCH 35/52] UI: Amends blocking queries text and toggle component
in settings (#5467)
---
ui-v2/app/styles/components/app-view/layout.scss | 5 +++++
ui-v2/app/styles/components/app-view/skin.scss | 3 +++
ui-v2/app/styles/core/typography.scss | 1 +
ui-v2/app/templates/settings.hbs | 6 ++++--
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ui-v2/app/styles/components/app-view/layout.scss b/ui-v2/app/styles/components/app-view/layout.scss
index f518b5d38d..4c1fa44032 100644
--- a/ui-v2/app/styles/components/app-view/layout.scss
+++ b/ui-v2/app/styles/components/app-view/layout.scss
@@ -30,6 +30,11 @@
padding-bottom: 0.2em;
margin-bottom: 1.1em;
}
+%app-view fieldset h2,
+%app-view fieldset p {
+ padding-bottom: 0;
+ margin-bottom: 0;
+}
%app-view header .actions > *:not(:last-child) {
margin-right: 12px;
}
diff --git a/ui-v2/app/styles/components/app-view/skin.scss b/ui-v2/app/styles/components/app-view/skin.scss
index a117fa1258..607135363d 100644
--- a/ui-v2/app/styles/components/app-view/skin.scss
+++ b/ui-v2/app/styles/components/app-view/skin.scss
@@ -1,6 +1,9 @@
%app-view h2 {
border-bottom: $decor-border-200;
}
+%app-view fieldset h2 {
+ border-bottom: none;
+}
@media #{$--horizontal-selects} {
%app-view header h1 {
border-bottom: $decor-border-200;
diff --git a/ui-v2/app/styles/core/typography.scss b/ui-v2/app/styles/core/typography.scss
index 298874a035..35792cc434 100644
--- a/ui-v2/app/styles/core/typography.scss
+++ b/ui-v2/app/styles/core/typography.scss
@@ -85,6 +85,7 @@ h2,
}
body,
%action-group-action,
+fieldset h2,
pre code,
input,
textarea,
diff --git a/ui-v2/app/templates/settings.hbs b/ui-v2/app/templates/settings.hbs
index f38dfe069a..aaf9565340 100644
--- a/ui-v2/app/templates/settings.hbs
+++ b/ui-v2/app/templates/settings.hbs
@@ -7,14 +7,16 @@
{{/block-slot}}
{{#block-slot 'content'}}
- These settings allow you to configure your browser for the Consul Web UI. Everything is saved to localstorage, and persists through visits and browser usage.
+ These settings are specific to the Consul web UI. They are saved to local storage and persist through browser usage and visits.
-{{#if proxy}}
+{{#if proxy.ServiceName}}
{{if proxy.ServiceProxy.DestinationServiceID "Sidecar " ""}}Proxy
{{proxy.ServiceID}}
diff --git a/ui-v2/tests/acceptance/dc/list-blocking.feature b/ui-v2/tests/acceptance/dc/list-blocking.feature
index 21bb5ec990..7413ae8a7b 100644
--- a/ui-v2/tests/acceptance/dc/list-blocking.feature
+++ b/ui-v2/tests/acceptance/dc/list-blocking.feature
@@ -46,11 +46,9 @@ Feature: dc / list-blocking
And an external edit results in 1 [Model] model
And pause until I see 1 [Model] model
And an external edit results in 0 [Model] models
- And pause for 300
- And I see the text "deregistered" in "[data-notification]"
+ And pause until I see the text "deregistered" in "[data-notification]"
Where:
- ------------------------------------------------
- | Page | Model | Url |
+ -------------------------------------------------
+ | Page | Model | Url |
| service | instance | services/service-0 |
- ------------------------------------------------
-
+ -------------------------------------------------
\ No newline at end of file
diff --git a/ui-v2/tests/acceptance/dc/nodes/show.feature b/ui-v2/tests/acceptance/dc/nodes/show.feature
index 2ea28bb3e2..21ca13a9ad 100644
--- a/ui-v2/tests/acceptance/dc/nodes/show.feature
+++ b/ui-v2/tests/acceptance/dc/nodes/show.feature
@@ -1,8 +1,9 @@
@setupApplicationTest
Feature: dc / nodes / show: Show node
- Scenario: Given 2 nodes all the tabs are visible and clickable
+ Background:
Given 1 datacenter model with the value "dc1"
- And 2 node models from yaml
+ Scenario: Given 2 nodes all the tabs are visible and clickable
+ Given 2 node models from yaml
When I visit the node page for yaml
---
dc: dc1
@@ -19,8 +20,7 @@ Feature: dc / nodes / show: Show node
When I click lockSessions on the tabs
And I see lockSessionsIsSelected on the tabs
Scenario: Given 1 node all the tabs are visible and clickable and the RTT one isn't there
- Given 1 datacenter model with the value "dc1"
- And 1 node models from yaml
+ Given 1 node models from yaml
---
ID: node-0
---
@@ -39,8 +39,7 @@ Feature: dc / nodes / show: Show node
When I click lockSessions on the tabs
And I see lockSessionsIsSelected on the tabs
Scenario: Given 1 node with no checks all the tabs are visible but the Services tab is selected
- Given 1 datacenter model with the value "dc1"
- And 1 node models from yaml
+ Given 1 node models from yaml
---
ID: node-0
Checks: []
@@ -55,3 +54,24 @@ Feature: dc / nodes / show: Show node
And I see roundTripTime on the tabs
And I see lockSessions on the tabs
And I see servicesIsSelected on the tabs
+ Scenario: A node warns when deregistered whilst blocking
+ Given 1 node model from yaml
+ ---
+ ID: node-0
+ ---
+ And settings from yaml
+ ---
+ consul:client:
+ blocking: 1
+ throttle: 200
+ ---
+ And a network latency of 100
+ When I visit the node page for yaml
+ ---
+ dc: dc1
+ node: node-0
+ ---
+ Then the url should be /dc1/nodes/node-0
+ And the url "/v1/internal/ui/node/node-0" responds with a 404 status
+ And pause until I see the text "no longer exists" in "[data-notification]"
+
diff --git a/ui-v2/tests/acceptance/dc/services/instances/show.feature b/ui-v2/tests/acceptance/dc/services/instances/show.feature
index bf3f64971c..8547bf6615 100644
--- a/ui-v2/tests/acceptance/dc/services/instances/show.feature
+++ b/ui-v2/tests/acceptance/dc/services/instances/show.feature
@@ -1,6 +1,6 @@
@setupApplicationTest
Feature: dc / services / instances / show: Show Service Instance
- Scenario: A Service instance has no Proxy
+ Background:
Given 1 datacenter model with the value "dc1"
And 1 service model from yaml
---
@@ -41,6 +41,7 @@ Feature: dc / services / instances / show: Show Service Instance
DestinationServiceName: service-1
DestinationServiceID: ~
---
+ Scenario: A Service instance has no Proxy
When I visit the instance page for yaml
---
dc: dc1
@@ -49,7 +50,6 @@ Feature: dc / services / instances / show: Show Service Instance
---
Then the url should be /dc1/services/service-0/service-0-with-id
Then I don't see type on the proxy
-
Then I see externalSource like "nomad"
And I don't see upstreams on the tabs
@@ -65,4 +65,21 @@ Feature: dc / services / instances / show: Show Service Instance
Then I see the text "Tag1" in "[data-test-tags] span:nth-child(1)"
Then I see the text "Tag2" in "[data-test-tags] span:nth-child(2)"
+ Scenario: A Service instance warns when deregistered whilst blocking
+ Given settings from yaml
+ ---
+ consul:client:
+ blocking: 1
+ throttle: 200
+ ---
+ And a network latency of 100
+ When I visit the instance page for yaml
+ ---
+ dc: dc1
+ service: service-0
+ id: service-0-with-id
+ ---
+ Then the url should be /dc1/services/service-0/service-0-with-id
+ And an external edit results in 0 instance models
+ And pause until I see the text "deregistered" in "[data-notification]"
diff --git a/ui-v2/tests/integration/services/repository/node-test.js b/ui-v2/tests/integration/services/repository/node-test.js
index 8a6b4816da..d3086c04fc 100644
--- a/ui-v2/tests/integration/services/repository/node-test.js
+++ b/ui-v2/tests/integration/services/repository/node-test.js
@@ -55,6 +55,10 @@ test('findBySlug returns the correct data for item endpoint', function(assert) {
return Object.assign({}, item, {
Datacenter: dc,
uid: `["${dc}","${item.ID}"]`,
+ meta: {
+ date: undefined,
+ cursor: undefined,
+ },
});
})
);
diff --git a/ui-v2/tests/steps.js b/ui-v2/tests/steps.js
index cad75cceef..b115e0c0dd 100644
--- a/ui-v2/tests/steps.js
+++ b/ui-v2/tests/steps.js
@@ -21,6 +21,22 @@ export default function(assert, library, pages, utils) {
return page;
};
+ const pauseUntil = function(cb) {
+ return new Promise(function(resolve, reject) {
+ let count = 0;
+ const interval = setInterval(function() {
+ if (++count >= 50) {
+ clearInterval(interval);
+ assert.ok(false);
+ reject();
+ }
+ cb(function() {
+ clearInterval(interval);
+ resolve();
+ });
+ }, 100);
+ });
+ };
models(library, utils.create);
http(library, utils.respondWith, utils.set);
visit(library, pages, setCurrentPage);
@@ -28,9 +44,9 @@ export default function(assert, library, pages, utils) {
form(library, utils.fillIn, utils.triggerKeyEvent, getCurrentPage);
debug(library, assert, utils.currentURL);
assertHttp(library, assert, utils.lastNthRequest);
- assertModel(library, assert, getCurrentPage, utils.pluralize);
+ assertModel(library, assert, getCurrentPage, pauseUntil, utils.pluralize);
assertPage(library, assert, getCurrentPage);
- assertDom(library, assert, utils.find, utils.currentURL);
+ assertDom(library, assert, pauseUntil, utils.find, utils.currentURL);
return library.given(["I'm using a legacy token"], function(number, model, data) {
window.localStorage['consul:token'] = JSON.stringify({ AccessorID: null, SecretID: 'id' });
diff --git a/ui-v2/tests/steps/assertions/dom.js b/ui-v2/tests/steps/assertions/dom.js
index 519ed3ab7a..12699d04bf 100644
--- a/ui-v2/tests/steps/assertions/dom.js
+++ b/ui-v2/tests/steps/assertions/dom.js
@@ -1,5 +1,17 @@
-export default function(scenario, assert, find, currentURL) {
+export default function(scenario, assert, pauseUntil, find, currentURL) {
scenario
+ .then('pause until I see the text "$text" in "$selector"', function(text, selector) {
+ return pauseUntil(function(resolve) {
+ const $el = find(selector);
+ if ($el) {
+ const hasText = $el.textContent.indexOf(text) !== -1;
+ if (hasText) {
+ assert.ok(hasText, `Expected to see "${text}" in "${selector}"`);
+ resolve();
+ }
+ }
+ });
+ })
.then(['I see the text "$text" in "$selector"'], function(text, selector) {
assert.ok(
find(selector).textContent.indexOf(text) !== -1,
diff --git a/ui-v2/tests/steps/assertions/model.js b/ui-v2/tests/steps/assertions/model.js
index 7019c086ea..c7d68bd33a 100644
--- a/ui-v2/tests/steps/assertions/model.js
+++ b/ui-v2/tests/steps/assertions/model.js
@@ -1,23 +1,14 @@
-export default function(scenario, assert, currentPage, pluralize) {
+export default function(scenario, assert, currentPage, pauseUntil, pluralize) {
scenario
.then('pause until I see $number $model model[s]?', function(num, model) {
- return new Promise(function(resolve) {
- let count = 0;
- const interval = setInterval(function() {
- if (++count >= 50) {
- clearInterval(interval);
- assert.ok(false);
- resolve();
- }
- const len = currentPage()[pluralize(model)].filter(function(item) {
- return item.isVisible;
- }).length;
- if (len === num) {
- clearInterval(interval);
- assert.equal(len, num, `Expected ${num} ${model}s, saw ${len}`);
- resolve();
- }
- }, 100);
+ return pauseUntil(function(resolve) {
+ const len = currentPage()[pluralize(model)].filter(function(item) {
+ return item.isVisible;
+ }).length;
+ if (len === num) {
+ assert.equal(len, num, `Expected ${num} ${model}s, saw ${len}`);
+ resolve();
+ }
});
})
.then(['I see $num $model model[s]?'], function(num, model) {
diff --git a/ui-v2/tests/unit/controllers/dc/nodes/show-test.js b/ui-v2/tests/unit/controllers/dc/nodes/show-test.js
index a1dd0c5618..d6f93489b6 100644
--- a/ui-v2/tests/unit/controllers/dc/nodes/show-test.js
+++ b/ui-v2/tests/unit/controllers/dc/nodes/show-test.js
@@ -2,7 +2,7 @@ import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:dc/nodes/show', 'Unit | Controller | dc/nodes/show', {
// Specify the other units that are required for this test.
- needs: ['service:search', 'service:dom'],
+ needs: ['service:search', 'service:dom', 'service:flashMessages'],
});
// Replace this with your real tests.
diff --git a/ui-v2/tests/unit/controllers/dc/services/instance-test.js b/ui-v2/tests/unit/controllers/dc/services/instance-test.js
index 2b0693934f..7e4fc2ca75 100644
--- a/ui-v2/tests/unit/controllers/dc/services/instance-test.js
+++ b/ui-v2/tests/unit/controllers/dc/services/instance-test.js
@@ -2,7 +2,7 @@ import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:dc/services/instance', 'Unit | Controller | dc/services/instance', {
// Specify the other units that are required for this test.
- // needs: ['controller:foo']
+ needs: ['service:dom', 'service:flashMessages'],
});
// Replace this with your real tests.
diff --git a/ui-v2/tests/unit/routes/dc/nodes/show-test.js b/ui-v2/tests/unit/routes/dc/nodes/show-test.js
index e6f486e6bc..4f512ba9aa 100644
--- a/ui-v2/tests/unit/routes/dc/nodes/show-test.js
+++ b/ui-v2/tests/unit/routes/dc/nodes/show-test.js
@@ -4,6 +4,7 @@ moduleFor('route:dc/nodes/show', 'Unit | Route | dc/nodes/show', {
// Specify the other units that are required for this test.
needs: [
'service:repository/node',
+ 'service:repository/coordinate',
'service:repository/session',
'service:feedback',
'service:logger',
From 4a9d259304cd181026a8cd2fe43757fe1ab84b5d Mon Sep 17 00:00:00 2001
From: John Cowen
Date: Mon, 25 Mar 2019 14:20:59 +0000
Subject: [PATCH 39/52] ui: Remove index.html from the docs URL so we just
point to `/docs` (#5547)
---
ui-v2/app/templates/components/hashicorp-consul.hbs | 4 ++--
ui-v2/app/templates/error.hbs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui-v2/app/templates/components/hashicorp-consul.hbs b/ui-v2/app/templates/components/hashicorp-consul.hbs
index 32161b51e6..4c7ba823ef 100644
--- a/ui-v2/app/templates/components/hashicorp-consul.hbs
+++ b/ui-v2/app/templates/components/hashicorp-consul.hbs
@@ -42,7 +42,7 @@