Skip to content

Commit

Permalink
Remove the thumbnail input field from the Save As plugin (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
luorlandini authored Nov 23, 2021
1 parent 4fbe941 commit 807d882
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
1 change: 0 additions & 1 deletion geonode_mapstore_client/client/js/plugins/SaveAs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ function SaveAs({
return (
<SaveModal
{...props}
hideThumbnail={!isNew}
hideDescription={!isNew}
// add key to reset the component when a new resource is returned
key={props?.resource?.pk || 'new'}
Expand Down
31 changes: 1 addition & 30 deletions geonode_mapstore_client/client/js/plugins/save/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import React, { useState, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import ResizableModal from '@mapstore/framework/components/misc/ResizableModal';
import Thumbnail from '@mapstore/framework/components/misc/Thumbnail';
import Message from '@mapstore/framework/components/I18N/Message';
import { Form, FormGroup, ControlLabel, FormControl as FormControlRB, Alert } from 'react-bootstrap';
import localizedProps from '@mapstore/framework/components/misc/enhancers/localizedProps';
Expand All @@ -30,13 +29,10 @@ function SaveModal({
onClose,
onSave,
onClear,
hideThumbnail,
hideDescription,
thumbnailOptions
hideDescription
}) {

const [thumbnail, setThumbnail] = useState();
const [thumbnailError, setThumbnailError] = useState();
const [name, setName] = useState('');
const [description, setDescription] = useState('');
const [nameValidation, setNameValidation] = useState(false);
Expand All @@ -57,7 +53,6 @@ function SaveModal({
setThumbnail(res.thumbnail_url);
setName(res.title);
setDescription(res.abstract);
setThumbnailError(false);
setNameValidation(!res.title
? 'error'
: undefined);
Expand Down Expand Up @@ -103,30 +98,6 @@ function SaveModal({
<div><Message msgId="saveDialog.saveSuccessMessage" /></div>
</Alert>}
<Form>
{!hideThumbnail && <FormGroup
validationState={thumbnailError ? 'error' : undefined}
>
<ControlLabel>
<Message msgId="map.thumbnail"/>
</ControlLabel>
<Thumbnail
thumbnail={thumbnail}
thumbnailOptions={thumbnailOptions}
message={<Message msgId="map.message"/>}
onUpdate={(data) => {
setThumbnail(data);
setThumbnailError(false);
}}
onError={(newThumbnailError) => {
setThumbnailError(newThumbnailError);
}}
/>
{thumbnailError && <div>
<div><Message msgId="map.error"/></div>
<div>{thumbnailError.indexOf && thumbnailError.indexOf('FORMAT') !== -1 && <small><Message msgId="map.errorFormat" /></small>}</div>
<div>{thumbnailError.indexOf && thumbnailError.indexOf('SIZE') !== -1 && <small><Message msgId="map.errorSize" /></small>}</div>
</div>}
</FormGroup>}
<FormGroup
validationState={nameValidation}
>
Expand Down

0 comments on commit 807d882

Please sign in to comment.