refactor: 💡 remove old unused code (#2367)
This commit is contained in:
1 parent
27abf9e2d9
commit
e83bb425af
2 files changed
+1
-51
No files matched your search
@@ -4,54 +4,5 @@
|
||||
*/
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeRolesRoleIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
|
||||
/**
|
||||
* Load the role's scope and sub scopes into a hierarchical data structure.
|
||||
* @param {Model} model
|
||||
*/
|
||||
async afterModel() {
|
||||
const currentScope = this.modelFor('scopes.scope');
|
||||
let subScopes = [];
|
||||
//await the store query to fix ember's proxy promise deprecation warning
|
||||
if (!currentScope.isProject) {
|
||||
const scopes = await this.store.query('scope', {
|
||||
scope_id: currentScope.id,
|
||||
query: { filters: { scope_id: [{ equals: currentScope.id }] } },
|
||||
});
|
||||
subScopes = await Promise.all(
|
||||
scopes.map(async (scope) => ({
|
||||
model: scope,
|
||||
subScopes: !scope.isProject
|
||||
? await this.store.query('scope', {
|
||||
scope_id: scope.id,
|
||||
query: { filters: { scope_id: [{ equals: scope.id }] } },
|
||||
})
|
||||
: [],
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
const grantScopes = [
|
||||
{
|
||||
model: currentScope,
|
||||
subScopes,
|
||||
},
|
||||
];
|
||||
this.grantScopes = grantScopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds `grantScopes` to the context.
|
||||
* @param {Controller} controller
|
||||
*/
|
||||
setupController(controller) {
|
||||
super.setupController(...arguments);
|
||||
controller.set('grantScopes', this.grantScopes);
|
||||
}
|
||||
}
|
||||
export default class ScopesScopeRolesRoleIndexRoute extends Route {}
|
||||
@@ -24,7 +24,6 @@
|
||||
<page.body>
|
||||
<Form::Role
|
||||
@model={{@model}}
|
||||
@grantScopes={{this.grantScopes}}
|
||||
@submit={{fn this.roles.save @model}}
|
||||
@cancel={{fn this.roles.cancel @model}}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user