feature: add array fields to oidc form

This commit is contained in:
Randall Morey committed 2021-05-25 17:36:28 -04:00
1 parent 9f469aec38
commit 5ea26dc7ea
5 files changed
+328 -2

No files matched your search

@@ -119,6 +119,277 @@
{{/if}}
</form.input>
{{! Signing Algorithms }}
<Rose::Form::Fieldset>
<:title>{{t 'form.signing_algorithms.label'}}</:title>
<:description>{{t 'form.signing_algorithms.help'}}</:description>
<:body>
<Rose::Table @style="condensed" as |table|>
<table.header as |header|>
<header.row @hidden={{true}} as |row|>
<row.headerCell>{{t 'titles.value'}}</row.headerCell>
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.attributes.signing_algorithms as |algorithm i|}}
<body.row as |row|>
<row.cell>
<form.select
@value={{algorithm.value}}
@error={{@model.errors.attributes.signing_algorithms}}
@contextual={{true}}
@onChange={{fn (mut algorithm.value)}}
as |field|>
<field.label>{{t 'form.algorithm.label'}}</field.label>
<field.field as |select|>
{{#each this.signingAlgorithms as |algorithm|}}
<select.option @value={{algorithm}}>{{algorithm}}</select.option>
{{/each}}
</field.field>
{{#if @model.errors.attributes.signing_algorithms}}
<field.errors as |errors|>
{{#each @model.errors.attributes.signing_algorithms as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.select>
</row.cell>
<row.cell @shrink={{true}}>
<Rose::Button
@style='secondary'
@iconOnly='trash'
title={{t 'actions.remove'}}
>
{{t 'actions.remove'}}
</Rose::Button>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</:body>
</Rose::Form::Fieldset>
{{! Certificates }}
<Rose::Form::Fieldset>
<:title>{{t 'form.idp_ca_certs.label'}}</:title>
<:description>{{t 'form.idp_ca_certs.help'}}</:description>
<:body>
<Rose::Table @style="condensed" as |table|>
<table.header as |header|>
<header.row @hidden={{true}} as |row|>
<row.headerCell>{{t 'titles.value'}}</row.headerCell>
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.attributes.idp_ca_certs as |cert i|}}
<body.row as |row|>
<row.cell>
<form.textarea
@value={{cert.value}}
@error={{@model.errors.attributes.idp_ca_certs}}
@contextual={{true}}
as |field|>
<field.label>{{t 'form.certificate.label'}}</field.label>
<field.field />
{{#if @model.errors.attributes.idp_ca_certs}}
<field.errors as |errors|>
{{#each @model.errors.attributes.idp_ca_certs as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.textarea>
</row.cell>
<row.cell @shrink={{true}}>
<Rose::Button
@style='secondary'
@iconOnly='trash'
title={{t 'actions.remove'}}
>
{{t 'actions.remove'}}
</Rose::Button>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</:body>
</Rose::Form::Fieldset>
{{! Allowed Audiences }}
<Rose::Form::Fieldset>
<:title>{{t 'form.allowed_audiences.label'}}</:title>
<:description>{{t 'form.allowed_audiences.help'}}</:description>
<:body>
<Rose::Table @style="condensed" as |table|>
<table.header as |header|>
<header.row @hidden={{true}} as |row|>
<row.headerCell>{{t 'titles.value'}}</row.headerCell>
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.attributes.allowed_audiences as |audience i|}}
<body.row as |row|>
<row.cell>
<form.input
@type='text'
@value={{audience.value}}
@error={{@model.errors.attributes.allowed_audiences}}
@contextual={{true}}
as |field|>
<field.label>{{t 'form.claim.label'}}</field.label>
<field.field />
{{#if @model.errors.attributes.allowed_audiences}}
<field.errors as |errors|>
{{#each @model.errors.attributes.allowed_audiences as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
</row.cell>
<row.cell @shrink={{true}}>
<Rose::Button
@style='secondary'
@iconOnly='trash'
title={{t 'actions.remove'}}
>
{{t 'actions.remove'}}
</Rose::Button>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</:body>
</Rose::Form::Fieldset>
{{! Claims Scopes }}
<Rose::Form::Fieldset>
<:title>{{t 'form.claims_scopes.label'}}</:title>
<:description>{{t 'form.claims_scopes.help'}}</:description>
<:body>
<Rose::Table @style="condensed" as |table|>
<table.header as |header|>
<header.row @hidden={{true}} as |row|>
<row.headerCell>{{t 'titles.value'}}</row.headerCell>
<row.headerCell></row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.attributes.claims_scopes as |claimsScope i|}}
<body.row as |row|>
<row.cell>
<form.input
@type='text'
@value={{claimsScope.value}}
@error={{@model.errors.attributes.claims_scopes}}
as |field|>
<field.label>{{t 'form.claims_scope.label'}}</field.label>
<field.field />
{{#if @model.errors.attributes.claims_scopes}}
<field.errors as |errors|>
{{#each @model.errors.attributes.claims_scopes as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
</row.cell>
<row.cell @shrink={{true}}>
<Rose::Button
@style='secondary'
@iconOnly='trash'
title={{t 'actions.remove'}}
>
{{t 'actions.remove'}}
</Rose::Button>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</:body>
</Rose::Form::Fieldset>
{{! Account Claim Maps }}
<Rose::Form::Fieldset>
<:title>{{t 'form.account_claim_maps.label'}}</:title>
<:description>{{t 'form.account_claim_maps.help'}}</:description>
<:body>
<Rose::Table @style="condensed" as |table|>
<table.header as |header|>
<header.row as |row|>
<row.headerCell>{{t 'form.from_claim.label'}}</row.headerCell>
<row.headerCell>{{t 'form.to_claim.label'}}</row.headerCell>
<row.headerCell>{{t 'titles.actions'}}</row.headerCell>
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.attributes.account_claim_maps as |claimMap i|}}
<body.row as |row|>
<row.cell>
<form.input
@type='text'
@value={{claimMap.from}}
@error={{@model.errors.attributes.account_claim_maps}}
@contextual={{true}}
as |field|>
<field.label>{{t 'form.from_claim.label'}}</field.label>
<field.field />
{{#if @model.errors.attributes.account_claim_maps}}
<field.errors as |errors|>
{{#each @model.errors.attributes.account_claim_maps as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.input>
</row.cell>
<row.cell>
<form.select
@value={{claimMap.to}}
@error={{@model.errors.attributes.account_claim_maps}}
@contextual={{true}}
@onChange={{fn (mut claimMap.to)}}
as |field|>
<field.label>{{t 'form.to_claim.label'}}</field.label>
<field.field as |select|>
{{#each this.toClaims as |toClaim|}}
<select.option @value={{toClaim}}>{{toClaim}}</select.option>
{{/each}}
</field.field>
{{#if @model.errors.attributes.account_claim_maps}}
<field.errors as |errors|>
{{#each @model.errors.attributes.account_claim_maps as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
{{/if}}
</form.select>
</row.cell>
<row.cell @shrink={{true}}>
<Rose::Button
@style='secondary'
@iconOnly='trash'
title={{t 'actions.remove'}}
>
{{t 'actions.remove'}}
</Rose::Button>
</row.cell>
</body.row>
{{/each}}
</table.body>
</Rose::Table>
</:body>
</Rose::Form::Fieldset>
<form.input
@name='max_age'
@type='number'
@@ -165,4 +436,4 @@
@submitText={{t 'actions.save'}}
@cancelText={{t 'actions.cancel'}}
/>
</Rose::Form>
</Rose::Form>
@@ -0,0 +1,17 @@
import Component from '@glimmer/component';
import { options } from 'api/models/auth-method';
export default class FormAuthMethodOidcComponent extends Component {
// =attributes
/**
* @type {object}
*/
signingAlgorithms = options.oidc.signing_algorithms;
/**
* @type {object}
*/
toClaims = options.oidc.account_claim_maps.to;
}