3e6e16d54f
* Return all services except Proxies * Add Gateway icon to the codebase * Create and implement ConsulExternalSource component * Fix tests to work with new mock data and add a Gateway test * Update consul-api-double to 2.14.3
40 lines
1 KiB
JavaScript
40 lines
1 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import { get, computed } from '@ember/object';
|
|
import WithEventSource from 'consul-ui/mixins/with-event-source';
|
|
import WithSearching from 'consul-ui/mixins/with-searching';
|
|
export default Controller.extend(WithEventSource, WithSearching, {
|
|
queryParams: {
|
|
s: {
|
|
as: 'filter',
|
|
},
|
|
},
|
|
init: function() {
|
|
this.searchParams = {
|
|
service: 's',
|
|
};
|
|
this._super(...arguments);
|
|
},
|
|
searchable: computed('services.[]', function() {
|
|
return get(this, 'searchables.service')
|
|
.add(this.services)
|
|
.search(this.terms);
|
|
}),
|
|
services: computed('items.[]', function() {
|
|
return this.items.filter(function(item) {
|
|
return item.Kind !== 'connect-proxy';
|
|
});
|
|
}),
|
|
proxies: computed('items.[]', function() {
|
|
const proxies = {};
|
|
this.items
|
|
.filter(function(item) {
|
|
return item.Kind === 'connect-proxy';
|
|
})
|
|
.forEach(item => {
|
|
proxies[item.Name.replace('-proxy', '')] = true;
|
|
});
|
|
|
|
return proxies;
|
|
}),
|
|
});
|