Show image name and path in image name modal

Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-05-27 17:45:44 +02:00
parent 4752fa6dd2
commit aee3a0a281

View File

@ -439,9 +439,8 @@ export class SourceSelector extends React.Component<
const hasImage = selectionState.hasImage();
const imageBasename = hasImage
? path.basename(selectionState.getImagePath())
: '';
const imagePath = selectionState.getImagePath();
const imageBasename = hasImage ? path.basename(imagePath) : '';
const imageName = selectionState.getImageName();
const imageSize = selectionState.getImageSize();
@ -466,7 +465,7 @@ export class SourceSelector extends React.Component<
<StepNameButton
plain
onClick={this.showSelectedImageDetails}
tooltip={imageBasename}
tooltip={imageName || imageBasename}
>
{middleEllipsis(imageName || imageBasename, 20)}
</StepNameButton>
@ -533,21 +532,28 @@ export class SourceSelector extends React.Component<
{showImageDetails && (
<Modal
title="Image File Name"
title="Image"
done={() => {
this.setState({ showImageDetails: false });
}}
>
{selectionState.getImagePath()}
<Txt.p>
<Txt.span bold>Name: </Txt.span>
<Txt.span>{imageName || imageBasename}</Txt.span>
</Txt.p>
<Txt.p>
<Txt.span bold>Path: </Txt.span>
<Txt.span>{imagePath}</Txt.span>
</Txt.p>
</Modal>
)}
{showURLSelector && (
<URLSelector
done={async (imagePath: string) => {
done={async (imageURL: string) => {
// Avoid analytics and selection state changes
// if no file was resolved from the dialog.
if (!imagePath) {
if (!imageURL) {
analytics.logEvent('URL selector closed');
this.setState({
showURLSelector: false,
@ -556,7 +562,7 @@ export class SourceSelector extends React.Component<
}
await this.selectImageByPath({
imagePath,
imagePath: imageURL,
SourceType: sourceDestination.Http,
});
this.setState({