-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error handling to download interface
- Loading branch information
1 parent
9cd08ac
commit 28f7e93
Showing
13 changed files
with
173 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,6 +338,16 @@ | |
} | ||
] | ||
|
||
DOWNLOAD_ERRORS = { | ||
'bbox': ['Please enter a valid bounding box.'], | ||
'point': ['Please enter a valid point.'], | ||
'country': ['Please select a country.'], | ||
'mask': ['Please select a valid NetCDF file.'], | ||
'shape': ['Please select a valid Shapefile or GeoJSON file.'], | ||
'var': ['Please enter a valid name for a variable.'], | ||
'layer': ['Please enter a layer.'] | ||
} | ||
|
||
RESTRICTED_MESSAGES = {} | ||
RESTRICTED_DEFAULT_MESSAGE = 'Please contact <a href="mailto:[email protected]">[email protected]</a>' \ | ||
' if you need access to the dataset.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
isimip_data/download/assets/js/components/form/widgets/Errors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { useState } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { isEmpty } from 'lodash' | ||
|
||
const Errors = ({ errors }) => { | ||
if (isEmpty(errors)) { | ||
return null | ||
} else { | ||
return ( | ||
<ul className="text-danger list-unstyled mb-2"> | ||
{ | ||
errors.map((error, errorIndex) => <li>{error}</li>) | ||
} | ||
</ul> | ||
) | ||
} | ||
} | ||
|
||
Errors.propTypes = { | ||
errors: PropTypes.array | ||
} | ||
|
||
export default Errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.