Skip to content

Commit

Permalink
feat: aligned to ps changes and fixed image urls (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter authored Apr 18, 2024
1 parent 8aa1535 commit 4219b77
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 24 deletions.
34 changes: 17 additions & 17 deletions docs/modules/onecx-shell-bff/pages/onecx-shell-bff-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,44 +47,44 @@ h| Version
| tkit-quarkus-log-cdi
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-cdi.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.22.0
| tkit-quarkus-log-rs
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-rs.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.22.0
| tkit-quarkus-log-json
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-json.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.22.0
| tkit-quarkus-rest
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.22.0
| tkit-quarkus-rest-context
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest-context.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.22.0
| tkit-quarkus-jpa
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-jpa.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.22.0
| tkit-quarkus-security
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-security.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.21.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.21.0
| https://github.com/1000kit/tkit-quarkus/blob/2.22.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.22.0
| quarkus-hibernate-validator
Expand All @@ -95,8 +95,8 @@ h| Version
| onecx-permissions
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-permissions.html[Link]
| https://github.com/onecx/onecx-quarkus/blob/0.16.0/docs/modules/onecx-quarkus/pages/includes/onecx-permissions.adoc[Link]
| 0.16.0
| https://github.com/onecx/onecx-quarkus/blob/0.17.0/docs/modules/onecx-quarkus/pages/includes/onecx-permissions.adoc[Link]
| 0.17.0
| quarkus-oidc
Expand All @@ -114,7 +114,7 @@ h| Version
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
| 0.16.0
| 0.17.0
| quarkus-arc
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.tkit.onecx</groupId>
<artifactId>onecx-quarkus3-parent</artifactId>
<version>0.46.0</version>
<version>0.47.0</version>
</parent>

<artifactId>onecx-shell-bff</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.tkit.quarkus.log.cdi.LogService;

import gen.org.tkit.onecx.product.store.client.api.ProductsApi;
import gen.org.tkit.onecx.product.store.client.model.MicrofrontendTypePSV1;
import gen.org.tkit.onecx.product.store.client.model.ProductPSV1;
import gen.org.tkit.onecx.shell.bff.rs.internal.WorkspaceConfigApiService;
import gen.org.tkit.onecx.shell.bff.rs.internal.model.*;
Expand Down Expand Up @@ -77,31 +78,41 @@ public Response getWorkspaceConfig(GetWorkspaceConfigRequestDTO getWorkspaceConf

//get productStore information for each Product
List<RouteDTO> routes = new ArrayList<>();
List<RemoteComponentDTO> components = new ArrayList<>();
List<RemoteComponentMappingDTO> shellComponents = new ArrayList<>();
detailedWorkspaceInfo.getProducts().forEach(p -> {
try (Response psResponse = productStoreClient.getProductByName(p.getProductName())) {
var product = psResponse.readEntity(ProductPSV1.class);
product.getMicrofrontends()
.forEach(mfe -> routes.add(mapper.mapRoute(mfe, product, p.getMicrofrontends(),
workspaceResponse.getBaseUrl())));
.forEach(mfe -> {
if (mfe.getType() == MicrofrontendTypePSV1.MODULE) {
routes.add(mapper.mapRoute(mfe, product, p.getMicrofrontends(),
workspaceResponse.getBaseUrl()));
}
});
} catch (WebApplicationException ex) {
//skip
}
});
responseDTO.setRoutes(routes);
responseDTO.setRemoteComponents(components);
responseDTO.setShellRemoteComponents(shellComponents);

}
//get theme info
try (Response themeResponse = themeClient.getThemeByName(workspaceResponse.getTheme())) {
var themeInfo = themeResponse.readEntity(Theme.class);
if (themeInfo.getFaviconUrl() == null) {
themeInfo.setFaviconUrl(uriInfo.getPath() + "/themes/" + themeInfo.getName() + "/favicon");
themeInfo.setFaviconUrl(uriInfo.getAbsolutePath() + "/themes/" + themeInfo.getName() + "/favicon");
}
if (themeInfo.getLogoUrl() == null) {
themeInfo.setLogoUrl(uriInfo.getPath() + "/themes/" + themeInfo.getName() + "/logo");
themeInfo.setLogoUrl(uriInfo.getAbsolutePath() + "/themes/" + themeInfo.getName() + "/logo");
}
responseDTO.setTheme(mapper.mapTheme(themeInfo));
}
//call remoteComponent Mocks => should be removed after implementation
responseDTO = mockRemoteComponents(responseDTO);

responseBuilder = Response.status(Response.Status.OK).entity(responseDTO);
} else {
responseBuilder = Response.status(Response.Status.NOT_FOUND.getStatusCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.tkit.onecx.shell.bff.rs.controllers.WorkspaceConfigRestController;

import gen.org.tkit.onecx.product.store.client.model.MicrofrontendPSV1;
import gen.org.tkit.onecx.product.store.client.model.MicrofrontendTypePSV1;
import gen.org.tkit.onecx.product.store.client.model.ProductPSV1;
import gen.org.tkit.onecx.shell.bff.rs.internal.model.GetWorkspaceConfigRequestDTO;
import gen.org.tkit.onecx.shell.bff.rs.internal.model.GetWorkspaceConfigResponseDTO;
Expand Down Expand Up @@ -74,7 +75,8 @@ void getWorkspaceConfigByBaseUrlTest() {
.appName("app1")
.remoteBaseUrl("/remoteBaseUrl")
.remoteEntry("/remoteEntry.js")
.technology("ANGULAR")));
.technology("ANGULAR")
.type(MicrofrontendTypePSV1.MODULE)));
// create mock rest endpoint for get product by name from product-store
mockServerClient.when(request().withPath("/v1/products/product1").withMethod(HttpMethod.GET))
.withId("mockPS")
Expand Down Expand Up @@ -160,7 +162,8 @@ void getWorkspaceConfigByBaseUrlTest_emptyImageUrl_should_create_urls_test() {
.appName("app1")
.remoteBaseUrl("/remoteBaseUrl")
.remoteEntry("/remoteEntry.js")
.technology("ANGULAR")));
.technology("ANGULAR")
.type(MicrofrontendTypePSV1.MODULE)));
// create mock rest endpoint for get product by name from product-store
mockServerClient.when(request().withPath("/v1/products/product1").withMethod(HttpMethod.GET))
.withId("mockPS")
Expand Down

0 comments on commit 4219b77

Please sign in to comment.