-
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
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?
vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java
Show resolved
Hide resolved
|
||
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?
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 still, why does exhibition need to be cast?
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 still
* @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
vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/ImageService.java
Show resolved
Hide resolved
@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
|
||
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.
this still
</head> | ||
|
||
<body> | ||
<div id="mainDivContent" layout:fragment="content"> | ||
<script th:inline="javascript"> | ||
//# sourceURL=click.js | ||
//# sourceURL=click.js |
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.
indent this line correctly
if (exhibitID == null || exhibitID.isEmpty()) { | ||
exhibition = (Exhibition) exhibitFactory.createExhibition(); | ||
} else { | ||
exhibition = (Exhibition) exhibitManager.getExhibitionById(exhibitID); | ||
exhibition = (Exhibition) exhibitionManager.getExhibitionById(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 does not need to be cast
@@ -140,7 +142,7 @@ public void updateExhibitionLanguages(Exhibition exhibition, List<String> codes, | |||
*/ | |||
private IExhibitionLanguage addExhibitionLanguage(Exhibition exhibition, Map languageMap) { |
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.
should get an IExhibition
@@ -121,13 +121,15 @@ public void updateExhibitionLanguages(Exhibition exhibition, List<String> codes, | |||
exhibitionLanguageConfig.getExhibitionLanguageList().stream() | |||
.filter(languageConfig -> codes.contains(languageConfig.get(ConfigConstants.CODE))) | |||
.forEach(languageMap -> { | |||
IExhibitionLanguage exhibitionLanguage = addExhibitionLanguage(exhibition , languageMap); | |||
IExhibitionLanguage exhibitionLanguage = addExhibitionLanguage((Exhibition) exhibition , languageMap); |
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.
should not be cast
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 ...