diff --git a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs index 0b90b4312..cf5a08726 100644 --- a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.hbs @@ -1,52 +1,66 @@ - + diff --git a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.js b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.js new file mode 100644 index 000000000..a02657584 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.js @@ -0,0 +1,24 @@ +import Component from '@glimmer/component'; +import { inject as service } from '@ember/service'; +import { sort } from '@ember/object/computed'; + +export default class ConsulUpstreamInstanceList extends Component { + @service('sort') sort; + @service('search') search; + + @sort('searched', 'comparator') sorted; + + get items() { + return this.sorted; + } + get searched() { + if (typeof this.args.search === 'undefined') { + return this.args.items; + } + const predicate = this.search.predicate('upstream-instance'); + return this.args.items.filter(predicate(this.args.search)); + } + get comparator() { + return this.sort.comparator('upstream-instance')(this.args.sort); + } +} diff --git a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.scss b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.scss index 983f72b9c..ea1017138 100644 --- a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.scss +++ b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.scss @@ -1,6 +1,14 @@ -.consul-upstream-instance-list > li { - @extend %composite-row; +.consul-upstream-instance-list { + li { + @extend %composite-row; + } + dl { + @extend %icon-definition; + } + dl.datacenter dt::before { + @extend %with-user-organization-mask, %as-pseudo; + } + dl.nspace dt::before { + @extend %with-folder-outline-mask, %as-pseudo; + } } -.consul-upstream-instance-list > ul { - border-top: 1px solid $gray-200; -} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/pageobject.js b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/pageobject.js new file mode 100644 index 000000000..552200a39 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/upstream-instance/list/pageobject.js @@ -0,0 +1,11 @@ +export default (collection, text) => (scope = '.consul-upstream-instance-list') => { + return { + scope, + item: collection('li', { + name: text('.header p'), + nspace: text('.nspace dd'), + datacenter: text('.datacenter dd'), + localAddress: text('.local-address dd'), + }), + }; +}; diff --git a/ui/packages/consul-ui/app/components/consul/upstream-instance/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream-instance/search-bar/index.hbs new file mode 100644 index 000000000..fee027149 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/upstream-instance/search-bar/index.hbs @@ -0,0 +1,41 @@ +