8080 < label > < i class = "fa fa-tag" > </ i > Kill if running</ label >
8181 < input type = "checkbox" id = "node-input-killexisting" style = "width: auto;" >
8282 </ div >
83+ < div class = "form-row" >
84+ < label > < i class = "fa fa-tag" > </ i > Kill all running</ label >
85+ < input type = "checkbox" id = "node-input-killallexisting" style = "width: auto;" >
86+ </ div >
8387 < div class = "form-row" >
8488 < label > < i class = "fa fa-tag" > </ i > Name</ label >
8589 < input type = "text" id = "node-input-name" placeholder = "Node name" >
9296You can set the timeout using msg . expiration < br >
9397Expiration controls how long to wait for a robot to pickup the message , it does not effect how long the robot can run for . < br >
9498Kill if running / msg.killexisting will tell a robot to kill the workflow if it is allready running.< br >
99+ killallexisting / msg.killallexisting will tell a robot to kill all running workflows before running workflow.< br >
95100</ script >
96101< script type ="text/javascript ">
97102 RED . nodes . registerType ( 'rpa workflow' , {
104109 workflow : { value : "" } ,
105110 localqueue : { value : Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 ) } ,
106111 killexisting : { value : false } ,
112+ killallexisting : { value : false } ,
107113 name : { value : "" }
108114 } ,
109115 inputs : 1 ,
116122 return this . name ? "node_label_italic" : "" ;
117123 } ,
118124 oneditprepare : function ( ) {
119- $ . getJSON ( 'rpa_robots ' , function ( data ) {
125+ $ . getJSON ( 'rpa_robots_roles ' , function ( data ) {
120126 $ ( '#node-input-queue-select' ) . empty ( ) ;
121127 $ ( '#node-input-queue-select' ) . append ( $ ( '<option>' , {
122128 value : null ,
174180 }
175181
176182 } ) ;
183+ </ script >
184+
185+
186+ < script type ="text/x-red " data-template-name ="rpa killworkflows ">
187+ < div class = "form-row" >
188+ < label > < i class = "fa fa-tag" > </ i > Robot</ label >
189+ < select id = "node-input-queue-select" >
190+ < option > Loading...</ option >
191+ </ select >
192+ < input id = "node-input-queue" type = "hidden" >
193+ </ div >
194+ < div class = "form-row" >
195+ < label > < i class = "fa fa-tag" > </ i > Local queue name</ label >
196+ < input type = "text" id = "node-input-localqueue" placeholder = "Queue name" >
197+ </ div >
198+ < div class = "form-row" >
199+ < label > < i class = "fa fa-tag" > </ i > Name</ label >
200+ < input type = "text" id = "node-input-name" placeholder = "Node name" >
201+ </ div >
202+ </ script >
203+ < script type ="text/x-red " data-help-name ="rpa killworkflows ">
204+ Active everytime a trigger gets triggered on a robot .
205+ </ script >
206+ < script type ="text/javascript ">
207+ RED . nodes . registerType ( 'rpa killworkflows' , {
208+ category : 'rpa' ,
209+ color : "#E9967A" ,
210+ paletteLabel : 'killworkflows' ,
211+ icon : "font-awesome/fa-times-circle" ,
212+ defaults : {
213+ queue : { value : "" , required : true } ,
214+ localqueue : { value : Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 ) } ,
215+ name : { value : "" }
216+ } ,
217+ inputs : 1 ,
218+ outputs : 2 ,
219+ label : function ( ) {
220+ return this . name || "rpa killworkflows" ;
221+ } ,
222+ labelStyle : function ( ) {
223+ return this . name ? "node_label_italic" : "" ;
224+ } ,
225+ oneditprepare : function ( ) {
226+ $ . getJSON ( 'rpa_robots' , function ( data ) {
227+ $ ( '#node-input-queue-select' ) . empty ( ) ;
228+ $ ( '#node-input-queue-select' ) . append ( $ ( '<option>' , {
229+ value : null ,
230+ text : "none"
231+ } ) ) ;
232+ $ . each ( data , function ( i , ele ) {
233+ $ ( '#node-input-queue-select' ) . append ( $ ( '<option>' , {
234+ value : ele . _id ,
235+ text : ele . name
236+ } ) ) ;
237+ } ) ;
238+ $ ( '#node-input-queue-select' ) . val ( $ ( '#node-input-queue' ) . val ( ) ) ;
239+ reloadWorkflows ( true ) ;
240+ $ ( "#node-input-queue-select" ) . change ( function ( ) {
241+ reloadWorkflows ( false ) ;
242+ } )
243+ } ) . error ( function ( jqXHR , textStatus , errorThrown ) {
244+ console . error ( "error " + textStatus ) ;
245+ console . error ( "incoming Text " + jqXHR . responseText ) ;
246+ alert ( "error:" + jqXHR . responseText ) ;
247+ } ) ;
248+ } ,
249+ oneditsave : function ( ) {
250+ $ ( '#node-input-queue' ) . val ( $ ( '#node-input-queue-select' ) . val ( ) ) ;
251+ }
252+ } ) ;
177253</ script >
0 commit comments