a73e0958d5
Move all the dom-things to use the dom service in tabular-collection, feedback-dialog, list-collection and node show. Move get-component-factory into utils/dom and use dom.root() in a few more places This includes an additional `dom.components` method which gives you a list of components matching the selector instead of just one.
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import { get, computed } from '@ember/object';
|
|
import sumOfUnhealthy from 'consul-ui/utils/sumOfUnhealthy';
|
|
import hasStatus from 'consul-ui/utils/hasStatus';
|
|
import WithHealthFiltering from 'consul-ui/mixins/with-health-filtering';
|
|
import WithSearching from 'consul-ui/mixins/with-searching';
|
|
export default Controller.extend(WithSearching, WithHealthFiltering, {
|
|
init: function() {
|
|
this.searchParams = {
|
|
healthyServiceNode: 's',
|
|
unhealthyServiceNode: 's',
|
|
};
|
|
this._super(...arguments);
|
|
},
|
|
searchableHealthy: computed('healthy', function() {
|
|
return get(this, 'searchables.healthyServiceNode')
|
|
.add(get(this, 'healthy'))
|
|
.search(get(this, this.searchParams.healthyServiceNode));
|
|
}),
|
|
searchableUnhealthy: computed('unhealthy', function() {
|
|
return get(this, 'searchables.unhealthyServiceNode')
|
|
.add(get(this, 'unhealthy'))
|
|
.search(get(this, this.searchParams.unhealthyServiceNode));
|
|
}),
|
|
unhealthy: computed('filtered', function() {
|
|
return get(this, 'filtered').filter(function(item) {
|
|
return sumOfUnhealthy(item.Checks) > 0;
|
|
});
|
|
}),
|
|
healthy: computed('filtered', function() {
|
|
return get(this, 'filtered').filter(function(item) {
|
|
return sumOfUnhealthy(item.Checks) === 0;
|
|
});
|
|
}),
|
|
filter: function(item, { s = '', status = '' }) {
|
|
return hasStatus(get(item, 'Checks'), status);
|
|
},
|
|
});
|