2021-12-17 03:44:29 +00:00
|
|
|
{{! template-lint-configure simple-unless "warn" }}
|
2021-06-07 18:11:46 +00:00
|
|
|
<div class="field" data-test-form-field-from-model>
|
|
|
|
{{#unless
|
|
|
|
(or
|
|
|
|
(contains
|
2021-12-17 03:44:29 +00:00
|
|
|
@attr.options.editType (array "boolean" "searchSelect" "mountAccessor" "kv" "file" "ttl" "stringArray" "json")
|
2021-06-07 18:11:46 +00:00
|
|
|
)
|
|
|
|
(eq @attr.type "boolean")
|
|
|
|
)
|
|
|
|
}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#unless (eq @attr.type "object")}}
|
|
|
|
<label for={{@attr.name}} class="is-label">
|
|
|
|
{{capitalize (or @attr.options.label (humanize (dasherize @attr.name)))}}
|
|
|
|
{{#if @attr.options.helpText}}
|
|
|
|
<InfoTooltip>{{@attr.options.helpText}}</InfoTooltip>
|
|
|
|
{{/if}}
|
|
|
|
</label>
|
|
|
|
{{/unless}}
|
2021-06-07 18:11:46 +00:00
|
|
|
{{/unless}}
|
|
|
|
{{#if @attr.options.possibleValues}}
|
|
|
|
<div class="control is-expanded">
|
|
|
|
<div class="select is-fullwidth">
|
|
|
|
<select
|
2021-12-17 03:44:29 +00:00
|
|
|
name={{@attr.name}}
|
|
|
|
id={{@attr.name}}
|
2021-06-07 18:11:46 +00:00
|
|
|
onchange={{action (mut (get @model @attr.name)) value="target.value"}}
|
|
|
|
data-test-input={{@attr.name}}
|
|
|
|
>
|
|
|
|
{{#each @attr.options.possibleValues as |val|}}
|
|
|
|
<option selected={{eq (get @model @attr.name) val}} value={{val}}>
|
|
|
|
{{val}}
|
|
|
|
</option>
|
|
|
|
{{/each}}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{else if (eq @attr.options.editType "ttl")}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<TtlPicker2
|
|
|
|
@initialValue={{or (get @model @attr.name) @attr.options.defaultValue}}
|
|
|
|
@initialEnabled={{or (get @model @attr.name) false}}
|
|
|
|
@label={{or @attr.options.label (humanize (dasherize @attr.name))}}
|
|
|
|
@helperTextDisabled="If this is not set, the engine default will be used."
|
|
|
|
@helperTextEnabled="Disable lease after"
|
|
|
|
@onChange={{@updateTtl}}
|
|
|
|
/>
|
2021-06-07 18:11:46 +00:00
|
|
|
{{else if (or (eq @attr.type "number") (eq @attr.type "string"))}}
|
|
|
|
<div class="control">
|
2021-12-17 03:44:29 +00:00
|
|
|
<Input
|
|
|
|
id={{@attr.name}}
|
|
|
|
@value={{get @model (or @attr.options.fieldValue @attr.name)}}
|
|
|
|
class="input"
|
|
|
|
data-test-input={{@attr.name}}
|
|
|
|
/>
|
2021-06-07 18:11:46 +00:00
|
|
|
</div>
|
|
|
|
{{else if (eq @attr.type "boolean")}}
|
|
|
|
<div class="b-checkbox">
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
2021-12-17 03:44:29 +00:00
|
|
|
id={{@attr.name}}
|
2021-06-07 18:11:46 +00:00
|
|
|
class="styled"
|
2021-12-17 03:44:29 +00:00
|
|
|
checked={{get this.model @attr.name}}
|
|
|
|
onchange={{action (mut (get this.model @attr.name)) value="target.checked"}}
|
2021-06-07 18:11:46 +00:00
|
|
|
data-test-input={{@attr.name}}
|
2021-12-17 03:44:29 +00:00
|
|
|
/>
|
2021-06-07 18:11:46 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
<label for={{@attr.name}} class="is-label">
|
2021-06-07 18:11:46 +00:00
|
|
|
{{capitalize (or @attr.options.label (humanize (dasherize @attr.name)))}}
|
|
|
|
{{#if @attr.options.helpText}}
|
|
|
|
<InfoTooltip>{{@attr.options.helpText}}</InfoTooltip>
|
|
|
|
{{/if}}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{{else if (eq @attr.type "object")}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<JsonEditor
|
2021-06-07 18:11:46 +00:00
|
|
|
@title={{capitalize (or @attr.options.label (humanize (dasherize @attr.name)))}}
|
2021-12-17 03:44:29 +00:00
|
|
|
@helpText={{@attr.options.helpText}}
|
|
|
|
@value={{if (get @model @attr.name) (stringify (get @model @attr.name)) @emptyData}}
|
|
|
|
@valueUpdated={{@codemirrorUpdated}}
|
|
|
|
/>
|
2021-06-07 18:11:46 +00:00
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
</div>
|