From 2cda4f639e4782ada8853bcbce2e2b9584f493d1 Mon Sep 17 00:00:00 2001 From: Cameron Perera Date: Thu, 4 Aug 2022 14:53:44 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20update=20onSubmit=20?= =?UTF-8?q?for=20add-credential-sources=20(#1233)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove submit action from form component and pass selected credential IDs directly to the submit method --- .../target/add-credential-sources/index.hbs | 4 ++-- .../target/add-credential-sources/index.js | 18 +++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ui/admin/app/components/form/target/add-credential-sources/index.hbs b/ui/admin/app/components/form/target/add-credential-sources/index.hbs index 1f7f7704b..c9a06ad13 100644 --- a/ui/admin/app/components/form/target/add-credential-sources/index.hbs +++ b/ui/admin/app/components/form/target/add-credential-sources/index.hbs @@ -1,6 +1,6 @@ {{credentialSource.name}} diff --git a/ui/admin/app/components/form/target/add-credential-sources/index.js b/ui/admin/app/components/form/target/add-credential-sources/index.js index 451d47f15..1715401da 100644 --- a/ui/admin/app/components/form/target/add-credential-sources/index.js +++ b/ui/admin/app/components/form/target/add-credential-sources/index.js @@ -15,22 +15,14 @@ export default class FormTargetAddCredentialSourcesIndexComponent extends Compon /** * Add/Remove credential source to current selection - * @param {CredentialLibraryModel, CredentialModel} credentialSource + * @param {string} credentialSourceId */ @action - toggleCredentialSource(credentialSource) { - if (!this.selectedCredentialSourceIDs.includes(credentialSource.id)) { - this.selectedCredentialSourceIDs.addObject(credentialSource.id); + toggleCredentialSource(credentialSourceId) { + if (!this.selectedCredentialSourceIDs.includes(credentialSourceId)) { + this.selectedCredentialSourceIDs.addObject(credentialSourceId); } else { - this.selectedCredentialSourceIDs.removeObject(credentialSource.id); + this.selectedCredentialSourceIDs.removeObject(credentialSourceId); } } - - /** - * Submit selected credential source ids - */ - @action - submit(fn) { - fn(this.selectedCredentialSourceIDs); - } }