2017-10-10 02:00:14 +00:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
2017-10-11 17:10:27 +00:00
|
|
|
const { Component, inject, computed } = Ember;
|
2017-10-10 02:00:14 +00:00
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
system: inject.service(),
|
|
|
|
|
2017-10-11 17:10:27 +00:00
|
|
|
sortedNamespaces: computed('system.namespaces.@each.name', function() {
|
|
|
|
const namespaces = this.get('system.namespaces').toArray() || [];
|
|
|
|
|
|
|
|
return namespaces.sort((a, b) => {
|
|
|
|
const aName = a.get('name');
|
|
|
|
const bName = b.get('name');
|
|
|
|
|
|
|
|
// Make sure the default namespace is always first in the list
|
|
|
|
if (aName === 'default') {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (bName === 'default') {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aName < bName) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (aName > bName) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
|
2017-10-10 02:00:14 +00:00
|
|
|
onNamespaceChange() {},
|
|
|
|
});
|