da36c2a0f9
- Maintain http headers as JSON-API meta for all API requests (#4946) - Add EventSource ready for implementing blocking queries - EventSource project implementation to enable blocking queries for service and node listings (#5267) - Add setting to enable/disable blocking queries (#5352)
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import { computed } from '@ember/object';
|
|
import WithEventSource from 'consul-ui/mixins/with-event-source';
|
|
import WithHealthFiltering from 'consul-ui/mixins/with-health-filtering';
|
|
import WithSearching from 'consul-ui/mixins/with-searching';
|
|
import { get } from '@ember/object';
|
|
export default Controller.extend(WithEventSource, WithSearching, WithHealthFiltering, {
|
|
init: function() {
|
|
this.searchParams = {
|
|
healthyNode: 's',
|
|
unhealthyNode: 's',
|
|
};
|
|
this._super(...arguments);
|
|
},
|
|
searchableHealthy: computed('healthy', function() {
|
|
return get(this, 'searchables.healthyNode')
|
|
.add(get(this, 'healthy'))
|
|
.search(get(this, this.searchParams.healthyNode));
|
|
}),
|
|
searchableUnhealthy: computed('unhealthy', function() {
|
|
return get(this, 'searchables.unhealthyNode')
|
|
.add(get(this, 'unhealthy'))
|
|
.search(get(this, this.searchParams.unhealthyNode));
|
|
}),
|
|
unhealthy: computed('filtered', function() {
|
|
return get(this, 'filtered').filter(function(item) {
|
|
return get(item, 'isUnhealthy');
|
|
});
|
|
}),
|
|
healthy: computed('filtered', function() {
|
|
return get(this, 'filtered').filter(function(item) {
|
|
return get(item, 'isHealthy');
|
|
});
|
|
}),
|
|
filter: function(item, { s = '', status = '' }) {
|
|
return item.hasStatus(status);
|
|
},
|
|
});
|