Fix bug where images can't be reselected

Signed-off-by: Lucian <lucian.buzzo@gmail.com>
This commit is contained in:
Lucian 2019-12-04 12:39:01 +00:00 committed by Lorenzo Alberto Maria Ambrosi
parent 996c2b55a4
commit b6fb44d6a5

View File

@ -118,6 +118,7 @@ class ImageSelector extends React.Component {
} }
reselectImage () { reselectImage () {
console.log('reselecting image')
analytics.logEvent('Reselect image', { analytics.logEvent('Reselect image', {
previousImage: selectionState.getImage(), previousImage: selectionState.getImage(),
applicationSessionUuid: store.getState().toJS().applicationSessionUuid, applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
@ -299,59 +300,59 @@ class ImageSelector extends React.Component {
return ( return (
<ThemedProvider> <ThemedProvider>
<Dropzone multiple={false} noClick onDrop={this.handleOnDrop}> <div className="box text-center relative">
{({ getRootProps, getInputProps }) => ( <Dropzone multiple={false} onDrop={this.handleOnDrop}>
<div className="box text-center relative" {...getRootProps()}> {({ getRootProps, getInputProps }) => (
<input {...getInputProps()} /> <div className="center-block" {...getRootProps()}>
<div className="center-block"> <input {...getInputProps()} />
<SVGIcon contents={selectionState.getImageLogo()} paths={[ '../../assets/image.svg' ]} /> <SVGIcon contents={selectionState.getImageLogo()} paths={[ '../../assets/image.svg' ]} />
</div> </div>
)}
</Dropzone>
<div className="space-vertical-large"> <div className="space-vertical-large">
{hasImage ? ( {hasImage ? (
<React.Fragment> <React.Fragment>
<StepNameButton <StepNameButton
plain plain
onClick={showSelectedImageDetails} onClick={showSelectedImageDetails}
tooltip={imageBasename} tooltip={imageBasename}
> >
{/* eslint-disable no-magic-numbers */} {/* eslint-disable no-magic-numbers */}
{ middleEllipsis(imageName || imageBasename, 20) } { middleEllipsis(imageName || imageBasename, 20) }
</StepNameButton> </StepNameButton>
{ !flashing && { !flashing &&
<ChangeButton <ChangeButton
plain plain
mb={14} mb={14}
onClick={this.reselectImage} onClick={this.reselectImage}
> >
Change Change
</ChangeButton> </ChangeButton>
} }
<DetailsText> <DetailsText>
{shared.bytesToClosestUnit(imageSize)} {shared.bytesToClosestUnit(imageSize)}
</DetailsText> </DetailsText>
</React.Fragment> </React.Fragment>
) : ( ) : (
<StepSelection> <StepSelection>
<StepButton <StepButton
onClick={this.openImageSelector} onClick={this.openImageSelector}
> >
Select image Select image
</StepButton> </StepButton>
<Footer> <Footer>
{ mainSupportedExtensions.join(', ') }, and{' '} { mainSupportedExtensions.join(', ') }, and{' '}
<Underline <Underline
tooltip={ extraSupportedExtensions.join(', ') } tooltip={ extraSupportedExtensions.join(', ') }
> >
many more many more
</Underline> </Underline>
</Footer> </Footer>
</StepSelection> </StepSelection>
)} )}
</div> </div>
</div> </div>
)}
</Dropzone>
{Boolean(this.state.warning) && ( {Boolean(this.state.warning) && (
<Modal <Modal