Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add manage metadata option to dialogs ( MAPCO-5510 ) #525

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/discrete-layer/components/dialogs/file-picker.dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface FilePickerDialogProps {
onSetOpen: (open: boolean) => void;
onFilesSelection: (selected: Selection) => void;
selection: Selection;
fetchMetaData?: boolean;
}

const getSuffixFromFolderChain = (folderChain: FileData[]): string => {
Expand All @@ -58,6 +59,7 @@ export const FilePickerDialog: React.FC<FilePickerDialogProps> = observer(
onSetOpen,
onFilesSelection,
selection: currentSelection,
fetchMetaData=true,
}) => {
const filePickerRef = useRef<FilePickerComponentHandle>(null);
const [files, setFiles] = useState<FileData[]>([]);
Expand Down Expand Up @@ -118,7 +120,7 @@ export const FilePickerDialog: React.FC<FilePickerDialogProps> = observer(
const hasMetadata = dirContent.some(
(file) => file.name === 'metadata.json'
);
if (hasMetadata) {
if (hasMetadata && fetchMetaData) {
queryMetadata.setQuery(
store.queryGetFile({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface IngestionFieldsProps {
metadata: MetadataFile
) => void;
formik?: EntityFormikHandlers;
manageMetadata?: boolean;
}

const FileItem: React.FC<{ file: FileData }> = ({ file }) => {
Expand Down Expand Up @@ -171,6 +172,7 @@ export const IngestionFields: React.FC<PropsWithChildren<IngestionFieldsProps>>
reloadFormMetadata,
formik,
children,
manageMetadata=true,
}) => {
const intl = useIntl();
const store = useStore();
Expand Down Expand Up @@ -453,6 +455,8 @@ export const IngestionFields: React.FC<PropsWithChildren<IngestionFieldsProps>>
<FormattedMessage id="general.choose-btn.text" />
</Button>
</Box>
{
manageMetadata &&
<Box className="uploadMetadataButton">
<Button
outlined
Expand Down Expand Up @@ -489,6 +493,7 @@ export const IngestionFields: React.FC<PropsWithChildren<IngestionFieldsProps>>
)}
</Button>
</Box>
}
<Box>
{children}
</Box>
Expand All @@ -502,6 +507,7 @@ export const IngestionFields: React.FC<PropsWithChildren<IngestionFieldsProps>>
onSetOpen={setFilePickerDialogOpen}
onFilesSelection={onFilesSelection}
selection={selection}
fetchMetaData={manageMetadata}
/>
}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ export const InnerRasterForm = (
values={values}
isError={showCurtain}
onErrorCallback={setShowCurtain}
manageMetadata={false}
>
<Box className="uploadShapeButton">
<Button
Expand Down
Loading