@5minds/node-red-dashboard-2-processcube-process-progress-bar 1.0.0-master-f256e1-m848mtcq
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.
- package/LICENSE +201 -0
- package/README.md +31 -0
- package/nodes/icons/ui-progress-bar.svg +4 -0
- package/nodes/locales/en-US/ui-process-progress-bar.html +3 -0
- package/nodes/locales/en-US/ui-process-progress-bar.json +7 -0
- package/nodes/ui-process-progress-bar.html +232 -0
- package/nodes/ui-process-progress-bar.js +56 -0
- package/package.json +79 -0
- package/resources/ui-process-progress-bar.umd.js +2 -0
- package/ui/components/UIProcessProgressBar.vue +85 -0
- package/ui/index.js +2 -0
- package/ui/main.js +10 -0
- package/ui/stylesheets/ui-process-progress-bar.css +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Process Progress Bar
|
|
2
|
+
|
|
3
|
+
A UI-Node to display a step-by-step progress bar, tracking the progress of a process.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
After configuring the node, use a `usertask-event-listener` node and direct all `new` and `finished` events for the tracked process into the `ui-process-progress-bar` node.
|
|
8
|
+
It will automatically update, when UserTasks are started or finished.
|
|
9
|
+
|
|
10
|
+
## Title
|
|
11
|
+
|
|
12
|
+
Will be displayed above the progress bar. It can also be set dynamically by setting `msg.payload.title`.
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
This field is used for configuring the steps of the progress bar.
|
|
17
|
+
|
|
18
|
+
Each step is defined by:
|
|
19
|
+
|
|
20
|
+
- **Label**: The text displayed for the progress bar step
|
|
21
|
+
- **FlownodeId**: The Id of the Flownode, that needs to be active/finished to start/fullfill this step.
|
|
22
|
+
- **Icon (optional)**: An URL for an image, that should be displayed in addition to the label. This will be used as the `src`-Property of a HTML `img`-Element. Therefore DataURLs can be used to add images/svgs etc., that are not available online.
|
|
23
|
+
- **Icon finished (optional)**: An URL for an image, that should be displayed in addition to the label, after the step has been finished. This will be used as the `src`-Property of a HTML `img`-Element. Therefore DataURLs can be used to add images/svgs etc., that are not available online.
|
|
24
|
+
|
|
25
|
+
## Color
|
|
26
|
+
|
|
27
|
+
Will be used as the outline/fill/text color for the steps.
|
|
28
|
+
|
|
29
|
+
## Reference
|
|
30
|
+
|
|
31
|
+
[https://processcube.io/docs/solutions/node-red](https://processcube.io/docs/solutions/node-red)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="40" height="60" viewBox="0 0 40 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 25C5.23858 25 3 27.2386 3 30C3 32.7614 5.23858 35 8 35H33C35.7614 35 38 32.7614 38 30C38 27.2386 35.7614 25 33 25H8ZM8 28C6.89543 28 6 28.8954 6 30C6 31.1046 6.89543 32 8 32H33C34.1046 32 35 31.1046 35 30C35 28.8954 34.1046 28 33 28H8Z" fill="white"/>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 32H35V28H19C20.1046 28 21 28.8954 21 30C21 31.1046 20.1046 32 19 32Z" fill="white"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
(function () {
|
|
3
|
+
function hasProperty(obj, prop) {
|
|
4
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
RED.nodes.registerType('ui-process-progress-bar', {
|
|
8
|
+
category: 'ProcessCube UI',
|
|
9
|
+
color: '#00aed7',
|
|
10
|
+
defaults: {
|
|
11
|
+
name: { value: '' },
|
|
12
|
+
group: { type: 'ui-group', required: true },
|
|
13
|
+
order: { value: 1 },
|
|
14
|
+
color: { value: '#8899C9' },
|
|
15
|
+
steps: {
|
|
16
|
+
value: [],
|
|
17
|
+
validate: function (v) {
|
|
18
|
+
const unique = new Set(
|
|
19
|
+
v.map(function (o) {
|
|
20
|
+
return o.label;
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
return v.length === unique.size;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
width: {
|
|
27
|
+
value: 0,
|
|
28
|
+
validate: function (v) {
|
|
29
|
+
const width = v || 0;
|
|
30
|
+
const currentGroup = $('#node-input-group').val() || this.group;
|
|
31
|
+
const groupNode = RED.nodes.node(currentGroup);
|
|
32
|
+
const valid = !groupNode || +width <= +groupNode.width;
|
|
33
|
+
$('#node-input-size').toggleClass('input-error', !valid);
|
|
34
|
+
return valid;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
height: { value: 0 },
|
|
38
|
+
outputs: { value: 0 },
|
|
39
|
+
},
|
|
40
|
+
inputs: 1,
|
|
41
|
+
outputs: 0,
|
|
42
|
+
icon: 'ui-progress-bar.svg',
|
|
43
|
+
paletteLabel: 'ui-process-progress-bar',
|
|
44
|
+
label: function () {
|
|
45
|
+
return this.name || 'ui-process-progress-bar';
|
|
46
|
+
},
|
|
47
|
+
oneditprepare: function () {
|
|
48
|
+
$('#node-input-size').elementSizer({
|
|
49
|
+
width: '#node-input-width',
|
|
50
|
+
height: '#node-input-height',
|
|
51
|
+
group: '#node-input-group',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function generateStep(i, step) {
|
|
55
|
+
const container = $('<li/>', {
|
|
56
|
+
style: 'background: var(--red-ui-secondary-background, #fff); margin:0; padding:8px 0px 0px;',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Create input fields for flowNodeId, icon and label
|
|
60
|
+
const row = $('<div/>').appendTo(container);
|
|
61
|
+
$('<input/>', {
|
|
62
|
+
class: 'node-input-step-label',
|
|
63
|
+
type: 'text',
|
|
64
|
+
style: 'margin-left:7px; width:calc(50% - 32px);',
|
|
65
|
+
placeholder: 'Label',
|
|
66
|
+
value: step.label,
|
|
67
|
+
})
|
|
68
|
+
.appendTo(row)
|
|
69
|
+
.typedInput({
|
|
70
|
+
type: 'str',
|
|
71
|
+
types: ['str'],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
$('<input/>', {
|
|
75
|
+
class: 'node-input-step-flowNodeId',
|
|
76
|
+
type: 'text',
|
|
77
|
+
style: 'margin-left:7px; width:calc(50% - 32px);',
|
|
78
|
+
placeholder: 'FlownodeId',
|
|
79
|
+
value: step.flowNodeId,
|
|
80
|
+
})
|
|
81
|
+
.appendTo(row)
|
|
82
|
+
.typedInput({
|
|
83
|
+
type: 'str',
|
|
84
|
+
types: ['str'],
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
$('<input/>', {
|
|
88
|
+
class: 'node-input-step-icon',
|
|
89
|
+
type: 'text',
|
|
90
|
+
style: 'margin-left:7px; width:calc(50% - 32px);',
|
|
91
|
+
placeholder: 'Icon',
|
|
92
|
+
value: step.icon,
|
|
93
|
+
})
|
|
94
|
+
.appendTo(row)
|
|
95
|
+
.typedInput({
|
|
96
|
+
type: 'str',
|
|
97
|
+
types: ['str'],
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
$('<input/>', {
|
|
101
|
+
class: 'node-input-step-iconFinished',
|
|
102
|
+
type: 'text',
|
|
103
|
+
style: 'margin-left:7px; width:calc(50% - 32px);',
|
|
104
|
+
placeholder: 'Icon (finished)',
|
|
105
|
+
value: step.iconFinished,
|
|
106
|
+
})
|
|
107
|
+
.appendTo(row)
|
|
108
|
+
.typedInput({
|
|
109
|
+
type: 'str',
|
|
110
|
+
types: ['str'],
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Create delete button for the step
|
|
114
|
+
const finalSpan = $('<span/>', {
|
|
115
|
+
style: 'float:right; margin-right:8px;',
|
|
116
|
+
}).appendTo(row);
|
|
117
|
+
const deleteButton = $('<a/>', {
|
|
118
|
+
href: '#',
|
|
119
|
+
class: 'editor-button editor-button-small',
|
|
120
|
+
style: 'margin-top:7px; margin-left:5px;',
|
|
121
|
+
}).appendTo(finalSpan);
|
|
122
|
+
$('<i/>', { class: 'fa fa-remove' }).appendTo(deleteButton);
|
|
123
|
+
|
|
124
|
+
deleteButton.click(function () {
|
|
125
|
+
container.css({
|
|
126
|
+
background: 'var(--red-ui-secondary-background-inactive, #fee)',
|
|
127
|
+
});
|
|
128
|
+
container.fadeOut(300, function () {
|
|
129
|
+
$(this).remove();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
$('#node-input-step-container').append(container);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
$('#node-input-add-step').click(function () {
|
|
137
|
+
generateStep($('#node-input-step-container').children().length + 1, {});
|
|
138
|
+
$('#node-input-step-container-div').scrollTop(
|
|
139
|
+
$('#node-input-step-container-div').get(0).scrollHeight
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < this.steps.length; i++) {
|
|
144
|
+
const step = this.steps[i];
|
|
145
|
+
generateStep(i + 1, step);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
$('#node-input-step-container').sortable({
|
|
149
|
+
axis: 'y',
|
|
150
|
+
handle: '.node-input-step-handle',
|
|
151
|
+
cursor: 'move',
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
oneditsave: function () {
|
|
155
|
+
const steps = $('#node-input-step-container').children();
|
|
156
|
+
const node = this;
|
|
157
|
+
node.steps = [];
|
|
158
|
+
steps.each(function (i) {
|
|
159
|
+
const step = $(this);
|
|
160
|
+
const o = {
|
|
161
|
+
label: step.find('.node-input-step-label').val(),
|
|
162
|
+
flowNodeId: step.find('.node-input-step-flowNodeId').val(),
|
|
163
|
+
icon: step.find('.node-input-step-icon').val(),
|
|
164
|
+
iconFinished: step.find('.node-input-step-iconFinished').val(),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
node.steps.push(o);
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
})();
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<script type="text/html" data-template-name="ui-process-progress-bar">
|
|
175
|
+
<div class="form-row">
|
|
176
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
177
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
178
|
+
</div>
|
|
179
|
+
<div class="form-row">
|
|
180
|
+
<label for="node-input-group"><i class="fa fa-table"></i> Group</label>
|
|
181
|
+
<input type="text" id="node-input-group">
|
|
182
|
+
</div>
|
|
183
|
+
<div class="form-row">
|
|
184
|
+
<label><i class="fa fa-object-group"></i> <span data-i18n="ui-process-progress-bar.label.size"></label>
|
|
185
|
+
<input type="hidden" id="node-input-width">
|
|
186
|
+
<input type="hidden" id="node-input-height">
|
|
187
|
+
<button class="editor-button" id="node-input-size"></button>
|
|
188
|
+
</div>
|
|
189
|
+
<div class="form-row form-row-flex node-input-step-container-row" style="margin-bottom: 0px;width: 100%">
|
|
190
|
+
<label for="node-input-width" style="vertical-align:top"><i class="fa fa-list-alt"></i> Steps</label>
|
|
191
|
+
<div id="node-input-step-container-div" style="box-sizing:border-box; border-radius:5px; height:257px; padding:5px; border:1px solid var(--red-ui-form-input-border-color, #ccc); overflow-y:scroll; display:inline-block; width: 70%;">
|
|
192
|
+
<span id="valWarning" style="color: var(--red-ui-text-color-error, #910000)"><b>All Values must be unique.</b></span>
|
|
193
|
+
<ol id="node-input-step-container" style="list-style-type:none; margin:0;"></ol>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
<!-- Add Step Button -->
|
|
197
|
+
<div class="form-row">
|
|
198
|
+
<a href="#" class="editor-button editor-button-small" id="node-input-add-step" style="margin-top:4px; margin-left:103px;"><i class="fa fa-plus"></i> <span>action</span></a>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="form-row">
|
|
201
|
+
<label for="node-input-color"><i class="fa fa-table"></i> Color</label>
|
|
202
|
+
<input type="color" id="node-input-color" style="max-width:200px;">
|
|
203
|
+
</div>
|
|
204
|
+
</script>
|
|
205
|
+
|
|
206
|
+
<script type="text/markdown" data-help-name="ui-process-progress-bar">
|
|
207
|
+
A UI-Node to display a step-by-step progress bar, tracking the progress of a process.
|
|
208
|
+
|
|
209
|
+
## Usage
|
|
210
|
+
|
|
211
|
+
After configuring the node, use a `usertask-event-listener` node and direct all `new` and `finished` events for the tracked process into the `ui-process-progress-bar` node.
|
|
212
|
+
It will automatically update, when UserTasks are started or finished.
|
|
213
|
+
|
|
214
|
+
## Steps
|
|
215
|
+
|
|
216
|
+
This field is used for configuring the steps of the progress bar.
|
|
217
|
+
|
|
218
|
+
Each step is defined by:
|
|
219
|
+
|
|
220
|
+
- **Label**: The text displayed for the progress bar step
|
|
221
|
+
- **FlownodeId**: The Id of the Flownode, that needs to be active/finished to start/fullfill this step.
|
|
222
|
+
- **Icon (optional)**: An URL for an image, that should be displayed in addition to the label. This will be used as the `src`-Property of a HTML `img`-Element. Therefore DataURLs can be used to add images/svgs etc., that are not available online.
|
|
223
|
+
- **Icon finished (optional)**: An URL for an image, that should be displayed in addition to the label, after the step has been finished. This will be used as the `src`-Property of a HTML `img`-Element. Therefore DataURLs can be used to add images/svgs etc., that are not available online.
|
|
224
|
+
|
|
225
|
+
## Color
|
|
226
|
+
|
|
227
|
+
Will be used as the outline/fill/text color for the steps.
|
|
228
|
+
|
|
229
|
+
## Reference
|
|
230
|
+
|
|
231
|
+
[https://processcube.io/docs/solutions/node-red](https://processcube.io/docs/solutions/node-red)
|
|
232
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const util = require('util');
|
|
2
|
+
module.exports = function (RED) {
|
|
3
|
+
function ProcessProgressBarNode(config) {
|
|
4
|
+
RED.nodes.createNode(this, config);
|
|
5
|
+
|
|
6
|
+
const node = this;
|
|
7
|
+
|
|
8
|
+
const group = RED.nodes.getNode(config.group);
|
|
9
|
+
|
|
10
|
+
const base = group.getBase();
|
|
11
|
+
|
|
12
|
+
//server-side event handlers
|
|
13
|
+
const evts = {
|
|
14
|
+
onAction: true,
|
|
15
|
+
onInput: function (msg, send, done) {
|
|
16
|
+
let activeStep = null;
|
|
17
|
+
let finishedSteps = [];
|
|
18
|
+
|
|
19
|
+
if (msg.payload?.action && msg.payload?.userTask) {
|
|
20
|
+
const flowNodeId = msg.payload.userTask.flowNodeId;
|
|
21
|
+
const action = msg.payload.action;
|
|
22
|
+
const flowNodeIds = config.steps.map(step => step.flowNodeId);
|
|
23
|
+
const flowNodeIdExists = flowNodeIds.includes(flowNodeId);
|
|
24
|
+
|
|
25
|
+
if (flowNodeIdExists && action === 'new') {
|
|
26
|
+
activeStep = flowNodeId;
|
|
27
|
+
finishedSteps = flowNodeIds.slice(0, flowNodeIds.indexOf(flowNodeId));
|
|
28
|
+
} else if (flowNodeIdExists && action === 'finished') {
|
|
29
|
+
finishedSteps = flowNodeIds.slice(0, flowNodeIds.indexOf(flowNodeId) + 1)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
msg.processProgressBar = {
|
|
34
|
+
activeStep, finishedSteps
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
base.stores.data.save(base, node, msg);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (group) {
|
|
42
|
+
group.register(node, config, evts);
|
|
43
|
+
} else {
|
|
44
|
+
node.error('No group configured');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
RED.nodes.registerType('ui-process-progress-bar', ProcessProgressBarNode, {
|
|
49
|
+
defaults: {
|
|
50
|
+
outputs: { value: 0 },
|
|
51
|
+
},
|
|
52
|
+
outputs: function (config) {
|
|
53
|
+
return 0;
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@5minds/node-red-dashboard-2-processcube-process-progress-bar",
|
|
3
|
+
"version": "1.0.0-master-f256e1-m848mtcq",
|
|
4
|
+
"description": "A ui component for showing progress bars tracking a process",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"processcube",
|
|
7
|
+
"usertask",
|
|
8
|
+
"node-red",
|
|
9
|
+
"node-red-dashboard-2"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/5minds/node-red-dashboard-2-processcube-process-progress-bar.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Martin Moellenbeck",
|
|
18
|
+
"url": "https://github.com/moellenbeck"
|
|
19
|
+
},
|
|
20
|
+
"contributors": [
|
|
21
|
+
{
|
|
22
|
+
"name": "Niclas Podzierski",
|
|
23
|
+
"url": "https://github.com/niclaspodzierski"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
"require": "./resources/ui-process-progress-bar.umd.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/*",
|
|
31
|
+
"nodes/*",
|
|
32
|
+
"ui/*",
|
|
33
|
+
"resources/*"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "vite build",
|
|
37
|
+
"build:dev": "NODE_ENV=development vite build",
|
|
38
|
+
"dev": "NODE_ENV=development vite build --watch",
|
|
39
|
+
"dev:prod": "vite build --watch",
|
|
40
|
+
"lint": "npm run lint:js && npm run lint:package",
|
|
41
|
+
"lint:fix": "npm run lint:js:fix && npm run lint:package:fix",
|
|
42
|
+
"lint:js": "eslint --ext .js,.vue,.cjs,.mjs .",
|
|
43
|
+
"lint:js:fix": "yarn lint:js --fix",
|
|
44
|
+
"lint:package": "sort-package-json --check 'package.json'",
|
|
45
|
+
"lint:package:fix": "sort-package-json 'package.json'"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"vue": "^3.3.8",
|
|
49
|
+
"vuex": "^4.1.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@vitejs/plugin-vue": "^4.5.0",
|
|
53
|
+
"eslint": "^8.53.0",
|
|
54
|
+
"eslint-config-standard": "^17.1.0",
|
|
55
|
+
"eslint-plugin-import": "^2.29.0",
|
|
56
|
+
"eslint-plugin-n": "^16.3.1",
|
|
57
|
+
"eslint-plugin-vue": "^9.18.1",
|
|
58
|
+
"vite": "^5.3.2",
|
|
59
|
+
"vite-plugin-css-injected-by-js": "^3.3.0"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=14"
|
|
63
|
+
},
|
|
64
|
+
"node-red": {
|
|
65
|
+
"version": ">=3.0.0",
|
|
66
|
+
"nodes": {
|
|
67
|
+
"ui-process-progress-bar": "nodes/ui-process-progress-bar.js"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"node-red-dashboard-2": {
|
|
71
|
+
"version": "1.0.0",
|
|
72
|
+
"widgets": {
|
|
73
|
+
"ui-process-progress-bar": {
|
|
74
|
+
"output": "ui-process-progress-bar.umd.js",
|
|
75
|
+
"component": "UIProcessProgressBar"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(".progressBarWrapper[data-v-d9042733]{display:grid;align-items:center;gap:8px;padding:40px;border-radius:8px;border:2px solid #F6F5FA;background:#fff;margin-left:92px;margin-right:92px;margin-bottom:32px}.progressBarWrapper .progressBarStep[data-v-d9042733]{display:flex;align-items:center;gap:8px;padding:16px}.progressBarWrapper .currentStep[data-v-d9042733]{border-radius:15px;border:4px solid #8899C9}.progressBarWrapper .finishedStep[data-v-d9042733]{border-radius:15px;background:#8899c9;color:#fff}.progressBarWrapper hr[data-v-d9042733]{border-radius:2px;border:none;height:4px;background:#4a4759}.progressBarWrapper .coloredConnection[data-v-d9042733]{background:#8899c9}.progressBarWrapper span[data-v-d9042733]{font-size:21px;font-style:normal;font-weight:400;line-height:normal;white-space:nowrap}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
(function(o,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vuex"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vuex","vue"],n):(o=typeof globalThis<"u"?globalThis:o||self,n(o["ui-process-progress-bar"]={},o.vuex,o.Vue))})(this,function(o,n,e){"use strict";const a=(t,s)=>{const c=t.__vccOpts||t;for(const[l,d]of s)c[l]=d;return c},p={name:"UIProcessProgressBar",inject:["$socket"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!0,visible:!0})}},created(){this.steps=this.props.steps},computed:{...n.mapState("data",["messages"]),templateColumns(){return{gridTemplateColumns:new Array(this.steps.length).fill("min-content").join(" auto ")}},stepFlowNodeIds(){return this.steps.map(t=>t.flowNodeId)},activeStep(){var t,s;return(s=(t=this.messages[this.id])==null?void 0:t.processProgressBar)==null?void 0:s.activeStep},finishedSteps(){var t,s;return((s=(t=this.messages[this.id])==null?void 0:t.processProgressBar)==null?void 0:s.finishedSteps)??[]}},data(){return{steps:[]}},mounted(){this.$socket.on("widget-load:"+this.id,t=>{this.steps=this.props.steps,this.$store.commit("data/bind",{widgetId:this.id,msg:t})}),this.$socket.on("msg-input:"+this.id,t=>{this.messages[this.id]=t,this.$store.commit("data/bind",{widgetId:this.id,msg:t})}),this.$socket.emit("widget-load",this.id)},unmounted(){var t,s;(t=this.$socket)==null||t.off("widget-load"+this.id),(s=this.$socket)==null||s.off("msg-input:"+this.id)},methods:{}},m=["src"],h=["src"];function f(t,s,c,l,d,r){return e.openBlock(),e.createElementBlock("div",{class:"progressBarWrapper",style:e.normalizeStyle(r.templateColumns)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.steps,(i,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["progressBarStep",{currentStep:i.flowNodeId==r.activeStep,finishedStep:r.finishedSteps.includes(i.flowNodeId)}])},[i.icon&&!r.finishedSteps.includes(i.flowNodeId)?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.icon},null,8,m)):e.createCommentVNode("",!0),i.iconFinished&&r.finishedSteps.includes(i.flowNodeId)?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.iconFinished},null,8,h)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(i.label),1)],2),g!=d.steps.length-1?(e.openBlock(),e.createElementBlock("hr",{key:0,class:e.normalizeClass({coloredConnection:r.finishedSteps.includes(i.flowNodeId)})},null,2)):e.createCommentVNode("",!0)],64))),256))],4)}const u=a(p,[["render",f],["__scopeId","data-v-d9042733"]]);o.UIProcessProgressBar=u,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="progressBarWrapper" :style="templateColumns">
|
|
3
|
+
<template v-for="(step, index) in steps">
|
|
4
|
+
<div class="progressBarStep" :class="{ currentStep: step.flowNodeId == activeStep, finishedStep: finishedSteps.includes(step.flowNodeId) }">
|
|
5
|
+
<img v-if="step.icon && !finishedSteps.includes(step.flowNodeId)" :src="step.icon" />
|
|
6
|
+
<img v-if="step.iconFinished && finishedSteps.includes(step.flowNodeId)" :src="step.iconFinished" />
|
|
7
|
+
<span>
|
|
8
|
+
{{ step.label }}
|
|
9
|
+
</span>
|
|
10
|
+
</div>
|
|
11
|
+
<hr v-if="index != steps.length - 1" :class="{coloredConnection: finishedSteps.includes(step.flowNodeId)}" />
|
|
12
|
+
</template>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { mapState } from 'vuex';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'UIProcessProgressBar',
|
|
21
|
+
inject: ['$socket'],
|
|
22
|
+
props: {
|
|
23
|
+
/* do not remove entries from this - Dashboard's Layout Manager's will pass this data to your component */
|
|
24
|
+
id: { type: String, required: true },
|
|
25
|
+
props: { type: Object, default: () => ({}) },
|
|
26
|
+
/* state: { type: Object, default: () => ({ enabled: false, visible: false }) } // DEFAULT */
|
|
27
|
+
state: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: () => ({ enabled: true, visible: true }),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
created() {
|
|
33
|
+
this.steps = this.props.steps;
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
...mapState('data', ['messages']),
|
|
37
|
+
templateColumns () {
|
|
38
|
+
return { gridTemplateColumns: new Array(this.steps.length).fill("min-content").join(" auto ")};
|
|
39
|
+
},
|
|
40
|
+
stepFlowNodeIds () {
|
|
41
|
+
return this.steps.map(step => step.flowNodeId);
|
|
42
|
+
},
|
|
43
|
+
activeStep () {
|
|
44
|
+
return this.messages[this.id]?.processProgressBar?.activeStep;
|
|
45
|
+
},
|
|
46
|
+
finishedSteps () {
|
|
47
|
+
return this.messages[this.id]?.processProgressBar?.finishedSteps ?? [];
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
steps: [],
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
mounted() {
|
|
56
|
+
this.$socket.on('widget-load:' + this.id, (msg) => {
|
|
57
|
+
this.steps = this.props.steps;
|
|
58
|
+
this.$store.commit('data/bind', {
|
|
59
|
+
widgetId: this.id,
|
|
60
|
+
msg,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
this.$socket.on('msg-input:' + this.id, (msg) => {
|
|
64
|
+
this.messages[this.id] = msg;
|
|
65
|
+
|
|
66
|
+
this.$store.commit('data/bind', {
|
|
67
|
+
widgetId: this.id,
|
|
68
|
+
msg,
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
this.$socket.emit('widget-load', this.id);
|
|
72
|
+
},
|
|
73
|
+
unmounted() {
|
|
74
|
+
this.$socket?.off('widget-load' + this.id);
|
|
75
|
+
this.$socket?.off('msg-input:' + this.id);
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<style scoped>
|
|
83
|
+
/* CSS is auto scoped, but using named classes is still recommended */
|
|
84
|
+
@import '../stylesheets/ui-process-progress-bar.css'
|
|
85
|
+
</style>
|
package/ui/index.js
ADDED
package/ui/main.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used only for development (via `npm run dev`).
|
|
3
|
+
*
|
|
4
|
+
* This file is useful for testing your component in isolation from Node-RED.
|
|
5
|
+
*/
|
|
6
|
+
import { createApp } from "vue";
|
|
7
|
+
|
|
8
|
+
import UIProcessProgressBar from "./components/UIProcessProgressBar.vue";
|
|
9
|
+
|
|
10
|
+
createApp(UIProcessProgressBar).mount("#app");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.progressBarWrapper {
|
|
2
|
+
display: grid;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
padding: 40px;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
border: 2px solid #F6F5FA;
|
|
8
|
+
background: #FFF;
|
|
9
|
+
margin-left: 92px;
|
|
10
|
+
margin-right: 92px;
|
|
11
|
+
margin-bottom: 32px;
|
|
12
|
+
}
|
|
13
|
+
.progressBarWrapper .progressBarStep {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 8px;
|
|
17
|
+
padding: 16px;
|
|
18
|
+
}
|
|
19
|
+
.progressBarWrapper .currentStep {
|
|
20
|
+
border-radius: 15px;
|
|
21
|
+
border: 4px solid #8899C9;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.progressBarWrapper .finishedStep {
|
|
25
|
+
border-radius: 15px;
|
|
26
|
+
background: #8899C9;
|
|
27
|
+
color: #FFF;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.progressBarWrapper hr {
|
|
31
|
+
border-radius: 2px;
|
|
32
|
+
border: none;
|
|
33
|
+
height: 4px;
|
|
34
|
+
background: #4A4759;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.progressBarWrapper .coloredConnection {
|
|
38
|
+
background: #8899C9;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.progressBarWrapper span {
|
|
42
|
+
font-size: 21px;
|
|
43
|
+
font-style: normal;
|
|
44
|
+
font-weight: 400;
|
|
45
|
+
line-height: normal;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|