orderby added to config and download
This commit is contained in:
+6
-1
@@ -5,7 +5,8 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
apikey: {value:""},
|
apikey: {value:""},
|
||||||
what: {value:""}
|
what: {value:""},
|
||||||
|
orderby: {value:""}
|
||||||
},
|
},
|
||||||
inputs: 1,
|
inputs: 1,
|
||||||
outputs: 2,
|
outputs: 2,
|
||||||
@@ -25,6 +26,10 @@
|
|||||||
<label for="node-input-what"><i class="fa fa-lock"></i> What</label>
|
<label for="node-input-what"><i class="fa fa-lock"></i> What</label>
|
||||||
<input type="text" id="node-input-what" placeholder="sales_invoice_item">
|
<input type="text" id="node-input-what" placeholder="sales_invoice_item">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-orderby"><i class="fa fa-lock"></i> OrderBy</label>
|
||||||
|
<input type="text" id="node-input-orderby" placeholder="OrderBy">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-apikey"><i class="fa fa-lock"></i> APIKey</label>
|
<label for="node-input-apikey"><i class="fa fa-lock"></i> APIKey</label>
|
||||||
<input type="text" id="node-input-apikey" placeholder="APIKey">
|
<input type="text" id="node-input-apikey" placeholder="APIKey">
|
||||||
|
|||||||
+9
-1
@@ -54,11 +54,15 @@ module.exports = function(RED) {
|
|||||||
const page = parseInt(encodeURIComponent(msg.page || 0));
|
const page = parseInt(encodeURIComponent(msg.page || 0));
|
||||||
const apikey = encodeURIComponent(msg.apikey || config.apikey);
|
const apikey = encodeURIComponent(msg.apikey || config.apikey);
|
||||||
const what = encodeURIComponent(config.what)
|
const what = encodeURIComponent(config.what)
|
||||||
|
const orderby = encodeURIComponent(msg.orderby || config.orderby);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
msg.page = page
|
msg.page = page
|
||||||
msg.what = what
|
msg.what = what
|
||||||
msg.retry = 0
|
msg.retry = 0
|
||||||
|
|
||||||
|
var orderbystr = "";
|
||||||
var filtersstr = "";
|
var filtersstr = "";
|
||||||
const filters = encodeURIComponent(msg.filters || "")
|
const filters = encodeURIComponent(msg.filters || "")
|
||||||
if (filters.length > 0) {
|
if (filters.length > 0) {
|
||||||
@@ -75,7 +79,11 @@ module.exports = function(RED) {
|
|||||||
filtersstr += `&dateto=${dateto}`
|
filtersstr += `&dateto=${dateto}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://myobsync.accede.com.au/download/${what}/json/${page}?apikey=${apikey}${filtersstr}`;
|
if (orderby.length > 0) {
|
||||||
|
orderbystr += `&orderby=${orderby}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = `https://myobsync.accede.com.au/download/${what}/json/${page}?apikey=${apikey}${filtersstr}${orderbystr}`;
|
||||||
DoImport(msg, url, node)
|
DoImport(msg, url, node)
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user