Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
Expand Down
3 changes: 2 additions & 1 deletion addons/api/addon/abilities/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ export default class RoleAbility extends ModelAbility {
const type = this.model.constructor.modelName;
const typeIsValid =
type === 'user' || type === 'group' || type === 'managed-group';
if (!typeIsValid)
if (!typeIsValid) {
throw new InvalidRolePrincipalTypeError(
`Expected a role principal of type 'user', 'group', or 'managed-group'. Got '${type}'.`,
);
}
return this.can.can(`read ${type}`, this.model);
}
}
3 changes: 2 additions & 1 deletion addons/api/addon/serializers/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ export default class AccountSerializer extends ApplicationSerializer {
serialized.attributes = {};
}
// New record case
if (password && snapshot?.record?.isNew)
if (password && snapshot?.record?.isNew) {
serialized.attributes.password = password;
}
// Set password custom method
if (snapshot?.adapterOptions?.method === 'set-password') {
serialized = this.serializeForSetPassword(snapshot, password);
Expand Down
3 changes: 2 additions & 1 deletion addons/api/addon/serializers/credential-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export default class CredentialStoreSerializer extends ApplicationSerializer {
if (
!serialized.attributes?.client_certificate_key &&
serialized.attributes?.client_certificate
)
) {
delete serialized.attributes.client_certificate_key;
}
}
return serialized;
}
Expand Down
3 changes: 2 additions & 1 deletion addons/api/addon/serializers/storage-bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ export default class StorageBucketSerializer extends ApplicationSerializer {
// This deletes any fields that don't belong to the record's credential type
if (options.isNestedAttribute && json.attributes) {
// The key must be included in the fieldsByType list above
if (!fieldsByCredentialType[credentialType].includes(key))
if (!fieldsByCredentialType[credentialType].includes(key)) {
// API requires these fields to be null
json.attributes[key] = null;
}
}

//json.secrets is only present, if there are any updates to the secret fields
Expand Down
6 changes: 4 additions & 2 deletions addons/api/addon/serializers/target.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ export default class TargetSerializer extends ApplicationSerializer {
const injectedApplicationCredentialSourceIDs =
snapshot?.adapterOptions?.injectedApplicationCredentialSourceIDs;

if (brokeredCredentialSourceIDs)
if (brokeredCredentialSourceIDs) {
serialized = this.serializeWithBrokeredCredentialSources(
snapshot,
brokeredCredentialSourceIDs,
);
if (injectedApplicationCredentialSourceIDs)
}
if (injectedApplicationCredentialSourceIDs) {
serialized = this.serializeWithInjectedApplicationCredentialSources(
snapshot,
injectedApplicationCredentialSourceIDs,
);
}

if (isNew && serialized?.with_aliases) {
// API expects scope id along with every alias value
Expand Down
3 changes: 2 additions & 1 deletion addons/api/addon/serializers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export default class UserSerializer extends ApplicationSerializer {
serialize(snapshot) {
let serialized = super.serialize(...arguments);
const accountIDs = snapshot?.adapterOptions?.accountIDs;
if (accountIDs)
if (accountIDs) {
serialized = this.serializewithAccounts(snapshot, accountIDs);
}
return serialized;
}

Expand Down
3 changes: 2 additions & 1 deletion addons/api/mirage/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,11 @@ function routes() {
session.update({
status: pickRandomStatusString(),
});
if (session.id.split('-').pop() % 2)
if (session.id.split('-').pop() % 2) {
session.update({
userId: 'authenticateduser',
});
}
});
}
if (recursive && scope_id === 'global') {
Expand Down
1 change: 1 addition & 0 deletions addons/auth/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
Expand Down
1 change: 1 addition & 0 deletions addons/core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
Expand Down
3 changes: 2 additions & 1 deletion addons/core/addon/decorators/resource-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ class RouteResourceFilter extends EmberObject {
const filterKey = `filter-${name}`;

// If the route has no query params specified yet, declare them.
if (!Object.keys(routeClass.queryParams).length)
if (!Object.keys(routeClass.queryParams).length) {
routeClass.queryParams = {};
}

// If the route has no resource filters list specified yet, create one.
if (!routeClass.resourceFilterParams) routeClass.resourceFilterParams = [];
Expand Down
1 change: 1 addition & 0 deletions addons/rose/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-jquery': 'error',
'ember/no-new-mixins': 0,
'ember/no-get': 'off',
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
es2021: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'no-empty-pattern': ['error', { allowObjectPatternsAsParameters: true }],
},
overrides: [
Expand Down
17 changes: 8 additions & 9 deletions e2e-tests/admin/pages/orgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ export class OrgsPage extends BaseResourcePage {
async chooseScopeFromDropdown(fromScope, toScope) {
await this.page
.getByRole('button', { name: fromScope, exact: true })
.click()
await this.page
.getByRole('option', { name: toScope, exact: true })
.click()
.click();
await this.page.getByRole('option', { name: toScope, exact: true }).click();
await expect(
this.page.getByRole('button', { name: toScope, exact: true })
).toBeVisible()
if (toScope != 'Global')
this.page.getByRole('button', { name: toScope, exact: true }),
).toBeVisible();
if (toScope !== 'Global') {
await expect(
this.page.getByRole('link', { name: toScope, exact: true })
).toBeVisible()
this.page.getByRole('link', { name: toScope, exact: true }),
).toBeVisible();
}
}
}
6 changes: 4 additions & 2 deletions e2e-tests/admin/pages/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ export class TargetsPage extends BaseResourcePage {
await this.page.getByLabel('Name').fill(targetName);
await this.page.getByLabel('Description').fill('This is an automated test');
if (targetType) {
if (targetTypeLabel)
if (targetTypeLabel) {
await this.page
.getByRole('group', { name: 'Type' })
.getByLabel(targetTypeLabel)
.click();
else throw new Error(`Unsupported target type: ${targetType}`);
} else {
throw new Error(`Unsupported target type: ${targetType}`);
}
}
if (address) await this.page.getByLabel('Target Address').fill(address);
if (port) await this.page.getByLabel('Default Port').fill(port);
Expand Down
1 change: 1 addition & 0 deletions ui/admin/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
async cancel(credentialLibrary) {
const { isNew } = credentialLibrary;
credentialLibrary.rollbackAttributes();
if (isNew)
if (isNew) {
await this.router.transitionTo(
'scopes.scope.credential-stores.credential-store.credential-libraries',
);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsIndexC
async cancel(credential) {
const { isNew } = credential;
credential.rollbackAttributes();
if (isNew)
if (isNew) {
await this.router.transitionTo(
'scopes.scope.credential-stores.credential-store.credentials',
);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
cancel(host) {
const { isNew } = host;
host.rollbackAttributes();
if (isNew)
if (isNew) {
this.router.transitionTo(
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts',
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexController e
cancel(hostSet) {
const { isNew } = hostSet;
hostSet.rollbackAttributes();
if (isNew)
if (isNew) {
this.router.transitionTo(
'scopes.scope.host-catalogs.host-catalog.host-sets',
);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsIndexController exte
cancel(host) {
const { isNew } = host;
host.rollbackAttributes();
if (isNew)
if (isNew) {
this.router.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts');
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion ui/admin/app/routes/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export default class OnboardingRoute extends Route {
scope_id: 'global',
query: { filters: { scope_id: [{ equals: 'global' }] } },
});
if (!this.session.isAuthenticated || orgs.length)
if (!this.session.isAuthenticated || orgs.length) {
this.router.transitionTo('index');
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion ui/admin/app/routes/scopes/scope/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ export default class ScopesScopeAuthenticateRoute extends Route {
// =methods

beforeModel() {
if (this.session.isAuthenticated)
if (this.session.isAuthenticated) {
this.router.transitionTo('scopes.scope.index');
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions ui/desktop/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
browser: true,
},
rules: {
curly: ['error', 'multi-line', 'consistent'],
'ember/no-get': 'off',
'ember/no-get-with-default': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
Expand Down
Loading