1 parent
8bdd4416fc
commit
2bb1c9cfec
4 files changed
+21
-7
No files matched your search
@@ -22,7 +22,6 @@ export default class OnboardingRoute extends Route {
|
||||
model() {
|
||||
return this.store.query('scope', {
|
||||
scope_id: 'global',
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ export default class ScopesScopeRoute extends Route {
|
||||
orgs = await this.store
|
||||
.query('scope', { scope_id: 'global' })
|
||||
.catch(() => A([]));
|
||||
|
||||
if (model.isProject) {
|
||||
projects = await this.store.query('scope', { scope_id: model.scopeID });
|
||||
}
|
||||
|
||||
@@ -13,14 +13,28 @@ export default class ScopesScopeIndexRoute extends Route {
|
||||
* Redirects to scopes/scope/authenticate for further processing.
|
||||
* If already authenticated, redirects to scopes/scope/scopes to display
|
||||
* list of sub scopes.
|
||||
*
|
||||
* If authenticated but no orgs exist, redirect into onboarding.
|
||||
*/
|
||||
redirect(model) {
|
||||
const hasOrgs = this.store.peekAll('scope').filterBy('type', 'org').length;
|
||||
|
||||
// Must authenticate before proceeding anywhere else
|
||||
if (!this.session.isAuthenticated) {
|
||||
this.router.transitionTo('scopes.scope.authenticate');
|
||||
} else if (model.isProject) {
|
||||
this.router.transitionTo('scopes.scope.edit');
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.scopes');
|
||||
return this.router.transitionTo('scopes.scope.authenticate');
|
||||
}
|
||||
|
||||
// If authenticated but no orgs exist yet, redirect to onboarding
|
||||
if (this.session.isAuthenticated && !hasOrgs) {
|
||||
return this.router.transitionTo('onboarding.quick-setup.choose-path');
|
||||
}
|
||||
|
||||
// If this a project scope, there are no further sub scopes, so show edit
|
||||
if (model.isProject) {
|
||||
return this.router.transitionTo('scopes.scope.edit');
|
||||
}
|
||||
|
||||
// For all other scope types (global and org), show sub scopes
|
||||
return this.router.transitionTo('scopes.scope.scopes');
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ export default class ScopesScopeScopesRoute extends Route {
|
||||
|
||||
/**
|
||||
* Loads sub scopes for the current scope.
|
||||
* @return {Promise
|
||||
* @return {Promise}
|
||||
*/
|
||||
async model() {
|
||||
const currentScope = this.modelFor('scopes.scope');
|
||||
|
||||
Reference in new issue
Block a user