Merge pull request #891 from hashicorp/refactor-transitions
Refactor transitions
This commit is contained in:
50 files changed
+270
-125
No files matched your search
@@ -44,6 +44,11 @@ class RouteResourceFilter extends EmberObject {
|
||||
return this.allowed;
|
||||
}
|
||||
|
||||
get router() {
|
||||
const owner = getOwner(this.route);
|
||||
return owner.lookup('service:router');
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently selected value(s) for this filter, deserialized from the value of
|
||||
* the associated route query parameter.
|
||||
@@ -67,7 +72,7 @@ class RouteResourceFilter extends EmberObject {
|
||||
const queryParams = {};
|
||||
const serialized = value.map((value) => this.serializeValue(value));
|
||||
queryParams[this.filterKey] = JSON.stringify(serialized);
|
||||
this.route.transitionTo({ queryParams });
|
||||
this.router.transitionTo(this.route.routeName, { queryParams });
|
||||
}
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -5,6 +5,7 @@ export default class AccountRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -12,6 +13,6 @@ export default class AccountRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class AccountChangePasswordRoute extends Route {
|
||||
@service session;
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -42,7 +43,7 @@ export default class AccountChangePasswordRoute extends Route {
|
||||
// redirects depending on the authentication context. These additional
|
||||
// redirects may abort this initial transition, resulting in a
|
||||
// TransitionAborted error, which we do not want to show to the user.
|
||||
await this.replaceWith('index').catch(() => {});
|
||||
await this.router.replaceWith('index').catch(() => {});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,6 @@ export default class AccountChangePasswordRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith('index');
|
||||
this.router.replaceWith('index');
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class IndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Redirects to scopes route for further processing.
|
||||
*/
|
||||
redirect() {
|
||||
this.transitionTo('scopes');
|
||||
this.router.transitionTo('scopes');
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ export default class ScopesIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -21,9 +22,9 @@ export default class ScopesIndexRoute extends Route {
|
||||
'data.authenticated.scope.id'
|
||||
);
|
||||
if (authenticatedScopeID) {
|
||||
this.transitionTo('scopes.scope', authenticatedScopeID);
|
||||
this.router.transitionTo('scopes.scope', authenticatedScopeID);
|
||||
} else {
|
||||
this.transitionTo('scopes.scope', 'global');
|
||||
this.router.transitionTo('scopes.scope', 'global');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class ScopesScopeRoute extends Route {
|
||||
@service intl;
|
||||
@service session;
|
||||
@service scope;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -116,7 +117,7 @@ export default class ScopesScopeRoute extends Route {
|
||||
cancel(scope) {
|
||||
const { isNew } = scope;
|
||||
scope.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope');
|
||||
if (isNew) this.router.transitionTo('scopes.scope');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +134,7 @@ export default class ScopesScopeRoute extends Route {
|
||||
async save(scope) {
|
||||
const { isNew } = scope;
|
||||
await scope.save();
|
||||
await this.transitionTo('scopes.scope.edit', scope);
|
||||
await this.router.transitionTo('scopes.scope.edit', scope);
|
||||
if (isNew) this.refresh();
|
||||
}
|
||||
|
||||
@@ -149,7 +150,7 @@ export default class ScopesScopeRoute extends Route {
|
||||
async delete(scope) {
|
||||
const { scopeID } = scope;
|
||||
await scope.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.scopes', scopeID);
|
||||
await this.router.replaceWith('scopes.scope.scopes', scopeID);
|
||||
//this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
@service session;
|
||||
@service can;
|
||||
@service resourceFilterStore;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -25,7 +26,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +57,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
cancel(authMethod) {
|
||||
const { isNew } = authMethod;
|
||||
authMethod.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.auth-methods');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.auth-methods');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,12 +73,12 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
async save(authMethod) {
|
||||
await authMethod.save();
|
||||
if (this.can.can('read model', authMethod)) {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method',
|
||||
authMethod
|
||||
);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.auth-methods');
|
||||
await this.router.transitionTo('scopes.scope.auth-methods');
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -97,7 +98,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
// Reload the scope, since this is where the primary_auth_method_id is
|
||||
// stored. An auth method deletion could affect this field.
|
||||
await scopeModel.reload();
|
||||
await this.replaceWith('scopes.scope.auth-methods');
|
||||
await this.router.replaceWith('scopes.scope.auth-methods');
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
@@ -40,7 +42,9 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
|
||||
const { isNew } = account;
|
||||
account.rollbackAttributes();
|
||||
if (isNew)
|
||||
this.transitionTo('scopes.scope.auth-methods.auth-method.accounts');
|
||||
this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.accounts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,12 +65,14 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
|
||||
}
|
||||
await account.save({ adapterOptions });
|
||||
if (this.can.can('read model', account)) {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.accounts.account',
|
||||
account
|
||||
);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.auth-methods.auth-method.accounts');
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.accounts'
|
||||
);
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -82,7 +88,9 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async deleteAccount(account) {
|
||||
await account.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.auth-methods.auth-method.accounts');
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.auth-methods.auth-method.accounts'
|
||||
);
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -9,6 +9,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -40,7 +41,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSettingsRout
|
||||
@notifySuccess('notifications.save-success')
|
||||
async setPassword(account, password) {
|
||||
await account.setPassword(password);
|
||||
await this.replaceWith(
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.auth-methods.auth-method.accounts.account.set-password'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
//=methods
|
||||
|
||||
@@ -40,7 +41,9 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
|
||||
const { isNew } = managedGroup;
|
||||
managedGroup.rollbackAttributes();
|
||||
if (isNew) {
|
||||
this.transitionTo('scopes.scope.auth-methods.auth-method.managed-groups');
|
||||
this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +60,12 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
|
||||
async save(managedGroup) {
|
||||
await managedGroup.save();
|
||||
if (this.can.can('read model', managedGroup)) {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups.managed-group',
|
||||
managedGroup
|
||||
);
|
||||
} else {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups'
|
||||
);
|
||||
}
|
||||
@@ -80,7 +83,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(managedGroup) {
|
||||
await managedGroup.destroyRecord();
|
||||
await this.replaceWith(
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups'
|
||||
);
|
||||
this.refresh();
|
||||
|
||||
@@ -6,11 +6,13 @@ export default class ScopesScopeAuthenticateRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
beforeModel() {
|
||||
if (this.session.isAuthenticated) this.transitionTo('scopes.scope.index');
|
||||
if (this.session.isAuthenticated)
|
||||
this.router.transitionTo('scopes.scope.index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeAuthenticateIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
@@ -12,7 +17,10 @@ export default class ScopesScopeAuthenticateIndexRoute extends Route {
|
||||
redirect({ authMethods }) {
|
||||
const firstAuthMethod = authMethods.firstObject;
|
||||
if (firstAuthMethod) {
|
||||
this.transitionTo('scopes.scope.authenticate.method', firstAuthMethod);
|
||||
this.router.transitionTo(
|
||||
'scopes.scope.authenticate.method',
|
||||
firstAuthMethod
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route {
|
||||
@service notify;
|
||||
@service intl;
|
||||
@service windowManager;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -60,14 +61,14 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route {
|
||||
requestCookies,
|
||||
{ scope, authMethod }
|
||||
);
|
||||
this.transitionTo('index');
|
||||
this.router.transitionTo('index');
|
||||
break;
|
||||
case 'oidc':
|
||||
await this.startOIDCAuthentication(authenticatorName, {
|
||||
scope,
|
||||
authMethod,
|
||||
});
|
||||
this.transitionTo('scopes.scope.authenticate.method.oidc');
|
||||
this.router.transitionTo('scopes.scope.authenticate.method.oidc');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
|
||||
|
||||
@service session;
|
||||
@service windowManager;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -47,7 +48,7 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
|
||||
@action
|
||||
@notifyError(() => 'errors.authentication-failed.title', { catch: true })
|
||||
error(e) {
|
||||
this.transitionTo('scopes.scope.authenticate.method.index');
|
||||
this.router.transitionTo('scopes.scope.authenticate.method.index');
|
||||
// rethrow the error to activate the notifyError decorator
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,13 @@ import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
|
||||
export default class ScopesScopeCredentialStoresRoute extends Route {
|
||||
// =methods
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Load all credential stores under current scope
|
||||
* @returns {Promise[CredentialStoreModel]}
|
||||
@@ -36,7 +41,7 @@ export default class ScopesScopeCredentialStoresRoute extends Route {
|
||||
@notifySuccess('notifications.save-success')
|
||||
async save(credentialStore) {
|
||||
await credentialStore.save();
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store',
|
||||
credentialStore
|
||||
);
|
||||
@@ -51,7 +56,7 @@ export default class ScopesScopeCredentialStoresRoute extends Route {
|
||||
cancel(credentialStore) {
|
||||
const { isNew } = credentialStore;
|
||||
credentialStore.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.credential-stores');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.credential-stores');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +70,7 @@ export default class ScopesScopeCredentialStoresRoute extends Route {
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(credentialStore) {
|
||||
await credentialStore.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.credential-stores');
|
||||
await this.router.replaceWith('scopes.scope.credential-stores');
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
+9
-5
@@ -6,8 +6,12 @@ import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesRoute extends Route {
|
||||
// =methods
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Loads all credential libraries under the current credential store.
|
||||
@@ -38,7 +42,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
const { isNew } = credentialLibrary;
|
||||
credentialLibrary.rollbackAttributes();
|
||||
if (isNew)
|
||||
this.transitionTo(
|
||||
this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store.credential-libraries'
|
||||
);
|
||||
}
|
||||
@@ -56,12 +60,12 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
async save(credentialLibrary) {
|
||||
await credentialLibrary.save();
|
||||
if (this.can.can('read model', credentialLibrary)) {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store.credential-libraries.credential-library',
|
||||
credentialLibrary
|
||||
);
|
||||
} else {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store.credential-libraries'
|
||||
);
|
||||
}
|
||||
@@ -79,7 +83,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(credentialLibrary) {
|
||||
await credentialLibrary.destroyRecord();
|
||||
await this.replaceWith(
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.credential-stores.credential-store.credential-libraries'
|
||||
);
|
||||
this.refresh();
|
||||
|
||||
@@ -5,6 +5,7 @@ export default class ScopesScopeEditRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -12,6 +13,6 @@ export default class ScopesScopeEditRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,15 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
@service notify;
|
||||
@service session;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +44,7 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
cancel(group) {
|
||||
const { isNew } = group;
|
||||
group.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.groups');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.groups');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +60,9 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
async save(group) {
|
||||
await group.save();
|
||||
if (this.can.can('read model', group)) {
|
||||
await this.transitionTo('scopes.scope.groups.group', group);
|
||||
await this.router.transitionTo('scopes.scope.groups.group', group);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.groups');
|
||||
await this.router.transitionTo('scopes.scope.groups');
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -76,7 +78,7 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(group) {
|
||||
await group.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.groups');
|
||||
await this.router.replaceWith('scopes.scope.groups');
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -70,7 +71,7 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
|
||||
@notifySuccess('notifications.add-success')
|
||||
async addMembers(group, userIDs) {
|
||||
await group.addMembers(userIDs);
|
||||
await this.replaceWith('scopes.scope.groups.group.members');
|
||||
await this.router.replaceWith('scopes.scope.groups.group.members');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,6 +79,6 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith('scopes.scope.groups.group.members');
|
||||
this.router.replaceWith('scopes.scope.groups.group.members');
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,15 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
|
||||
@service notify;
|
||||
@service session;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +47,7 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
|
||||
cancel(hostCatalog) {
|
||||
const { isNew } = hostCatalog;
|
||||
hostCatalog.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.host-catalogs');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.host-catalogs');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +63,7 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
|
||||
)
|
||||
async save(hostCatalog) {
|
||||
await hostCatalog.save();
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog',
|
||||
hostCatalog
|
||||
);
|
||||
@@ -79,7 +81,7 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(hostCatalog) {
|
||||
await hostCatalog.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.host-catalogs');
|
||||
await this.router.replaceWith('scopes.scope.host-catalogs');
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
@@ -43,7 +45,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
|
||||
const { isNew } = hostSet;
|
||||
hostSet.rollbackAttributes();
|
||||
if (isNew)
|
||||
this.transitionTo('scopes.scope.host-catalogs.host-catalog.host-sets');
|
||||
this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,12 +64,12 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
|
||||
async save(hostSet) {
|
||||
await hostSet.save();
|
||||
if (this.can.can('read model', hostSet)) {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set',
|
||||
hostSet
|
||||
);
|
||||
} else {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets'
|
||||
);
|
||||
}
|
||||
@@ -83,6 +87,8 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async deleteHostSet(hostSet) {
|
||||
await hostSet.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.host-catalogs.host-catalog.host-sets');
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets'
|
||||
);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -10,6 +10,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRo
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -75,7 +76,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRo
|
||||
@notifySuccess('notifications.add-success')
|
||||
async addHosts(hostSet, hostIDs) {
|
||||
await hostSet.addHosts(hostIDs);
|
||||
await this.replaceWith(
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
|
||||
);
|
||||
}
|
||||
@@ -85,7 +86,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRo
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith(
|
||||
this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
|
||||
);
|
||||
}
|
||||
|
||||
+3
-2
@@ -9,6 +9,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -70,7 +71,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
|
||||
);
|
||||
await host.save();
|
||||
await hostSet.addHost(host.id);
|
||||
await this.replaceWith(
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
|
||||
);
|
||||
}
|
||||
@@ -80,7 +81,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith(
|
||||
this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
@@ -42,7 +44,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
|
||||
const { isNew } = host;
|
||||
host.rollbackAttributes();
|
||||
if (isNew)
|
||||
this.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts');
|
||||
this.router.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,12 +61,14 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
|
||||
async save(host) {
|
||||
await host.save();
|
||||
if (this.can.can('read model', host)) {
|
||||
await this.transitionTo(
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.hosts.host',
|
||||
host
|
||||
);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts');
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.hosts'
|
||||
);
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -80,7 +84,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async deleteHost(host) {
|
||||
await host.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.host-catalogs.host-catalog.hosts');
|
||||
await this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.hosts'
|
||||
);
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ export default class ScopesScopeIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -15,11 +16,11 @@ export default class ScopesScopeIndexRoute extends Route {
|
||||
*/
|
||||
redirect(model) {
|
||||
if (!this.session.isAuthenticated) {
|
||||
this.transitionTo('scopes.scope.authenticate');
|
||||
this.router.transitionTo('scopes.scope.authenticate');
|
||||
} else if (model.isProject) {
|
||||
this.transitionTo('scopes.scope.edit');
|
||||
this.router.transitionTo('scopes.scope.edit');
|
||||
} else {
|
||||
this.transitionTo('scopes.scope.scopes');
|
||||
this.router.transitionTo('scopes.scope.scopes');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ export default class ScopesScopeNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -12,7 +13,7 @@ export default class ScopesScopeNewRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
@service notify;
|
||||
@service session;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -19,7 +20,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
cancel(role) {
|
||||
const { isNew } = role;
|
||||
role.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.roles');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.roles');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,9 +60,9 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
async save(role) {
|
||||
await role.save();
|
||||
if (this.can.can('read model', role)) {
|
||||
await this.transitionTo('scopes.scope.roles.role', role);
|
||||
await this.router.transitionTo('scopes.scope.roles.role', role);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.roles');
|
||||
await this.router.transitionTo('scopes.scope.roles');
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -77,7 +78,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(role) {
|
||||
await role.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.roles');
|
||||
await this.router.replaceWith('scopes.scope.roles');
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -64,7 +65,7 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||
@notifySuccess('notifications.add-success')
|
||||
async addPrincipals(role, principalIDs) {
|
||||
await role.addPrincipals(principalIDs);
|
||||
this.replaceWith('scopes.scope.roles.role.principals');
|
||||
this.router.replaceWith('scopes.scope.roles.role.principals');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,6 +73,6 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith('scopes.scope.roles.role.principals');
|
||||
this.router.replaceWith('scopes.scope.roles.role.principals');
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export default class ScopesScopeScopesRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -17,7 +18,7 @@ export default class ScopesScopeScopesRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ export default class ScopesScopeSessionsRoute extends Route {
|
||||
@service notify;
|
||||
@service session;
|
||||
@service resourceFilterStore;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -37,7 +38,7 @@ export default class ScopesScopeSessionsRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ export default class ScopesScopeTargetsRoute extends Route {
|
||||
@service notify;
|
||||
@service session;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -19,7 +20,7 @@ export default class ScopesScopeTargetsRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +45,7 @@ export default class ScopesScopeTargetsRoute extends Route {
|
||||
cancel(target) {
|
||||
const { isNew } = target;
|
||||
target.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.targets');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.targets');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +62,9 @@ export default class ScopesScopeTargetsRoute extends Route {
|
||||
async save(target) {
|
||||
await target.save();
|
||||
if (this.can.can('read model', target)) {
|
||||
await this.transitionTo('scopes.scope.targets.target', target);
|
||||
await this.router.transitionTo('scopes.scope.targets.target', target);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.targets');
|
||||
await this.router.transitionTo('scopes.scope.targets');
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -79,7 +80,7 @@ export default class ScopesScopeTargetsRoute extends Route {
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(target) {
|
||||
await target.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.targets');
|
||||
await this.router.replaceWith('scopes.scope.targets');
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -78,7 +79,7 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R
|
||||
@notifySuccess('notifications.add-success')
|
||||
async save(target, credentialLibraryIDs) {
|
||||
await target.addCredentialSources(credentialLibraryIDs);
|
||||
this.replaceWith('scopes.scope.targets.target.credential-sources');
|
||||
this.router.replaceWith('scopes.scope.targets.target.credential-sources');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,6 +87,6 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith('scopes.scope.targets.target.credential-sources');
|
||||
this.router.replaceWith('scopes.scope.targets.target.credential-sources');
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -72,7 +73,7 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route {
|
||||
@notifySuccess('notifications.add-success')
|
||||
async save(target, hostSetIDs) {
|
||||
await target.addHostSources(hostSetIDs);
|
||||
this.replaceWith('scopes.scope.targets.target.host-sources');
|
||||
this.router.replaceWith('scopes.scope.targets.target.host-sources');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +81,6 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith('scopes.scope.targets.target.host-sources');
|
||||
this.router.replaceWith('scopes.scope.targets.target.host-sources');
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
@service notify;
|
||||
@service session;
|
||||
@service can;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -19,7 +20,7 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
cancel(user) {
|
||||
const { isNew } = user;
|
||||
user.rollbackAttributes();
|
||||
if (isNew) this.transitionTo('scopes.scope.users');
|
||||
if (isNew) this.router.transitionTo('scopes.scope.users');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +61,9 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
async save(user) {
|
||||
await user.save();
|
||||
if (this.can.can('read model', user)) {
|
||||
await this.transitionTo('scopes.scope.users.user', user);
|
||||
await this.router.transitionTo('scopes.scope.users.user', user);
|
||||
} else {
|
||||
await this.transitionTo('scopes.scope.users');
|
||||
await this.router.transitionTo('scopes.scope.users');
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
@@ -78,7 +79,7 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(user) {
|
||||
await user.destroyRecord();
|
||||
await this.replaceWith('scopes.scope.users');
|
||||
await this.router.replaceWith('scopes.scope.users');
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export default class ScopesScopeUsersUserAddAccountsRoute extends Route {
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -74,7 +75,7 @@ export default class ScopesScopeUsersUserAddAccountsRoute extends Route {
|
||||
@notifySuccess('notifications.add-success')
|
||||
async addAccounts(user, accountIDs) {
|
||||
await user.addAccounts(accountIDs);
|
||||
await this.replaceWith('scopes.scope.users.user.accounts');
|
||||
await this.router.replaceWith('scopes.scope.users.user.accounts');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +83,6 @@ export default class ScopesScopeUsersUserAddAccountsRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
cancel() {
|
||||
this.replaceWith('scopes.scope.users.user.accounts');
|
||||
this.router.replaceWith('scopes.scope.users.user.accounts');
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
.rose-dropdown {
|
||||
$icon-width: sizing.rems(m) + sizing.rems(s);
|
||||
$indent: $icon-width + sizing.rems(xs);
|
||||
$indent: $icon-width + sizing.rems(xs);
|
||||
|
||||
.rose-form-radio-label {
|
||||
display: flex;
|
||||
@@ -129,7 +129,14 @@
|
||||
&.loading {
|
||||
&::after {
|
||||
animation: gradient 1s linear infinite;
|
||||
background: repeating-linear-gradient(to right, var(--subtle), var(--subtle), var(--info), var(--subtle), var(--subtle));
|
||||
background: repeating-linear-gradient(
|
||||
to right,
|
||||
var(--subtle),
|
||||
var(--subtle),
|
||||
var(--info),
|
||||
var(--subtle),
|
||||
var(--subtle)
|
||||
);
|
||||
background-position: -100% 0;
|
||||
background-size: 200% auto;
|
||||
content: ' ';
|
||||
@@ -140,8 +147,12 @@
|
||||
top: 100%;
|
||||
|
||||
@keyframes gradient {
|
||||
0% { background-position: -100% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
0% {
|
||||
background-position: -100% 0;
|
||||
}
|
||||
100% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,8 +194,12 @@
|
||||
color: inherit;
|
||||
|
||||
@keyframes fadeBackground {
|
||||
0% { background-color: var(--action-subtler-1); }
|
||||
100% { background-color: transparent; }
|
||||
0% {
|
||||
background-color: var(--action-subtler-1);
|
||||
}
|
||||
100% {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export default class IndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service origin;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -14,9 +15,9 @@ export default class IndexRoute extends Route {
|
||||
redirect() {
|
||||
const rendererOrigin = this.origin.rendererOrigin;
|
||||
if (!rendererOrigin) {
|
||||
this.replaceWith('origin');
|
||||
this.router.replaceWith('origin');
|
||||
} else {
|
||||
this.replaceWith('scopes');
|
||||
this.router.replaceWith('scopes');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class OriginRoute extends Route {
|
||||
@service origin;
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -40,7 +41,7 @@ export default class OriginRoute extends Route {
|
||||
* processing. User must be logged out before changing the origin.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (this.session.isAuthenticated) this.replaceWith('index');
|
||||
if (this.session.isAuthenticated) this.router.replaceWith('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ export default class OriginRoute extends Route {
|
||||
async setOrigin(origin) {
|
||||
try {
|
||||
await this.origin.setOrigin(origin);
|
||||
this.replaceWith('index');
|
||||
this.router.replaceWith('index');
|
||||
} catch (e) {
|
||||
// If scopes do not load, we assume this is not a Boundary API
|
||||
const errorMessage = this.intl.t(
|
||||
|
||||
@@ -6,6 +6,7 @@ export default class ScopesIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -21,9 +22,9 @@ export default class ScopesIndexRoute extends Route {
|
||||
'data.authenticated.scope.id'
|
||||
);
|
||||
if (authenticatedScopeID) {
|
||||
this.replaceWith('scopes.scope', authenticatedScopeID);
|
||||
this.router.replaceWith('scopes.scope', authenticatedScopeID);
|
||||
} else {
|
||||
this.replaceWith('scopes.scope', 'global');
|
||||
this.router.replaceWith('scopes.scope', 'global');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,13 @@ export default class ScopesScopeAuthenticateRoute extends Route {
|
||||
|
||||
@service session;
|
||||
@service origin;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
beforeModel() {
|
||||
if (this.session.isAuthenticated) this.replaceWith('scopes.scope.index');
|
||||
if (this.session.isAuthenticated)
|
||||
this.router.replaceWith('scopes.scope.index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +31,7 @@ export default class ScopesScopeAuthenticateRoute extends Route {
|
||||
}
|
||||
|
||||
redirect() {
|
||||
if (!this.origin.rendererOrigin) this.replaceWith('index');
|
||||
if (!this.origin.rendererOrigin) this.router.replaceWith('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeAuthenticateIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
@@ -12,7 +17,10 @@ export default class ScopesScopeAuthenticateIndexRoute extends Route {
|
||||
redirect({ authMethods }) {
|
||||
const firstAuthMethod = authMethods.firstObject;
|
||||
if (firstAuthMethod) {
|
||||
this.replaceWith('scopes.scope.authenticate.method', firstAuthMethod);
|
||||
this.router.replaceWith(
|
||||
'scopes.scope.authenticate.method',
|
||||
firstAuthMethod
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route {
|
||||
@service notify;
|
||||
@service ipc;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -67,14 +68,14 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route {
|
||||
requestCookies,
|
||||
{ scope, authMethod }
|
||||
);
|
||||
this.transitionTo('index');
|
||||
this.router.transitionTo('index');
|
||||
break;
|
||||
case 'oidc':
|
||||
await this.startOIDCAuthentication(authenticatorName, {
|
||||
scope,
|
||||
authMethod,
|
||||
});
|
||||
this.transitionTo('scopes.scope.authenticate.method.oidc');
|
||||
this.router.transitionTo('scopes.scope.authenticate.method.oidc');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
|
||||
// =attributes
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -39,7 +38,7 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
|
||||
@action
|
||||
@notifyError(() => 'errors.authentication-failed.title', { catch: true })
|
||||
error(e) {
|
||||
this.transitionTo('scopes.scope.authenticate.method.index');
|
||||
this.router.transitionTo('scopes.scope.authenticate.method.index');
|
||||
// rethrow the error to activate the notifyError decorator
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ export default class ScopesScopeIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -15,9 +16,9 @@ export default class ScopesScopeIndexRoute extends Route {
|
||||
*/
|
||||
redirect() {
|
||||
if (!this.session.isAuthenticated) {
|
||||
this.replaceWith('scopes.scope.authenticate');
|
||||
this.router.replaceWith('scopes.scope.authenticate');
|
||||
} else {
|
||||
this.replaceWith('scopes.scope.projects.targets');
|
||||
this.router.replaceWith('scopes.scope.projects.targets');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
|
||||
@service session;
|
||||
@service resourceFilterStore;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -27,7 +28,7 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@ export default class ScopesScopeProjectsSessionsRoute extends Route {
|
||||
@service ipc;
|
||||
@service session;
|
||||
@service resourceFilterStore;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -36,7 +37,7 @@ export default class ScopesScopeProjectsSessionsRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ export default class ScopesScopeProjectsTargetsRoute extends Route {
|
||||
@service notify;
|
||||
@service confirm;
|
||||
@service resourceFilterStore;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -32,7 +33,7 @@ export default class ScopesScopeProjectsTargetsRoute extends Route {
|
||||
* If arriving here unauthenticated, redirect to index for further processing.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (!this.session.isAuthenticated) this.transitionTo('index');
|
||||
if (!this.session.isAuthenticated) this.router.transitionTo('index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeProjectsTargetsTargetIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Navigate to hosts within a target.
|
||||
*/
|
||||
afterModel() {
|
||||
this.transitionTo('scopes.scope.projects.targets.target.sessions');
|
||||
this.router.transitionTo('scopes.scope.projects.targets.target.sessions');
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,8 @@
|
||||
border-radius: sizing.rems(xxxs);
|
||||
margin: 0 auto;
|
||||
margin-top: sizing.rems(l) * 1.25;
|
||||
padding: (sizing.rems(l) * 4) (sizing.rems(l) * 3) (sizing.rems(l) * 2) (sizing.rems(l) * 3);
|
||||
padding: (sizing.rems(l) * 4) (sizing.rems(l) * 3) (sizing.rems(l) * 2)
|
||||
(sizing.rems(l) * 3);
|
||||
position: relative;
|
||||
width: sizing.rems(l) * 16;
|
||||
|
||||
@@ -324,7 +325,6 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
// Dialog Detail
|
||||
// These styles are a Work In Progress. Expect changes (lots of them)
|
||||
.rose-dialog,
|
||||
@@ -487,12 +487,14 @@ $chevron-down: url("data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231
|
||||
color: var(--ui-gray-subtler-2);
|
||||
}
|
||||
|
||||
.rose-button-ghost { // Copyable button icon.
|
||||
.rose-button-ghost {
|
||||
// Copyable button icon.
|
||||
color: var(--ui-gray-subtler-1);
|
||||
}
|
||||
}
|
||||
|
||||
.rose-button-ghost { // Hide/Show secret button icon.
|
||||
.rose-button-ghost {
|
||||
// Hide/Show secret button icon.
|
||||
color: var(--ui-gray);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,9 @@ module('Acceptance | authentication', function (hooks) {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
user: null,
|
||||
target: null,
|
||||
session: null,
|
||||
};
|
||||
|
||||
const stubs = {
|
||||
@@ -65,6 +68,10 @@ module('Acceptance | authentication', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
instances.user = this.server.create('user', {
|
||||
scope: instances.scopes.global,
|
||||
});
|
||||
|
||||
invalidateSession();
|
||||
|
||||
// create scopes
|
||||
@@ -91,6 +98,22 @@ module('Acceptance | authentication', function (hooks) {
|
||||
type: 'password',
|
||||
});
|
||||
|
||||
instances.target = this.server.create(
|
||||
'target',
|
||||
{ scope: instances.scopes.project },
|
||||
'withAssociations'
|
||||
);
|
||||
instances.session = this.server.create(
|
||||
'session',
|
||||
{
|
||||
scope: instances.scopes.project,
|
||||
target: instances.target,
|
||||
status: 'active',
|
||||
user: instances.user,
|
||||
},
|
||||
'withAssociations'
|
||||
);
|
||||
|
||||
urls.scopes.global = `/scopes/${instances.scopes.global.id}`;
|
||||
urls.scopes.org = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.authenticate.global = `${urls.scopes.global}/authenticate`;
|
||||
@@ -176,16 +199,20 @@ module('Acceptance | authentication', function (hooks) {
|
||||
|
||||
test('401 responses result in deauthentication', async function (assert) {
|
||||
assert.expect(3);
|
||||
await visit(urls.authenticate.methods.global);
|
||||
await fillIn('[name="identification"]', 'test');
|
||||
await fillIn('[name="password"]', 'test');
|
||||
await click('[type="submit"]');
|
||||
authenticateSession({
|
||||
scope: {
|
||||
id: instances.scopes.global.id,
|
||||
type: instances.scopes.global.type,
|
||||
},
|
||||
});
|
||||
await visit(urls.sessions);
|
||||
assert.ok(
|
||||
currentSession().isAuthenticated,
|
||||
'Session begins authenticated, before encountering 401'
|
||||
);
|
||||
assert.ok(currentURL(), urls.targets);
|
||||
this.server.get('/sessions', () => new Response(401));
|
||||
await visit(urls.targets);
|
||||
await visit(urls.sessions);
|
||||
assert.notOk(
|
||||
currentSession().isAuthenticated,
|
||||
|
||||
Reference in new issue
Block a user