Skip to content

Commit

Permalink
fix: removed favicon and logo path generation (#72)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrej Petras <[email protected]>
  • Loading branch information
JordenReuter and andrejpetras authored Nov 21, 2024
1 parent 29568f5 commit 87e0351
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import jakarta.validation.ConstraintViolationException;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;

import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.jboss.resteasy.reactive.ClientWebApplicationException;
Expand Down Expand Up @@ -49,9 +47,6 @@ public class WorkspaceConfigRestController implements WorkspaceConfigApiService
@Inject
ExceptionMapper exceptionMapper;

@Context
UriInfo uriInfo;

@Override
public Response loadWorkspaceConfig(LoadWorkspaceConfigRequestDTO loadWorkspaceConfigRequestDTO) {

Expand Down Expand Up @@ -80,7 +75,7 @@ public Response loadWorkspaceConfig(LoadWorkspaceConfigRequestDTO loadWorkspaceC
//get theme info
try (Response themeResponse = themeClient.getThemeByName(wrapper.getTheme())) {
var theme = themeResponse.readEntity(Theme.class);
result.setTheme(mapper.createTheme(theme, uriInfo.getPath()));
result.setTheme(mapper.createTheme(theme));
}

return Response.ok(result).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,13 @@ default SlotDTO createSlot(WorkspaceWrapperSlot slot) {
}

@Mapping(target = "properties", ignore = true)
ThemeDTO createTheme(Theme themeInfo, String path);
ThemeDTO createTheme(Theme themeInfo);

@AfterMapping
default void createThemeAfter(@MappingTarget ThemeDTO target, Theme themeInfo, String path) {
default void createThemeAfter(@MappingTarget ThemeDTO target, Theme themeInfo) {
if (themeInfo != null) {
target.setProperties(String.valueOf(themeInfo.getProperties()));
}
if (target.getFaviconUrl() == null) {
target.setFaviconUrl(path + "/themes/" + target.getName() + "/favicon");
}
if (target.getLogoUrl() == null) {
target.setLogoUrl(path + "/themes/" + target.getName() + "/logo");
}
}

default LoadProductRequestPSV1 create(WorkspaceWrapper wrapper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ void loadWorkspaceConfigByBaseUrlTest() {
Assertions.assertEquals(productResponse.getProducts().get(0).getMicrofrontends().get(0).getEndpoints().size(),
output.getRoutes().get(0).getEndpoints().size());
Assertions.assertEquals("endpoint1", output.getRoutes().get(0).getEndpoints().get(0).getName());
Assertions.assertEquals("/workspaceConfig/themes/theme1/logo", output.getTheme().getLogoUrl());
Assertions.assertNull(output.getTheme().getLogoUrl());
Assertions.assertNotNull(output.getTheme().getFaviconUrl());
mockServerClient.clear("mockWS");
mockServerClient.clear("mockPS");
mockServerClient.clear("mockTheme");
Expand Down

0 comments on commit 87e0351

Please sign in to comment.