stages/prompt: Add Radio Button Group, Dropdown and Text Area prompt fields (#4822)
* Added radio-button prompt type in model * Add radio-button prompt * Refactored radio-button prompt; Added dropdown prompt * Added tests * Fixed unrelated to choice fields bug causing validation errors; Added more tests * Added description for new prompts * Added docs * Fix lint * Add forgotten file changes * Fix lint * Small fix * Add text-area prompts * Update authentik/stages/prompt/models.py Co-authored-by: Jens L. <jens@beryju.org> Signed-off-by: sdimovv <36302090+sdimovv@users.noreply.github.com> * Update authentik/stages/prompt/models.py Co-authored-by: Jens L. <jens@beryju.org> Signed-off-by: sdimovv <36302090+sdimovv@users.noreply.github.com> * Fix inline css * remove AKGlobal, update schema Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: sdimovv <36302090+sdimovv@users.noreply.github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens L. <jens@beryju.org> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -49,12 +49,24 @@ export class PromptForm extends ModelForm<Prompt, string> {
|
||||
>
|
||||
${t`Text: Simple Text input`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.TextArea}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.TextArea}
|
||||
>
|
||||
${t`Text Area: Multiline text input`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.TextReadOnly}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.TextReadOnly}
|
||||
>
|
||||
${t`Text (read-only): Simple Text input, but cannot be edited.`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.TextAreaReadOnly}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.TextAreaReadOnly}
|
||||
>
|
||||
${t`Text Area (read-only): Multiline text input, but cannot be edited.`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.Username}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.Username}
|
||||
@ -85,6 +97,18 @@ export class PromptForm extends ModelForm<Prompt, string> {
|
||||
>
|
||||
${t`Checkbox`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.RadioButtonGroup}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.RadioButtonGroup}
|
||||
>
|
||||
${t`Radio Button Group (fixed choice)`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.Dropdown}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.Dropdown}
|
||||
>
|
||||
${t`Dropdown (fixed choice)`}
|
||||
</option>
|
||||
<option
|
||||
value=${PromptTypeEnum.Date}
|
||||
?selected=${this.instance?.type === PromptTypeEnum.Date}
|
||||
@ -210,7 +234,11 @@ export class PromptForm extends ModelForm<Prompt, string> {
|
||||
<ak-form-element-horizontal label=${t`Placeholder`} name="placeholder">
|
||||
<ak-codemirror mode="python" value="${ifDefined(this.instance?.placeholder)}">
|
||||
</ak-codemirror>
|
||||
<p class="pf-c-form__helper-text">${t`Optionally pre-fill the input value`}</p>
|
||||
<p class="pf-c-form__helper-text">
|
||||
${t`Optionally pre-fill the input value.
|
||||
When creating a "Radio Button Group" or "Dropdown", enable interpreting as
|
||||
expression and return a list to return multiple choices.`}
|
||||
</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal label=${t`Help text`} name="subText">
|
||||
<ak-codemirror mode="htmlmixed" value="${ifDefined(this.instance?.subText)}">
|
||||
|
||||
Reference in New Issue
Block a user