open-vault/ui/app/templates/components/identity/edit-form.hbs
claire bontempo f58990677f
UI: Implement new policy SS + modal designs (#17749)
* refactor ss+modal to accept multiple models

* create policy form

* cleanup and fix test

* add tabs to policy modal form

* add search select with modal to entity form

* update group form;

* allow modal to fit-content

* add changelog

* add check for policy create ability

* add id so tests pass

* filter out root option

* fix test

* add cleanup method

* add ACL policy link

* cleanup from comments

* refactor sending action to parent

* refactor, data down actions up!

* cleanup comments

* form field refactor

* add ternary to options

* update tests

* Remodel component structure for clearer logic

Includes fixing the wizard

* address comments

* cleanup args

* refactor inline oidc assignment form

* add line break

* cleanup comments

* fix tests

* add policy template to ss+modal test

* cleanup =true from test

* final cleanup!!!!!!

* actual final cleanup

* fix typo, please be done

Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
2022-11-18 17:29:04 -08:00

90 lines
2.9 KiB
Handlebars

{{#if (and (eq this.mode "edit") this.model.canDelete)}}
<Toolbar>
<ToolbarActions>
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "deleteItem" this.model}}
data-test-entity-item-delete="true"
>
Delete
{{this.model.identityType}}
</ConfirmAction>
</ToolbarActions>
</Toolbar>
{{/if}}
<form {{action (perform this.save) on="submit"}}>
<div class="box is-sideless is-fullwidth is-marginless">
<NamespaceReminder @mode={{this.mode}} @noun={{lowercase (humanize this.model.identityType)}} />
<MessageError @model={{this.model}} />
{{#if (eq this.mode "merge")}}
<AlertBanner
@type="warning"
@message="Metadata on merged entities is not preserved, you will need to recreate it on the entity you merge to."
/>
{{/if}}
{{#each this.model.fields as |attr|}}
<FormField data-test-field={{true}} @attr={{attr}} @model={{@model}}>
<div class="form-section">
{{#if this.model.canCreatePolicies}}
<SearchSelectWithModal
@id="policies"
@label="Policies"
@labelClass="title is-4"
@models={{array "policy/acl" "policy/rgp"}}
@inputValue={{@model.policies}}
@onChange={{action (mut this.model.policies)}}
@fallbackComponent="string-list"
@modalFormTemplate="modal-form/policy-template"
@excludeOptions={{array "root"}}
/>
{{else}}
<SearchSelect
@id="policies"
@label="Policies"
@labelClass="title is-4"
@models={{array "policy/acl" "policy/rgp"}}
@inputValue={{@model.policies}}
@onChange={{action (mut this.model.policies)}}
@fallbackComponent="string-list"
@disallowNewItems={{true}}
/>
{{/if}}
</div>
</FormField>
{{/each}}
</div>
<div class="field is-grouped is-grouped-split is-fullwidth box is-bottomless">
<div class="field is-grouped">
<div class="control">
<button
type="submit"
data-test-identity-submit={{true}}
class="button is-primary {{if this.save.isRunning 'loading'}}"
disabled={{this.save.isRunning}}
>
{{#if (eq this.mode "create")}}
Create
{{else}}
Save
{{/if}}
</button>
{{#if (or (eq this.mode "merge") (eq this.mode "create"))}}
<LinkTo @route={{this.cancelLink}} class="button" data-test-cancel-link={{true}}>
Cancel
</LinkTo>
{{else}}
<LinkTo
@route={{this.cancelLink}}
@models={{array this.model.id "details"}}
class="button"
data-test-cancel-link={{true}}
>
Cancel
</LinkTo>
{{/if}}
</div>
</div>
</div>
</form>