Reformat codebase with trailing commas in functions (#2006)
* style: 💄 Update trailing commas in API * style: 💄 Update trailing commas in core * style: 💄 Update trailing commas in rose * style: 💄 Update trailing commas in admin * style: 💄 Update trailing commas in desktop
This commit is contained in:
1 parent
cb3a9e3bdc
commit
bcf004b8a4
423 files changed
+1636
-1605
No files matched your search
@@ -18,7 +18,7 @@ export default class ChannelRecordingAbility extends ModelAbility {
|
||||
const sessionRecording = this.model.connection_recording.session_recording;
|
||||
const sessionRecordingAbility = this.abilities.abilityFor(
|
||||
'session-recording',
|
||||
sessionRecording
|
||||
sessionRecording,
|
||||
);
|
||||
|
||||
return this.model.isAsciicast && sessionRecordingAbility.canDownload;
|
||||
|
||||
@@ -54,7 +54,7 @@ export default class RoleAbility extends ModelAbility {
|
||||
type === 'user' || type === 'group' || type === 'managed-group';
|
||||
if (!typeIsValid)
|
||||
throw new InvalidRolePrincipalTypeError(
|
||||
`Expected a role principal of type 'user', 'group', or 'managed-group'. Got '${type}'.`
|
||||
`Expected a role principal of type 'user', 'group', or 'managed-group'. Got '${type}'.`,
|
||||
);
|
||||
return this.can.can(`read ${type}`, this.model);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ function prenormalizeArrayResponse(response) {
|
||||
}
|
||||
|
||||
export default class ApplicationAdapter extends RESTAdapter.extend(
|
||||
AdapterBuildURLMixin
|
||||
AdapterBuildURLMixin,
|
||||
) {
|
||||
// =attributes
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class SessionRecordingAdapter extends ApplicationAdapter {
|
||||
throw this.handleResponse(
|
||||
response.status,
|
||||
response.headers,
|
||||
await response.text()
|
||||
await response.text(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export default class AccountModel extends GeneratedAccountModel {
|
||||
changePassword(
|
||||
currentPassword,
|
||||
newPassword,
|
||||
options = { adapterOptions: {} }
|
||||
options = { adapterOptions: {} },
|
||||
) {
|
||||
const defaultAdapterOptions = {
|
||||
method: 'change-password',
|
||||
|
||||
@@ -138,7 +138,7 @@ export default class RoleModel extends GeneratedRoleModel {
|
||||
const authMethods = this.resourceFilterStore.queryBy(
|
||||
'auth-method',
|
||||
{ type: [TYPE_AUTH_METHOD_OIDC, TYPE_AUTH_METHOD_LDAP] },
|
||||
{ scope_id: 'global', recursive: true }
|
||||
{ scope_id: 'global', recursive: true },
|
||||
);
|
||||
|
||||
// For each auth method, query all managed groups with IDs
|
||||
@@ -149,9 +149,9 @@ export default class RoleModel extends GeneratedRoleModel {
|
||||
methods.map(({ id: auth_method_id }) =>
|
||||
this.resourceFilterStore
|
||||
.queryBy('managed-group', { id: ids }, { auth_method_id })
|
||||
.then((models) => models.map((model) => model))
|
||||
)
|
||||
)
|
||||
.then((models) => models.map((model) => model)),
|
||||
),
|
||||
),
|
||||
)
|
||||
// The result is an array of arrays of model instances (grouped by
|
||||
// auth methods), so these must be flattened.
|
||||
|
||||
@@ -76,7 +76,7 @@ class SessionCredential {
|
||||
if (this.#payloadSecret?.decoded) {
|
||||
const secretJSON = this.#payloadSecret.decoded;
|
||||
return Object.keys(secretJSON).map(
|
||||
(key) => new SessionCredential.SecretItem(key, secretJSON[key])
|
||||
(key) => new SessionCredential.SecretItem(key, secretJSON[key]),
|
||||
);
|
||||
} else {
|
||||
// decode from base64
|
||||
|
||||
@@ -122,7 +122,7 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
*/
|
||||
get isActive() {
|
||||
const pendingOrActiveSessions = this.sessions.filter(
|
||||
(s) => s.isActive || s.isPending
|
||||
(s) => s.isActive || s.isPending,
|
||||
);
|
||||
return Boolean(pendingOrActiveSessions.length);
|
||||
}
|
||||
@@ -195,7 +195,7 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
*/
|
||||
addBrokeredCredentialSources(
|
||||
brokeredCredentialSourceIDs,
|
||||
options = { adapterOptions: {} }
|
||||
options = { adapterOptions: {} },
|
||||
) {
|
||||
const defaultAdapterOptions = {
|
||||
method: 'add-credential-sources',
|
||||
@@ -221,7 +221,7 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
*/
|
||||
addInjectedApplicationCredentialSources(
|
||||
injectedApplicationCredentialSourceIDs,
|
||||
options = { adapterOptions: {} }
|
||||
options = { adapterOptions: {} },
|
||||
) {
|
||||
const defaultAdapterOptions = {
|
||||
method: 'add-credential-sources',
|
||||
@@ -247,7 +247,7 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
*/
|
||||
removeBrokeredCredentialSources(
|
||||
brokeredCredentialSourceIDs,
|
||||
options = { adapterOptions: {} }
|
||||
options = { adapterOptions: {} },
|
||||
) {
|
||||
const defaultAdapterOptions = {
|
||||
method: 'remove-credential-sources',
|
||||
@@ -272,7 +272,7 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
removeBrokeredCredentialSource(brokeredCredentialSourceID, options) {
|
||||
return this.removeBrokeredCredentialSources(
|
||||
[brokeredCredentialSourceID],
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
*/
|
||||
removeInjectedApplicationCredentialSources(
|
||||
injectedApplicationCredentialSourceIDs,
|
||||
options = { adapterOptions: {} }
|
||||
options = { adapterOptions: {} },
|
||||
) {
|
||||
const defaultAdapterOptions = {
|
||||
method: 'remove-credential-sources',
|
||||
@@ -310,11 +310,11 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
*/
|
||||
removeInjectedApplicationCredentialSource(
|
||||
injectedApplicationCredentialSourceID,
|
||||
options
|
||||
options,
|
||||
) {
|
||||
return this.removeInjectedApplicationCredentialSources(
|
||||
[injectedApplicationCredentialSourceID],
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export default class WorkerModel extends GeneratedWorkerModel {
|
||||
|
||||
return Object.values(this.config_tags).reduce(
|
||||
(previousCount, currentTags) => previousCount + currentTags.length,
|
||||
0
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export default class WorkerModel extends GeneratedWorkerModel {
|
||||
}
|
||||
|
||||
return Object.entries(this.config_tags).flatMap(([key, value]) =>
|
||||
value.map((tag) => ({ key, value: tag }))
|
||||
value.map((tag) => ({ key, value: tag })),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ export default class AccountSerializer extends ApplicationSerializer {
|
||||
serialized = this.serializeForChangePassword(
|
||||
snapshot,
|
||||
currentPassword,
|
||||
newPassword
|
||||
newPassword,
|
||||
);
|
||||
}
|
||||
return serialized;
|
||||
|
||||
@@ -145,7 +145,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
const transformedPayload = {};
|
||||
// Find the Ember-data-expected root key name.
|
||||
const payloadKey = this.payloadKeyFromModelName(
|
||||
primaryModelClass.modelName
|
||||
primaryModelClass.modelName,
|
||||
);
|
||||
// Copy the data rooted under `items` in the existing payload into the new
|
||||
// payload under the expected root key name.
|
||||
@@ -156,7 +156,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
primaryModelClass,
|
||||
transformedPayload,
|
||||
id,
|
||||
requestType
|
||||
requestType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
const transformedPayload = {};
|
||||
// Find the Ember-data-expected root key name.
|
||||
const payloadKey = this.payloadKeyFromModelName(
|
||||
primaryModelClass.modelName
|
||||
primaryModelClass.modelName,
|
||||
);
|
||||
// Copy the unrooted payload under the expected root key name.
|
||||
transformedPayload[payloadKey] = payload;
|
||||
@@ -193,7 +193,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
primaryModelClass,
|
||||
transformedPayload,
|
||||
id,
|
||||
requestType
|
||||
requestType,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
primaryModelClass,
|
||||
payload,
|
||||
id,
|
||||
requestType
|
||||
requestType,
|
||||
) {
|
||||
const newPayload = structuredClone(payload);
|
||||
|
||||
@@ -338,7 +338,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
primaryModelClass,
|
||||
newPayload,
|
||||
id,
|
||||
requestType
|
||||
requestType,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export default class AuthMethodSerializer extends ApplicationSerializer {
|
||||
normalizeArrayResponse() {
|
||||
const normalized = super.normalizeArrayResponse(...arguments);
|
||||
normalized.data = normalized.data.sort((a) =>
|
||||
a.attributes.is_primary ? -1 : 1
|
||||
a.attributes.is_primary ? -1 : 1,
|
||||
);
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import ApplicationSerializer from './application';
|
||||
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
||||
|
||||
export default class ConnectionSerializer extends ApplicationSerializer.extend(
|
||||
EmbeddedRecordsMixin
|
||||
EmbeddedRecordsMixin,
|
||||
) {
|
||||
attrs = {
|
||||
channel_recordings: { embedded: 'always' },
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class CredentialSerializer extends ApplicationSerializer {
|
||||
|
||||
if (serialized?.attributes?.json_object) {
|
||||
serialized.attributes.object = JSON.parse(
|
||||
serialized.attributes.json_object
|
||||
serialized.attributes.json_object,
|
||||
);
|
||||
delete serialized.attributes.json_object;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import ApplicationSerializer from './application';
|
||||
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
|
||||
export default class RecordingSerializer extends ApplicationSerializer.extend(
|
||||
EmbeddedRecordsMixin
|
||||
EmbeddedRecordsMixin,
|
||||
) {
|
||||
attrs = {
|
||||
connection_recordings: { embedded: 'always' },
|
||||
|
||||
@@ -36,12 +36,12 @@ export default class TargetSerializer extends ApplicationSerializer {
|
||||
if (brokeredCredentialSourceIDs)
|
||||
serialized = this.serializeWithBrokeredCredentialSources(
|
||||
snapshot,
|
||||
brokeredCredentialSourceIDs
|
||||
brokeredCredentialSourceIDs,
|
||||
);
|
||||
if (injectedApplicationCredentialSourceIDs)
|
||||
serialized = this.serializeWithInjectedApplicationCredentialSources(
|
||||
snapshot,
|
||||
injectedApplicationCredentialSourceIDs
|
||||
injectedApplicationCredentialSourceIDs,
|
||||
);
|
||||
|
||||
// Delete session recording related fields from non-SSH targets
|
||||
@@ -75,7 +75,7 @@ export default class TargetSerializer extends ApplicationSerializer {
|
||||
*/
|
||||
serializeWithBrokeredCredentialSources(
|
||||
snapshot,
|
||||
brokered_credential_source_ids
|
||||
brokered_credential_source_ids,
|
||||
) {
|
||||
return {
|
||||
version: snapshot.attr('version'),
|
||||
@@ -92,7 +92,7 @@ export default class TargetSerializer extends ApplicationSerializer {
|
||||
*/
|
||||
serializeWithInjectedApplicationCredentialSources(
|
||||
snapshot,
|
||||
injected_application_credential_source_ids
|
||||
injected_application_credential_source_ids,
|
||||
) {
|
||||
return {
|
||||
version: snapshot.attr('version'),
|
||||
|
||||
@@ -22,7 +22,7 @@ export default class WorkerSerializer extends ApplicationSerializer {
|
||||
if (workerGeneratedAuthToken)
|
||||
serialized = this.serializeWithGeneratedToken(
|
||||
snapshot,
|
||||
workerGeneratedAuthToken
|
||||
workerGeneratedAuthToken,
|
||||
);
|
||||
return serialized;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ export class ResourceFilter {
|
||||
return this.in(value.contains, key);
|
||||
}
|
||||
return this.equals(key, value);
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
);
|
||||
})
|
||||
.flat()
|
||||
|
||||
Reference in new issue
Block a user