Skip to content
Open
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
15 changes: 13 additions & 2 deletions eda-frontend/src/components/SchematicEditor/ToolbarExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ export function SelectLibrariesModal ({ open, close }) {
const allLibraries = useSelector(state => state.schematicEditorReducer.allLibraries)
const libraries = useSelector(state => state.schematicEditorReducer.libraries)
const uploadSuccess = useSelector(state => state.schematicEditorReducer.uploadSuccess)
const uploadError = useSelector(state => state.schematicEditorReducer.uploadError)
const auth = useSelector(state => state.authReducer)
const dispatch = useDispatch()
const classes = useStyles()
Expand All @@ -1061,11 +1062,21 @@ export function SelectLibrariesModal ({ open, close }) {
dispatch(fetchAllLibraries())
}
if (uploadSuccess === false) {
setMessage('An Error Occured')
if (uploadError === 400) {
setMessage('Upload Failed: Invalid file format. Please upload valid .lib and .dcm files.')
} else if (uploadError === 401 || uploadError === 403) {
setMessage('Upload Failed: You are not authorized to upload libraries.')
} else if (uploadError === 413) {
setMessage('Upload Failed: File size too large.')
} else if (uploadError === 500) {
setMessage('Upload Failed: Server error. Please try again.')
} else {
setMessage('Upload Failed: An unexpected error occurred.')
}
setsnacOpen(true)
dispatch(resetUploadSuccess())
}
}, [dispatch, uploadSuccess])
}, [dispatch, uploadSuccess, uploadError])

useEffect(() => {
const updateActive = () => {
Expand Down
4 changes: 2 additions & 2 deletions eda-frontend/src/redux/reducers/schematicEditorReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export default function (state = InitialState, action) {

case actions.UPLOAD_LIBRARIES: {
if (action.payload === 201) {
return { ...state, uploadSuccess: true }
} else { return { ...state, uploadSuccess: false } }
return { ...state, uploadSuccess: true, uploadError: null }
} else { return { ...state, uploadSuccess: false, uploadError: action.payload } }
}

case actions.RESET_UPLOAD_SUCCESS: {
Expand Down
4 changes: 2 additions & 2 deletions esim-cloud-backend/libAPI/lib_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def save_libs(files, path, out_path, library_set):
# Get Component name
component_svg = os.path.split(component_svg)[-1]

# Get Corresponding Details
if component_svg[:-4] not in component_details:
continue
svg_desc = component_details[component_svg[:-4]]

# Seed DB
component = LibraryComponent.objects.filter(
name=svg_desc['name'],
Expand Down