mirror of https://github.com/status-im/consul.git
ui: Move dc sorting to the view/template (#8297)
* ui: Move dc sorting to the view/template * Cleanup unused coordinates service from Node repo * Fix up integration test to not expect a sorted result
This commit is contained in:
parent
89af0212d3
commit
35fcf69914
|
@ -70,7 +70,7 @@
|
|||
@loading="lazy"
|
||||
/>
|
||||
</li>
|
||||
{{#each dcs as |item|}}
|
||||
{{#each (sort-by 'Name' dcs) as |item|}}
|
||||
<li role="none" data-test-datacenter-picker class={{if (eq dc.Name item.Name) 'is-active'}}>
|
||||
<a tabindex="-1" role="menuitem" href={{href-mut (hash dc=item.Name)}}>{{item.Name}}</a>
|
||||
</li>
|
||||
|
|
|
@ -10,10 +10,7 @@ export default RepositoryService.extend({
|
|||
return modelName;
|
||||
},
|
||||
findAll: function() {
|
||||
return this.store.query(this.getModelName(), {}).then(function(items) {
|
||||
// TODO: Move to view/template
|
||||
return items.sortBy('Name');
|
||||
});
|
||||
return this.store.query(this.getModelName(), {});
|
||||
},
|
||||
findBySlug: function(name, items) {
|
||||
if (name != null) {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import RepositoryService from 'consul-ui/services/repository';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
const modelName = 'node';
|
||||
export default RepositoryService.extend({
|
||||
coordinates: service('repository/coordinate'),
|
||||
getModelName: function() {
|
||||
return modelName;
|
||||
},
|
||||
|
|
|
@ -24,11 +24,7 @@ test('findAll returns the correct data for list endpoint', function(assert) {
|
|||
assert.deepEqual(
|
||||
actual,
|
||||
expected(function(payload) {
|
||||
return payload.map(item => ({ Name: item })).sort(function(a, b) {
|
||||
if (a.Name < b.Name) return -1;
|
||||
if (a.Name > b.Name) return 1;
|
||||
return 0;
|
||||
});
|
||||
return payload.map(item => ({ Name: item }));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue