diff --git a/ui/packages/consul-ui/app/components/changeable-set/index.hbs b/ui/packages/consul-ui/app/components/changeable-set/index.hbs
deleted file mode 100644
index 020700435..000000000
--- a/ui/packages/consul-ui/app/components/changeable-set/index.hbs
+++ /dev/null
@@ -1,7 +0,0 @@
-{{yield}}
- {{yield}}
-{{#if (gt items.length 0)}}
- {{yield}}
-{{else}}
- {{yield}}
-{{/if}}
\ No newline at end of file
diff --git a/ui/packages/consul-ui/app/components/changeable-set/index.js b/ui/packages/consul-ui/app/components/changeable-set/index.js
deleted file mode 100644
index 3cb2c3e83..000000000
--- a/ui/packages/consul-ui/app/components/changeable-set/index.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import Component from '@ember/component';
-import { get, set } from '@ember/object';
-import { inject as service } from '@ember/service';
-import Slotted from 'block-slots';
-
-export default Component.extend(Slotted, {
- tagName: '',
- dom: service('dom'),
- init: function() {
- this._super(...arguments);
- this._listeners = this.dom.listeners();
- },
- willDestroyElement: function() {
- this._listeners.remove();
- this._super(...arguments);
- },
- didReceiveAttrs: function() {
- this._super(...arguments);
- if (this.items !== this.dispatcher.data) {
- this._listeners.remove();
- this._listeners.add(this.dispatcher, {
- change: e => set(this, 'items', e.target.data),
- });
- set(this, 'items', get(this.dispatcher, 'data'));
- }
- this.dispatcher.search(this.terms);
- },
-});
diff --git a/ui/packages/consul-ui/app/components/child-selector/index.hbs b/ui/packages/consul-ui/app/components/child-selector/index.hbs
index 801005122..525bca8c6 100644
--- a/ui/packages/consul-ui/app/components/child-selector/index.hbs
+++ b/ui/packages/consul-ui/app/components/child-selector/index.hbs
@@ -1,4 +1,5 @@
{{yield}}
@@ -11,18 +12,28 @@
@onchange={{action (mut allOptions) value="data"}}
/>
{{/if}}
+
+ @searchEnabled={{true}}
+ @search={{action collection.search}}
+ @options={{options}}
+ @loadingMessage="Loading..."
+ @searchMessage="No possible options"
+ @searchPlaceholder={{placeholder}}
+ @onOpen={{action (mut isOpen) true}}
+ @onClose={{action (mut isOpen) false}}
+ @onChange={{action "change" "items[]" items}}
+ as |item|>
{{yield}}
+
{{#if (gt items.length 0)}}
{{yield}}
diff --git a/ui/packages/consul-ui/app/components/child-selector/index.js b/ui/packages/consul-ui/app/components/child-selector/index.js
index 6291d631c..9760e1f58 100644
--- a/ui/packages/consul-ui/app/components/child-selector/index.js
+++ b/ui/packages/consul-ui/app/components/child-selector/index.js
@@ -15,8 +15,6 @@ export default Component.extend(Slotted, {
type: '',
dom: service('dom'),
- search: service('search'),
- sort: service('sort'),
formContainer: service('form'),
item: alias('form.data'),
@@ -26,7 +24,6 @@ export default Component.extend(Slotted, {
init: function() {
this._super(...arguments);
this._listeners = this.dom.listeners();
- this.searchable = this.search.searchable(this.type);
this.form = this.formContainer.form(this.type);
this.form.clear({ Datacenter: this.dc, Namespace: this.nspace });
},
@@ -34,14 +31,10 @@ export default Component.extend(Slotted, {
this._super(...arguments);
this._listeners.remove();
},
- sortedOptions: sort('allOptions.[]', 'comparator'),
- comparator: computed(function() {
- return this.sort.comparator(this.type)();
- }),
- options: computed('selectedOptions.[]', 'sortedOptions.[]', function() {
+ options: computed('selectedOptions.[]', 'allOptions.[]', function() {
// It's not massively important here that we are defaulting `items` and
// losing reference as its just to figure out the diff
- let options = this.sortedOptions || [];
+ let options = this.allOptions || [];
const items = this.selectedOptions || [];
if (get(items, 'length') > 0) {
// filter out any items from the available options that have already been
@@ -49,7 +42,6 @@ export default Component.extend(Slotted, {
// TODO: find a proper ember-data diff
options = options.filter(item => !items.findBy('ID', get(item, 'ID')));
}
- this.searchable.add(options);
return options;
}),
save: task(function*(item, items, success = function() {}) {
@@ -72,19 +64,6 @@ export default Component.extend(Slotted, {
}
}),
actions: {
- search: function(term) {
- // TODO: make sure we can either search before things are loaded
- // or wait until we are loaded, guess power select take care of that
- return new Promise(resolve => {
- const remove = this._listeners.add(this.searchable, {
- change: e => {
- remove();
- resolve(e.target.data);
- },
- });
- this.searchable.search(term);
- });
- },
reset: function() {
this.form.clear({ Datacenter: this.dc, Namespace: this.nspace });
},
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 cf5a08726..15b8927c4 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
@@ -2,65 +2,61 @@
class="consul-upstream-instance-list"
...attributes
>
- {{#if (gt this.items.length 0)}}
-
- {{#each this.items as |item|}}
- -
-
-
- {{#if (env 'CONSUL_NSPACES_ENABLED')}}
- {{#if (not-eq item.DestinationType 'prepared_query')}}
-
- -
-
- Namespace
-
-
- -
- {{or item.DestinationNamespace 'default'}}
-
-
- {{/if}}
+
+ {{#each @items as |item|}}
+ -
+
+
+ {{#if (env 'CONSUL_NSPACES_ENABLED')}}
+ {{#if (not-eq item.DestinationType 'prepared_query')}}
+
+ -
+
+ Namespace
+
+
+ -
+ {{or item.DestinationNamespace 'default'}}
+
+
{{/if}}
- {{#if (and (not-eq item.Datacenter @dc) (not-eq item.Datacenter ""))}}
-
- -
-
- Datacenter
-
-
- -
- {{item.Datacenter}}
-
-
- {{/if}}
- {{#if (gt item.LocalBindPort 0)}}
+ {{/if}}
+ {{#if (and (not-eq item.Datacenter @dc) (not-eq item.Datacenter ""))}}
+
+ -
+
+ Datacenter
+
+
+ -
+ {{item.Datacenter}}
+
+
+ {{/if}}
+ {{#if (gt item.LocalBindPort 0)}}
{{#let (concat (or item.LocalBindAddress '127.0.0.1') ':' item.LocalBindPort) as |combinedAddress|}}
-
- -
-
- Address
-
-
- -
-
- {{combinedAddress}}
-
-
+
+ -
+
+ Address
+
+
+ -
+
+ {{combinedAddress}}
+
+
{{/let}}
- {{/if}}
-
-
- {{/each}}
-
- {{else}}
- {{yield api to="empty"}}
- {{/if}}
+ {{/if}}
+
+
+ {{/each}}
+
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
deleted file mode 100644
index a02657584..000000000
--- a/ui/packages/consul-ui/app/components/consul/upstream-instance/list/index.js
+++ /dev/null
@@ -1,24 +0,0 @@
-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/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream-instance/search-bar/index.hbs
index fee027149..2111718bb 100644
--- 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
@@ -2,11 +2,33 @@
class="consul-upstream-instance-search-bar filter-bar"
...attributes
>
-