chore: rename to application_credential_source_ids

This commit is contained in:
Randall Morey committed 2021-09-22 17:39:15 -04:00
1 parent 735878b7ef
commit 8b09f132e0
9 files changed
+31 -31

No files matched your search

+3 -3
View File
@@ -28,7 +28,7 @@ export default class TargetModel extends GeneratedTargetModel {
readOnly: true,
emptyArrayIfMissing: true,
})
application_credential_library_ids;
application_credential_source_ids;
/**
* An array of resolved host set and host catalog instances. Model instances
@@ -52,9 +52,9 @@ export default class TargetModel extends GeneratedTargetModel {
* instances). Unresolvable instances are excluded from the array.
* @type {[CredentialLibraryModel]}
*/
@computed('application_credential_library_ids.[]', 'store')
@computed('application_credential_source_ids.[]', 'store')
get credentialLibraries() {
return this.application_credential_library_ids
return this.application_credential_source_ids
.map((credential_library_fragment) =>
this.store.peekRecord(
'credential-library',
+1 -1
View File
@@ -54,7 +54,7 @@ export default class TargetSerializer extends ApplicationSerializer {
serializeWithCredentialSources(snapshot, credentialSourceIDs) {
return {
version: snapshot.attr('version'),
application_credential_library_ids: credentialSourceIDs,
application_credential_source_ids: credentialSourceIDs,
};
}
}
+2 -2
View File
@@ -386,7 +386,7 @@ export default function () {
// If adding credential libraries, push them into the array
if (method === 'add-credential-libraries') {
updatedAttrs.credentialLibraryIds = target.credentialLibraryIds;
attrs.applicationCredentialLibraryIds.forEach((id) => {
attrs.applicationCredentialSourceIds.forEach((id) => {
if (!updatedAttrs.credentialLibraryIds.includes(id)) {
updatedAttrs.credentialLibraryIds.push(id);
}
@@ -397,7 +397,7 @@ export default function () {
updatedAttrs.credentialLibraryIds = target.credentialLibraryIds;
updatedAttrs.credentialLibraryIds =
updatedAttrs.credentialLibraryIds.filter((id) => {
return !attrs.applicationCredentialLibraryIds.includes(id);
return !attrs.applicationCredentialSourceIds.includes(id);
});
}
return target.update(updatedAttrs);
+1 -1
View File
@@ -24,7 +24,7 @@ export default ApplicationSerializer.extend({
});
}
if (model.credentialLibraryIds?.length) {
json.application_credential_library_ids = model.credentialLibraryIds;
json.application_credential_source_ids = model.credentialLibraryIds;
}
return json;
},
+14 -14
View File
@@ -232,15 +232,15 @@ module('Unit | Model | target', function (hooks) {
id: '123abc',
type: 'target',
attributes: {
application_credential_library_ids: [{ value: '1' }, { value: '2' }],
application_credential_source_ids: [{ value: '1' }, { value: '2' }],
},
},
});
const target = store.peekRecord('target', '123abc');
assert.equal(
target.application_credential_library_ids.length,
target.application_credential_source_ids.length,
2,
'Target has two entires in application_credential_library_ids'
'Target has two entires in application_credential_source_ids'
);
assert.equal(
target.credentialLibraries.length,
@@ -261,17 +261,17 @@ module('Unit | Model | target', function (hooks) {
attributes: {},
},
});
// Since `credentialLibraries` is computed on `application_credential_library_ids`,
// Since `credentialLibraries` is computed on `application_credential_source_ids`,
// not the store itself, it's necessary to do this assignment to kick-off the
// computed update.
/* eslint-disable no-self-assign */
target.application_credential_library_ids =
target.application_credential_library_ids;
target.application_credential_source_ids =
target.application_credential_source_ids;
/* eslint-enable no-self-assign */
assert.equal(
target.application_credential_library_ids.length,
target.application_credential_source_ids.length,
2,
'Target has two entires in application_credential_library_ids'
'Target has two entires in application_credential_source_ids'
);
assert.equal(
target.credentialLibraries.length,
@@ -287,7 +287,7 @@ module('Unit | Model | target', function (hooks) {
(schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
application_credential_library_ids: ['123_abc', 'foobar'],
application_credential_source_ids: ['123_abc', 'foobar'],
version: 1,
});
return { id: '123abc' };
@@ -301,7 +301,7 @@ module('Unit | Model | target', function (hooks) {
attributes: {
name: 'Target',
description: 'Description',
application_credential_library_ids: [{ value: '1' }, { value: '2' }],
application_credential_source_ids: [{ value: '1' }, { value: '2' }],
version: 1,
scope: {
scope_id: 'o_1',
@@ -321,7 +321,7 @@ module('Unit | Model | target', function (hooks) {
(schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
application_credential_library_ids: ['1', '2'],
application_credential_source_ids: ['1', '2'],
version: 1,
});
return { id: '123abc' };
@@ -335,7 +335,7 @@ module('Unit | Model | target', function (hooks) {
attributes: {
name: 'Target',
description: 'Description',
application_credential_library_ids: [{ value: '1' }, { value: '2' }],
application_credential_source_ids: [{ value: '1' }, { value: '2' }],
version: 1,
scope: {
scope_id: 'o_1',
@@ -355,7 +355,7 @@ module('Unit | Model | target', function (hooks) {
(schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
application_credential_library_ids: ['2'],
application_credential_source_ids: ['2'],
version: 1,
});
return { id: '123abc' };
@@ -369,7 +369,7 @@ module('Unit | Model | target', function (hooks) {
attributes: {
name: 'Target',
description: 'Description',
application_credential_library_ids: [{ value: '1' }, { value: '2' }],
application_credential_source_ids: [{ value: '1' }, { value: '2' }],
version: 1,
scope: {
scope_id: 'o_1',
@@ -205,7 +205,7 @@ module('Unit | Serializer | application', function (hooks) {
name: 'Target 1',
scope: { scope_id: 'o_123' },
host_sets: [],
application_credential_library_ids: [],
application_credential_source_ids: [],
},
relationships: {},
},
@@ -15,7 +15,7 @@ module('Unit | Serializer | target', function (hooks) {
{ host_source_id: '1', host_catalog_id: '2' },
{ host_source_id: '3', host_catalog_id: '4' },
],
application_credential_library_ids: [{ value: '1' }, { value: '2' }],
application_credential_source_ids: [{ value: '1' }, { value: '2' }],
scope: {
scope_id: 'org_1',
type: 'org',
@@ -71,7 +71,7 @@ module('Unit | Serializer | target', function (hooks) {
const record = store.createRecord('target', {
name: 'User',
description: 'Description',
application_credential_library_ids: [{ value: '1' }, { value: '2' }],
application_credential_source_ids: [{ value: '1' }, { value: '2' }],
version: 1,
});
const snapshot = record._createSnapshot();
@@ -80,7 +80,7 @@ module('Unit | Serializer | target', function (hooks) {
};
const serializedRecord = serializer.serialize(snapshot);
assert.deepEqual(serializedRecord, {
application_credential_library_ids: ['4', '5'],
application_credential_source_ids: ['4', '5'],
version: 1,
});
});
@@ -97,7 +97,7 @@ module('Unit | Serializer | target', function (hooks) {
{ host_source_id: '1', host_catalog_id: '2' },
{ host_source_id: '3', host_catalog_id: '4' },
],
application_credential_library_ids: ['1'],
application_credential_source_ids: ['1'],
};
const normalized = serializer.normalizeSingleResponse(
store,
@@ -116,7 +116,7 @@ module('Unit | Serializer | target', function (hooks) {
{ host_source_id: '1', host_catalog_id: '2' },
{ host_source_id: '3', host_catalog_id: '4' },
],
application_credential_library_ids: [{ value: '1' }],
application_credential_source_ids: [{ value: '1' }],
},
relationships: {},
},
@@ -148,7 +148,7 @@ module('Unit | Serializer | target', function (hooks) {
name: 'Target 1',
scope: { scope_id: 'o_123' },
host_sets: [],
application_credential_library_ids: [],
application_credential_source_ids: [],
},
relationships: {},
},
@@ -26,12 +26,12 @@ export default class FormTargetAddCredentialLibrariesIndexComponent extends Comp
* @type {[CredentialLibraryModel]}
*/
@computed(
'args.{credentialLibraries.[],model.application_credential_library_ids.[]}'
'args.{credentialLibraries.[],model.application_credential_source_ids.[]}'
)
get filteredCredentialLibraries() {
// Get IDs for credential libraries already added to the current target
const currentCredentialLibraryIDs =
this.args.model.application_credential_library_ids.map(
this.args.model.application_credential_source_ids.map(
(credentialLibrary) => credentialLibrary.value
);
const notAddedCredentialLibraries = this.args.credentialLibraries.filter(
@@ -13,7 +13,7 @@ export default class ScopesScopeTargetsTargetCredentialSourcesRoute extends Rout
* @return {Promise{[CredentialLibraryModel]}}
*/
beforeModel() {
const { application_credential_library_ids: credential_libraries } =
const { application_credential_source_ids: credential_libraries } =
this.modelFor('scopes.scope.targets.target');
return all(
credential_libraries.map((credential_library) =>