refactor: 💡 upgrade addons/api to Ember 3.24
This commit is contained in:
92 files changed
+1348
-621
No files matched your search
@@ -18,7 +18,8 @@ export default class GeneratedRoleModel extends BaseModel {
|
||||
description;
|
||||
|
||||
@attr('string', {
|
||||
description: 'The scope to which this role applies. Defaults to the role\'s scope.',
|
||||
description:
|
||||
"The scope to which this role applies. Defaults to the role's scope.",
|
||||
})
|
||||
grant_scope_id;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
export default class GeneratedSessionModel extends BaseModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@attr('string') user_id;
|
||||
@@ -32,5 +31,4 @@ export default class GeneratedSessionModel extends BaseModel {
|
||||
description: 'Current version number of this resource.',
|
||||
})
|
||||
version;
|
||||
|
||||
}
|
||||
@@ -24,13 +24,13 @@ export default class GeneratedTargetModel extends BaseModel {
|
||||
|
||||
@attr('number', {
|
||||
description: '',
|
||||
defaultValue: 28800
|
||||
defaultValue: 28800,
|
||||
})
|
||||
session_max_seconds;
|
||||
|
||||
@attr('number', {
|
||||
description: '',
|
||||
defaultValue: 1
|
||||
defaultValue: 1,
|
||||
})
|
||||
session_connection_limit;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { computed } from '@ember/object';
|
||||
import { equal } from '@ember/object/computed';
|
||||
|
||||
export default class AccountModel extends GeneratedAccountModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,6 @@ import { computed } from '@ember/object';
|
||||
* 2) Or as an ID: `record.scopeID`.
|
||||
*/
|
||||
export default class BaseModel extends Model {
|
||||
|
||||
// =relationships
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@ import GeneratedHostSetModel from '../generated/models/host-set';
|
||||
import { fragmentArray } from 'ember-data-model-fragments/attributes';
|
||||
|
||||
export default class HostSetModel extends GeneratedHostSetModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,9 @@ import GeneratedHostModel from '../generated/models/host';
|
||||
import { fragment } from 'ember-data-model-fragments/attributes';
|
||||
|
||||
export default class HostModel extends GeneratedHostModel {
|
||||
|
||||
/**
|
||||
* Attributes of this resource, if any, represented as a JSON fragment.
|
||||
* @type {FragmentHostAttributesModel}
|
||||
*/
|
||||
@fragment('fragment-host-attributes', { defaultValue: {} }) attributes;
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export default class RoleModel extends GeneratedRoleModel {
|
||||
return this.save({
|
||||
adapterOptions: {
|
||||
method: 'set-grants',
|
||||
grantStrings
|
||||
grantStrings,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { equal } from '@ember/object/computed';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
export default class SessionModel extends GeneratedSessionModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
@attr('string', { readOnly: true }) proxy_address;
|
||||
@@ -61,5 +60,4 @@ export default class SessionModel extends GeneratedSessionModel {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,8 +41,9 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
* @type {SessionModel[]}
|
||||
*/
|
||||
get sessions() {
|
||||
return this.store.peekAll('session')
|
||||
.filter(s => s && (s.target_id === this.id));
|
||||
return this.store
|
||||
.peekAll('session')
|
||||
.filter((s) => s && s.target_id === this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,8 +59,9 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isActive() {
|
||||
const pendingOrActiveSessions =
|
||||
this.sessions.filter(s => s.isActive || s.isPending);
|
||||
const pendingOrActiveSessions = this.sessions.filter(
|
||||
(s) => s.isActive || s.isPending
|
||||
);
|
||||
return Boolean(pendingOrActiveSessions.length);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import { attr } from '@ember-data/model';
|
||||
import { A } from '@ember/array';
|
||||
|
||||
export default class UserModel extends GeneratedUserModel {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
@@ -74,5 +73,4 @@ export default class UserModel extends GeneratedUserModel {
|
||||
removeAccount(accountID, options) {
|
||||
return this.removeAccounts([accountID], options);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class AccountSerializer extends ApplicationSerializer {
|
||||
|
||||
// =properties
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import { copy } from 'ember-copy';
|
||||
* Manages serialization/normalization of data to/from the API.
|
||||
*/
|
||||
export default class ApplicationSerializer extends RESTSerializer {
|
||||
|
||||
// =properties
|
||||
|
||||
/**
|
||||
@@ -82,7 +81,7 @@ export default class ApplicationSerializer extends RESTSerializer {
|
||||
// Delete `scope` field
|
||||
delete serialized.scope;
|
||||
// And serialize `scope_id`
|
||||
if(this.serializeScopeID) {
|
||||
if (this.serializeScopeID) {
|
||||
const scope_id = snapshot?.attr('scope')?.attr('scope_id');
|
||||
if (scope_id) serialized.scope_id = scope_id;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class HostSetSerializer extends ApplicationSerializer {
|
||||
|
||||
// =properties
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class HostSerializer extends ApplicationSerializer {
|
||||
|
||||
// =properties
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
serializeScopeID = false;
|
||||
|
||||
}
|
||||
@@ -17,8 +17,8 @@ export default class RoleSerializer extends ApplicationSerializer {
|
||||
serialize(snapshot) {
|
||||
const grantStrings = get(snapshot, 'adapterOptions.grantStrings');
|
||||
let serialized = super.serialize(...arguments);
|
||||
if (grantStrings) serialized =
|
||||
this.serializeWithGrantStrings(snapshot, grantStrings);
|
||||
if (grantStrings)
|
||||
serialized = this.serializeWithGrantStrings(snapshot, grantStrings);
|
||||
const principalIDs = snapshot?.adapterOptions?.principalIDs;
|
||||
if (principalIDs)
|
||||
serialized = this.serializewithPrincipals(snapshot, principalIDs);
|
||||
@@ -34,7 +34,7 @@ export default class RoleSerializer extends ApplicationSerializer {
|
||||
serializeWithGrantStrings(snapshot, grantStrings) {
|
||||
return {
|
||||
version: snapshot.attr('version'),
|
||||
grant_strings: grantStrings
|
||||
grant_strings: grantStrings,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ export default class UserSerializer extends ApplicationSerializer {
|
||||
serialize(snapshot) {
|
||||
let serialized = super.serialize(...arguments);
|
||||
const accountIDs = snapshot?.adapterOptions?.accountIDs;
|
||||
if (accountIDs) serialized =
|
||||
this.serializewithAccounts(snapshot, accountIDs);
|
||||
if (accountIDs)
|
||||
serialized = this.serializewithAccounts(snapshot, accountIDs);
|
||||
return serialized;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user