* refactor: 💡 add-credential-sources to include credentials * refactor: 💡 update add-credential-sources template Update to how AddCredentialSources form is rendered in the template ✅ Closes: ICU-5253 * refactor: 💡 Update add-credential-sources method signatures * refactor: 💡 change how add-credential-source form is rendered * refactor: 💡 Remove duplicate add-credential-sources message Remove the duplicate No Credential Credential Sources message from add-credential-sources form * refactor: 💡 Move filter logic to controller Move credential source filter logic from route to controller for add-credential-sources * test: 💍 Verify all available credential sources are listed
37 lines
923 B
JavaScript
37 lines
923 B
JavaScript
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { A } from '@ember/array';
|
|
|
|
export default class FormTargetAddCredentialSourcesIndexComponent extends Component {
|
|
// =properties
|
|
|
|
/**
|
|
* Array of selected credential source IDs.
|
|
* @type {EmberArray}
|
|
*/
|
|
selectedCredentialSourceIDs = A();
|
|
|
|
// =actions
|
|
|
|
/**
|
|
* Add/Remove credential source to current selection
|
|
* @param {CredentialLibraryModel, CredentialModel} credentialSource
|
|
*/
|
|
@action
|
|
toggleCredentialSource(credentialSource) {
|
|
if (!this.selectedCredentialSourceIDs.includes(credentialSource.id)) {
|
|
this.selectedCredentialSourceIDs.addObject(credentialSource.id);
|
|
} else {
|
|
this.selectedCredentialSourceIDs.removeObject(credentialSource.id);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Submit selected credential source ids
|
|
*/
|
|
@action
|
|
submit(fn) {
|
|
fn(this.selectedCredentialSourceIDs);
|
|
}
|
|
}
|