open-vault/ui/app/templates/components/form-field.hbs

227 lines
6.2 KiB
Handlebars
Raw Normal View History

2018-12-10 16:44:37 +00:00
{{#unless
(or
(eq attr.type "boolean")
2019-02-14 18:52:34 +00:00
(contains
attr.options.editType
(array
"boolean"
"searchSelect"
"mountAccessor"
"kv"
"file"
"ttl"
"stringArray"
"json"
)
)
2018-12-10 16:44:37 +00:00
)
}}
2018-04-03 14:16:57 +00:00
<label for="{{attr.name}}" class="is-label">
{{labelString}}
{{#if attr.options.helpText}}
{{#info-tooltip}}
2018-12-10 16:44:37 +00:00
<span data-test-help-text>
{{attr.options.helpText}}
</span>
2018-04-03 14:16:57 +00:00
{{/info-tooltip}}
{{/if}}
</label>
{{/unless}}
{{#if attr.options.possibleValues}}
2018-12-10 16:44:37 +00:00
<div class="control is-expanded">
2018-04-03 14:16:57 +00:00
<div class="select is-fullwidth">
<select
name="{{attr.name}}"
id="{{attr.name}}"
2018-12-10 16:44:37 +00:00
onchange={{action
(action "setAndBroadcast" valuePath)
value="target.value"
}}
2018-04-03 14:16:57 +00:00
data-test-input={{attr.name}}
>
{{#each (path-or-array attr.options.possibleValues model) as |val|}}
2018-12-10 16:44:37 +00:00
<option
selected={{eq (get model valuePath) (or val.value val)}}
value={{or val.value val}}
>
2018-04-03 14:16:57 +00:00
{{or val.displayName val}}
</option>
{{/each}}
</select>
</div>
</div>
2018-12-10 16:44:37 +00:00
{{else if (and (eq attr.type "string") (eq attr.options.editType "boolean"))}}
<div class="b-checkbox">
2018-12-10 16:44:37 +00:00
<input
type="checkbox"
id="{{attr.name}}"
class="styled"
checked={{eq (get model valuePath) attr.options.trueValue}}
onchange={{action
(action
"setAndBroadcastBool"
valuePath
attr.options.trueValue
attr.options.falseValue
)
value="target.checked"
}}
data-test-input={{attr.name}}
/>
<label for="{{attr.name}}" class="is-label">
{{labelString}}
{{#if attr.options.helpText}}
2018-12-10 16:44:37 +00:00
{{#info-tooltip}}{{attr.options.helpText}}{{/info-tooltip}}
{{/if}}
</label>
</div>
2018-12-10 16:44:37 +00:00
{{else if (eq attr.options.editType "searchSelect")}}
<div class="form-section">
<SearchSelect
@id={{attr.name}}
@models={{attr.options.models}}
@onChange={{action (action "setAndBroadcast" valuePath)}}
@inputValue={{get model valuePath}}
@helpText={{attr.options.helpText}}
@warning={{attr.options.warning}}
@label={{labelString}}
@fallbackComponent={{attr.options.fallbackComponent}}
/>
2018-12-10 16:44:37 +00:00
</div>
{{else if (eq attr.options.editType "mountAccessor")}}
2018-04-03 14:16:57 +00:00
{{mount-accessor-select
name=attr.name
label=labelString
warning=attr.options.warning
helpText=attr.options.helpText
value=(get model valuePath)
onChange=(action "setAndBroadcast" valuePath)
2018-12-10 16:44:37 +00:00
}}
{{else if (eq attr.options.editType "kv")}}
2018-04-03 14:16:57 +00:00
{{kv-object-editor
value=(get model valuePath)
onChange=(action "setAndBroadcast" valuePath)
label=labelString
warning=attr.options.warning
helpText=attr.options.helpText
}}
2018-12-10 16:44:37 +00:00
{{else if (eq attr.options.editType "file")}}
2018-04-03 14:16:57 +00:00
{{text-file
2018-12-10 16:44:37 +00:00
index=""
2018-04-03 14:16:57 +00:00
file=file
2018-12-10 16:44:37 +00:00
onChange=(action "setFile")
2018-04-03 14:16:57 +00:00
warning=attr.options.warning
label=labelString
}}
2018-12-10 16:44:37 +00:00
{{else if (eq attr.options.editType "ttl")}}
2018-04-03 14:16:57 +00:00
{{ttl-picker
2018-08-28 05:03:55 +00:00
data-test-input=attr.name
2018-04-03 14:16:57 +00:00
initialValue=(or (get model valuePath) attr.options.defaultValue)
labelText=labelString
warning=attr.options.warning
setDefaultValue=(or attr.options.setDefault false)
2018-04-03 14:16:57 +00:00
onChange=(action (action "setAndBroadcast" valuePath))
}}
2018-12-10 16:44:37 +00:00
{{else if (eq attr.options.editType "stringArray")}}
2018-04-03 14:16:57 +00:00
{{string-list
2019-02-14 18:52:34 +00:00
data-test-input=attr.name
2018-04-03 14:16:57 +00:00
label=labelString
warning=attr.options.warning
helpText=attr.options.helpText
inputValue=(get model valuePath)
onChange=(action (action "setAndBroadcast" valuePath))
}}
{{else if (eq attr.options.sensitive true)}}
<MaskedInput
@value={{or (get model valuePath) attr.options.defaultValue}}
@placeholder=""
2019-02-14 18:52:34 +00:00
@allowCopy="true"
/>
{{else if (or (eq attr.type "number") (eq attr.type "string"))}}
2018-04-03 14:16:57 +00:00
<div class="control">
2018-12-10 16:44:37 +00:00
{{#if (eq attr.options.editType "textarea")}}
2018-04-03 14:16:57 +00:00
<textarea
data-test-input={{attr.name}}
id={{attr.name}}
value={{or (get model valuePath) attr.options.defaultValue}}
2018-12-10 16:44:37 +00:00
oninput={{action
(action "setAndBroadcast" valuePath)
value="target.value"
}}
2018-04-03 14:16:57 +00:00
class="textarea"
2018-12-10 16:44:37 +00:00
></textarea>
{{else if (eq attr.options.editType "json")}}
<label for="{{attr.name}}" class="is-label">
{{labelString}}
{{#if attr.options.helpText}}
{{#info-tooltip}}
2018-12-10 16:44:37 +00:00
<span data-test-help-text>
{{attr.options.helpText}}
</span>
{{/info-tooltip}}
{{/if}}
</label>
{{json-editor
2018-12-10 16:44:37 +00:00
value=(if
(get model valuePath) (stringify (jsonify (get model valuePath)))
)
valueUpdated=(action "codemirrorUpdated" attr.name "string")
}}
2018-04-03 14:16:57 +00:00
{{else}}
<input
data-test-input={{attr.name}}
id={{attr.name}}
UI namespaces (#5119) * add namespace sidebar item * depend on ember-inflector directly * list-view and list-item components * fill out components and render empty namespaces page * list namespaces in access * add menu contextual component to list item * popup contextual component * full crud for namespaces * add namespaces service and picker component * split application and vault.cluster templates and controllers, add namespace query param, add namespace-picker to vault.namespace template * remove usage of href-to * remove ember-href-to from deps * add ember-responsive * start styling the picker and link to appropriate namespaces, use ember-responsive to render picker in different places based on the breakpoint * get query param working and save ns to authdata when authenticating, feed through ns in application adapter * move to observer on the controller for setting state on the service * set state in the beforeModel hook and clear the ember data model cache * nav to secrets on change and make error handling more resilient utilizing the method that atlas does to eagerly update URLs * add a list of sys endpoints in a helper * hide header elements if not in the root namespace * debounce namespace input on auth, fix 404 for auth method fetch, move auth method fetch to a task on the auth-form component and refretch on namespace change * fix display of supported engines and exclusion of sys and identity engines * don't fetch replication status if you're in a non-root namespace * hide seal sub-menu if not in the root namespace * don't autocomplete auth form inputs * always send some requests to the root namespace * use methodType and engineType instead of type in case there it is ns_ prefixed * use sys/internal/ui/namespaces to fetch the list in the dropdown * don't use model for namespace picker and always make the request to the token namespace * fix header handling for fetch calls * use namespace-reminder component on creation and edit forms throughout the application * add namespace-reminder to the console * add flat * add deepmerge for creating the tree in the menu * delayed rendering for animation timing * design and code feedback on the first round * white text in the namespace picker * fix namespace picker issues with root keys * separate path-to-tree * add tests for path-to-tree util * hide picker if you're in the root ns and you can't access other namespaces * show error message if you enter invalid characters for namespace path * return a different model if we dont have the namespaces feature and show upgrade page * if a token has a namespace_path, use that as the root user namespace and transition them there on login * use token namespace for user, but use specified namespace to log in * always renew tokens in the token namespace * fix edition-badge test
2018-08-16 17:48:24 +00:00
autocomplete="off"
2018-04-03 14:16:57 +00:00
value={{or (get model valuePath) attr.options.defaultValue}}
2018-12-10 16:44:37 +00:00
oninput={{action
(action "setAndBroadcast" valuePath)
value="target.value"
}}
UI namespaces (#5119) * add namespace sidebar item * depend on ember-inflector directly * list-view and list-item components * fill out components and render empty namespaces page * list namespaces in access * add menu contextual component to list item * popup contextual component * full crud for namespaces * add namespaces service and picker component * split application and vault.cluster templates and controllers, add namespace query param, add namespace-picker to vault.namespace template * remove usage of href-to * remove ember-href-to from deps * add ember-responsive * start styling the picker and link to appropriate namespaces, use ember-responsive to render picker in different places based on the breakpoint * get query param working and save ns to authdata when authenticating, feed through ns in application adapter * move to observer on the controller for setting state on the service * set state in the beforeModel hook and clear the ember data model cache * nav to secrets on change and make error handling more resilient utilizing the method that atlas does to eagerly update URLs * add a list of sys endpoints in a helper * hide header elements if not in the root namespace * debounce namespace input on auth, fix 404 for auth method fetch, move auth method fetch to a task on the auth-form component and refretch on namespace change * fix display of supported engines and exclusion of sys and identity engines * don't fetch replication status if you're in a non-root namespace * hide seal sub-menu if not in the root namespace * don't autocomplete auth form inputs * always send some requests to the root namespace * use methodType and engineType instead of type in case there it is ns_ prefixed * use sys/internal/ui/namespaces to fetch the list in the dropdown * don't use model for namespace picker and always make the request to the token namespace * fix header handling for fetch calls * use namespace-reminder component on creation and edit forms throughout the application * add namespace-reminder to the console * add flat * add deepmerge for creating the tree in the menu * delayed rendering for animation timing * design and code feedback on the first round * white text in the namespace picker * fix namespace picker issues with root keys * separate path-to-tree * add tests for path-to-tree util * hide picker if you're in the root ns and you can't access other namespaces * show error message if you enter invalid characters for namespace path * return a different model if we dont have the namespaces feature and show upgrade page * if a token has a namespace_path, use that as the root user namespace and transition them there on login * use token namespace for user, but use specified namespace to log in * always renew tokens in the token namespace * fix edition-badge test
2018-08-16 17:48:24 +00:00
class="input"
2018-12-10 16:44:37 +00:00
/>
UI namespaces (#5119) * add namespace sidebar item * depend on ember-inflector directly * list-view and list-item components * fill out components and render empty namespaces page * list namespaces in access * add menu contextual component to list item * popup contextual component * full crud for namespaces * add namespaces service and picker component * split application and vault.cluster templates and controllers, add namespace query param, add namespace-picker to vault.namespace template * remove usage of href-to * remove ember-href-to from deps * add ember-responsive * start styling the picker and link to appropriate namespaces, use ember-responsive to render picker in different places based on the breakpoint * get query param working and save ns to authdata when authenticating, feed through ns in application adapter * move to observer on the controller for setting state on the service * set state in the beforeModel hook and clear the ember data model cache * nav to secrets on change and make error handling more resilient utilizing the method that atlas does to eagerly update URLs * add a list of sys endpoints in a helper * hide header elements if not in the root namespace * debounce namespace input on auth, fix 404 for auth method fetch, move auth method fetch to a task on the auth-form component and refretch on namespace change * fix display of supported engines and exclusion of sys and identity engines * don't fetch replication status if you're in a non-root namespace * hide seal sub-menu if not in the root namespace * don't autocomplete auth form inputs * always send some requests to the root namespace * use methodType and engineType instead of type in case there it is ns_ prefixed * use sys/internal/ui/namespaces to fetch the list in the dropdown * don't use model for namespace picker and always make the request to the token namespace * fix header handling for fetch calls * use namespace-reminder component on creation and edit forms throughout the application * add namespace-reminder to the console * add flat * add deepmerge for creating the tree in the menu * delayed rendering for animation timing * design and code feedback on the first round * white text in the namespace picker * fix namespace picker issues with root keys * separate path-to-tree * add tests for path-to-tree util * hide picker if you're in the root ns and you can't access other namespaces * show error message if you enter invalid characters for namespace path * return a different model if we dont have the namespaces feature and show upgrade page * if a token has a namespace_path, use that as the root user namespace and transition them there on login * use token namespace for user, but use specified namespace to log in * always renew tokens in the token namespace * fix edition-badge test
2018-08-16 17:48:24 +00:00
{{#if attr.options.validationAttr}}
2018-12-10 16:44:37 +00:00
{{#if
(and
(get model valuePath) (not (get model attr.options.validationAttr))
)
}}
2018-11-02 16:02:45 +00:00
<AlertInline
@type="danger"
@message={{attr.options.invalidMessage}}
2018-12-10 16:44:37 +00:00
/>
UI namespaces (#5119) * add namespace sidebar item * depend on ember-inflector directly * list-view and list-item components * fill out components and render empty namespaces page * list namespaces in access * add menu contextual component to list item * popup contextual component * full crud for namespaces * add namespaces service and picker component * split application and vault.cluster templates and controllers, add namespace query param, add namespace-picker to vault.namespace template * remove usage of href-to * remove ember-href-to from deps * add ember-responsive * start styling the picker and link to appropriate namespaces, use ember-responsive to render picker in different places based on the breakpoint * get query param working and save ns to authdata when authenticating, feed through ns in application adapter * move to observer on the controller for setting state on the service * set state in the beforeModel hook and clear the ember data model cache * nav to secrets on change and make error handling more resilient utilizing the method that atlas does to eagerly update URLs * add a list of sys endpoints in a helper * hide header elements if not in the root namespace * debounce namespace input on auth, fix 404 for auth method fetch, move auth method fetch to a task on the auth-form component and refretch on namespace change * fix display of supported engines and exclusion of sys and identity engines * don't fetch replication status if you're in a non-root namespace * hide seal sub-menu if not in the root namespace * don't autocomplete auth form inputs * always send some requests to the root namespace * use methodType and engineType instead of type in case there it is ns_ prefixed * use sys/internal/ui/namespaces to fetch the list in the dropdown * don't use model for namespace picker and always make the request to the token namespace * fix header handling for fetch calls * use namespace-reminder component on creation and edit forms throughout the application * add namespace-reminder to the console * add flat * add deepmerge for creating the tree in the menu * delayed rendering for animation timing * design and code feedback on the first round * white text in the namespace picker * fix namespace picker issues with root keys * separate path-to-tree * add tests for path-to-tree util * hide picker if you're in the root ns and you can't access other namespaces * show error message if you enter invalid characters for namespace path * return a different model if we dont have the namespaces feature and show upgrade page * if a token has a namespace_path, use that as the root user namespace and transition them there on login * use token namespace for user, but use specified namespace to log in * always renew tokens in the token namespace * fix edition-badge test
2018-08-16 17:48:24 +00:00
{{/if}}
{{/if}}
2018-04-03 14:16:57 +00:00
{{/if}}
</div>
2018-12-10 16:44:37 +00:00
{{else if (eq attr.type "boolean")}}
2018-04-03 14:16:57 +00:00
<div class="b-checkbox">
2018-12-10 16:44:37 +00:00
<input
type="checkbox"
id="{{attr.name}}"
class="styled"
checked={{get model attr.name}}
onchange={{action
(action "setAndBroadcast" valuePath)
value="target.checked"
}}
data-test-input={{attr.name}}
/>
2018-04-03 14:16:57 +00:00
<label for="{{attr.name}}" class="is-label">
{{labelString}}
{{#if attr.options.helpText}}
2018-12-10 16:44:37 +00:00
{{#info-tooltip}}{{attr.options.helpText}}{{/info-tooltip}}
2018-04-03 14:16:57 +00:00
{{/if}}
</label>
</div>
2018-12-10 16:44:37 +00:00
{{else if (eq attr.type "object")}}
2018-04-03 14:16:57 +00:00
{{json-editor
value=(if (get model valuePath) (stringify (get model valuePath)) emptyData)
valueUpdated=(action "codemirrorUpdated" attr.name false)
2018-04-03 14:16:57 +00:00
}}
2018-12-10 16:44:37 +00:00
{{/if}}