From 10da4af957e42718836ed3891dcd7ffc84f3d120 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Mon, 20 Sep 2021 15:10:04 -0400 Subject: [PATCH 01/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20change=20fragment?= =?UTF-8?q?-host-set=20to=20fragment-host-source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{fragment-host-set.js => fragment-host-source.js} | 2 +- addons/api/addon/models/target.js | 4 ++-- ...ragment-auth-method-attributes-account-claim-map.js | 2 +- .../{fragment-host-set.js => fragment-host-source.js} | 2 +- addons/api/app/models/fragment-host-set.js | 1 - addons/api/app/models/fragment-host-source.js | 1 + addons/api/app/serializers/fragment-host-set.js | 1 - addons/api/app/serializers/fragment-host-source.js | 1 + ...t-host-set-test.js => fragment-host-source-test.js} | 4 ++-- ...t-host-set-test.js => fragment-host-source-test.js} | 10 +++++----- 10 files changed, 14 insertions(+), 14 deletions(-) rename addons/api/addon/models/{fragment-host-set.js => fragment-host-source.js} (83%) rename addons/api/addon/serializers/{fragment-host-set.js => fragment-host-source.js} (84%) delete mode 100644 addons/api/app/models/fragment-host-set.js create mode 100644 addons/api/app/models/fragment-host-source.js delete mode 100644 addons/api/app/serializers/fragment-host-set.js create mode 100644 addons/api/app/serializers/fragment-host-source.js rename addons/api/tests/unit/models/{fragment-host-set-test.js => fragment-host-source-test.js} (63%) rename addons/api/tests/unit/serializers/{fragment-host-set-test.js => fragment-host-source-test.js} (62%) diff --git a/addons/api/addon/models/fragment-host-set.js b/addons/api/addon/models/fragment-host-source.js similarity index 83% rename from addons/api/addon/models/fragment-host-set.js rename to addons/api/addon/models/fragment-host-source.js index e0f3a1e1c..66532f7d4 100644 --- a/addons/api/addon/models/fragment-host-set.js +++ b/addons/api/addon/models/fragment-host-source.js @@ -1,7 +1,7 @@ import Fragment from 'ember-data-model-fragments/fragment'; import { attr } from '@ember-data/model'; -export default class FragmentHostSetModel extends Fragment { +export default class FragmentHostSourceModel extends Fragment { // =attributes @attr('string', { diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index d60596465..829455a88 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -12,9 +12,9 @@ export default class TargetModel extends GeneratedTargetModel { @fragment('fragment-target-attributes', { defaultValue: {} }) attributes; /** - * @type {[FragmentHostSetModel]} + * @type {[FragmentHostSourceModel]} */ - @fragmentArray('fragment-host-set', { + @fragmentArray('fragment-host-source', { readOnly: true, emptyArrayIfMissing: true, }) diff --git a/addons/api/addon/serializers/fragment-auth-method-attributes-account-claim-map.js b/addons/api/addon/serializers/fragment-auth-method-attributes-account-claim-map.js index 5c5b4789e..611f6aa13 100644 --- a/addons/api/addon/serializers/fragment-auth-method-attributes-account-claim-map.js +++ b/addons/api/addon/serializers/fragment-auth-method-attributes-account-claim-map.js @@ -1,6 +1,6 @@ import JSONSerializer from '@ember-data/serializer/json'; -export default class FragmentHostSetSerializer extends JSONSerializer { +export default class FragmentHostSourceSerializer extends JSONSerializer { // =methods /** diff --git a/addons/api/addon/serializers/fragment-host-set.js b/addons/api/addon/serializers/fragment-host-source.js similarity index 84% rename from addons/api/addon/serializers/fragment-host-set.js rename to addons/api/addon/serializers/fragment-host-source.js index 564c7ec9b..01da7ad84 100644 --- a/addons/api/addon/serializers/fragment-host-set.js +++ b/addons/api/addon/serializers/fragment-host-source.js @@ -1,6 +1,6 @@ import JSONSerializer from '@ember-data/serializer/json'; -export default class FragmentHostSetSerializer extends JSONSerializer { +export default class FragmentHostSourceSerializer extends JSONSerializer { // =methods /** diff --git a/addons/api/app/models/fragment-host-set.js b/addons/api/app/models/fragment-host-set.js deleted file mode 100644 index bd1726680..000000000 --- a/addons/api/app/models/fragment-host-set.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'api/models/fragment-host-set'; diff --git a/addons/api/app/models/fragment-host-source.js b/addons/api/app/models/fragment-host-source.js new file mode 100644 index 000000000..20b7480cc --- /dev/null +++ b/addons/api/app/models/fragment-host-source.js @@ -0,0 +1 @@ +export { default } from 'api/models/fragment-host-source'; diff --git a/addons/api/app/serializers/fragment-host-set.js b/addons/api/app/serializers/fragment-host-set.js deleted file mode 100644 index 62d638912..000000000 --- a/addons/api/app/serializers/fragment-host-set.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'api/serializers/fragment-host-set'; diff --git a/addons/api/app/serializers/fragment-host-source.js b/addons/api/app/serializers/fragment-host-source.js new file mode 100644 index 000000000..6e5a68c75 --- /dev/null +++ b/addons/api/app/serializers/fragment-host-source.js @@ -0,0 +1 @@ +export { default } from 'api/serializers/fragment-host-source'; diff --git a/addons/api/tests/unit/models/fragment-host-set-test.js b/addons/api/tests/unit/models/fragment-host-source-test.js similarity index 63% rename from addons/api/tests/unit/models/fragment-host-set-test.js rename to addons/api/tests/unit/models/fragment-host-source-test.js index 3031c94f5..69cde9319 100644 --- a/addons/api/tests/unit/models/fragment-host-set-test.js +++ b/addons/api/tests/unit/models/fragment-host-source-test.js @@ -1,12 +1,12 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Model | fragment host set', function (hooks) { +module('Unit | Model | fragment host source', function (hooks) { setupTest(hooks); test('it exists', function (assert) { let store = this.owner.lookup('service:store'); - let model = store.createRecord('fragment-host-set', {}); + let model = store.createRecord('fragment-host-source', {}); assert.ok(model); }); }); diff --git a/addons/api/tests/unit/serializers/fragment-host-set-test.js b/addons/api/tests/unit/serializers/fragment-host-source-test.js similarity index 62% rename from addons/api/tests/unit/serializers/fragment-host-set-test.js rename to addons/api/tests/unit/serializers/fragment-host-source-test.js index 61285678d..6631288b2 100644 --- a/addons/api/tests/unit/serializers/fragment-host-set-test.js +++ b/addons/api/tests/unit/serializers/fragment-host-source-test.js @@ -1,15 +1,15 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -import FragmentHostSet from 'api/models/fragment-host-set'; +import FragmentHostSource from 'api/models/fragment-host-source'; -module('Unit | Serializer | fragment host set', function (hooks) { +module('Unit | Serializer | fragment host source', function (hooks) { setupTest(hooks); test('it normalizes `id` into `host_set_id`', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); - const serializer = store.serializerFor('fragment-host-set'); - const normalized = serializer.normalize(FragmentHostSet, { + const serializer = store.serializerFor('fragment-host-source'); + const normalized = serializer.normalize(FragmentHostSource, { id: '2', host_catalog_id: '1', }); @@ -21,7 +21,7 @@ module('Unit | Serializer | fragment host set', function (hooks) { }, id: null, relationships: {}, - type: 'fragment-host-set', + type: 'fragment-host-source', }, }); }); From fb734eb61b4b63d645c812e356c591100a9c453d Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 21 Sep 2021 09:37:47 -0400 Subject: [PATCH 02/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20rename=20host=5Fs?= =?UTF-8?q?et=5Fid=20to=20host=5Fsource=5Fid=20internally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/fragment-host-source.js | 2 +- addons/api/addon/models/target.js | 4 ++-- .../addon/serializers/fragment-host-source.js | 6 +++--- addons/api/tests/unit/models/target-test.js | 16 ++++++++-------- .../serializers/fragment-host-source-test.js | 4 ++-- addons/api/tests/unit/serializers/target-test.js | 16 ++++++++-------- .../scopes/scope/targets/target/host-sets.js | 2 +- .../scopes/scope/targets/target/host-sets.js | 4 ++-- .../scope/projects/targets/target/hosts.js | 4 ++-- 9 files changed, 29 insertions(+), 29 deletions(-) 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) ) ); From 64fccf87531269fff428f4af58e205356deacbb7 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 21 Sep 2021 10:57:01 -0400 Subject: [PATCH 03/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20rename=20translat?= =?UTF-8?q?ions=20and=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/fragment-host-source.js | 2 +- addons/core/translations/resources/en-us.yaml | 4 ++-- .../form/target/add-credential-libraries/index.hbs | 4 ++-- ui/admin/app/components/form/target/add-host-sets/index.hbs | 4 ++-- .../controllers/scopes/scope/targets/target/host-sets.js | 2 +- .../templates/scopes/scope/targets/target/-navigation.hbs | 4 ++-- .../scope/targets/target/add-credential-libraries.hbs | 4 ++-- .../targets/target/add-credential-libraries/-header.hbs | 4 ++-- .../templates/scopes/scope/targets/target/add-host-sets.hbs | 4 ++-- .../scopes/scope/targets/target/add-host-sets/-header.hbs | 4 ++-- .../scopes/scope/targets/target/credential-libraries.hbs | 6 +++--- .../app/templates/scopes/scope/targets/target/host-sets.hbs | 6 +++--- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/addons/api/addon/models/fragment-host-source.js b/addons/api/addon/models/fragment-host-source.js index 242891371..5f39cb8f7 100644 --- a/addons/api/addon/models/fragment-host-source.js +++ b/addons/api/addon/models/fragment-host-source.js @@ -5,7 +5,7 @@ export default class FragmentHostSourceModel extends Fragment { // =attributes @attr('string', { - description: 'ID of the related host set', + description: 'ID of the related host source', }) host_source_id; diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 4d373e26d..f6b3373c8 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -257,7 +257,7 @@ target: add-credential-libraries: Add Credential Sources types: tcp: TCP - host-set: + host-source: title: Host Source title_plural: Host Sources messages: @@ -270,7 +270,7 @@ target: add: title: Add Host Sources description: Select host sources to assign to this target. - credential-library: + credential-source: title: Credential Source title_plural: Credential Sources messages: diff --git a/ui/admin/app/components/form/target/add-credential-libraries/index.hbs b/ui/admin/app/components/form/target/add-credential-libraries/index.hbs index 693179213..e70fc20e2 100644 --- a/ui/admin/app/components/form/target/add-credential-libraries/index.hbs +++ b/ui/admin/app/components/form/target/add-credential-libraries/index.hbs @@ -48,11 +48,11 @@ {{#unless this.hasAvailableCredentialLibraries}} - {{t 'resources.target.credential-library.messages.none.description'}} + {{t 'resources.target.credential-source.messages.none.description'}} diff --git a/ui/admin/app/components/form/target/add-host-sets/index.hbs b/ui/admin/app/components/form/target/add-host-sets/index.hbs index 17fb97b88..f248e80fd 100644 --- a/ui/admin/app/components/form/target/add-host-sets/index.hbs +++ b/ui/admin/app/components/form/target/add-host-sets/index.hbs @@ -52,11 +52,11 @@ {{#unless this.hasAvailableHostSets}} - {{t 'resources.target.host-set.messages.none.description'}} + {{t 'resources.target.host-source.messages.none.description'}} 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 627954f30..b37d3dbf6 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.target.host-set.title_plural'); + return this.intl.t('resources.target.host-source.title_plural'); } } diff --git a/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs b/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs index 027162874..55b292b21 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs @@ -3,11 +3,11 @@ {{t 'titles.details'}} - {{t 'resources.target.host-set.title_plural'}} + {{t 'resources.target.host-source.title_plural'}} {{#if (feature-flag 'credential-store')}} - {{t 'resources.target.credential-library.title_plural'}} + {{t 'resources.target.credential-source.title_plural'}} {{/if}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs index 4ddfd983d..cbb836a58 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs @@ -12,11 +12,11 @@ {{#unless @model.credentialLibraries}} - {{t 'resources.target.credential-library.messages.none.description'}} + {{t 'resources.target.credential-source.messages.none.description'}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries/-header.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries/-header.hbs index 4ae5bad96..699536650 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries/-header.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries/-header.hbs @@ -1,4 +1,4 @@

- {{t 'resources.target.credential-library.messages.add.title'}} + {{t 'resources.target.credential-source.messages.add.title'}}

-

{{t 'resources.target.credential-library.messages.add.description'}}

\ No newline at end of file +

{{t 'resources.target.credential-source.messages.add.description'}}

\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs index eb0d9bc71..02cc4c8cc 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs @@ -13,11 +13,11 @@ {{#unless @model.hostSets}} - {{t 'resources.target.host-set.messages.none.description'}} + {{t 'resources.target.host-source.messages.none.description'}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs index 5f127e68c..dcec19c1c 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs @@ -1,5 +1,5 @@

- {{t 'resources.target.host-set.messages.add.title'}} + {{t 'resources.target.host-source.messages.add.title'}}

-

{{t 'resources.target.host-set.messages.add.description'}}

\ No newline at end of file +

{{t 'resources.target.host-source.messages.add.description'}}

\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs b/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs index 7dd80919c..7692af1c2 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs @@ -1,4 +1,4 @@ -{{page-title (t 'resources.target.credential-library.title_plural')}} +{{page-title (t 'resources.target.credential-source.title_plural')}} {{#if @model.credentialLibraries}} @@ -73,11 +73,11 @@ - {{t 'resources.target.credential-library.messages.welcome.description'}} + {{t 'resources.target.credential-source.messages.welcome.description'}} - {{t 'resources.target.host-set.messages.welcome.description'}} + {{t 'resources.target.host-source.messages.welcome.description'}} From bb8920a90c7fa12cab4188b08032703b4412b7b1 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 21 Sep 2021 14:32:39 -0400 Subject: [PATCH 04/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20rename=20ember=20?= =?UTF-8?q?resources=20to=20*-sources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/core/translations/actions/en-us.yaml | 1 - addons/core/translations/resources/en-us.yaml | 4 +- .../target/add-credential-libraries/index.hbs | 4 +- .../form/target/add-host-sets/index.hbs | 4 +- .../{add-host-sets.js => add-host-sources.js} | 4 +- ...ial-libraries.js => credential-sources.js} | 4 +- .../target/{host-sets.js => host-sources.js} | 2 +- ui/admin/app/router.js | 8 ++-- ...libraries.js => add-credential-sources.js} | 17 ++++---- .../{add-host-sets.js => add-host-sources.js} | 8 ++-- ...ial-libraries.js => credential-sources.js} | 2 +- .../target/{host-sets.js => host-sources.js} | 2 +- .../scopes/scope/targets/target/-actions.hbs | 10 ++--- .../scope/targets/target/-navigation.hbs | 4 +- ...braries.hbs => add-credential-sources.hbs} | 4 +- .../-header.hbs | 0 ...add-host-sets.hbs => add-host-sources.hbs} | 4 +- .../-header.hbs | 2 +- ...l-libraries.hbs => credential-sources.hbs} | 6 +-- .../{host-sets.hbs => host-sources.hbs} | 4 +- ui/admin/config/environment.js | 2 +- ...ies-test.js => credential-sources-test.js} | 42 +++++++++---------- ...host-sets-test.js => host-sources-test.js} | 32 +++++++------- ...-sets-test.js => add-host-sources-test.js} | 4 +- ...ies-test.js => credential-sources-test.js} | 4 +- ...host-sets-test.js => host-sources-test.js} | 4 +- ...test.js => add-credential-sources-test.js} | 4 +- ...-sets-test.js => add-host-sources-test.js} | 4 +- ...ies-test.js => credential-sources-test.js} | 4 +- ...host-sets-test.js => host-sources-test.js} | 4 +- 30 files changed, 95 insertions(+), 103 deletions(-) rename ui/admin/app/controllers/scopes/scope/targets/target/{add-host-sets.js => add-host-sources.js} (60%) rename ui/admin/app/controllers/scopes/scope/targets/target/{credential-libraries.js => credential-sources.js} (60%) rename ui/admin/app/controllers/scopes/scope/targets/target/{host-sets.js => host-sources.js} (77%) rename ui/admin/app/routes/scopes/scope/targets/target/{add-credential-libraries.js => add-credential-sources.js} (83%) rename ui/admin/app/routes/scopes/scope/targets/target/{add-host-sets.js => add-host-sources.js} (86%) rename ui/admin/app/routes/scopes/scope/targets/target/{credential-libraries.js => credential-sources.js} (94%) rename ui/admin/app/routes/scopes/scope/targets/target/{host-sets.js => host-sources.js} (96%) rename ui/admin/app/templates/scopes/scope/targets/target/{add-credential-libraries.hbs => add-credential-sources.hbs} (90%) rename ui/admin/app/templates/scopes/scope/targets/target/{add-credential-libraries => add-credential-sources}/-header.hbs (100%) rename ui/admin/app/templates/scopes/scope/targets/target/{add-host-sets.hbs => add-host-sources.hbs} (84%) rename ui/admin/app/templates/scopes/scope/targets/target/{add-host-sets => add-host-sources}/-header.hbs (68%) rename ui/admin/app/templates/scopes/scope/targets/target/{credential-libraries.hbs => credential-sources.hbs} (94%) rename ui/admin/app/templates/scopes/scope/targets/target/{host-sets.hbs => host-sources.hbs} (97%) rename ui/admin/tests/acceptance/targets/{credential-libraries-test.js => credential-sources-test.js} (81%) rename ui/admin/tests/acceptance/targets/{host-sets-test.js => host-sources-test.js} (85%) rename ui/admin/tests/unit/controllers/scopes/scope/targets/target/{add-host-sets-test.js => add-host-sources-test.js} (69%) rename ui/admin/tests/unit/controllers/scopes/scope/targets/target/{credential-libraries-test.js => credential-sources-test.js} (68%) rename ui/admin/tests/unit/controllers/scopes/scope/targets/target/{host-sets-test.js => host-sources-test.js} (71%) rename ui/admin/tests/unit/routes/scopes/scope/targets/target/{add-credential-libraries-test.js => add-credential-sources-test.js} (64%) rename ui/admin/tests/unit/routes/scopes/scope/targets/target/{add-host-sets-test.js => add-host-sources-test.js} (67%) rename ui/admin/tests/unit/routes/scopes/scope/targets/target/{credential-libraries-test.js => credential-sources-test.js} (65%) rename ui/admin/tests/unit/routes/scopes/scope/targets/target/{host-sets-test.js => host-sources-test.js} (68%) diff --git a/addons/core/translations/actions/en-us.yaml b/addons/core/translations/actions/en-us.yaml index 9b7a8561d..144ced636 100644 --- a/addons/core/translations/actions/en-us.yaml +++ b/addons/core/translations/actions/en-us.yaml @@ -23,7 +23,6 @@ choose-org: Choose Scope choose-different-org: Choose a different scope add-host-set: Create Host Set add-host: Create Host -add-host-sets: Add Host Sets add-principals: Add Principals add-members: Add Members add-hosts: Add Hosts diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index f6b3373c8..91ed16ac1 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -253,8 +253,8 @@ target: actions: create: New Target delete: Delete Target - add-host-sets: Add Host Sources - add-credential-libraries: Add Credential Sources + add-host-sources: Add Host Sources + add-credential-sources: Add Credential Sources types: tcp: TCP host-source: diff --git a/ui/admin/app/components/form/target/add-credential-libraries/index.hbs b/ui/admin/app/components/form/target/add-credential-libraries/index.hbs index e70fc20e2..d07c27884 100644 --- a/ui/admin/app/components/form/target/add-credential-libraries/index.hbs +++ b/ui/admin/app/components/form/target/add-credential-libraries/index.hbs @@ -8,7 +8,7 @@ as |form| > @@ -54,7 +54,7 @@ {{t 'resources.target.credential-source.messages.none.description'}} - + {{t 'actions.back'}} diff --git a/ui/admin/app/components/form/target/add-host-sets/index.hbs b/ui/admin/app/components/form/target/add-host-sets/index.hbs index f248e80fd..1885700fd 100644 --- a/ui/admin/app/components/form/target/add-host-sets/index.hbs +++ b/ui/admin/app/components/form/target/add-host-sets/index.hbs @@ -9,7 +9,7 @@ > @@ -58,7 +58,7 @@ {{t 'resources.target.host-source.messages.none.description'}} - + {{t 'actions.back'}} diff --git a/ui/admin/app/controllers/scopes/scope/targets/target/add-host-sets.js b/ui/admin/app/controllers/scopes/scope/targets/target/add-host-sources.js similarity index 60% rename from ui/admin/app/controllers/scopes/scope/targets/target/add-host-sets.js rename to ui/admin/app/controllers/scopes/scope/targets/target/add-host-sources.js index 6700b582d..56c5282ea 100644 --- a/ui/admin/app/controllers/scopes/scope/targets/target/add-host-sets.js +++ b/ui/admin/app/controllers/scopes/scope/targets/target/add-host-sources.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeTargetsTargetAddHostSetsController extends Controller { +export default class ScopesScopeTargetsTargetAddHostSourcesController extends Controller { // =services @service intl; @@ -13,6 +13,6 @@ export default class ScopesScopeTargetsTargetAddHostSetsController extends Contr * @type {string} */ get breadCrumb() { - return this.intl.t('resources.target.actions.add-host-sets'); + return this.intl.t('resources.target.actions.add-host-sources'); } } diff --git a/ui/admin/app/controllers/scopes/scope/targets/target/credential-libraries.js b/ui/admin/app/controllers/scopes/scope/targets/target/credential-sources.js similarity index 60% rename from ui/admin/app/controllers/scopes/scope/targets/target/credential-libraries.js rename to ui/admin/app/controllers/scopes/scope/targets/target/credential-sources.js index ff0f8c558..eb9ab7720 100644 --- a/ui/admin/app/controllers/scopes/scope/targets/target/credential-libraries.js +++ b/ui/admin/app/controllers/scopes/scope/targets/target/credential-sources.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeTargetsTargetCredentialLibrariesController extends Controller { +export default class ScopesScopeTargetsTargetCredentialSourcesController extends Controller { // =services @service intl; @@ -13,6 +13,6 @@ export default class ScopesScopeTargetsTargetCredentialLibrariesController exten * @type {string} */ get breadCrumb() { - return this.intl.t('resources.credential-library.title_plural'); + return this.intl.t('resources.target.credential-source.title_plural'); } } diff --git a/ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js b/ui/admin/app/controllers/scopes/scope/targets/target/host-sources.js similarity index 77% rename from ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js rename to ui/admin/app/controllers/scopes/scope/targets/target/host-sources.js index b37d3dbf6..80317b66d 100644 --- a/ui/admin/app/controllers/scopes/scope/targets/target/host-sets.js +++ b/ui/admin/app/controllers/scopes/scope/targets/target/host-sources.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeTargetsTargetHostSetsController extends Controller { +export default class ScopesScopeTargetsTargetHostSourcesController extends Controller { // =services @service intl; diff --git a/ui/admin/app/router.js b/ui/admin/app/router.js index 6b70bd999..7e62a2ce4 100644 --- a/ui/admin/app/router.js +++ b/ui/admin/app/router.js @@ -63,10 +63,10 @@ Router.map(function () { this.route('targets', function () { this.route('target', { path: ':target_id' }, function () { - this.route('host-sets', function () {}); - this.route('add-host-sets'); - this.route('credential-libraries'); - this.route('add-credential-libraries'); + this.route('host-sources', function () {}); + this.route('add-host-sources'); + this.route('credential-sources'); + this.route('add-credential-sources'); }); this.route('new'); }); diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-credential-libraries.js b/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js similarity index 83% rename from ui/admin/app/routes/scopes/scope/targets/target/add-credential-libraries.js rename to ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js index f2cb1eca2..acc333255 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-credential-libraries.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js @@ -5,7 +5,7 @@ import { action } from '@ember/object'; import loading from 'ember-loading/decorator'; import { notifySuccess, notifyError } from 'core/decorators/notify'; -export default class ScopesScopeTargetsTargetAddCredentialLibrariesRoute extends Route { +export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends Route { // =services @service intl; @@ -49,13 +49,10 @@ export default class ScopesScopeTargetsTargetAddCredentialLibrariesRoute extends renderTemplate() { super.renderTemplate(...arguments); - this.render( - 'scopes/scope/targets/target/add-credential-libraries/-header', - { - into: 'scopes/scope/targets/target', - outlet: 'header', - } - ); + this.render('scopes/scope/targets/target/add-credential-sources/-header', { + into: 'scopes/scope/targets/target', + outlet: 'header', + }); this.render('-empty', { into: 'scopes/scope/targets/target', @@ -81,7 +78,7 @@ export default class ScopesScopeTargetsTargetAddCredentialLibrariesRoute extends @notifySuccess('notifications.add-success') async save(target, credentialLibraryIDs) { await target.addCredentialLibraries(credentialLibraryIDs); - this.replaceWith('scopes.scope.targets.target.credential-libraries'); + this.replaceWith('scopes.scope.targets.target.credential-sources'); } /** @@ -89,6 +86,6 @@ export default class ScopesScopeTargetsTargetAddCredentialLibrariesRoute extends */ @action cancel() { - this.replaceWith('scopes.scope.targets.target.credential-libraries'); + this.replaceWith('scopes.scope.targets.target.credential-sources'); } } diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sets.js b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js similarity index 86% rename from ui/admin/app/routes/scopes/scope/targets/target/add-host-sets.js rename to ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js index 15cb88ddd..18e721233 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sets.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js @@ -5,7 +5,7 @@ import { all } from 'rsvp'; import loading from 'ember-loading/decorator'; import { notifySuccess, notifyError } from 'core/decorators/notify'; -export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route { +export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route { // =services @service intl; @@ -48,7 +48,7 @@ export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route { renderTemplate() { super.renderTemplate(...arguments); - this.render('scopes/scope/targets/target/add-host-sets/-header', { + this.render('scopes/scope/targets/target/add-host-sources/-header', { into: 'scopes/scope/targets/target', outlet: 'header', }); @@ -72,7 +72,7 @@ export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route { @notifySuccess('notifications.add-success') async save(target, hostSetIDs) { await target.addHostSets(hostSetIDs); - this.replaceWith('scopes.scope.targets.target.host-sets'); + this.replaceWith('scopes.scope.targets.target.host-sources'); } /** @@ -80,6 +80,6 @@ export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route { */ @action cancel() { - this.replaceWith('scopes.scope.targets.target.host-sets'); + this.replaceWith('scopes.scope.targets.target.host-sources'); } } diff --git a/ui/admin/app/routes/scopes/scope/targets/target/credential-libraries.js b/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js similarity index 94% rename from ui/admin/app/routes/scopes/scope/targets/target/credential-libraries.js rename to ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js index 66ce6f8ec..a4fd2a7de 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/credential-libraries.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js @@ -5,7 +5,7 @@ import loading from 'ember-loading/decorator'; import { confirm } from 'core/decorators/confirm'; import { notifySuccess, notifyError } from 'core/decorators/notify'; -export default class ScopesScopeTargetsTargetCredentialLibrariesRoute extends Route { +export default class ScopesScopeTargetsTargetCredentialSourcesRoute extends Route { // =methods /** diff --git a/ui/admin/app/routes/scopes/scope/targets/target/host-sets.js b/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js similarity index 96% rename from ui/admin/app/routes/scopes/scope/targets/target/host-sets.js rename to ui/admin/app/routes/scopes/scope/targets/target/host-sources.js index 120de013a..8abf4022c 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/host-sets.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js @@ -6,7 +6,7 @@ import loading from 'ember-loading/decorator'; import { confirm } from 'core/decorators/confirm'; import { notifySuccess, notifyError } from 'core/decorators/notify'; -export default class ScopesScopeTargetsTargetHostSetsRoute extends Route { +export default class ScopesScopeTargetsTargetHostSourcesRoute extends Route { // =services @service intl; diff --git a/ui/admin/app/templates/scopes/scope/targets/target/-actions.hbs b/ui/admin/app/templates/scopes/scope/targets/target/-actions.hbs index 2de077d3d..3e32c0848 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/-actions.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/-actions.hbs @@ -3,14 +3,12 @@ @dropdownRight={{true}} as |dropdown| > - - {{t 'resources.target.actions.add-host-sets'}} + + {{t 'resources.target.actions.add-host-sources'}} {{#if (feature-flag 'credential-store')}} - - {{t 'resources.target.actions.add-credential-libraries'}} + + {{t 'resources.target.actions.add-credential-sources'}} {{/if}} {{#if (can 'delete model' @model)}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs b/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs index 55b292b21..8d35a9f03 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/-navigation.hbs @@ -2,11 +2,11 @@ {{t 'titles.details'}} - + {{t 'resources.target.host-source.title_plural'}} {{#if (feature-flag 'credential-store')}} - + {{t 'resources.target.credential-source.title_plural'}} {{/if}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-sources.hbs similarity index 90% rename from ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs rename to ui/admin/app/templates/scopes/scope/targets/target/add-credential-sources.hbs index cbb836a58..cc0992c50 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-sources.hbs @@ -1,4 +1,4 @@ -{{page-title (t 'resources.target.actions.add-credential-libraries')}} +{{page-title (t 'resources.target.actions.add-credential-sources')}} {{#if @model.credentialLibraries}} {{t 'resources.target.credential-source.messages.none.description'}} - + {{t 'actions.back'}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries/-header.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-credential-sources/-header.hbs similarity index 100% rename from ui/admin/app/templates/scopes/scope/targets/target/add-credential-libraries/-header.hbs rename to ui/admin/app/templates/scopes/scope/targets/target/add-credential-sources/-header.hbs diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sources.hbs similarity index 84% rename from ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs rename to ui/admin/app/templates/scopes/scope/targets/target/add-host-sources.hbs index 02cc4c8cc..f846930c6 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sources.hbs @@ -1,4 +1,4 @@ -{{page-title (t 'resources.target.actions.add-host-sets')}} +{{page-title (t 'resources.target.actions.add-host-sources')}} {{#if @model.hostSets}} {{t 'resources.target.host-source.messages.none.description'}} - + {{t 'actions.back'}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sources/-header.hbs similarity index 68% rename from ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs rename to ui/admin/app/templates/scopes/scope/targets/target/add-host-sources/-header.hbs index dcec19c1c..abbb353fa 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/add-host-sources/-header.hbs @@ -1,5 +1,5 @@

{{t 'resources.target.host-source.messages.add.title'}} - +

{{t 'resources.target.host-source.messages.add.description'}}

\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs b/ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs similarity index 94% rename from ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs rename to ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs index 7692af1c2..4a2c688b1 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/credential-libraries.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs @@ -79,11 +79,9 @@ {{t 'resources.target.credential-source.messages.welcome.description'}} - + - {{t 'resources.target.actions.add-credential-libraries'}} + {{t 'resources.target.actions.add-credential-sources'}}
diff --git a/ui/admin/app/templates/scopes/scope/targets/target/host-sets.hbs b/ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs similarity index 97% rename from ui/admin/app/templates/scopes/scope/targets/target/host-sets.hbs rename to ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs index b6d335414..876622e14 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/host-sets.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs @@ -67,9 +67,9 @@ {{t 'resources.target.host-source.messages.welcome.description'}} - + - {{t 'resources.target.actions.add-host-sets'}} + {{t 'resources.target.actions.add-host-sources'}}
diff --git a/ui/admin/config/environment.js b/ui/admin/config/environment.js index 3b1a8df4b..b515fc76a 100644 --- a/ui/admin/config/environment.js +++ b/ui/admin/config/environment.js @@ -64,7 +64,7 @@ module.exports = function (environment) { session: '/sessions', target: '/targets', 'target.new': '/targets/new', - 'target.add-host-sets': '/targets/add-host-sets', + 'target.add-host-sources': '/targets/add-host-sets', user: '/users', }, }, diff --git a/ui/admin/tests/acceptance/targets/credential-libraries-test.js b/ui/admin/tests/acceptance/targets/credential-sources-test.js similarity index 81% rename from ui/admin/tests/acceptance/targets/credential-libraries-test.js rename to ui/admin/tests/acceptance/targets/credential-sources-test.js index 3e75c8fa2..dd3d0c7ed 100644 --- a/ui/admin/tests/acceptance/targets/credential-libraries-test.js +++ b/ui/admin/tests/acceptance/targets/credential-sources-test.js @@ -72,65 +72,65 @@ module('Acceptance | targets | credential-libraries', function (hooks) { urls.projectScope = `/scopes/${instances.scopes.project.id}`; urls.targets = `${urls.projectScope}/targets`; urls.target = `${urls.targets}/${instances.target.id}`; - urls.credentialLibraries = `${urls.target}/credential-libraries`; + urls.credentialSources = `${urls.target}/credential-sources`; urls.credentialLibrary = `${urls.projectScope}/credential-stores/${instances.credentialLibrary.credentialStoreId}/credential-libraries/${instances.credentialLibrary.id}`; - urls.addCredentialLibraries = `${urls.target}/add-credential-libraries`; + urls.addCredentialSources = `${urls.target}/add-credential-sources`; // Generate resource counter getCredentialLibraryCount = () => this.server.schema.credentialLibraries.all().models.length; authenticateSession({}); }); - test('visiting target credential libraries', async function (assert) { + test('visiting target credential sources', async function (assert) { assert.expect(2); - await visit(urls.credentialLibraries); + await visit(urls.credentialSources); await a11yAudit(); - assert.equal(currentURL(), urls.credentialLibraries); + assert.equal(currentURL(), urls.credentialSources); assert.equal(findAll('tbody tr').length, getCredentialLibraryCount()); }); test('can navigate to a credential library', async function (assert) { assert.expect(1); - await visit(urls.credentialLibraries); + await visit(urls.credentialSources); await click('main tbody .rose-table-header-cell:nth-child(1) a'); await a11yAudit(); assert.equal(currentURL(), urls.credentialLibrary); }); - test('visiting add credential libraries', async function (assert) { + test('visiting add credential sources', async function (assert) { assert.expect(1); - await visit(urls.addCredentialLibraries); + await visit(urls.addCredentialSources); await a11yAudit(); - assert.equal(currentURL(), urls.addCredentialLibraries); + assert.equal(currentURL(), urls.addCredentialSources); }); - test('can select and save credential libraries to add', async function (assert) { + test('can select and save credential sources to add', async function (assert) { assert.expect(4); instances.target.update({ credentialLibraries: [] }); - await visit(urls.credentialLibraries); + await visit(urls.credentialSources); assert.equal(findAll('tbody tr').length, 0); - await visit(urls.addCredentialLibraries); + await visit(urls.addCredentialSources); assert.equal(findAll('tbody tr').length, getCredentialLibraryCount()); await click('tbody label'); await click('form [type="submit"]'); - assert.equal(currentURL(), urls.credentialLibraries); + assert.equal(currentURL(), urls.credentialSources); assert.equal(findAll('tbody tr').length, 1); }); - test('can select and cancel credential libraries to add', async function (assert) { + test('can select and cancel credential sources to add', async function (assert) { assert.expect(4); instances.target.update({ credentialLibraries: [] }); - await visit(urls.credentialLibraries); + await visit(urls.credentialSources); assert.equal(findAll('tbody tr').length, 0); - await visit(urls.addCredentialLibraries); + await visit(urls.addCredentialSources); assert.equal(findAll('tbody tr').length, getCredentialLibraryCount()); await click('tbody label'); await click('form [type="button"]'); - assert.equal(currentURL(), urls.credentialLibraries); + assert.equal(currentURL(), urls.credentialSources); assert.equal(findAll('tbody tr').length, 0); }); - test('adding credential libraries which errors displays error message', async function (assert) { + test('adding credential sources which errors displays error message', async function (assert) { assert.expect(1); this.server.post('/targets/:idMethod', () => { return new Response( @@ -145,7 +145,7 @@ module('Acceptance | targets | credential-libraries', function (hooks) { ); }); instances.target.update({ credentialLibraries: [] }); - await visit(urls.addCredentialLibraries); + await visit(urls.addCredentialSources); await click('tbody label'); await click('form [type="submit"]'); assert.ok(find('[role="alert"]')); @@ -154,7 +154,7 @@ module('Acceptance | targets | credential-libraries', function (hooks) { test('can remove a credential library', async function (assert) { assert.expect(2); const count = getCredentialLibraryCount(); - await visit(urls.credentialLibraries); + await visit(urls.credentialSources); assert.equal(findAll('tbody tr').length, count); await click('tbody tr .rose-dropdown-button-danger'); assert.equal(findAll('tbody tr').length, count - 1); @@ -175,7 +175,7 @@ module('Acceptance | targets | credential-libraries', function (hooks) { ); }); const count = getCredentialLibraryCount(); - await visit(urls.credentialLibraries); + await visit(urls.credentialSources); assert.equal(findAll('tbody tr').length, count); await click('tbody tr .rose-dropdown-button-danger'); assert.ok(find('[role="alert"]')); diff --git a/ui/admin/tests/acceptance/targets/host-sets-test.js b/ui/admin/tests/acceptance/targets/host-sources-test.js similarity index 85% rename from ui/admin/tests/acceptance/targets/host-sets-test.js rename to ui/admin/tests/acceptance/targets/host-sources-test.js index 3ea6f4a07..9cf02a4f4 100644 --- a/ui/admin/tests/acceptance/targets/host-sets-test.js +++ b/ui/admin/tests/acceptance/targets/host-sources-test.js @@ -11,7 +11,7 @@ import { //invalidateSession, } from 'ember-simple-auth/test-support'; -module('Acceptance | targets | host-sets', function (hooks) { +module('Acceptance | targets | host-sources', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); @@ -60,17 +60,17 @@ module('Acceptance | targets | host-sets', function (hooks) { urls.projectScope = `/scopes/${instances.scopes.project.id}`; urls.targets = `/scopes/${instances.scopes.project.id}/targets`; urls.target = `${urls.targets}/${instances.target.id}`; - urls.targetHostSets = `${urls.target}/host-sets`; - urls.targetAddHostSets = `${urls.target}/add-host-sets`; + urls.targetHostSources = `${urls.target}/host-sources`; + urls.targetAddHostSources = `${urls.target}/add-host-sources`; authenticateSession({}); }); test('visiting target host sets', async function (assert) { assert.expect(3); const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); await a11yAudit(); - assert.equal(currentURL(), urls.targetHostSets); + assert.equal(currentURL(), urls.targetHostSources); assert.ok(targetHostSetCount); assert.equal(findAll('tbody tr').length, targetHostSetCount); }); @@ -78,7 +78,7 @@ module('Acceptance | targets | host-sets', function (hooks) { test('can remove a host sets', async function (assert) { assert.expect(2); const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); assert.equal(findAll('tbody tr').length, targetHostSetCount); await click('tbody tr .rose-dropdown-button-danger'); assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); @@ -99,7 +99,7 @@ module('Acceptance | targets | host-sets', function (hooks) { ); }); const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); assert.equal(findAll('tbody tr').length, targetHostSetCount); await click('tbody tr .rose-dropdown-button-danger'); assert.ok(find('[role="alert"]')); @@ -108,32 +108,32 @@ module('Acceptance | targets | host-sets', function (hooks) { test('select and save host sets to add', async function (assert) { assert.expect(3); instances.target.update({ hostSetIds: [] }); - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); assert.equal(findAll('tbody tr').length, 0); await click('.rose-layout-page-actions a'); - assert.equal(currentURL(), urls.targetAddHostSets); + assert.equal(currentURL(), urls.targetAddHostSources); // Click three times to select, unselect, then reselect (for coverage) await click('tbody label'); await click('tbody label'); await click('tbody label'); await click('form [type="submit"]'); - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); assert.equal(findAll('tbody tr').length, 1); }); test('select and cancel host sets to add', async function (assert) { assert.expect(4); const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); assert.equal(findAll('tbody tr').length, targetHostSetCount); // first, remove a target host set (otherwise none would be available to add) await click('tbody tr .rose-dropdown-button-danger'); assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); await click('.rose-layout-page-actions a'); - assert.equal(currentURL(), urls.targetAddHostSets); + assert.equal(currentURL(), urls.targetAddHostSources); await click('tbody label'); await click('form [type="button"]'); - await visit(urls.targetHostSets); + await visit(urls.targetHostSources); assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); }); @@ -152,12 +152,12 @@ module('Acceptance | targets | host-sets', function (hooks) { ); }); instances.target.update({ hostSetIds: [] }); - await visit(urls.targetAddHostSets); + await visit(urls.targetAddHostSources); assert.equal(instances.target.hostSets.length, 0); - assert.equal(currentURL(), urls.targetAddHostSets); + assert.equal(currentURL(), urls.targetAddHostSources); await click('tbody label'); await click('form [type="submit"]'); - assert.equal(currentURL(), urls.targetAddHostSets); + assert.equal(currentURL(), urls.targetAddHostSources); assert.equal(instances.target.hostSets.length, 0); }); }); diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sets-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js similarity index 69% rename from ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sets-test.js rename to ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js index bd24fcaf8..395717b7a 100644 --- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sets-test.js +++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js @@ -2,14 +2,14 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Controller | scopes/scope/targets/target/add-host-sets', + 'Unit | Controller | scopes/scope/targets/target/add-host-sources', function (hooks) { setupTest(hooks); // TODO: Replace this with your real tests. test('it exists', function (assert) { let controller = this.owner.lookup( - 'controller:scopes/scope/targets/target/add-host-sets' + 'controller:scopes/scope/targets/target/add-host-sources' ); assert.ok(controller); }); diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-libraries-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-sources-test.js similarity index 68% rename from ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-libraries-test.js rename to ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-sources-test.js index 76a26ff69..e96f06784 100644 --- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-libraries-test.js +++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/credential-sources-test.js @@ -2,14 +2,14 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Controller | scopes/scope/targets/target/credential-libraries', + 'Unit | Controller | scopes/scope/targets/target/credential-sources', function (hooks) { setupTest(hooks); // TODO: Replace this with your real tests. test('it exists', function (assert) { let controller = this.owner.lookup( - 'controller:scopes/scope/targets/target/credential-libraries' + 'controller:scopes/scope/targets/target/credential-sources' ); assert.ok(controller); }); diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/host-sets-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/host-sources-test.js similarity index 71% rename from ui/admin/tests/unit/controllers/scopes/scope/targets/target/host-sets-test.js rename to ui/admin/tests/unit/controllers/scopes/scope/targets/target/host-sources-test.js index 46ca085a6..31df17359 100644 --- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/host-sets-test.js +++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/host-sources-test.js @@ -2,14 +2,14 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Controller | scopes/scope/targets/target/host-sets', + 'Unit | Controller | scopes/scope/targets/target/host-sources', function (hooks) { setupTest(hooks); // TODO: Replace this with your real tests. test('it exists', function (assert) { let controller = this.owner.lookup( - 'controller:scopes/scope/targets/target/host-sets' + 'controller:scopes/scope/targets/target/host-sources' ); assert.ok(controller); }); diff --git a/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-credential-libraries-test.js b/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-credential-sources-test.js similarity index 64% rename from ui/admin/tests/unit/routes/scopes/scope/targets/target/add-credential-libraries-test.js rename to ui/admin/tests/unit/routes/scopes/scope/targets/target/add-credential-sources-test.js index e6279d5b3..90afd3ac1 100644 --- a/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-credential-libraries-test.js +++ b/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-credential-sources-test.js @@ -2,13 +2,13 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Route | scopes/scope/targets/target/add-credential-libraries', + 'Unit | Route | scopes/scope/targets/target/add-credential-sources', function (hooks) { setupTest(hooks); test('it exists', function (assert) { let route = this.owner.lookup( - 'route:scopes/scope/targets/target/add-credential-libraries' + 'route:scopes/scope/targets/target/add-credential-sources' ); assert.ok(route); }); diff --git a/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-host-sets-test.js b/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-host-sources-test.js similarity index 67% rename from ui/admin/tests/unit/routes/scopes/scope/targets/target/add-host-sets-test.js rename to ui/admin/tests/unit/routes/scopes/scope/targets/target/add-host-sources-test.js index e2a87487e..3f5fbd33a 100644 --- a/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-host-sets-test.js +++ b/ui/admin/tests/unit/routes/scopes/scope/targets/target/add-host-sources-test.js @@ -2,13 +2,13 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Route | scopes/scope/targets/target/add-host-sets', + 'Unit | Route | scopes/scope/targets/target/add-host-sources', function (hooks) { setupTest(hooks); test('it exists', function (assert) { let route = this.owner.lookup( - 'route:scopes/scope/targets/target/add-host-sets' + 'route:scopes/scope/targets/target/add-host-sources' ); assert.ok(route); }); diff --git a/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-libraries-test.js b/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-sources-test.js similarity index 65% rename from ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-libraries-test.js rename to ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-sources-test.js index 894e3add0..76a6808de 100644 --- a/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-libraries-test.js +++ b/ui/admin/tests/unit/routes/scopes/scope/targets/target/credential-sources-test.js @@ -2,13 +2,13 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Route | scopes/scope/targets/target/credential-libraries', + 'Unit | Route | scopes/scope/targets/target/credential-sources', function (hooks) { setupTest(hooks); test('it exists', function (assert) { let route = this.owner.lookup( - 'route:scopes/scope/targets/target/credential-libraries' + 'route:scopes/scope/targets/target/credential-sources' ); assert.ok(route); }); diff --git a/ui/admin/tests/unit/routes/scopes/scope/targets/target/host-sets-test.js b/ui/admin/tests/unit/routes/scopes/scope/targets/target/host-sources-test.js similarity index 68% rename from ui/admin/tests/unit/routes/scopes/scope/targets/target/host-sets-test.js rename to ui/admin/tests/unit/routes/scopes/scope/targets/target/host-sources-test.js index 214bf28b3..fed9b412e 100644 --- a/ui/admin/tests/unit/routes/scopes/scope/targets/target/host-sets-test.js +++ b/ui/admin/tests/unit/routes/scopes/scope/targets/target/host-sources-test.js @@ -2,13 +2,13 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; module( - 'Unit | Route | scopes/scope/targets/target/host-sets', + 'Unit | Route | scopes/scope/targets/target/host-sources', function (hooks) { setupTest(hooks); test('it exists', function (assert) { let route = this.owner.lookup( - 'route:scopes/scope/targets/target/host-sets' + 'route:scopes/scope/targets/target/host-sources' ); assert.ok(route); }); From 614b98b8fbd57f5600fd3921b60f9c6eb31997e5 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 21 Sep 2021 14:53:56 -0400 Subject: [PATCH 05/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20change=20method?= =?UTF-8?q?=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/target.js | 21 +++++++--------- addons/api/tests/unit/models/host-set-test.js | 2 +- addons/api/tests/unit/models/target-test.js | 24 +++++++++---------- .../targets/target/add-credential-sources.js | 2 +- .../scope/targets/target/add-host-sources.js | 2 +- .../targets/target/credential-sources.js | 4 ++-- .../scope/targets/target/host-sources.js | 4 ++-- .../targets/target/credential-sources.hbs | 2 +- .../scope/targets/target/host-sources.hbs | 2 +- .../targets/credential-sources-test.js | 2 +- 10 files changed, 31 insertions(+), 34 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 305c63cb1..919a47201 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -22,7 +22,7 @@ export default class TargetModel extends GeneratedTargetModel { /** * Credential library ids are read only and can be - * persisted via a dedicated call to `addCredentialLibraries()`. + * persisted via a dedicated call to `addCredentialSources()`. */ @fragmentArray('fragment-string', { readOnly: true, @@ -103,7 +103,7 @@ export default class TargetModel extends GeneratedTargetModel { * @param {object} options.adapterOptions * @return {Promise} */ - addHostSets(hostSetIDs, options = { adapterOptions: {} }) { + addHostSources(hostSetIDs, options = { adapterOptions: {} }) { const defaultAdapterOptions = { method: 'add-host-sets', hostSetIDs, @@ -126,7 +126,7 @@ export default class TargetModel extends GeneratedTargetModel { * @param {object} options.adapterOptions * @return {Promise} */ - removeHostSets(hostSetIDs, options = { adapterOptions: {} }) { + removeHostSources(hostSetIDs, options = { adapterOptions: {} }) { const defaultAdapterOptions = { method: 'remove-host-sets', hostSetIDs, @@ -147,8 +147,8 @@ export default class TargetModel extends GeneratedTargetModel { * @param {object} options * @return {Promise} */ - removeHostSet(hostSetID, options) { - return this.removeHostSets([hostSetID], options); + removeHostSource(hostSetID, options) { + return this.removeHostSources([hostSetID], options); } /** @@ -159,10 +159,7 @@ export default class TargetModel extends GeneratedTargetModel { * @param {object} options.adapterOptions * @return {Promise} */ - addCredentialLibraries( - credentialLibraryIDs, - options = { adapterOptions: {} } - ) { + addCredentialSources(credentialLibraryIDs, options = { adapterOptions: {} }) { const defaultAdapterOptions = { method: 'add-credential-libraries', credentialLibraryIDs, @@ -185,7 +182,7 @@ export default class TargetModel extends GeneratedTargetModel { * @param {object} options.adapterOptions * @return {Promise} */ - removeCredentialLibraries( + removeCredentialSources( credentialLibraryIDs, options = { adapterOptions: {} } ) { @@ -209,7 +206,7 @@ export default class TargetModel extends GeneratedTargetModel { * @param {object} options * @return {Promise} */ - removeCredentialLibrary(credentialLibraryID, options) { - return this.removeCredentialLibraries([credentialLibraryID], options); + removeCredentialSource(credentialLibraryID, options) { + return this.removeCredentialSources([credentialLibraryID], options); } } diff --git a/addons/api/tests/unit/models/host-set-test.js b/addons/api/tests/unit/models/host-set-test.js index d3738fe5b..f1cf1c110 100644 --- a/addons/api/tests/unit/models/host-set-test.js +++ b/addons/api/tests/unit/models/host-set-test.js @@ -68,7 +68,7 @@ module('Unit | Model | host set', function (hooks) { await model.addHost('foobar'); }); - test('it has a `removeHostSets` method that targets a specific POST API endpoint and serialization', async function (assert) { + test('it has a `removeHosts` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post('/v1/host-sets/123abc:remove-hosts', (schema, request) => { const body = JSON.parse(request.requestBody); diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index 2721480e2..5635a1a3d 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -72,7 +72,7 @@ module('Unit | Model | target', function (hooks) { assert.ok(target.hostSets[0].hostCatalog, 'Host catalog is resolved'); }); - test('it has an `addHostSets` method that targets a specific POST API endpoint and serialization', async function (assert) { + test('it has an `addHostSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post('/v1/targets/123abc:add-host-sets', (schema, request) => { const body = JSON.parse(request.requestBody); @@ -103,10 +103,10 @@ module('Unit | Model | target', function (hooks) { }, }); const model = store.peekRecord('target', '123abc'); - await model.addHostSets(['123_abc', 'foobar']); + await model.addHostSources(['123_abc', 'foobar']); }); - test('it has a `removeHostSets` method that targets a specific POST API endpoint and serialization', async function (assert) { + test('it has a `removeHostSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post( '/v1/targets/123abc:remove-host-sets', @@ -140,10 +140,10 @@ module('Unit | Model | target', function (hooks) { }, }); const model = store.peekRecord('target', '123abc'); - await model.removeHostSets(['1', '3']); + await model.removeHostSources(['1', '3']); }); - test('it has a `removeHostSet` method that deletes a single host set using `removeHostSets` method', async function (assert) { + test('it has a `removeHostSource` method that deletes a single host set using `removeHostSources` method', async function (assert) { assert.expect(1); this.server.post( '/v1/targets/123abc:remove-host-sets', @@ -177,7 +177,7 @@ module('Unit | Model | target', function (hooks) { }, }); const model = store.peekRecord('target', '123abc'); - await model.removeHostSet('3'); + await model.removeHostSource('3'); }); test('it has a `sessions` array of session instances associated with the target (if those instances are already in the store)', function (assert) { @@ -280,7 +280,7 @@ module('Unit | Model | target', function (hooks) { ); }); - test('it has an `addCredentialLibraries` method that targets a specific POST API endpoint and serialization', async function (assert) { + test('it has an `addCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post( '/v1/targets/123abc:add-credential-libraries', @@ -311,10 +311,10 @@ module('Unit | Model | target', function (hooks) { }, }); const model = store.peekRecord('target', '123abc'); - await model.addCredentialLibraries(['123_abc', 'foobar']); + await model.addCredentialSources(['123_abc', 'foobar']); }); - test('it has a `removeCredentialLibraries` method that targets a specific POST API endpoint and serialization', async function (assert) { + test('it has a `removeCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post( '/v1/targets/123abc:remove-credential-libraries', @@ -345,10 +345,10 @@ module('Unit | Model | target', function (hooks) { }, }); const model = store.peekRecord('target', '123abc'); - await model.removeCredentialLibraries(['1', '2']); + await model.removeCredentialSources(['1', '2']); }); - test('it has a `removeCredentialLibrary` method that deletes a single credential library using `removeCredentialLibraries` method', async function (assert) { + test('it has a `removeCredentialSource` method that deletes a single credential library using `removeCredentialSources` method', async function (assert) { assert.expect(1); this.server.post( '/v1/targets/123abc:remove-credential-libraries', @@ -379,6 +379,6 @@ module('Unit | Model | target', function (hooks) { }, }); const model = store.peekRecord('target', '123abc'); - await model.removeCredentialLibrary('2'); + await model.removeCredentialSource('2'); }); }); diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js index acc333255..9cfc43d03 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js @@ -77,7 +77,7 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.add-success') async save(target, credentialLibraryIDs) { - await target.addCredentialLibraries(credentialLibraryIDs); + await target.addCredentialSources(credentialLibraryIDs); this.replaceWith('scopes.scope.targets.target.credential-sources'); } diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js index 18e721233..44bb07406 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js @@ -71,7 +71,7 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route { @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.add-success') async save(target, hostSetIDs) { - await target.addHostSets(hostSetIDs); + await target.addHostSources(hostSetIDs); this.replaceWith('scopes.scope.targets.target.host-sources'); } diff --git a/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js index a4fd2a7de..89cee4978 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js @@ -44,8 +44,8 @@ export default class ScopesScopeTargetsTargetCredentialSourcesRoute extends Rout @confirm('questions.remove-confirm') @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.remove-success') - async removeCredentialLibrary(target, credentialLibrary) { - await target.removeCredentialLibrary(credentialLibrary.id); + async removeCredentialSource(target, credentialLibrary) { + await target.removeCredentialSource(credentialLibrary.id); this.refresh(); } } diff --git a/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js index 8abf4022c..2f0296764 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js @@ -58,8 +58,8 @@ export default class ScopesScopeTargetsTargetHostSourcesRoute extends Route { @confirm('questions.remove-confirm') @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.remove-success') - async removeHostSet(target, hostSet) { - await target.removeHostSet(hostSet.id); + async removeHostSource(target, hostSet) { + await target.removeHostSource(hostSet.id); this.refresh(); } } diff --git a/ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs b/ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs index 4a2c688b1..1c297bd1e 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/credential-sources.hbs @@ -56,7 +56,7 @@ {{on 'click' (route-action - 'removeCredentialLibrary' @model credentialLibrary + 'removeCredentialSource' @model credentialLibrary ) }} > diff --git a/ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs b/ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs index 876622e14..e9081c106 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/host-sources.hbs @@ -45,7 +45,7 @@ @style='danger' {{on 'click' - (route-action 'removeHostSet' @model hostSet.model) + (route-action 'removeHostSource' @model hostSet.model) }} > {{t 'actions.remove'}} diff --git a/ui/admin/tests/acceptance/targets/credential-sources-test.js b/ui/admin/tests/acceptance/targets/credential-sources-test.js index dd3d0c7ed..b5c4d6508 100644 --- a/ui/admin/tests/acceptance/targets/credential-sources-test.js +++ b/ui/admin/tests/acceptance/targets/credential-sources-test.js @@ -35,7 +35,7 @@ module('Acceptance | targets | credential-libraries', function (hooks) { target: null, credentialLibraries: null, credentialLibrary: null, - addCredentialLibraries: null, + addCredentialSources: null, }; hooks.beforeEach(function () { From c7c01dc35e2782cd95b9ba4da8b1f8e57bc0ccff Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 21 Sep 2021 16:58:25 -0400 Subject: [PATCH 06/12] =?UTF-8?q?fix:=20=F0=9F=90=9B=20host=20set=20reconc?= =?UTF-8?q?iliation=20on=20targets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/target/add-host-sets/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/admin/app/components/form/target/add-host-sets/index.js b/ui/admin/app/components/form/target/add-host-sets/index.js index f49dda570..eb0f5e246 100644 --- a/ui/admin/app/components/form/target/add-host-sets/index.js +++ b/ui/admin/app/components/form/target/add-host-sets/index.js @@ -29,7 +29,7 @@ export default class FormTargetAddHostSetsComponent extends Component { get filteredHostSets() { // Get IDs for host sets already added to the current target const alreadyAddedHostSetIDs = this.args.model.host_sets.map( - ({ host_set_id }) => host_set_id + ({ host_source_id }) => host_source_id ); const notAddedHostSets = this.args.hostSets.filter( ({ id }) => !alreadyAddedHostSetIDs.includes(id) From 735878b7ef25788c7de8b18e6890e63a331e1e68 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 22 Sep 2021 08:49:38 -0400 Subject: [PATCH 07/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20internal?= =?UTF-8?q?=20variable=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/serializers/target.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/addons/api/addon/serializers/target.js b/addons/api/addon/serializers/target.js index c287aca46..2df01d96d 100644 --- a/addons/api/addon/serializers/target.js +++ b/addons/api/addon/serializers/target.js @@ -17,14 +17,15 @@ export default class TargetSerializer extends ApplicationSerializer { */ serialize(snapshot) { let serialized = super.serialize(...arguments); - const hostSetIDs = snapshot?.adapterOptions?.hostSetIDs; - if (hostSetIDs) - serialized = this.serializeWithHostSets(snapshot, hostSetIDs); - const credentialLibraryIDs = snapshot?.adapterOptions?.credentialLibraryIDs; - if (credentialLibraryIDs) - serialized = this.serializeWithCredentialLibraries( + const hostSourceIDs = snapshot?.adapterOptions?.hostSetIDs; + if (hostSourceIDs) { + serialized = this.serializeWithHostSources(snapshot, hostSourceIDs); + } + const credentialSourceIDs = snapshot?.adapterOptions?.credentialLibraryIDs; + if (credentialSourceIDs) + serialized = this.serializeWithCredentialSources( snapshot, - credentialLibraryIDs + credentialSourceIDs ); return serialized; } @@ -36,10 +37,10 @@ export default class TargetSerializer extends ApplicationSerializer { * @param {[string]} hostSetIDs * @return {object} */ - serializeWithHostSets(snapshot, hostSetIDs) { + serializeWithHostSources(snapshot, hostSourceIDs) { return { version: snapshot.attr('version'), - host_set_ids: hostSetIDs, + host_set_ids: hostSourceIDs, }; } @@ -50,10 +51,10 @@ export default class TargetSerializer extends ApplicationSerializer { * @param {[string]} credentialLibraryIDs * @return {object} */ - serializeWithCredentialLibraries(snapshot, credentialLibraryIDs) { + serializeWithCredentialSources(snapshot, credentialSourceIDs) { return { version: snapshot.attr('version'), - application_credential_library_ids: credentialLibraryIDs, + application_credential_library_ids: credentialSourceIDs, }; } } From 8b09f132e0447e48e2d4225f72ad2159138ca1d1 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 22 Sep 2021 17:39:15 -0400 Subject: [PATCH 08/12] chore: rename to application_credential_source_ids --- addons/api/addon/models/target.js | 6 ++-- addons/api/addon/serializers/target.js | 2 +- addons/api/mirage/config.js | 4 +-- addons/api/mirage/serializers/target.js | 2 +- addons/api/tests/unit/models/target-test.js | 28 +++++++++---------- .../unit/serializers/application-test.js | 2 +- .../api/tests/unit/serializers/target-test.js | 12 ++++---- .../target/add-credential-libraries/index.js | 4 +-- .../targets/target/credential-sources.js | 2 +- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 919a47201..48954ebbd 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -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', diff --git a/addons/api/addon/serializers/target.js b/addons/api/addon/serializers/target.js index 2df01d96d..a5e434b86 100644 --- a/addons/api/addon/serializers/target.js +++ b/addons/api/addon/serializers/target.js @@ -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, }; } } diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index c1b535a41..90d290801 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -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); diff --git a/addons/api/mirage/serializers/target.js b/addons/api/mirage/serializers/target.js index b970f4853..1697ab0e2 100644 --- a/addons/api/mirage/serializers/target.js +++ b/addons/api/mirage/serializers/target.js @@ -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; }, diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index 5635a1a3d..b753188ad 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -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', diff --git a/addons/api/tests/unit/serializers/application-test.js b/addons/api/tests/unit/serializers/application-test.js index 242b269c1..eed4c205a 100644 --- a/addons/api/tests/unit/serializers/application-test.js +++ b/addons/api/tests/unit/serializers/application-test.js @@ -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: {}, }, diff --git a/addons/api/tests/unit/serializers/target-test.js b/addons/api/tests/unit/serializers/target-test.js index ea2e5b3c8..5254b5ab2 100644 --- a/addons/api/tests/unit/serializers/target-test.js +++ b/addons/api/tests/unit/serializers/target-test.js @@ -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: {}, }, diff --git a/ui/admin/app/components/form/target/add-credential-libraries/index.js b/ui/admin/app/components/form/target/add-credential-libraries/index.js index 21ce6250a..24e827fc6 100644 --- a/ui/admin/app/components/form/target/add-credential-libraries/index.js +++ b/ui/admin/app/components/form/target/add-credential-libraries/index.js @@ -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( diff --git a/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js index 89cee4978..56dd78648 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/credential-sources.js @@ -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) => From 77420d29c65b694d5f25bd5f060e48d1b9f76512 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 22 Sep 2021 18:34:35 -0400 Subject: [PATCH 09/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20rename=20credenti?= =?UTF-8?q?al=20source=20custom=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/target.js | 10 +++++----- addons/api/mirage/config.js | 4 ++-- addons/api/tests/unit/models/target-test.js | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 48954ebbd..b50506dcb 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -152,7 +152,7 @@ export default class TargetModel extends GeneratedTargetModel { } /** - * Adds credential libraries via the `add-credential-libraries` method. + * Adds credential libraries via the `add-credential-sources` method. * See serializer and adapter for more information. * @param {[string]} credentialLibraryIDs * @param {object} options @@ -161,7 +161,7 @@ export default class TargetModel extends GeneratedTargetModel { */ addCredentialSources(credentialLibraryIDs, options = { adapterOptions: {} }) { const defaultAdapterOptions = { - method: 'add-credential-libraries', + method: 'add-credential-sources', credentialLibraryIDs, }; // There is no "deep merge" in ES. @@ -175,7 +175,7 @@ export default class TargetModel extends GeneratedTargetModel { } /** - * Delete credential libraries via the `remove-credential-libraries` method. + * Delete credential libraries via the `remove-credential-sources` method. * See serializer and adapter for more information. * @param {[string]} credentialLibraryIDs * @param {object} options @@ -187,7 +187,7 @@ export default class TargetModel extends GeneratedTargetModel { options = { adapterOptions: {} } ) { const defaultAdapterOptions = { - method: 'remove-credential-libraries', + method: 'remove-credential-sources', credentialLibraryIDs, }; // There is no "deep merge" in ES. @@ -201,7 +201,7 @@ export default class TargetModel extends GeneratedTargetModel { } /** - * Delete a single credential library set via the `remove-credential-libraries` method. + * Delete a single credential library set via the `remove-credential-sources` method. * @param {number} credentialLibraryID * @param {object} options * @return {Promise} diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index 90d290801..b39dff5a2 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -384,7 +384,7 @@ export default function () { }); } // If adding credential libraries, push them into the array - if (method === 'add-credential-libraries') { + if (method === 'add-credential-sources') { updatedAttrs.credentialLibraryIds = target.credentialLibraryIds; attrs.applicationCredentialSourceIds.forEach((id) => { if (!updatedAttrs.credentialLibraryIds.includes(id)) { @@ -393,7 +393,7 @@ export default function () { }); } // If deleting credential libraries, filter them out of the array - if (method === 'remove-credential-libraries') { + if (method === 'remove-credential-sources') { updatedAttrs.credentialLibraryIds = target.credentialLibraryIds; updatedAttrs.credentialLibraryIds = updatedAttrs.credentialLibraryIds.filter((id) => { diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index b753188ad..51be507e7 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -283,7 +283,7 @@ module('Unit | Model | target', function (hooks) { test('it has an `addCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post( - '/v1/targets/123abc:add-credential-libraries', + '/v1/targets/123abc:add-credential-sources', (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { @@ -317,7 +317,7 @@ module('Unit | Model | target', function (hooks) { test('it has a `removeCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post( - '/v1/targets/123abc:remove-credential-libraries', + '/v1/targets/123abc:remove-credential-sources', (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { @@ -351,7 +351,7 @@ module('Unit | Model | target', function (hooks) { test('it has a `removeCredentialSource` method that deletes a single credential library using `removeCredentialSources` method', async function (assert) { assert.expect(1); this.server.post( - '/v1/targets/123abc:remove-credential-libraries', + '/v1/targets/123abc:remove-credential-sources', (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { From 4e3a167ef70a24c5ea8f0dafd1dbe8976395cdfa Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 22 Sep 2021 18:52:38 -0400 Subject: [PATCH 10/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20change=20host=20s?= =?UTF-8?q?ource=20custom=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/target.js | 10 ++++---- addons/api/mirage/config.js | 4 ++-- addons/api/tests/unit/models/target-test.js | 23 +++++++++++-------- .../scope/targets/target/add-host-sources.js | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index b50506dcb..15cd3e678 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -96,7 +96,7 @@ export default class TargetModel extends GeneratedTargetModel { // =methods /** - * Adds host sets via the `add-host-sets` method. + * Adds host sets via the `add-host-sources` method. * See serializer and adapter for more information. * @param {[string]} hostSetIDs * @param {object} options @@ -105,7 +105,7 @@ export default class TargetModel extends GeneratedTargetModel { */ addHostSources(hostSetIDs, options = { adapterOptions: {} }) { const defaultAdapterOptions = { - method: 'add-host-sets', + method: 'add-host-sources', hostSetIDs, }; // There is no "deep merge" in ES. @@ -119,7 +119,7 @@ export default class TargetModel extends GeneratedTargetModel { } /** - * Delete host sets via the `remove-host-sets` method. + * Delete host sets via the `remove-host-sources` method. * See serializer and adapter for more information. * @param {[string]} hostSetIDs * @param {object} options @@ -128,7 +128,7 @@ export default class TargetModel extends GeneratedTargetModel { */ removeHostSources(hostSetIDs, options = { adapterOptions: {} }) { const defaultAdapterOptions = { - method: 'remove-host-sets', + method: 'remove-host-sources', hostSetIDs, }; // There is no "deep merge" in ES. @@ -142,7 +142,7 @@ export default class TargetModel extends GeneratedTargetModel { } /** - * Delete a single host set via the `remove-host-sets` method. + * Delete a single host set via the `remove-host-sources` method. * @param {number} hostSetID * @param {object} options * @return {Promise} diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index b39dff5a2..c697bb6c5 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -368,7 +368,7 @@ export default function () { version: attrs.version, }; // If adding host sets, push them into the array - if (method === 'add-host-sets') { + if (method === 'add-host-sources') { updatedAttrs.hostSetIds = target.hostSetIds; attrs.hostSetIds.forEach((id) => { if (!updatedAttrs.hostSetIds.includes(id)) { @@ -377,7 +377,7 @@ export default function () { }); } // If deleting host sets, filter them out of the array - if (method === 'remove-host-sets') { + if (method === 'remove-host-sources') { updatedAttrs.hostSetIds = target.hostSetIds; updatedAttrs.hostSetIds = updatedAttrs.hostSetIds.filter((id) => { return !attrs.hostSetIds.includes(id); diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index 51be507e7..dc458a879 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -74,14 +74,17 @@ module('Unit | Model | target', function (hooks) { test('it has an `addHostSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); - this.server.post('/v1/targets/123abc:add-host-sets', (schema, request) => { - const body = JSON.parse(request.requestBody); - assert.deepEqual(body, { - host_set_ids: ['123_abc', 'foobar'], - version: 1, - }); - return { id: '123abc' }; - }); + this.server.post( + '/v1/targets/123abc:add-host-sources', + (schema, request) => { + const body = JSON.parse(request.requestBody); + assert.deepEqual(body, { + host_set_ids: ['123_abc', 'foobar'], + version: 1, + }); + return { id: '123abc' }; + } + ); const store = this.owner.lookup('service:store'); store.push({ data: { @@ -109,7 +112,7 @@ module('Unit | Model | target', function (hooks) { test('it has a `removeHostSources` method that targets a specific POST API endpoint and serialization', async function (assert) { assert.expect(1); this.server.post( - '/v1/targets/123abc:remove-host-sets', + '/v1/targets/123abc:remove-host-sources', (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { @@ -146,7 +149,7 @@ module('Unit | Model | target', function (hooks) { test('it has a `removeHostSource` method that deletes a single host set using `removeHostSources` method', async function (assert) { assert.expect(1); this.server.post( - '/v1/targets/123abc:remove-host-sets', + '/v1/targets/123abc:remove-host-sources', (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js index 44bb07406..cb4f2150c 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js @@ -42,7 +42,7 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route { } /** - * Renders the add-host-sets-specific header template. + * Renders the add-host-sources-specific header template. * @override */ renderTemplate() { From 94f6316b4aae9ddfb4c079ec16a6529e07840228 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 22 Sep 2021 19:15:09 -0400 Subject: [PATCH 11/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20host=20s?= =?UTF-8?q?ource=20attribute=20ames?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/target.js | 6 ++-- addons/api/addon/serializers/target.js | 4 +-- addons/api/mirage/config.js | 4 +-- addons/api/mirage/serializers/target.js | 2 +- addons/api/tests/unit/models/target-test.js | 28 +++++++++---------- .../unit/serializers/application-test.js | 2 +- .../api/tests/unit/serializers/target-test.js | 18 ++++++------ .../form/target/add-host-sets/index.js | 4 +-- .../scope/targets/target/host-sources.js | 6 ++-- .../scope/projects/targets/target/hosts.js | 2 +- 10 files changed, 39 insertions(+), 37 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 15cd3e678..9cfd4dd2d 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -18,7 +18,7 @@ export default class TargetModel extends GeneratedTargetModel { readOnly: true, emptyArrayIfMissing: true, }) - host_sets; + host_sources; /** * Credential library ids are read only and can be @@ -36,9 +36,9 @@ export default class TargetModel extends GeneratedTargetModel { * instances). Unresolvable instances are excluded from the array. * @type {[{model: HostSetModel, hostCatalog: HostCatalogModel}]} */ - @computed('host_sets.[]', 'store') + @computed('host_sources.[]', 'store') get hostSets() { - return this.host_sets + return this.host_sources .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), diff --git a/addons/api/addon/serializers/target.js b/addons/api/addon/serializers/target.js index a5e434b86..a6ac73f73 100644 --- a/addons/api/addon/serializers/target.js +++ b/addons/api/addon/serializers/target.js @@ -31,7 +31,7 @@ export default class TargetSerializer extends ApplicationSerializer { } /** - * Returns a payload containing only the host_set_ids array using IDs + * Returns a payload containing only the host_source_ids array using IDs * passed into the function (rather than existing host sets on the model). * @param {Snapshot} snapshot * @param {[string]} hostSetIDs @@ -40,7 +40,7 @@ export default class TargetSerializer extends ApplicationSerializer { serializeWithHostSources(snapshot, hostSourceIDs) { return { version: snapshot.attr('version'), - host_set_ids: hostSourceIDs, + host_source_ids: hostSourceIDs, }; } diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index c697bb6c5..a6817e634 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -370,7 +370,7 @@ export default function () { // If adding host sets, push them into the array if (method === 'add-host-sources') { updatedAttrs.hostSetIds = target.hostSetIds; - attrs.hostSetIds.forEach((id) => { + attrs.hostSourceIds.forEach((id) => { if (!updatedAttrs.hostSetIds.includes(id)) { updatedAttrs.hostSetIds.push(id); } @@ -380,7 +380,7 @@ export default function () { if (method === 'remove-host-sources') { updatedAttrs.hostSetIds = target.hostSetIds; updatedAttrs.hostSetIds = updatedAttrs.hostSetIds.filter((id) => { - return !attrs.hostSetIds.includes(id); + return !attrs.hostSourceIds.includes(id); }); } // If adding credential libraries, push them into the array diff --git a/addons/api/mirage/serializers/target.js b/addons/api/mirage/serializers/target.js index 1697ab0e2..00249f164 100644 --- a/addons/api/mirage/serializers/target.js +++ b/addons/api/mirage/serializers/target.js @@ -17,7 +17,7 @@ export default ApplicationSerializer.extend({ ); const { hostSets } = this.schema; if (model.hostSetIds?.length) { - json.host_sets = model.hostSetIds.map((host_set_id) => { + json.host_sources = model.hostSetIds.map((host_set_id) => { const hostSet = hostSets.find(host_set_id); const host_catalog_id = hostSet?.hostCatalog?.id; return { id: host_set_id, host_catalog_id }; diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index dc458a879..e182ccf9f 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -14,7 +14,7 @@ module('Unit | Model | target', function (hooks) { id: '123abc', type: 'target', attributes: { - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '2' }, ], @@ -23,9 +23,9 @@ module('Unit | Model | target', function (hooks) { }); const target = store.peekRecord('target', '123abc'); assert.equal( - target.host_sets.length, + target.host_sources.length, 2, - 'Target has two entires in host_sets' + 'Target has two entires in host_sources' ); assert.equal( target.hostSets.length, @@ -46,14 +46,14 @@ module('Unit | Model | target', function (hooks) { attributes: {}, }, }); - // Since `hostSets` is computed on `host_sets`, not the store itself, + // Since `hostSets` is computed on `host_sources`, not the store itself, // it's necessary to do this assignment to kick-off the computed update. // eslint-disable-next-line no-self-assign - target.host_sets = target.host_sets; + target.host_sources = target.host_sources; assert.equal( - target.host_sets.length, + target.host_sources.length, 2, - 'Target has two entires in host_sets' + 'Target has two entires in host_sources' ); assert.equal(target.hostSets.length, 2, 'Target has two resolved hostSets'); assert.notOk( @@ -68,7 +68,7 @@ module('Unit | Model | target', function (hooks) { }, }); // eslint-disable-next-line no-self-assign - target.host_sets = target.host_sets; + target.host_sources = target.host_sources; assert.ok(target.hostSets[0].hostCatalog, 'Host catalog is resolved'); }); @@ -79,7 +79,7 @@ module('Unit | Model | target', function (hooks) { (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { - host_set_ids: ['123_abc', 'foobar'], + host_source_ids: ['123_abc', 'foobar'], version: 1, }); return { id: '123abc' }; @@ -93,7 +93,7 @@ module('Unit | Model | target', function (hooks) { attributes: { name: 'Target', description: 'Description', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], @@ -116,7 +116,7 @@ module('Unit | Model | target', function (hooks) { (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { - host_set_ids: ['1', '3'], + host_source_ids: ['1', '3'], version: 1, }); return { id: '123abc' }; @@ -130,7 +130,7 @@ module('Unit | Model | target', function (hooks) { attributes: { name: 'Target', description: 'Description', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], @@ -153,7 +153,7 @@ module('Unit | Model | target', function (hooks) { (schema, request) => { const body = JSON.parse(request.requestBody); assert.deepEqual(body, { - host_set_ids: ['3'], + host_source_ids: ['3'], version: 1, }); return { id: '123abc' }; @@ -167,7 +167,7 @@ module('Unit | Model | target', function (hooks) { attributes: { name: 'Target', description: 'Description', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], diff --git a/addons/api/tests/unit/serializers/application-test.js b/addons/api/tests/unit/serializers/application-test.js index eed4c205a..e1488127f 100644 --- a/addons/api/tests/unit/serializers/application-test.js +++ b/addons/api/tests/unit/serializers/application-test.js @@ -204,7 +204,7 @@ module('Unit | Serializer | application', function (hooks) { authorized_actions: [], name: 'Target 1', scope: { scope_id: 'o_123' }, - host_sets: [], + host_sources: [], application_credential_source_ids: [], }, relationships: {}, diff --git a/addons/api/tests/unit/serializers/target-test.js b/addons/api/tests/unit/serializers/target-test.js index 5254b5ab2..8f9c980c1 100644 --- a/addons/api/tests/unit/serializers/target-test.js +++ b/addons/api/tests/unit/serializers/target-test.js @@ -11,7 +11,7 @@ module('Unit | Serializer | target', function (hooks) { const record = store.createRecord('target', { name: 'User', description: 'Description', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], @@ -40,14 +40,14 @@ module('Unit | Serializer | target', function (hooks) { }); }); - test('it serializes only host sets and version when an `adapterOptions.hostSetIDs` array is passed', function (assert) { + test('it serializes only host sources and version when an `adapterOptions.hostSetIDs` array is passed', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('target'); const record = store.createRecord('target', { name: 'User', description: 'Description', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], @@ -59,12 +59,12 @@ module('Unit | Serializer | target', function (hooks) { }; const serializedRecord = serializer.serialize(snapshot); assert.deepEqual(serializedRecord, { - host_set_ids: ['4', '5'], + host_source_ids: ['4', '5'], version: 1, }); }); - test('it serializes only credential libraries and version when an `adapterOptions.credentialLibraryIDs` array is passed', function (assert) { + test('it serializes only credential sources and version when an `adapterOptions.credentialLibraryIDs` array is passed', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('target'); @@ -93,7 +93,7 @@ module('Unit | Serializer | target', function (hooks) { const payload = { id: '1', name: 'Target 1', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], @@ -112,7 +112,7 @@ module('Unit | Serializer | target', function (hooks) { attributes: { authorized_actions: [], name: 'Target 1', - host_sets: [ + host_sources: [ { host_source_id: '1', host_catalog_id: '2' }, { host_source_id: '3', host_catalog_id: '4' }, ], @@ -123,7 +123,7 @@ module('Unit | Serializer | target', function (hooks) { }); }); - test('it normalizes missing host_sets and credential libraries to empty array', function (assert) { + test('it normalizes missing host_sources and credential libraries to empty array', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('target'); @@ -147,7 +147,7 @@ module('Unit | Serializer | target', function (hooks) { authorized_actions: [], name: 'Target 1', scope: { scope_id: 'o_123' }, - host_sets: [], + host_sources: [], application_credential_source_ids: [], }, relationships: {}, diff --git a/ui/admin/app/components/form/target/add-host-sets/index.js b/ui/admin/app/components/form/target/add-host-sets/index.js index eb0f5e246..edb1cab73 100644 --- a/ui/admin/app/components/form/target/add-host-sets/index.js +++ b/ui/admin/app/components/form/target/add-host-sets/index.js @@ -25,10 +25,10 @@ export default class FormTargetAddHostSetsComponent extends Component { * Host sets not already added to the target. * @type {[HostSetModel]} */ - @computed('args.{hostSets.[],model.host_sets.[]}') + @computed('args.{hostSets.[],model.host_sources.[]}') get filteredHostSets() { // Get IDs for host sets already added to the current target - const alreadyAddedHostSetIDs = this.args.model.host_sets.map( + const alreadyAddedHostSetIDs = this.args.model.host_sources.map( ({ host_source_id }) => host_source_id ); const notAddedHostSets = this.args.hostSets.filter( diff --git a/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js index 2f0296764..39d1d313a 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/host-sources.js @@ -20,8 +20,10 @@ export default class ScopesScopeTargetsTargetHostSourcesRoute extends Route { * @return {Promise{[HostSetModel, HostCatalogModel]}} */ beforeModel() { - const { scopeID, host_sets } = this.modelFor('scopes.scope.targets.target'); - const promises = host_sets.map( + const { scopeID, host_sources } = this.modelFor( + 'scopes.scope.targets.target' + ); + const promises = host_sources.map( ({ host_source_id, host_catalog_id: hostCatalogID }) => hash({ // TODO: multiple host sets may belong to the same catalog, 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 b155f20c6..435901a2e 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,7 +21,7 @@ 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_source_id }) => + target.host_sources.map(({ host_source_id }) => this.store.findRecord('host-set', host_source_id) ) ); From 1e4aa6631a3f882bf0a1e132925ed19028fd2588 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 23 Sep 2021 10:04:23 -0400 Subject: [PATCH 12/12] =?UTF-8?q?chore:=20=F0=9F=A4=96=20misc=20name=20cha?= =?UTF-8?q?nges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/models/target.js | 9 +++------ addons/api/addon/serializers/target.js | 10 +++++----- addons/api/mirage/config.js | 8 ++++---- addons/api/tests/unit/serializers/target-test.js | 2 +- .../form/target/add-credential-libraries/index.js | 2 +- .../scope/targets/target/add-credential-sources.js | 2 +- .../scopes/scope/targets/target/add-host-sources.js | 2 +- ui/admin/tests/acceptance/targets/host-sources-test.js | 2 +- 8 files changed, 17 insertions(+), 20 deletions(-) diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 9cfd4dd2d..9b36a5749 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -21,7 +21,7 @@ export default class TargetModel extends GeneratedTargetModel { host_sources; /** - * Credential library ids are read only and can be + * Credential source ids are read only and can be * persisted via a dedicated call to `addCredentialSources()`. */ @fragmentArray('fragment-string', { @@ -55,11 +55,8 @@ export default class TargetModel extends GeneratedTargetModel { @computed('application_credential_source_ids.[]', 'store') get credentialLibraries() { return this.application_credential_source_ids - .map((credential_library_fragment) => - this.store.peekRecord( - 'credential-library', - credential_library_fragment.value - ) + .map((source) => + this.store.peekRecord('credential-library', source.value) ) .filter(Boolean); } diff --git a/addons/api/addon/serializers/target.js b/addons/api/addon/serializers/target.js index a6ac73f73..8bf8b6882 100644 --- a/addons/api/addon/serializers/target.js +++ b/addons/api/addon/serializers/target.js @@ -31,8 +31,8 @@ export default class TargetSerializer extends ApplicationSerializer { } /** - * Returns a payload containing only the host_source_ids array using IDs - * passed into the function (rather than existing host sets on the model). + * Returns a payload containing only version and an array of passed IDs, + * rather than existing instances on the model. * @param {Snapshot} snapshot * @param {[string]} hostSetIDs * @return {object} @@ -45,10 +45,10 @@ export default class TargetSerializer extends ApplicationSerializer { } /** - * Returns a payload containing only the credential_library_ids array using IDs - * passed into the function (rather than existing credential libraries on the model). + * Returns a payload containing only version and an array of passed IDs, + * rather than existing instances on the model. * @param {Snapshot} snapshot - * @param {[string]} credentialLibraryIDs + * @param {[string]} credentialSourceIDs * @return {object} */ serializeWithCredentialSources(snapshot, credentialSourceIDs) { diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index a6817e634..68c7f6b94 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -367,7 +367,7 @@ export default function () { const updatedAttrs = { version: attrs.version, }; - // If adding host sets, push them into the array + // If adding host sources, push them into the array if (method === 'add-host-sources') { updatedAttrs.hostSetIds = target.hostSetIds; attrs.hostSourceIds.forEach((id) => { @@ -376,14 +376,14 @@ export default function () { } }); } - // If deleting host sets, filter them out of the array + // If deleting host sources, filter them out of the array if (method === 'remove-host-sources') { updatedAttrs.hostSetIds = target.hostSetIds; updatedAttrs.hostSetIds = updatedAttrs.hostSetIds.filter((id) => { return !attrs.hostSourceIds.includes(id); }); } - // If adding credential libraries, push them into the array + // If adding credential sources, push them into the array if (method === 'add-credential-sources') { updatedAttrs.credentialLibraryIds = target.credentialLibraryIds; attrs.applicationCredentialSourceIds.forEach((id) => { @@ -392,7 +392,7 @@ export default function () { } }); } - // If deleting credential libraries, filter them out of the array + // If deleting credential sources, filter them out of the array if (method === 'remove-credential-sources') { updatedAttrs.credentialLibraryIds = target.credentialLibraryIds; updatedAttrs.credentialLibraryIds = diff --git a/addons/api/tests/unit/serializers/target-test.js b/addons/api/tests/unit/serializers/target-test.js index 8f9c980c1..0c1bd089c 100644 --- a/addons/api/tests/unit/serializers/target-test.js +++ b/addons/api/tests/unit/serializers/target-test.js @@ -123,7 +123,7 @@ module('Unit | Serializer | target', function (hooks) { }); }); - test('it normalizes missing host_sources and credential libraries to empty array', function (assert) { + test('it normalizes missing host_sources and application_credential_source_ids to empty array', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('target'); diff --git a/ui/admin/app/components/form/target/add-credential-libraries/index.js b/ui/admin/app/components/form/target/add-credential-libraries/index.js index 24e827fc6..78b4a29b0 100644 --- a/ui/admin/app/components/form/target/add-credential-libraries/index.js +++ b/ui/admin/app/components/form/target/add-credential-libraries/index.js @@ -32,7 +32,7 @@ export default class FormTargetAddCredentialLibrariesIndexComponent extends Comp // Get IDs for credential libraries already added to the current target const currentCredentialLibraryIDs = this.args.model.application_credential_source_ids.map( - (credentialLibrary) => credentialLibrary.value + (source) => source.value ); const notAddedCredentialLibraries = this.args.credentialLibraries.filter( ({ id }) => !currentCredentialLibraryIDs.includes(id) diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js index 9cfc43d03..88cfa0cb5 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-credential-sources.js @@ -82,7 +82,7 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R } /** - * Redirect to target credential libraries as if nothing ever happened. + * Redirect to target credential sources as if nothing ever happened. */ @action cancel() { diff --git a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js index cb4f2150c..19c4e6c37 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/add-host-sources.js @@ -76,7 +76,7 @@ export default class ScopesScopeTargetsTargetAddHostSourcesRoute extends Route { } /** - * Redirect to target host sets as if nothing ever happened. + * Redirect to target host sources as if nothing ever happened. */ @action cancel() { diff --git a/ui/admin/tests/acceptance/targets/host-sources-test.js b/ui/admin/tests/acceptance/targets/host-sources-test.js index 9cf02a4f4..e80ee4816 100644 --- a/ui/admin/tests/acceptance/targets/host-sources-test.js +++ b/ui/admin/tests/acceptance/targets/host-sources-test.js @@ -65,7 +65,7 @@ module('Acceptance | targets | host-sources', function (hooks) { authenticateSession({}); }); - test('visiting target host sets', async function (assert) { + test('visiting target host sources', async function (assert) { assert.expect(3); const targetHostSetCount = instances.target.hostSets.length; await visit(urls.targetHostSources);