2016-11-10 22:29:07 +01:00
|
|
|
|
2016-11-10 22:22:05 +01:00
|
|
|
<script type="text/x-red" data-template-name="yaml">
|
2018-01-16 11:59:44 +01:00
|
|
|
<div class="form-row">
|
2018-01-30 17:09:45 +01:00
|
|
|
<label for="node-input-property"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
|
|
|
|
<input type="text" id="node-input-property" style="width:70%;"/>
|
2018-01-16 11:59:44 +01:00
|
|
|
</div>
|
2016-11-10 22:22:05 +01:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
|
|
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
|
|
|
</div>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="yaml">
|
2017-05-23 15:18:09 +02:00
|
|
|
<p>Converts between a YAML formatted string and its JavaScript object representation, in either direction.</p>
|
2017-04-25 22:47:58 +02:00
|
|
|
<h3>Inputs</h3>
|
2017-05-23 15:18:09 +02:00
|
|
|
<dl class="message-properties">
|
|
|
|
<dt>payload<span class="property-type">object | string</span></dt>
|
|
|
|
<dd>A JavaScript object or YAML string.</dd>
|
|
|
|
</dl>
|
|
|
|
<h3>Outputs</h3>
|
|
|
|
<dl class="message-properties">
|
|
|
|
<dt>payload<span class="property-type">object | string</span></dt>
|
|
|
|
<dd>
|
|
|
|
<ul>
|
|
|
|
<li>If the input is a YAML string it tries to parse it to a JavaScript object.</li>
|
|
|
|
<li>If the input is a JavaScript object it creates a YAML string.</li>
|
|
|
|
</ul>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
2016-11-10 22:22:05 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('yaml',{
|
|
|
|
category: 'function',
|
|
|
|
color:"#DEBD5C",
|
|
|
|
defaults: {
|
2018-01-16 11:59:44 +01:00
|
|
|
property: {value:"payload",required:true},
|
2016-11-10 22:22:05 +01:00
|
|
|
name: {value:""}
|
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:1,
|
|
|
|
icon: "parser-yaml.png",
|
|
|
|
label: function() {
|
|
|
|
return this.name||"yaml";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2018-01-16 11:59:44 +01:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
if (this.property === undefined) {
|
|
|
|
$("#node-input-property").val("payload");
|
|
|
|
}
|
|
|
|
$("#node-input-property").typedInput({default:'msg',types:['msg']});
|
2016-11-10 22:22:05 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|