vault/ui/lib/pki/addon/components/page/pki-configuration-edit.hbs
claire bontempo 76e742ba32
ui: HDS adoption replace <AlertBanner> component (#21375)
* UI: HDS adoption replace AlertBanner part 1 (#21163)

* rename test selector

* replace db banner

* add class

* replace db role edit

* db creds

* generate creds

* simpler class

* license banner component

* oidc callback plash

* raft

* aws

* secret create or update

* change to compact alert for form field

* change back to inline

* combine alert banners

* wrap in conditional

* remove references to message class

* UI: HDS adoption replace AlertBanner part 2 (#21243)

* token expire warning

* delete css

* edit form

* item details distribute mfa step 2 transit verify

* back to secondary

* distribute

* oidc lease error

* sign

* kv obj and repl dash

* more repl

* update test selector

* show, creds

* shamir

* pki csr

* pki banners

* add hds library to ember engines

* woops comma

* fix k8 test

* update message error component for last!

* hold off MessageError changes until next pr

* revert test selectors

* update pki tests

* UI: part 3 remove alert banner (#21334)

* final component swap

* and actual final of MessageError

* update MessageError selectors

* delete alert-banner and remove references

* update next step alerts to highlight color

* finishing touches, auth form test and client dashboard inline link

* fix more selectors

* fix shamir flow test

* ui: part 4 final cleanup (#21365)

* replace AlertPopup

* add test tag

* move tag

* one more message error tag

* delete alert popup

* final css cleanup

* move preformatted flash into <p> tag

* ui: address comments for sidebranch  (#21388)

* add periods, move link to trailing

* more periods and typo fix
2023-06-21 11:37:11 -07:00

156 lines
5.9 KiB
Handlebars

<div class="box is-sideless is-fullwidth is-marginless">
{{#if this.errors}}
<Hds::Alert data-test-config-edit-error @type="inline" @color="critical" as |A|>
<A.Title>Error</A.Title>
<A.Description>
<ul class={{if (gt this.errors.length 1) "bullet"}}>
{{#each this.errors as |error|}}
<li>
<code>POST config/{{error.modelName}}</code>:
{{error.message}}
</li>
{{/each}}
</ul>
</A.Description>
</Hds::Alert>
{{/if}}
<form {{on "submit" (perform this.save)}}>
<fieldset class="is-shadowless is-marginless is-borderless is-fullwidth" data-test-cluster-config-edit-section>
<h2 class="title is-size-5 has-border-bottom-light page-header">
Cluster Config
</h2>
{{#if @cluster.canSet}}
{{#each @cluster.allFields as |attr|}}
<FormField @attr={{attr}} @model={{@cluster}} @showHelpText={{false}} />
{{/each}}
{{else}}
<EmptyState
class="is-shadowless"
@title="You do not have permission to set this mount's the cluster config"
@message="Ask your administrator if you think you should have access to:"
>
<code>POST /{{@backend}}/config/cluster</code>
</EmptyState>
{{/if}}
</fieldset>
<fieldset class="box is-shadowless is-marginless is-borderless is-fullwidth" data-test-acme-edit-section>
<h2 class="title is-size-5 has-border-bottom-light page-header">
ACME Config
</h2>
{{#if @acme.canSet}}
{{#each @acme.allFields as |attr|}}
<FormField @attr={{attr}} @model={{@acme}} @showHelpText={{false}} @backend={{@backend}} />
{{/each}}
{{else}}
<EmptyState
class="is-shadowless"
@title="You do not have permission to set this mount's ACME config"
@message="Ask your administrator if you think you should have access to:"
>
<code>POST /{{@backend}}/config/acme</code>
</EmptyState>
{{/if}}
</fieldset>
<fieldset class="box is-shadowless is-marginless is-borderless is-fullwidth" data-test-urls-edit-section>
<h2 class="title is-size-5 has-border-bottom-light page-header">
Global URLs
</h2>
{{#if @urls.canSet}}
{{#each @urls.allFields as |attr|}}
<FormField @attr={{attr}} @model={{@urls}} @showHelpText={{false}} />
{{/each}}
{{else}}
<EmptyState
class="is-shadowless"
@title="You do not have permission to set this mount's URLs"
@message="Ask your administrator if you think you should have access to:"
>
<code>POST /{{@backend}}/config/urls</code>
</EmptyState>
{{/if}}
</fieldset>
<fieldset class="box is-shadowless is-marginless is-borderless is-fullwidth" data-test-crl-edit-section>
{{#if @crl.canSet}}
{{#each @crl.formFieldGroups as |fieldGroup|}}
{{#each-in fieldGroup as |group fields|}}
{{#if (or (not-eq group "Unified Revocation") this.isEnterprise)}}
<h2 class="title is-size-5 has-border-bottom-light page-header" data-test-crl-header={{group}}>
{{group}}
</h2>
{{/if}}
{{#each fields as |attr|}}
{{#if (eq attr.options.editType "ttl")}}
{{#if (or (includes attr.name (array "expiry" "ocspExpiry")) (not @crl.disable))}}
{{#let (get @crl attr.options.mapToBoolean) as |enabled|}}
{{! 'enabled' is the pki/crl model's boolean attr that corresponds to the duration set by the ttl }}
<div class="field">
<TtlPicker
data-test-input={{attr.name}}
@onChange={{fn this.handleTtl attr}}
@label={{attr.options.label}}
@labelDisabled={{attr.options.labelDisabled}}
@helperTextDisabled={{attr.options.helperTextDisabled}}
@helperTextEnabled={{attr.options.helperTextEnabled}}
@initialEnabled={{if attr.options.isOppositeValue (not enabled) enabled}}
@initialValue={{get @crl attr.name}}
/>
</div>
{{/let}}
{{/if}}
{{else}}
{{#if this.isEnterprise}}
<FormField @attr={{attr}} @model={{@crl}} />
{{/if}}
{{/if}}
{{/each}}
{{/each-in}}
{{/each}}
{{else}}
<EmptyState
@title="You do not have permission to set this mount's revocation configuration"
@message="Ask your administrator if you think you should have access to:"
>
<code>POST /{{@backend}}/config/crl</code>
</EmptyState>
{{/if}}
</fieldset>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
{{#if (or @urls.canSet @crl.canSet)}}
<button
type="submit"
class="button is-primary {{if this.save.isRunning 'is-loading'}}"
disabled={{this.save.isRunning}}
data-test-configuration-edit-save
>
Save
</button>
{{/if}}
<button
{{on "click" this.cancel}}
type="button"
class="button has-left-margin-s"
disabled={{this.save.isRunning}}
data-test-configuration-edit-cancel
>
Cancel
</button>
</div>
{{#if this.invalidFormAlert}}
<div class="control">
<AlertInline
@type="danger"
@paddingTop={{true}}
@message={{this.invalidFormAlert}}
@mimicRefresh={{true}}
data-test-configuration-edit-validation-alert
/>
</div>
{{/if}}
</div>
</form>
</div>