|
| 1 | +<script type="text/html" data-template-name="seqera-datalink-poll"> |
| 2 | + <!-- Seqera config and node name --> |
| 3 | + <div class="form-row"> |
| 4 | + <label for="node-input-seqera"><i class="icon-globe"></i> Seqera config</label> |
| 5 | + <input type="text" id="node-input-seqera" data-type="seqera-config" /> |
| 6 | + </div> |
| 7 | + <div class="form-row"> |
| 8 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 9 | + <input type="text" id="node-input-name" /> |
| 10 | + </div> |
| 11 | + |
| 12 | + <!-- Polling specific --> |
| 13 | + <div class="form-row"> |
| 14 | + <label for="node-input-pollFrequency"><i class="fa fa-clock-o"></i> Poll frequency (min)</label> |
| 15 | + <input type="text" id="node-input-pollFrequency" /> |
| 16 | + </div> |
| 17 | + |
| 18 | + <!-- Data link parameters (same as list node) --> |
| 19 | + <div class="form-row"> |
| 20 | + <label for="node-input-dataLinkName"><i class="fa fa-link"></i> Data link name</label> |
| 21 | + <input type="text" id="node-input-dataLinkName" /> |
| 22 | + </div> |
| 23 | + <div class="form-row"> |
| 24 | + <label for="node-input-returnType"><i class="fa fa-filter"></i> Return type</label> |
| 25 | + <select id="node-input-returnType"> |
| 26 | + <option value="files">Files only</option> |
| 27 | + <option value="folders">Folders only</option> |
| 28 | + <option value="all">Everything</option> |
| 29 | + </select> |
| 30 | + </div> |
| 31 | + <div class="form-row"> |
| 32 | + <label for="node-input-basePath"><i class="fa fa-folder-open-o"></i> Base path</label> |
| 33 | + <input type="text" id="node-input-basePath" /> |
| 34 | + </div> |
| 35 | + <div class="form-row"> |
| 36 | + <label for="node-input-prefix"><i class="fa fa-filter"></i> Prefix</label> |
| 37 | + <input type="text" id="node-input-prefix" /> |
| 38 | + </div> |
| 39 | + <div class="form-row"> |
| 40 | + <label for="node-input-pattern"><i class="fa fa-file-code-o"></i> Pattern (regex)</label> |
| 41 | + <input type="text" id="node-input-pattern" /> |
| 42 | + </div> |
| 43 | + <div class="form-row"> |
| 44 | + <label for="node-input-maxResults"><i class="fa fa-sort-numeric-asc"></i> Max results</label> |
| 45 | + <input type="text" id="node-input-maxResults" /> |
| 46 | + </div> |
| 47 | + <div class="form-row"> |
| 48 | + <label for="node-input-depth"><i class="fa fa-level-down"></i> Depth</label> |
| 49 | + <input type="text" id="node-input-depth" /> |
| 50 | + </div> |
| 51 | + <div class="form-row"> |
| 52 | + <label for="node-input-workspaceId"><i class="icon-tasks"></i> Workspace ID</label> |
| 53 | + <input type="text" id="node-input-workspaceId" /> |
| 54 | + </div> |
| 55 | +</script> |
| 56 | + |
| 57 | +<!-- prettier-ignore --> |
| 58 | +<script type="text/markdown" data-help-name="seqera-datalink-poll"> |
| 59 | +Polls a Seqera Platform Data Explorer link at a fixed interval. |
| 60 | + |
| 61 | +### Inputs |
| 62 | + |
| 63 | +: pollFrequency (number) : The frequency of the poll in minutes (integer, minimum 1, default 15). |
| 64 | +: dataLinkName (string) : The name of the data explorer link. |
| 65 | +: basePath (string) : Path within the data link to start browsing. Leave blank for the root. |
| 66 | +: prefix (string) : Optional prefix filter for results (applies to folders and files) |
| 67 | +: pattern (string) : Optional regex pattern filter for results (applies to files only) |
| 68 | +: returnType (string) : Select whether to return files, folders or everything. |
| 69 | +: maxResults (number) : Maximum number of results to return (default 100). |
| 70 | +: workspaceId (string) : Override the workspace ID from the config node. |
| 71 | + |
| 72 | +All inputs support msg._, flow._, global.\*, env, or JSONata expressions via the **typedInput**. |
| 73 | + |
| 74 | +### Outputs |
| 75 | + |
| 76 | +The node has two outputs: |
| 77 | + |
| 78 | +1. All results on every poll. |
| 79 | +2. New objects since the previous poll (nothing sent if no new objects). |
| 80 | + |
| 81 | +Both outputs have the following properties: |
| 82 | + |
| 83 | +: payload (array) : Fle information aggregated from the API (array of objects). |
| 84 | +: files (array) : File names (array of strings). |
| 85 | + |
| 86 | +All typed-input fields are identical to the _List files_ node with the addition of **poll frequency** (minutes). |
| 87 | +</script> |
| 88 | + |
| 89 | +<script type="text/javascript"> |
| 90 | + RED.nodes.registerType("seqera-datalink-poll", { |
| 91 | + category: "seqera", |
| 92 | + color: "#A9A1C6", |
| 93 | + inputs: 0, |
| 94 | + outputs: 2, |
| 95 | + icon: "seqera.svg", |
| 96 | + align: "left", |
| 97 | + paletteLabel: "Poll files", |
| 98 | + label: function () { |
| 99 | + return this.name || "Poll files"; |
| 100 | + }, |
| 101 | + outputLabels: ["All objects", "Only new objects"], |
| 102 | + defaults: { |
| 103 | + name: { value: "" }, |
| 104 | + seqera: { value: "", type: "seqera-config" }, |
| 105 | + dataLinkName: { value: "" }, |
| 106 | + dataLinkNameType: { value: "str" }, |
| 107 | + basePath: { value: "" }, |
| 108 | + basePathType: { value: "str" }, |
| 109 | + prefix: { value: "" }, |
| 110 | + prefixType: { value: "str" }, |
| 111 | + pattern: { value: "" }, |
| 112 | + patternType: { value: "str" }, |
| 113 | + maxResults: { value: "100" }, |
| 114 | + maxResultsType: { value: "num" }, |
| 115 | + depth: { value: "0" }, |
| 116 | + depthType: { value: "num" }, |
| 117 | + workspaceId: { value: "" }, |
| 118 | + workspaceIdType: { value: "str" }, |
| 119 | + pollFrequency: { value: "15" }, |
| 120 | + returnType: { value: "files" }, |
| 121 | + }, |
| 122 | + oneditprepare: function () { |
| 123 | + function ti(id, val, type, def = "str") { |
| 124 | + const types = ["str", "num", "msg", "flow", "global", "env", "jsonata"]; |
| 125 | + if (def === "num") types.splice(types.indexOf("str"), 1); |
| 126 | + $(id).typedInput({ default: def, types }); |
| 127 | + $(id).typedInput("value", val); |
| 128 | + $(id).typedInput("type", type); |
| 129 | + } |
| 130 | + ti("#node-input-dataLinkName", this.dataLinkName || "", this.dataLinkNameType || "str"); |
| 131 | + ti("#node-input-basePath", this.basePath || "", this.basePathType || "str"); |
| 132 | + ti("#node-input-prefix", this.prefix || "", this.prefixType || "str"); |
| 133 | + ti("#node-input-pattern", this.pattern || "", this.patternType || "str"); |
| 134 | + ti("#node-input-maxResults", this.maxResults || "100", this.maxResultsType || "num", "num"); |
| 135 | + ti("#node-input-depth", this.depth || "0", this.depthType || "num", "num"); |
| 136 | + ti("#node-input-workspaceId", this.workspaceId || "", this.workspaceIdType || "str"); |
| 137 | + ti("#node-input-pollFrequency", this.pollFrequency || "15", "num", "num"); |
| 138 | + |
| 139 | + $("#node-input-returnType").val(this.returnType || "files"); |
| 140 | + }, |
| 141 | + oneditsave: function () { |
| 142 | + function save(id, prop, propType) { |
| 143 | + this[prop] = $(id).typedInput("value"); |
| 144 | + this[propType] = $(id).typedInput("type"); |
| 145 | + } |
| 146 | + save.call(this, "#node-input-dataLinkName", "dataLinkName", "dataLinkNameType"); |
| 147 | + save.call(this, "#node-input-basePath", "basePath", "basePathType"); |
| 148 | + save.call(this, "#node-input-prefix", "prefix", "prefixType"); |
| 149 | + save.call(this, "#node-input-pattern", "pattern", "patternType"); |
| 150 | + save.call(this, "#node-input-maxResults", "maxResults", "maxResultsType"); |
| 151 | + save.call(this, "#node-input-depth", "depth", "depthType"); |
| 152 | + save.call(this, "#node-input-workspaceId", "workspaceId", "workspaceIdType"); |
| 153 | + this.pollFrequency = $("#node-input-pollFrequency").typedInput("value"); |
| 154 | + this.returnType = $("#node-input-returnType").val(); |
| 155 | + }, |
| 156 | + }); |
| 157 | +</script> |
0 commit comments