1
1
/*
2
- * Copyright 2020 IBM Corporation
2
+ * Copyright 2020-21 IBM Corporation
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import { eventChannelUnsafe } from '@kui-shell/core'
19
19
// Component imports
20
20
import { Alert , Button , Icons , Loading } from '@kui-shell/plugin-client-common'
21
21
import { Caption , TableComposable , Thead , Tbody , Th , Tr , Td } from '@patternfly/react-table'
22
- import { Form , FormGroup , FormSelect , FormSelectOption , Touchspin } from '@patternfly/react-core'
22
+ import { Form , FormGroup , FormSelect , FormSelectOption , TextInput } from '@patternfly/react-core'
23
23
const Chart = React . lazy ( ( ) => import ( 'react-apexcharts' ) )
24
24
// Styling imports
25
25
import '../../src/web/scss/static/decisionForm.scss'
@@ -509,16 +509,6 @@ export default class DecisionBase extends React.Component<{}, DecisionState> {
509
509
this . handleReset ( )
510
510
}
511
511
512
- /** Handle sliders changing from the text input element */
513
- private handleTrafficChangeFromInputElement ( evt : React . FormEvent < HTMLInputElement > , version : string ) {
514
- const valString = ( event . target as HTMLInputElement ) . value
515
- try {
516
- this . handleTrafficChange ( parseInt ( valString , 10 ) , version )
517
- } catch ( err ) {
518
- console . error ( 'User entered invalid value' )
519
- }
520
- }
521
-
522
512
// Handle sliders changing
523
513
private handleTrafficChange = ( value : number , version : string ) => {
524
514
let newSplit
@@ -704,15 +694,12 @@ export default class DecisionBase extends React.Component<{}, DecisionState> {
704
694
const sliderId = `${ idx } =${ val . split } `
705
695
return (
706
696
< FormGroup key = { idx } fieldId = { `decisionForm-id-7-${ idx } ` } label = { val . version } >
707
- < Touchspin
697
+ < TextInput
708
698
key = { sliderId }
709
699
value = { val . split }
710
- min = { 0 }
711
- max = { 100 }
712
- unit = "%"
713
- onPlus = { ( ) => this . handleTrafficChange ( val . split + 1 , val . version ) }
714
- onMinus = { ( ) => this . handleTrafficChange ( val . split - 1 , val . version ) }
715
- onChange = { evt => this . handleTrafficChangeFromInputElement ( evt , val . version ) }
700
+ onChange = {
701
+ value => this . handleTrafficChange ( parseInt ( value , 10 ) , val . version ) /* FIXME validate!! */
702
+ }
716
703
/>
717
704
</ FormGroup >
718
705
)
0 commit comments