@gregoriusrippenstein/node-red-contrib-introspection 0.4.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,183 +0,0 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('Orphans',{
3
- color: '#e5e4ef',
4
- icon: "font-awesome/fa-support",
5
- category: 'introspection',
6
- paletteLabel: "Orphans",
7
- defaults: {
8
- name: {
9
- value:"",
10
- },
11
- },
12
- inputs:0,
13
- outputs:0,
14
-
15
- label: function() {
16
- return (this.name || this._def.paletteLabel);
17
- },
18
-
19
- labelStyle: function() {
20
- return this.name?"node_label_italic":"";
21
- },
22
-
23
- oneditprepare: function() {
24
- var node = this;
25
-
26
- this._resize = function() {
27
- var rows = $("#dialog-form>div:not(.node-input-target-list-row)");
28
- var height = $("#dialog-form").height();
29
- for (var i=0;i<rows.length;i++) {
30
- height -= $(rows[i]).outerHeight(true);
31
- }
32
- var editorRow = $("#dialog-form>div.node-input-target-list-row");
33
- editorRow.css("height",height+"px");
34
- };
35
-
36
- var search = $("#node-input-orphan-target-filter").searchBox({
37
- style: "compact",
38
- delay: 300,
39
- change: function() {
40
- var val = $(this).val().trim().toLowerCase();
41
- if (val === "") {
42
- dirList.treeList("filter", null);
43
- search.searchBox("count","");
44
- } else {
45
- var count = dirList.treeList("filter", function(item) {
46
- return item.label.toLowerCase().indexOf(val) > -1 || item.node.type.toLowerCase().indexOf(val) > -1
47
- });
48
- search.searchBox("count",count+" / "+items.length);
49
- }
50
- }
51
- });
52
-
53
- var dirList = $("#node-input-orphan-target-container-div").css({
54
- width: "100%",
55
- height: "100%"
56
- }).treeList(
57
- {
58
- multi:true
59
- }
60
- ).on("treelistitemmouseover", function(e, item) {
61
- if ( item.node ) {
62
- RED.workspaces.show(item.node.z,false,false,true);
63
- item.node.highlighted = true;
64
- item.node.dirty = true;
65
- RED.view.reveal(item.node.id,true);
66
- RED.view.redraw();
67
- }
68
- }).on("treelistitemmouseout", function(e, item) {
69
- if ( item.node ) {
70
- item.node.highlighted = false;
71
- item.node.dirty = true;
72
- RED.view.redraw();
73
- }
74
- }).on('treelistselect', function(event, item) {
75
- if ( item.node ) {
76
- RED.workspaces.show(item.node.z,false,false,true);
77
- item.node.highlighted = true;
78
- item.node.dirty = true;
79
- RED.view.reveal(item.node.id,true)
80
- RED.view.redraw();
81
- RED.tray.close();
82
- }
83
- });
84
-
85
- /* ***************
86
- * code taken from
87
- * https://discourse.nodered.org/t/search-for-orphan-nodes/77783/3
88
- */
89
- const connectedNodes = new Set()
90
- var candidateNodes = [];
91
-
92
- // Iterate over all links, add the nodes to the 'connected' set
93
- RED.nodes.eachLink(link => { connectedNodes.add(link.source); connectedNodes.add(link.target) })
94
- // Iterate over all nodes, add any not in the connected set to the disconnected set
95
- RED.nodes.eachNode(node => { if (!connectedNodes.has(node)) candidateNodes.push(node) })
96
- /************ done code borrowing ************/
97
-
98
- var items = [];
99
- var nodeItemMap = {};
100
-
101
- candidateNodes.forEach(function(n) {
102
- if (n.id === node.id) {
103
- return;
104
- }
105
-
106
- var nodeDef = RED.nodes.getType(n.type);
107
- var label;
108
- var sublabel;
109
-
110
- if (nodeDef) {
111
- var l = nodeDef.label;
112
- label = (typeof l === "function" ? l.call(n) : l)||"";
113
- sublabel = n.type;
114
-
115
- if (sublabel.indexOf("subflow:") === 0) {
116
- return;
117
-
118
- var subflowId = sublabel.substring(8);
119
- var subflow = RED.nodes.subflow(subflowId);
120
- sublabel = "subflow : "+subflow.name;
121
- }
122
- }
123
-
124
- if (!nodeDef || !label) {
125
- label = n.type;
126
- }
127
- nodeItemMap[n.id] = {
128
- node: n,
129
- label: label,
130
- sublabel: sublabel,
131
- selected: false,
132
- checkbox: false
133
- };
134
- items.push(nodeItemMap[n.id]);
135
- });
136
-
137
- dirList.treeList('data',items);
138
-
139
- $("#node-input-back-home-but").on("click", function(e) {
140
- e.preventDefault();
141
- var nde = RED.nodes.node(node.id);
142
- if ( nde ) {
143
- RED.workspaces.show(nde.z,false,false,true);
144
- nde.highlighted = true;
145
- nde.dirty = true;
146
- RED.view.reveal(nde.id,true)
147
- RED.view.redraw();
148
- RED.tray.close();
149
- }
150
- });
151
- },
152
-
153
- oneditsave: function() {
154
- },
155
-
156
- oneditresize: function(size) {
157
- this._resize();
158
- }
159
-
160
- });
161
- </script>
162
-
163
- <script type="text/html" data-template-name="Orphans">
164
- <div class="form-row node-input-target-row">
165
- <button id="node-input-back-home-but"
166
- class="red-ui-button">Back Home</button>
167
- </div>
168
-
169
- <div class="form-row node-input-target-row node-input-target-list-row" style="position: relative; min-height: 100px">
170
- <div style="position: absolute; top: -30px; right: 0;"><input type="text" id="node-input-orphan-target-filter"></div>
171
- <div id="node-input-orphan-target-container-div"></div>
172
- </div>
173
-
174
- <div class="form-row">
175
- <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name">Name</span></label>
176
- <input type="text" id="node-input-name" placeholder="Name">
177
- </div>
178
-
179
- </script>
180
-
181
- <script type="text/html" data-help-name="Orphans">
182
- <p>Orphan node shows all other nodes that are orphans, that is not connected to anything else either input nor output.</p>
183
- </script>
@@ -1,17 +0,0 @@
1
- module.exports = function(RED) {
2
- function OrphanFunctionality(config) {
3
- RED.nodes.createNode(this,config);
4
-
5
- var node = this;
6
- var cfg = config;
7
-
8
- node.on('close', function() {
9
- node.status({});
10
- });
11
-
12
- node.on("input",function(msg, send, done) {
13
- send(msg);
14
- });
15
- }
16
- RED.nodes.registerType("Orphans", OrphanFunctionality);
17
- }
@@ -1,49 +0,0 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('IsMobile',{
3
- color: '#e5e4ef',
4
- icon: "font-awesome/fa-mobile",
5
- category: 'introspection',
6
- defaults: {
7
- name: {
8
- value:"",
9
- },
10
- },
11
- inputs:0,
12
- outputs:0,
13
-
14
- label: function() {
15
- return (this.name || this._def.paletteLabel);
16
- },
17
-
18
- labelStyle: function() {
19
- return this.name?"node_label_italic":"";
20
- },
21
-
22
- onpaletteadd: () => {
23
- setTimeout( function() {
24
- RED.sidebar.info.show()
25
- }, 1000);
26
-
27
- if ( (RED.utils.getBrowserInfo().mobile > 0) ||
28
- window.matchMedia('only screen and (max-width: 890px)').matches ) {
29
-
30
- setTimeout( function() {
31
- // taken from https://discourse.nodered.org/t/togglepalette-v-togglesidebar/78169/3
32
- RED.actions.invoke("core:toggle-palette", false)
33
- RED.actions.invoke("core:toggle-sidebar", false)
34
- }, 1400);
35
- }
36
- },
37
- });
38
- </script>
39
-
40
- <script type="text/html" data-template-name="IsMobile">
41
- <div class="form-row">
42
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
43
- <input type="text" id="node-input-name" placeholder="Name">
44
- </div>
45
- </script>
46
-
47
- <script type="text/html" data-help-name="IsMobile">
48
- <p>A palette-only node, this does not get included in any flow. This node hides the palette bar and the sidebar on mobile devices. If not required, disable the node in the palette manager.</p>
49
- </script>
@@ -1,17 +0,0 @@
1
- module.exports = function(RED) {
2
- function IsMobileFunctionality(config) {
3
- RED.nodes.createNode(this,config);
4
-
5
- var node = this;
6
- var cfg = config;
7
-
8
- node.on('close', function() {
9
- node.status({});
10
- });
11
-
12
- node.on("input",function(msg, send, done) {
13
- send(msg);
14
- });
15
- }
16
- RED.nodes.registerType("IsMobile", IsMobileFunctionality);
17
- }
@@ -1,77 +0,0 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('Navigator',{
3
- color: '#e5e4ef',
4
- icon: "font-awesome/fa-crosshairs",
5
- category: 'introspection',
6
- defaults: {
7
- name: { value:"", },
8
- },
9
- inputs:0,
10
- outputs:0,
11
-
12
- label: function() {
13
- return (this.name || this._def.paletteLabel);
14
- },
15
-
16
- labelStyle: function() {
17
- return this.name?"node_label_italic":"";
18
- },
19
-
20
- onpaletteadd: () => {
21
- var nodeId = window.location.hash.match(/\/n\/([^\/]{16})(\/edit)?/);
22
-
23
- // RED.nodes is not initialised at this point, so there is no way to
24
- // check whether the nodeId really does exist, so we assume that nodeId
25
- // will be eventually addded to a workspace.
26
- if ( nodeId ) {
27
- var hndlr = (node) => {
28
- if ( node.id == nodeId[1] ) {
29
- setTimeout( function() {
30
- var nde = RED.nodes.node(nodeId[1]);
31
- RED.workspaces.show(nde.z,false,false,true);
32
-
33
- if ( nodeId[2] == "/edit" ) {
34
- RED.editor.edit(nde);
35
- }
36
-
37
- RED.view.reveal(nodeId[1],true);
38
- }, 1012);
39
- RED.events.off("nodes:add", hndlr);
40
- }
41
- };
42
- RED.events.on("nodes:add", hndlr);
43
- }
44
-
45
- // Highlight an entire path.
46
- var pathIds = window.location.hash.match(/\/p\/((.{16},?)+)/);
47
- if ( pathIds ) {
48
- var nodeIds = [];
49
- pathIds[1].split(",").forEach( function(ndeId) {
50
- if ( ndeId.trim() != "" ) { nodeIds.push( ndeId.trim() ) }
51
- });
52
-
53
- var hndlr = (stst) => {
54
- if ( stst.state == "start" ) {
55
- setTimeout( () => {
56
- RED.workspaces.show(RED.nodes.node(nodeIds[0]).z,false,false,true);
57
- RED.view.selectNodes({ selected: nodeIds });
58
- }, 321);
59
- RED.events.off("runtime-state", hndlr);
60
- }
61
- };
62
- RED.events.on("runtime-state", hndlr);
63
- }
64
- },
65
- });
66
- </script>
67
-
68
- <script type="text/html" data-template-name="Navigator">
69
- <div class="form-row">
70
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
71
- <input type="text" id="node-input-name" placeholder="Name">
72
- </div>
73
- </script>
74
-
75
- <script type="text/html" data-help-name="Navigator">
76
- <p>A palette-only node, this does not get included in any flow. This node ensures that nodes are focused on when the url contains `/n/[nodeid]`. If not required, disable the node in the palette manager.</p>
77
- </script>
@@ -1,17 +0,0 @@
1
- module.exports = function(RED) {
2
- function NavigatorFunctionality(config) {
3
- RED.nodes.createNode(this,config);
4
-
5
- var node = this;
6
- var cfg = config;
7
-
8
- node.on('close', function() {
9
- node.status({});
10
- });
11
-
12
- node.on("input",function(msg, send, done) {
13
- send(msg);
14
- });
15
- }
16
- RED.nodes.registerType("Navigator", NavigatorFunctionality);
17
- }
@@ -1,51 +0,0 @@
1
- <script type="text/javascript">
2
- RED.comms.subscribe("introspect:drawsvg", (event,data) => {
3
- if ( data.msg == "svgdata" ) {
4
- var version = RED.settings.version.split(".");
5
-
6
- if ( version[0] == "3" && version[1] == "0" ) {
7
- $($($('svg')[0]).find('> g > g > g')[2]).append(
8
- data.payload
9
- );
10
- }
11
-
12
- if ( version[0] == "3" && version[1] == "1" ) {
13
- $($($('svg[width=8000]')[0]).find('> g > g > g')[2]).append(
14
- data.payload
15
- );
16
- }
17
- }
18
- });
19
-
20
- RED.nodes.registerType('DrawSVG',{
21
- color: '#e5e4ef',
22
- icon: "font-awesome/fa-image",
23
- category: 'introspection',
24
- defaults: {
25
- name: {
26
- value:"",
27
- },
28
- },
29
- inputs:1,
30
- outputs:0,
31
-
32
- label: function() {
33
- return (this.name || this._def.paletteLabel);
34
- },
35
-
36
- labelStyle: function() {
37
- return this.name?"node_label_italic":"";
38
- },
39
- });
40
- </script>
41
-
42
- <script type="text/html" data-template-name="DrawSVG">
43
- <div class="form-row">
44
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
45
- <input type="text" id="node-input-name" placeholder="Name">
46
- </div>
47
- </script>
48
-
49
- <script type="text/html" data-help-name="DrawSVG">
50
- <p>Draw the given SVG onto the workspace placing it between the grid and the nodes and their connections. To remove the image, reload the workspace. Doing a deploy will completely ignore any image added to the workspace.</p>
51
- </script>
@@ -1,25 +0,0 @@
1
- module.exports = function(RED) {
2
- function DrawSVGFunctionality(config) {
3
- RED.nodes.createNode(this,config);
4
-
5
- var node = this;
6
- var cfg = config;
7
-
8
- node.on('close', function() {
9
- node.status({});
10
- });
11
-
12
- node.on("input", function(msg, send, done) {
13
- RED.comms.publish("introspect:drawsvg", RED.util.encodeObject({
14
- payload: msg.payload,
15
- msg: "svgdata",
16
- }));
17
-
18
- node.status({ fill: "green", shape: "dot", text: "SVG Data sent" });
19
- setTimeout( () => { node.status({}) }, 1432 );
20
-
21
- send(msg);
22
- });
23
- }
24
- RED.nodes.registerType("DrawSVG", DrawSVGFunctionality);
25
- }