From 614b98b8fbd57f5600fd3921b60f9c6eb31997e5 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 21 Sep 2021 14:53:56 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20change=20method=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 () {