Skip to content

Commit

Permalink
fix: minor fixes for linting and style
Browse files Browse the repository at this point in the history
Signed-off-by: svrnm <neumanns@cisco.com>
  • Loading branch information
svrnm committed Nov 17, 2022
1 parent 10a3ac2 commit b16f3ed
Showing 1 changed file with 2 additions and 53 deletions.
55 changes: 2 additions & 53 deletions src/components/shared/ConfigurationUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,6 @@ import {
TextField
} from '@mui/material'

class Prompt extends React.Component {
static propTypes = {
placeholder: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired
}

constructor(props) {
super(props)

this.state = {
value: ''
}

this.onChange = (e) => this._onChange(e)
}

componentDidUpdate(prevProps, prevState) {
if (prevState.value !== this.state.value) {
this.props.onChange(this.state.value)
}
}

_onChange(e) {
const value = e.target.value

this.setState({ value })
}

render() {
return (
<React.Fragment>
<label>
In which folder do you want to upload these configurations? Leave empty to put them on the
top level.
</label>
<input
className="text-input"
type="text"
placeholder={this.props.placeholder}
value={this.state.value}
onChange={this.onChange}
/>
</React.Fragment>
)
}
}

class ConfigurationUpload extends React.Component {
static propTypes = {
id: PropTypes.string.isRequired,
Expand Down Expand Up @@ -108,7 +61,7 @@ class ConfigurationUpload extends React.Component {
for (let i = 0; i < files.length; i++) {
const file = files.item(i)

this.setState({ file: file })
this.setState({ file })

const extension = file.name.split('.').pop()
if (extension === 'mnky' || extension === 'ini' || extension === 'json') {
Expand All @@ -123,10 +76,6 @@ class ConfigurationUpload extends React.Component {
}
reader.readAsText(file)
} else if (extension === 'zip') {
let folderName = ''
const promptChange = (value) => {
folderName = value
}
this.setState({ open: true })
} else {
window.alert(
Expand Down Expand Up @@ -189,7 +138,7 @@ class ConfigurationUpload extends React.Component {
<input multiple id={this.props.id} type="file" />
</form>

<Button href={'#configuration/upload'} onClick={(event) => this.showUploadDialog(event)}>
<Button style={{ textTransform: 'none', fontSize: '12px', lineHeight: '14px' }} href={'#configuration/upload'} onClick={(event) => this.showUploadDialog(event)}>
Upload
</Button>

Expand Down

0 comments on commit b16f3ed

Please sign in to comment.