chore: 🤖 global should be sorted to first place

This commit is contained in:
Randall Morey committed 2020-08-17 14:56:19 -04:00
1 parent 4be7dc7003
commit d9d429cb9d
3 files changed
+34 -1

No files matched your search

@@ -0,0 +1,21 @@
import Controller from '@ember/controller';
import { sort } from '@ember/object/computed';
export default class ScopesScopeAuthenticateController extends Controller {
// =attributes
/**
* @type {Array}
*/
@sort('model.scopes', (a, b) => {
if (a.isGlobal) {
return -1;
} else if (b.isGlobal) {
return 1;
}
return 0;
})
sortedScopes;
}
@@ -14,7 +14,7 @@
@text={{t "actions.choose-different-org"}}
@icon="user-organization"
as |dropdown|>
{{#each @model.scopes as |scope|}}
{{#each this.sortedScopes as |scope|}}
<dropdown.link @route="scopes.scope.authenticate" @model={{scope}}>
{{scope.displayName}}
</dropdown.link>
@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/authenticate', function(hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function(assert) {
let controller = this.owner.lookup('controller:scopes/scope/authenticate');
assert.ok(controller);
});
});