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

Story/vspc 208 #341

Open
wants to merge 123 commits into
base: develop
Choose a base branch
from
Open

Story/vspc 208 #341

wants to merge 123 commits into from

Conversation

pooja-thalur
Copy link
Member

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]).

  • I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
  • I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
  • I do not have any sysout statements in my code or commented out code that isn’t needed anymore
  • I am not reformatting any files in the wrong format or without cause.
  • I am not changing file encoding or line endings to something else than UTF-8, LF
  • My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
  • I have added Javadoc/documentation where appropriate
  • I have added test cases where appropriate
  • I have explained any part of my code/implementation decisions that is not be self-explanatory

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 ...

bnayak4 added 30 commits June 9, 2022 16:22
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/";
Copy link
Member

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.

@jdamerow
Copy link
Member

Make it so, Jenkins.

@jdamerow
Copy link
Member

There are test failures.

@jdamerow jdamerow closed this Jun 26, 2024
@pooja-thalur pooja-thalur reopened this Jun 28, 2024
}

/**
* Method to store an image in the file location
Copy link
Member

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?


exhibition.setCustomMessage(customMessage);
}

exhibition = (Exhibition) exhibitManager.storeExhibition(exhibition);
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member

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?

Copy link
Member

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,
Copy link
Member

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");
Copy link
Member

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);
}
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

@jdamerow jdamerow closed this Jul 3, 2024
@pooja-thalur pooja-thalur reopened this Jul 10, 2024
@Controller
public class DefaultLinkImageController {

private static final Map<String, BiConsumer<Exhibition, IVSImage>> imageSetterMap = new HashMap<>();
Copy link
Member

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;
Copy link
Member

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

@jdamerow jdamerow closed this Jul 10, 2024
@pooja-thalur pooja-thalur reopened this Sep 6, 2024
# Conflicts:
#	vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.html

exhibition.setCustomMessage(customMessage);
}

exhibition = (Exhibition) exhibitManager.storeExhibition(exhibition);
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent this line correctly

@jdamerow jdamerow closed this Jan 6, 2025
@pooja-thalur pooja-thalur reopened this Jan 31, 2025
if (exhibitID == null || exhibitID.isEmpty()) {
exhibition = (Exhibition) exhibitFactory.createExhibition();
} else {
exhibition = (Exhibition) exhibitManager.getExhibitionById(exhibitID);
exhibition = (Exhibition) exhibitionManager.getExhibitionById(exhibitID);
Copy link
Member

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) {
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be cast

@jdamerow jdamerow closed this Feb 7, 2025
@pooja-thalur pooja-thalur reopened this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants