From 9fe89c9b18205faae08c062a5bb28c885e0bb07b Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 26 May 2021 17:12:51 -0400 Subject: [PATCH] feature: add addItem functionality to array fields --- .../app/components/form/auth-method/index.hbs | 1 + .../form/auth-method/oidc/index.hbs | 117 +++++++++++++++++- .../components/form/auth-method/oidc/index.js | 5 + .../app/routes/scopes/scope/auth-methods.js | 14 +++ .../scope/auth-methods/auth-method/index.hbs | 1 + 5 files changed, 137 insertions(+), 1 deletion(-) diff --git a/ui/admin/app/components/form/auth-method/index.hbs b/ui/admin/app/components/form/auth-method/index.hbs index 9ac27859f..048be9d25 100644 --- a/ui/admin/app/components/form/auth-method/index.hbs +++ b/ui/admin/app/components/form/auth-method/index.hbs @@ -5,5 +5,6 @@ submit=@submit cancel=@cancel removeItemByIndex=@removeItemByIndex + addStringItem=@addStringItem }} {{/if}} \ No newline at end of file diff --git a/ui/admin/app/components/form/auth-method/oidc/index.hbs b/ui/admin/app/components/form/auth-method/oidc/index.hbs index a0ababf3d..8b82c6467 100644 --- a/ui/admin/app/components/form/auth-method/oidc/index.hbs +++ b/ui/admin/app/components/form/auth-method/oidc/index.hbs @@ -177,6 +177,44 @@ {{/each}} + + + + + + {{#each this.signingAlgorithms as |algorithm|}} + {{algorithm}} + {{/each}} + + + + + + {{t 'actions.add'}} + + + @@ -235,6 +273,33 @@ {{/each}} + + + + + + + + {{t 'actions.add'}} + + + @@ -293,6 +358,33 @@ {{/each}} + + + + + + + + {{t 'actions.add'}} + + + @@ -434,7 +526,30 @@ {{/each}} - {{! Add field }} + + + + + + + + {{t 'actions.add'}} + + + diff --git a/ui/admin/app/components/form/auth-method/oidc/index.js b/ui/admin/app/components/form/auth-method/oidc/index.js index fd99fc353..166e33561 100644 --- a/ui/admin/app/components/form/auth-method/oidc/index.js +++ b/ui/admin/app/components/form/auth-method/oidc/index.js @@ -12,4 +12,9 @@ export default class FormAuthMethodOidcComponent extends Component { * @type {object} */ toClaims = options.oidc.account_claim_maps.to; + + /** + * @type {string} + */ + newSigningAlgorithm = options.oidc.signing_algorithms[0]; } diff --git a/ui/admin/app/routes/scopes/scope/auth-methods.js b/ui/admin/app/routes/scopes/scope/auth-methods.js index d432f9b9d..00666c1fb 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods.js @@ -148,4 +148,18 @@ export default class ScopesScopeAuthMethodsRoute extends Route { const array = authMethod.get(property); array.removeAt(index); } + + /** + * Adds a string item to array `property` on the passed `authMethod`. + * This is used to manage entries in fragment string array fields such + * as `signing_algorithms`. + * @param {AuthMethodModel} authMethod + * @param {string} property + * @param {string} value + */ + @action + async addStringItem(authMethod, property, value) { + const array = authMethod.get(property); + array.addObject({ value }); + } } diff --git a/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/index.hbs index f610fc81e..2c477bb7c 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/index.hbs @@ -3,4 +3,5 @@ @submit={{route-action 'save' @model}} @cancel={{route-action 'cancel' @model}} @removeItemByIndex={{route-action 'removeItemByIndex' @model}} + @addStringItem={{route-action 'addStringItem' @model}} /> \ No newline at end of file