open-consul/ui/packages/consul-ui/app/controllers/dc/services/index.js

32 lines
746 B
JavaScript
Raw Normal View History

import { computed } from '@ember/object';
import Controller from '@ember/controller';
export default class IndexController extends Controller {
queryParams = {
sortBy: 'sort',
status: 'status',
source: 'source',
2020-11-13 15:55:40 +00:00
kind: 'kind',
search: {
as: 'filter',
2020-11-13 15:55:40 +00:00
replace: true,
},
};
@computed('items.[]')
get services() {
return this.items.filter(function(item) {
return item.Kind !== 'connect-proxy';
});
}
@computed('services')
get externalSources() {
const sources = this.services.reduce(function(prev, item) {
return prev.concat(item.ExternalSources || []);
}, []);
// unique, non-empty values, alpha sort
return [...new Set(sources)].filter(Boolean).sort();
}
}