-
Notifications
You must be signed in to change notification settings - Fork 3
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
Story/vspc 208 #341
base: develop
Are you sure you want to change the base?
Story/vspc 208 #341
Conversation
…ternal link image
# Conflicts: # vspace/src/main/java/edu/asu/diging/vspace/core/services/IImageService.java
*@param image - The image data as a byte array | ||
*@param filename - The name of the file to be stored | ||
*@return {@link IVSImage} instance | ||
*@throws FileStorageException If there is an error storing the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that true? where is it thrown?
exhibition = (Exhibition) exhibitManager.storeExhibition(exhibition); | ||
attributes.addAllAttributes(addSuccessAttributes(exhibition)); | ||
|
||
return new RedirectView(request.getContextPath() + "/staff/exhibit/config"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be three different forms to submit the default images; each should call this function with a parameter defining which default image to set; and then map the parameter to a function that sets the default on the image at exhibition.
*/ | ||
@RequestMapping(value = "/staff/exhibit/config/link/defaultImage", method = RequestMethod.POST) | ||
public RedirectView createOrUpdateLinkImage(HttpServletRequest request, | ||
@RequestParam(required = false, name = "exhibitionParam") String exhibitID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be needed; right now, you can just get the start exhibition
public static final String API_DEFAULT_SPACE_IMAGE_PATH = "/api/image/default/link/space/"; | ||
public static final String API_DEFAULT_MODULE_IMAGE_PATH = "/api/image/default/link/module/"; | ||
public static final String API_DEFAULT_EXTERNAL_IMAGE_PATH = "/api/image/default/link/external/"; | ||
public static final String API_DEFAULT_SPACE_IMAGE_STATUS = "/api/exhibition/default/link/image/status/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API endpoints should be in the api package.
Make it so, Jenkins. |
There are test failures. |
} | ||
|
||
/** | ||
* Method to store an image in the file location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what file location? this is confusing. the method only gets an image and a filename, right? nothing about location?
relativePath = storage.storeFile(image, filename, storedImage.getId()); | ||
} catch (FileStorageException e) { | ||
logger.error(DEFAULT_IMAGE_EXCEPTION,e); | ||
returnValue.getErrorMsgs().add(DEFAULT_IMAGE_EXCEPTION + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this is the case and the image can't be stored, the vsimage object should not be stored either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in line 291 deleting the vsimage object if an exception occurs, as we are using its id to store the image
|
||
exhibition.setCustomMessage(customMessage); | ||
} | ||
|
||
exhibition = (Exhibition) exhibitManager.storeExhibition(exhibition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to be casted to Exhibition
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because exhibitManager.storeExhibition(exhibition) is returning IExhibition type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but why would it need to be Exhibition
here?
* @throws IOException if an input or output error occurs | ||
*/ | ||
@RequestMapping(value = "/staff/exhibit/config/link/defaultImage", method = RequestMethod.POST) | ||
public RedirectView createOrUpdateLinkImage(HttpServletRequest request, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be in its own controller
attributes.addAttribute("alertType", "danger"); | ||
attributes.addAttribute("showAlert", "true"); | ||
attributes.addAttribute("message", "Couldn't save the default image"); | ||
return new RedirectView(request.getContextPath() + "/staff/exhibit/config"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context path should not be needed here. if the method returns String
, you can just return redirect:/path...
.
else if(linkType.equals("external")) { | ||
IVSImage externalLinkDefaultImage = imageService.storeImage(image.getBytes(), image.getOriginalFilename()); | ||
exhibition.setExternalLinkDefaultImage(externalLinkDefaultImage); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pretty ugly and would get worse if we add more link types. as said before, there should be a map that maps "space", "module",... to IExhibition::setSpace...
and then there is no if/else needed here, just getting the right method from the map and apply it.
} | ||
|
||
@Test | ||
public void test_storeDefaultImage_Error() throws FileStorageException, IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
relativePath = storage.storeFile(image, filename, storedImage.getId()); | ||
} catch (FileStorageException e) { | ||
logger.error(DEFAULT_IMAGE_EXCEPTION,e); | ||
returnValue.getErrorMsgs().add(DEFAULT_IMAGE_EXCEPTION + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
@Controller | ||
public class DefaultLinkImageController { | ||
|
||
private static final Map<String, BiConsumer<Exhibition, IVSImage>> imageSetterMap = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be static
IExhibitionManager exhibitManager; | ||
|
||
@Autowired | ||
IImageService imageService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those need to be private
# Conflicts: # vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.html
Guidelines for Pull Requests
If you haven't yet read our code review guidelines, please do so, You can find them here.
Please confirm the following by adding an x for each item (turn
[ ]
into[x]
).Please provide a brief description of your ticket
(you can copy the ticket if it hasn't changed)
https://diging.atlassian.net/browse/VSPC-208
...Put description here...
On the exhibition configuration page where you can set the exhibition title, etc. There should be three additional settings: scene link icon, module link icon, and external link icon. For each setting the user should be able to upload an image to be used as the default image for all links of that type.
This ticket requires changes on the staff side (to configure the link images) and the public side (use the default image if configured) for "arrow" type links.
Anything else the reviewer needs to know?
... describe here ...