Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit c8f9351

Browse files
committed
fix(plugins/plugin-iter8): remove use of patternfly's Touchspin
Fixes #6875
1 parent 8b8c2c1 commit c8f9351

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

plugins/plugin-iter8/src/modes/decisionForm.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IBM Corporation
2+
* Copyright 2020-21 IBM Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import { eventChannelUnsafe } from '@kui-shell/core'
1919
// Component imports
2020
import { Alert, Button, Icons, Loading } from '@kui-shell/plugin-client-common'
2121
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'
2323
const Chart = React.lazy(() => import('react-apexcharts'))
2424
// Styling imports
2525
import '../../src/web/scss/static/decisionForm.scss'
@@ -509,16 +509,6 @@ export default class DecisionBase extends React.Component<{}, DecisionState> {
509509
this.handleReset()
510510
}
511511

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-
522512
// Handle sliders changing
523513
private handleTrafficChange = (value: number, version: string) => {
524514
let newSplit
@@ -704,15 +694,12 @@ export default class DecisionBase extends React.Component<{}, DecisionState> {
704694
const sliderId = `${idx}=${val.split}`
705695
return (
706696
<FormGroup key={idx} fieldId={`decisionForm-id-7-${idx}`} label={val.version}>
707-
<Touchspin
697+
<TextInput
708698
key={sliderId}
709699
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+
}
716703
/>
717704
</FormGroup>
718705
)

0 commit comments

Comments
 (0)