diff --git a/src/forms/form-fields/image-select.js b/src/forms/form-fields/image-select.js index 41eaae9d8..c075e7677 100644 --- a/src/forms/form-fields/image-select.js +++ b/src/forms/form-fields/image-select.js @@ -98,7 +98,7 @@ export class ImageSelect extends Component { checkStorageStatus(id) { return this.api - .get(`${this.api.baseUrl}/fileResources/${id}`) + .get(`fileResources/${id}`) .then(({ storageStatus }) => { if (storageStatus === 'PENDING') { this.setState({ pending: true }); @@ -185,13 +185,13 @@ export class ImageSelect extends Component { render() { const { value: fileReference } = this.props; const { id: fileResourceId } = fileReference || {} - const { initialized, initialValue, loading, error, pending } = this.state; + const { removed, initialized, initialValue, loading, error, pending } = this.state; const fileResourceReady = initialized && !loading && !error && fileResourceId; const isPending = fileResourceReady && pending; const displayImage = fileResourceReady && !isPending; - const wasRemoved = !fileResourceId && this.state.removed - const hasNoImage = !fileResourceId && !this.state.removed + const wasRemoved = !fileResourceId && removed + const hasNoImage = !fileResourceId && !loading const hasInitialValue = initialValue && initialValue.id const dirty = ( (fileResourceId && !hasInitialValue) || @@ -209,7 +209,7 @@ export class ImageSelect extends Component { style={{ display: 'block', marginBottom: 6, - fontSize: 14, + fontSize: 12, lineHeight: '22px', pointerEvents: 'none', userSelect: 'none', @@ -226,36 +226,33 @@ export class ImageSelect extends Component { marginRight: 4, cursor: 'pointer', }}> -
- {(loading || (!displayImage && isPending)) && ( - ... - )} - - {!loading && displayImage && ( - {this.getTranslation('org_unit_image_alt_text')} - )} - - {!displayImage && !loading && !isPending && ( - тип - )} -
+ {!hasNoImage && !error && ( +
+ {!displayImage && (isPending || loading) && ( + ... + )} + + {!loading && displayImage && ( + {this.getTranslation('org_unit_image_alt_text')} + )} +
+ )}