2018-12-10 16:44:37 +00:00
|
|
|
{{#unless
|
|
|
|
(or
|
|
|
|
(and attr.options.editType (not-eq attr.options.editType "textarea"))
|
|
|
|
(eq attr.type "boolean")
|
|
|
|
)
|
|
|
|
}}
|
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}}
|
|
|
|
>
|
2018-09-28 21:45:30 +00:00
|
|
|
{{#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"))}}
|
2018-07-05 18:28:12 +00:00
|
|
|
<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}}
|
|
|
|
/>
|
|
|
|
|
2018-07-05 18:28:12 +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-07-05 18:28:12 +00:00
|
|
|
{{/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-07-05 18:28:12 +00:00
|
|
|
|
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
|
2018-09-28 21:45:30 +00:00
|
|
|
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
|
|
|
|
label=labelString
|
|
|
|
warning=attr.options.warning
|
|
|
|
helpText=attr.options.helpText
|
|
|
|
inputValue=(get model valuePath)
|
|
|
|
onChange=(action (action "setAndBroadcast" valuePath))
|
|
|
|
}}
|
2018-12-07 21:23:42 +00:00
|
|
|
{{else if (eq attr.options.sensitive true)}}
|
|
|
|
<MaskedInput
|
|
|
|
@value={{or (get model valuePath) attr.options.defaultValue}}
|
|
|
|
@placeholder=""
|
|
|
|
@allowCopy=true
|
|
|
|
/>
|
2018-04-03 14:16:57 +00:00
|
|
|
{{else if (or (eq attr.type 'number') (eq attr.type 'string'))}}
|
|
|
|
<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")}}
|
2018-08-28 00:54:30 +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-08-28 00:54:30 +00:00
|
|
|
{{/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-08-28 00:54:30 +00:00
|
|
|
}}
|
2018-04-03 14:16:57 +00:00
|
|
|
{{else}}
|
|
|
|
<input
|
|
|
|
data-test-input={{attr.name}}
|
|
|
|
id={{attr.name}}
|
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"
|
|
|
|
}}
|
2018-08-16 17:48:24 +00:00
|
|
|
class="input"
|
2018-12-10 16:44:37 +00:00
|
|
|
/>
|
|
|
|
|
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
|
|
|
/>
|
|
|
|
|
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)
|
2018-08-28 00:54:30 +00:00
|
|
|
valueUpdated=(action "codemirrorUpdated" attr.name false)
|
2018-04-03 14:16:57 +00:00
|
|
|
}}
|
2018-12-10 16:44:37 +00:00
|
|
|
{{/if}}
|