@danimart1991/node-red-radarr-api
Version:
A set of Node-RED nodes to use with Radarr API.
56 lines (52 loc) • 2.55 kB
HTML
<script type="text/html" data-template-name="radarr-api-server">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-config-input-url"><i class="fa fa-globe"></i> URL</label>
<input type="text" id="node-config-input-url" placeholder="http://localhost:7878">
</div>
<div class="form-tips" style="margin-bottom: 12px;"><b>URL</b> used to connect to <b>Radarr Server</b>, including <i>http(s)://</i>, <i>port</i>, and <i>urlbase</i> if required.</div>
<div class="form-row">
<label for="node-config-input-api_key"><i class="fa fa-key"></i> API Key</label>
<input type="password" id="node-config-input-api_key">
</div>
<div class="form-tips">The <b>API Key</b> generated by <b>Radarr</b> in <i>Settings/General</i>.</b></div>
</script>
<script type="text/html" data-help-name="radarr-api-server">
<p>A <b>configuration</b> node that holds the credentials of a <i>Radarr</i> server.</p>
<h3>Parameters</h3>
<dl class="message-properties">
<dt>url <span class="property-type">string</span></dt>
<dd><b>URL</b> used to connect to <b>Radarr Server</b>, including <i>http(s)://</i>, <i>port</i>, and <i>urlbase</i> if required.</dd>
<dt>api_key <span class="property-type">string</span></dt>
<dd>The <b>API Key</b> generated by <b>Radarr</b> in <i>Settings/General</i>.</dd>
</dl>
</script>
<script type="text/javascript">
RED.nodes.registerType('radarr-api-server', {
category: 'config',
defaults: {
name: { value: '', required: false },
},
credentials: {
url: { type: 'text', required: true },
api_key: { type: 'password', required: true },
},
label: function () {
return this.name || this.id;
},
exportable: false,
oneditsave: function () {
let trimFields = ['url', 'api_key'];
// In case some white space or end slash has sneaked in when copy-paste the fields.
trimFields.forEach(function (field) {
let value = $('#node-config-input-' + field)
.val()
.replace(/^\s+|\s+$|\/$/gm, '');
$('#node-config-input-' + field).val(value);
});
},
});
</script>