@@ -47,7 +47,6 @@ import {
4747 DetailsToolbarSeparator ,
4848} from '@stackstorm/module-panel' ;
4949import Time from '@stackstorm/module-time' ;
50- import validator from 'validator' ;
5150
5251
5352@connect ( ( state ) => {
@@ -195,20 +194,21 @@ export default class ActionsDetails extends React.Component {
195194 ;
196195 }
197196
198- minMax ( value ) {
199- if ( value < 0 || value > 2492000 ) {
200- return true
197+ minMax ( value ) {
198+ if ( value < 0 || value > 2492000 ) {
199+ return true ;
201200 }
201+ return false ;
202202 }
203203
204- isValidInt ( value ) {
205- for ( var n = 0 ; n < value . length ; n ++ ) {
206- var digit = ( value . charCodeAt ( n ) >= 48 && value . charCodeAt ( n ) <= 57 ) || value . charCodeAt ( n ) == 8 ;
207- if ( ! digit ) {
208- return true
209- }
210- }
211- return false
204+ isValidInt ( value ) {
205+ for ( let n = 0 ; n < value . length ; n += 1 ) {
206+ const digit = ( value . charCodeAt ( n ) >= 48 && value . charCodeAt ( n ) <= 57 ) || value . charCodeAt ( n ) === 45 || value . charCodeAt ( n ) = == 8 ;
207+ if ( ! digit ) {
208+ return true ;
209+ }
210+ }
211+ return false ;
212212 }
213213
214214 handleSection ( section ) {
@@ -270,13 +270,15 @@ export default class ActionsDetails extends React.Component {
270270 { section === 'general' ? (
271271 < DetailsBody >
272272 < DetailsToolbar key = "toolbar" >
273- < Button disabled = {
274- ( this . state . runValue && this . state . runValue . timeout && this . minMax ( this . state . runValue . timeout ) ) ||
275- ( this . state . runValue && this . state . runValue . limit && this . minMax ( this . state . runValue . limit ) ) ||
276- ( this . state . runValue && this . state . runValue . timeout && this . isValidInt ( this . state . runValue . timeout ) ) ||
277- ( this . state . runValue && this . state . runValue . limit && this . isValidInt ( this . state . runValue . limit ) )
278- }
279- value = "Run" data-test = "run_submit" onClick = { ( e ) => this . handleRun ( e , action . ref , this . state . runValue , this . state . runTrace || undefined ) } />
273+ < Button
274+ disabled = {
275+ ( this . state . runValue && this . state . runValue . timeout && this . minMax ( this . state . runValue . timeout ) ) ||
276+ ( this . state . runValue && this . state . runValue . limit && this . minMax ( this . state . runValue . limit ) ) ||
277+ ( this . state . runValue && this . state . runValue . timeout && this . isValidInt ( this . state . runValue . timeout ) ) ||
278+ ( this . state . runValue && this . state . runValue . limit && this . isValidInt ( this . state . runValue . limit ) )
279+ }
280+ value = "Run" data-test = "run_submit" onClick = { ( e ) => this . handleRun ( e , action . ref , this . state . runValue , this . state . runTrace || undefined ) }
281+ />
280282 < Button flat value = "Preview" onClick = { ( ) => this . handleToggleRunPreview ( ) } />
281283 < DetailsToolbarSeparator />
282284 { action . runner_type === 'mistral-v2' || action . runner_type === 'orquesta' ? (
0 commit comments