diff --git a/addons/api/addon/models/fragment-host-source.js b/addons/api/addon/models/fragment-host-source.js index 66532f7d4..242891371 100644 --- a/addons/api/addon/models/fragment-host-source.js +++ b/addons/api/addon/models/fragment-host-source.js @@ -7,7 +7,7 @@ export default class FragmentHostSourceModel extends Fragment { @attr('string', { description: 'ID of the related host set', }) - host_set_id; + host_source_id; @attr('string', { description: 'ID of the catalog to which the host set belongs', diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 829455a88..305c63cb1 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -39,8 +39,8 @@ export default class TargetModel extends GeneratedTargetModel { @computed('host_sets.[]', 'store') get hostSets() { return this.host_sets - .map(({ host_set_id, host_catalog_id }) => ({ - model: this.store.peekRecord('host-set', host_set_id), + .map(({ host_source_id, host_catalog_id }) => ({ + model: this.store.peekRecord('host-set', host_source_id), hostCatalog: this.store.peekRecord('host-catalog', host_catalog_id), })) .filter((hostSetRef) => hostSetRef.model !== null); diff --git a/addons/api/addon/serializers/fragment-host-source.js b/addons/api/addon/serializers/fragment-host-source.js index 01da7ad84..f4467f151 100644 --- a/addons/api/addon/serializers/fragment-host-source.js +++ b/addons/api/addon/serializers/fragment-host-source.js @@ -4,13 +4,13 @@ export default class FragmentHostSourceSerializer extends JSONSerializer { // =methods /** - * Renames `id` to `host_set_id` because fragments may not have IDs. + * Renames `id` to `host_source_id` because fragments may not have IDs. * Otherwise normalizes as normal. * @param {ModelClass} typeClass * @param {object} resourceHash * @return {object} */ - normalize(typeClass, { id: host_set_id, ...obj }) { - return super.normalize(typeClass, { host_set_id, ...obj }); + normalize(typeClass, { id: host_source_id, ...obj }) { + return super.normalize(typeClass, { host_source_id, ...obj }); } } diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index 1c6fa2b22..2721480e2 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -15,8 +15,8 @@ module('Unit | Model | target', function (hooks) { type: 'target', attributes: { host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '2' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '2' }, ], }, }, @@ -91,8 +91,8 @@ module('Unit | Model | target', function (hooks) { name: 'Target', description: 'Description', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], version: 1, scope: { @@ -128,8 +128,8 @@ module('Unit | Model | target', function (hooks) { name: 'Target', description: 'Description', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], version: 1, scope: { @@ -165,8 +165,8 @@ module('Unit | Model | target', function (hooks) { name: 'Target', description: 'Description', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], version: 1, scope: { diff --git a/addons/api/tests/unit/serializers/fragment-host-source-test.js b/addons/api/tests/unit/serializers/fragment-host-source-test.js index 6631288b2..5dee0ecb7 100644 --- a/addons/api/tests/unit/serializers/fragment-host-source-test.js +++ b/addons/api/tests/unit/serializers/fragment-host-source-test.js @@ -5,7 +5,7 @@ import FragmentHostSource from 'api/models/fragment-host-source'; module('Unit | Serializer | fragment host source', function (hooks) { setupTest(hooks); - test('it normalizes `id` into `host_set_id`', function (assert) { + test('it normalizes `id` into `host_source_id`', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('fragment-host-source'); @@ -16,7 +16,7 @@ module('Unit | Serializer | fragment host source', function (hooks) { assert.deepEqual(normalized, { data: { attributes: { - host_set_id: '2', + host_source_id: '2', host_catalog_id: '1', }, id: null, diff --git a/addons/api/tests/unit/serializers/target-test.js b/addons/api/tests/unit/serializers/target-test.js index d7103cc0e..ea2e5b3c8 100644 --- a/addons/api/tests/unit/serializers/target-test.js +++ b/addons/api/tests/unit/serializers/target-test.js @@ -12,8 +12,8 @@ module('Unit | Serializer | target', function (hooks) { name: 'User', description: 'Description', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], application_credential_library_ids: [{ value: '1' }, { value: '2' }], scope: { @@ -48,8 +48,8 @@ module('Unit | Serializer | target', function (hooks) { name: 'User', description: 'Description', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], version: 1, }); @@ -94,8 +94,8 @@ module('Unit | Serializer | target', function (hooks) { id: '1', name: 'Target 1', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], application_credential_library_ids: ['1'], }; @@ -113,8 +113,8 @@ module('Unit | Serializer | target', function (hooks) { authorized_actions: [], name: 'Target 1', host_sets: [ - { host_set_id: '1', host_catalog_id: '2' }, - { host_set_id: '3', host_catalog_id: '4' }, + { host_source_id: '1', host_catalog_id: '2' }, + { host_source_id: '3', host_catalog_id: '4' }, ], application_credential_library_ids: [{ value: '1' }], }, diff --git a/ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js b/ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js index 930b1e083..627954f30 100644 --- a/ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js +++ b/ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js @@ -13,6 +13,6 @@ export default class ScopesScopeTargetsTargetHostSetsController extends Controll * @type {string} */ get breadCrumb() { - return this.intl.t('resources.host-set.title_plural'); + return this.intl.t('resources.target.host-set.title_plural'); } } diff --git a/ui/admin/app/routes/scopes/scope/targets/target/host-sets.js b/ui/admin/app/routes/scopes/scope/targets/target/host-sets.js index 8bc1b1bd0..120de013a 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/host-sets.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/host-sets.js @@ -22,7 +22,7 @@ export default class ScopesScopeTargetsTargetHostSetsRoute extends Route { beforeModel() { const { scopeID, host_sets } = this.modelFor('scopes.scope.targets.target'); const promises = host_sets.map( - ({ host_set_id, host_catalog_id: hostCatalogID }) => + ({ host_source_id, host_catalog_id: hostCatalogID }) => hash({ // TODO: multiple host sets may belong to the same catalog, // resulting in the catalog being loaded multiple times. @@ -30,7 +30,7 @@ export default class ScopesScopeTargetsTargetHostSetsRoute extends Route { hostCatalog: this.store.findRecord('host-catalog', hostCatalogID, { adapterOptions: { scopeID }, }), - hostSet: this.store.findRecord('host-set', host_set_id, { + hostSet: this.store.findRecord('host-set', host_source_id, { adapterOptions: { scopeID, hostCatalogID }, }), }) diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets/target/hosts.js b/ui/desktop/app/routes/scopes/scope/projects/targets/target/hosts.js index f43e8bab4..b155f20c6 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/target/hosts.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/target/hosts.js @@ -21,8 +21,8 @@ export default class ScopesScopeProjectsTargetsTargetHostsRoute extends Route { const target = this.modelFor('scopes.scope.projects.targets.target'); // Load all host-sets const hostSets = await all( - target.host_sets.map(({ host_set_id }) => - this.store.findRecord('host-set', host_set_id) + target.host_sets.map(({ host_source_id }) => + this.store.findRecord('host-set', host_source_id) ) );