{{#if (eq @mode "create") }} Create Connection {{else if (eq @mode "edit")}} Edit Connection {{else}} {{@model.id}} {{/if}}

{{#if (eq @mode "show")}} {{#if @model.canDelete}} {{/if}} {{#if @model.canReset}} Reset connection {{/if}} {{#if (or @model.canReset @model.canDelete)}}
{{/if}} {{#if @model.canRotateRoot }} Rotate root credentials {{/if}} {{#if @model.canAddRole}} Add role {{/if}} {{#if @model.canEdit}} Edit configuration {{/if}} {{/if}} {{#if (eq @mode 'create')}}
{{#each @model.fieldAttrs as |attr|}} {{#if (not-eq attr.options.readOnly true)}} {{form-field data-test-field attr=attr model=@model}} {{/if}} {{/each}} {{!-- Plugin Config Section --}}
Plugin config {{#unless @model.pluginFieldGroups}} {{else}} {{#each @model.pluginFieldGroups as |fieldGroup|}} {{#each-in fieldGroup as |group fields|}} {{#if (eq group "default")}}
{{#each fields as |attr|}} {{#if (contains attr.name (array "max_open_connections" "max_idle_connections" "max_connection_lifetime" ) )}}
{{form-field data-test-field attr=attr model=@model}}
{{else}}
{{form-field data-test-field attr=attr model=@model}}
{{/if}} {{/each}}
{{else}} {{#if (get this (concat "show" (camelize group)))}}
{{#each fields as |attr|}} {{form-field data-test-field attr=attr model=@model}} {{/each}}
{{/if}} {{/if}} {{/each-in}} {{/each}} {{/unless}}
{{!-- Statements Section --}} {{#unless (and @model.plugin_name (not @model.statementFields))}}

Statements

{{#if (eq @model.statementFields null)}} {{else}} {{#each @model.statementFields as |attr|}} {{form-field data-test-field attr=attr model=@model}} {{/each}} {{/if}}
{{/unless}}
Cancel
{{else if (eq @mode 'edit')}}
{{#each @model.fieldAttrs as |attr|}} {{#if (or (eq attr.name 'name') (eq attr.name 'plugin_name'))}} {{else if (not-eq attr.options.readOnly true)}} {{form-field data-test-field attr=attr model=@model}} {{/if}} {{/each}} {{!-- Plugin Config Edit --}}
Plugin config {{#each @model.pluginFieldGroups as |fieldGroup|}} {{#each-in fieldGroup as |group fields|}} {{#if (eq group "default")}}
{{#each fields as |attr|}} {{#if (contains attr.name (array "max_open_connections" "max_idle_connections" "max_connection_lifetime" ) )}}
{{form-field data-test-field attr=attr model=@model}}
{{else if (eq attr.name "password")}}
Update password
{{if this.showPasswordField 'The new password that will be used when connecting to the database' 'Vault will use the existing password'}}
{{#if this.showPasswordField}} {{/if}}
{{else}}
{{form-field data-test-field attr=attr model=@model}}
{{/if}} {{/each}}
{{else}} {{#if (get this (concat "show" (camelize group)))}}
{{#each fields as |attr|}} {{form-field data-test-field attr=attr model=@model}} {{/each}}
{{/if}} {{/if}} {{/each-in}} {{/each}}
{{!-- Statements Edit Section --}} {{#unless (and @model.plugin_name (not @model.statementFields))}}
Statements {{#each @model.statementFields as |attr|}} {{form-field data-test-field attr=attr model=@model}} {{/each}}
{{/unless}}
Cancel
{{else}} {{#each @model.showAttrs as |attr|}} {{#let attr.options.defaultDisplay as |defaultDisplay|}} {{#if (eq attr.type "object")}} {{else if (eq attr.type "array")}} {{else}} {{/if}} {{/let}} {{/each}} {{/if}}