From e18baac53aac1567baecbcd757a3401aec92e074 Mon Sep 17 00:00:00 2001 From: Mikael Grankvist Date: Tue, 14 May 2024 07:10:05 +0300 Subject: [PATCH] feat: use Flow menu item collection Unify the views.json to use the same names as createViewConfigJson generates. depends on vaadin/flow#19355 Part of #19321 --- ...RouteUnifyingIndexHtmlRequestListener.java | 138 +++++++++--------- .../route/records/AvailableViewInfo.java | 79 ---------- .../hilla/route/records/ClientViewConfig.java | 9 +- .../route/records/ClientViewMenuConfig.java | 12 -- .../hilla/route/records/RouteParamType.java | 29 ---- .../hilla/route/ClientRouteRegistryTest.java | 2 +- ...eUnifyingIndexHtmlRequestListenerTest.java | 6 +- .../VAADIN/available-views-admin.json | 97 ++++++------ .../VAADIN/available-views-anonymous.json | 62 ++++---- .../META-INF/VAADIN/available-views-user.json | 84 ++++++----- .../META-INF/VAADIN/only-client-views.json | 40 +++-- 11 files changed, 239 insertions(+), 319 deletions(-) delete mode 100644 packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/AvailableViewInfo.java delete mode 100644 packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewMenuConfig.java delete mode 100644 packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/RouteParamType.java diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListener.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListener.java index bb36ac2a8c..a98bac407a 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListener.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListener.java @@ -27,10 +27,12 @@ import com.vaadin.flow.function.DeploymentConfiguration; import com.vaadin.flow.router.BeforeEnterListener; -import com.vaadin.flow.server.VaadinRequest; +import com.vaadin.flow.router.RouteConfiguration; import com.vaadin.flow.server.auth.MenuAccessControl; import com.vaadin.flow.server.auth.NavigationAccessControl; import com.vaadin.flow.server.auth.ViewAccessChecker; +import com.vaadin.flow.server.menu.AvailableViewInfo; +import com.vaadin.flow.server.menu.MenuRegistry; import com.vaadin.hilla.route.records.ClientViewConfig; import org.jsoup.nodes.DataNode; @@ -40,16 +42,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.lang.Nullable; -import com.vaadin.flow.internal.AnnotationReader; -import com.vaadin.flow.router.PageTitle; -import com.vaadin.flow.router.RouteData; import com.vaadin.flow.server.RouteRegistry; import com.vaadin.flow.server.VaadinService; import com.vaadin.flow.server.communication.IndexHtmlRequestListener; import com.vaadin.flow.server.communication.IndexHtmlResponse; -import com.vaadin.hilla.route.records.AvailableViewInfo; -import com.vaadin.hilla.route.records.ClientViewMenuConfig; -import com.vaadin.hilla.route.records.RouteParamType; /** * Index HTML request listener for collecting the client side and the server @@ -110,8 +106,7 @@ public void modifyIndexHtmlResponse(IndexHtmlResponse response) { if (exposeServerRoutesToClient) { LOGGER.debug( "Exposing server-side views to the client based on user configuration"); - availableViews - .putAll(collectServerViews(response.getVaadinRequest())); + availableViews.putAll(collectServerViews()); } if (availableViews.isEmpty()) { @@ -153,14 +148,14 @@ protected Map collectClientViews( config.getTitle(), config.getRolesAllowed(), config.isLoginRequired(), config.getRoute(), config.isLazy(), config.isAutoRegistered(), - config.menu(), config.getRouteParameters()); + config.menu(), Collections.emptyList(), + config.getRouteParameters()); clientViews.put(route, availableViewInfo); }); return clientViews; } - protected Map collectServerViews( - VaadinRequest vaadinRequest) { + protected Map collectServerViews() { var serverViews = new HashMap(); final VaadinService vaadinService = VaadinService.getCurrent(); if (vaadinService == null) { @@ -175,68 +170,73 @@ protected Map collectServerViews( .of(accessControl, viewAccessChecker).filter(Objects::nonNull) .toList(); - List serverRoutes = Collections.emptyList(); + // List serverRoutes = Collections.emptyList(); if (vaadinService.getInstantiator().getMenuAccessControl() .getPopulateClientSideMenu() == MenuAccessControl.PopulateClientMenu.ALWAYS || clientRouteRegistry.hasMainLayout()) { - serverRoutes = serverRouteRegistry - .getRegisteredAccessibleMenuRoutes(vaadinRequest, - accessControls); + MenuRegistry.collectAndAddServerMenuItems( + RouteConfiguration.forRegistry(serverRouteRegistry), + accessControls, serverViews); + // serverRoutes = serverRouteRegistry + // .getRegisteredAccessibleMenuRoutes(vaadinRequest, + // accessControls); } - serverRoutes.forEach(serverView -> { - final Class viewClass = serverView - .getNavigationTarget(); - final String targetUrl = serverView.getTemplate(); - if (targetUrl != null) { - final String url = "/" + targetUrl; - - final String title; - PageTitle pageTitle = AnnotationReader - .getAnnotationFor(viewClass, PageTitle.class) - .orElse(null); - if (pageTitle != null) { - title = pageTitle.value(); - } else { - title = serverView.getNavigationTarget().getSimpleName(); - } - - final ClientViewMenuConfig menuConfig = Optional - .ofNullable(serverView.getMenuData()) - .map(menu -> new ClientViewMenuConfig( - (menu.getTitle() == null - || menu.getTitle().isBlank()) ? title - : menu.getTitle(), - menu.getOrder(), menu.getIcon(), - menu.isExclude())) - .orElse(null); - - final Map routeParameters = getRouteParameters( - serverView); - - final AvailableViewInfo availableViewInfo = new AvailableViewInfo( - title, null, false, url, false, false, menuConfig, - routeParameters); - serverViews.put(url, availableViewInfo); - } - }); + // serverRoutes.forEach(serverView -> { + // final Class viewClass + // = serverView + // .getNavigationTarget(); + // final String targetUrl = serverView.getTemplate(); + // if (targetUrl != null) { + // final String url = "/" + targetUrl; + // + // final String title; + // PageTitle pageTitle = AnnotationReader + // .getAnnotationFor(viewClass, PageTitle.class) + // .orElse(null); + // if (pageTitle != null) { + // title = pageTitle.value(); + // } else { + // title = serverView.getNavigationTarget().getSimpleName(); + // } + // + // final MenuData menuConfig = Optional + // .ofNullable(serverView.getMenuData()) + // .map(menu -> new MenuData( + // (menu.getTitle() == null + // || menu.getTitle().isBlank()) ? title + // : menu.getTitle(), + // menu.getOrder(), menu.getIcon(), + // menu.isExclude())) + // .orElse(null); + // + // final Map routeParameters = + // getRouteParameters( + // serverView); + // + // final AvailableViewInfo availableViewInfo = new AvailableViewInfo( + // title, null, false, url, false, false, menuConfig, + // routeParameters); + // serverViews.put(url, availableViewInfo); + // } + // }); return serverViews; } - private Map getRouteParameters( - RouteData serverView) { - final Map routeParameters = new HashMap<>(); - serverView.getRouteParameters().forEach((route, params) -> { - if (params.getTemplate().contains("*")) { - routeParameters.put(params.getTemplate(), - RouteParamType.WILDCARD); - } else if (params.getTemplate().contains("?")) { - routeParameters.put(params.getTemplate(), - RouteParamType.OPTIONAL); - } else { - routeParameters.put(params.getTemplate(), - RouteParamType.REQUIRED); - } - }); - return routeParameters; - } + // private Map getRouteParameters( + // RouteData serverView) { + // final Map routeParameters = new HashMap<>(); + // serverView.getRouteParameters().forEach((route, params) -> { + // if (params.getTemplate().contains("*")) { + // routeParameters.put(params.getTemplate(), + // RouteParamType.WILDCARD); + // } else if (params.getTemplate().contains("?")) { + // routeParameters.put(params.getTemplate(), + // RouteParamType.OPTIONAL); + // } else { + // routeParameters.put(params.getTemplate(), + // RouteParamType.REQUIRED); + // } + // }); + // return routeParameters; + // } } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/AvailableViewInfo.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/AvailableViewInfo.java deleted file mode 100644 index 3f713df98a..0000000000 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/AvailableViewInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2000-2024 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.hilla.route.records; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.Arrays; -import java.util.Map; -import java.util.Objects; - -/** - * Represents a server side view configuration for the client side. - * - * @param route - * @param title - * @param rolesAllowed - * @param requiresLogin - * @param lazy - * @param register - * @param menu - * @param routeParameters - */ -public record AvailableViewInfo(String title, String[] rolesAllowed, - Boolean requiresLogin, - String route, Boolean lazy, - Boolean register, - ClientViewMenuConfig menu, - @JsonProperty("params") Map routeParameters) { - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } else if (o == null || getClass() != o.getClass()) { - return false; - } - final AvailableViewInfo that = (AvailableViewInfo) o; - return Objects.equals(title, that.title) - && Arrays.equals(rolesAllowed, that.rolesAllowed) - && Objects.equals(requiresLogin, that.requiresLogin) - && Objects.equals(route, that.route) - && Objects.equals(lazy, that.lazy) - && Objects.equals(register, that.register) - && Objects.equals(menu, that.menu) - && Objects.equals(routeParameters, that.routeParameters); - } - - @Override - public int hashCode() { - int result = Objects.hash(title, route, lazy, register, menu, routeParameters); - result = 31 * result + Arrays.hashCode(rolesAllowed); - return result; - } - - @Override - public String toString() { - return "AvailableViewInfo{" + "title='" + title - + '\'' + ", rolesAllowed=" + Arrays.toString(rolesAllowed) - + ", requiresLogin=" + requiresLogin - + ", route='" + route + '\'' - + ", lazy=" + lazy - + ", register=" + register - + ", menu=" + menu - + ", routeParameters=" + routeParameters + '}'; - } -} diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewConfig.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewConfig.java index 8ebe674f19..220f513adb 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewConfig.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewConfig.java @@ -10,6 +10,9 @@ import java.util.Map; import java.util.Objects; +import com.vaadin.flow.router.MenuData; +import com.vaadin.flow.server.menu.RouteParamType; + /** * Implementation of TypeScript's Hilla ConfigView. Represents a view * configuration from Hilla file-system-routing module. @@ -21,7 +24,7 @@ public final class ClientViewConfig { private String route; private boolean lazy; private boolean autoRegistered; - private ClientViewMenuConfig menu; + private MenuData menu; private List children; @JsonProperty("params") private Map routeParameters; @@ -79,7 +82,7 @@ public boolean isAutoRegistered() { return autoRegistered; } - public ClientViewMenuConfig menu() { + public MenuData menu() { return menu; } @@ -124,7 +127,7 @@ public void setAutoRegistered(boolean autoRegistered) { this.autoRegistered = autoRegistered; } - public void setMenu(ClientViewMenuConfig menu) { + public void setMenu(MenuData menu) { this.menu = menu; } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewMenuConfig.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewMenuConfig.java deleted file mode 100644 index af1b23bce9..0000000000 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/ClientViewMenuConfig.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.vaadin.hilla.route.records; - - -/** - * Implementation of TypeScript's Hilla ConfigView.Menu. - * Represents a view's menu configuration - * from Hilla file-system-routing. - * Used for configuring MainLayout navigation items - * - */ -public record ClientViewMenuConfig(String title, Double order, String icon, Boolean exclude) { -} diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/RouteParamType.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/RouteParamType.java deleted file mode 100644 index e6830bdd6f..0000000000 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/route/records/RouteParamType.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2024 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.hilla.route.records; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Represents the type of route parameter for the client side or the server side - * views - */ -public enum RouteParamType { - @JsonProperty("req") - REQUIRED, @JsonProperty("opt") - OPTIONAL, @JsonProperty("*") - WILDCARD -} diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/ClientRouteRegistryTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/ClientRouteRegistryTest.java index a8532d2bd4..92764eea5b 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/ClientRouteRegistryTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/ClientRouteRegistryTest.java @@ -1,8 +1,8 @@ package com.vaadin.hilla.route; import com.vaadin.flow.function.DeploymentConfiguration; +import com.vaadin.flow.server.menu.RouteParamType; import com.vaadin.hilla.route.records.ClientViewConfig; -import com.vaadin.hilla.route.records.RouteParamType; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListenerTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListenerTest.java index db33675825..24e52c049a 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListenerTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/route/RouteUnifyingIndexHtmlRequestListenerTest.java @@ -35,9 +35,9 @@ import com.vaadin.flow.server.VaadinService; import com.vaadin.flow.server.auth.MenuAccessControl; import com.vaadin.flow.server.communication.IndexHtmlResponse; -import com.vaadin.hilla.route.records.AvailableViewInfo; +import com.vaadin.flow.server.menu.AvailableViewInfo; +import com.vaadin.flow.server.menu.RouteParamType; import com.vaadin.hilla.route.records.ClientViewConfig; -import com.vaadin.hilla.route.records.RouteParamType; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -337,7 +337,7 @@ public void should_collectServerViews() { .mockStatic(VaadinService.class)) { mocked.when(VaadinService::getCurrent).thenReturn(vaadinService); - views = requestListener.collectServerViews(vaadinRequest); + views = requestListener.collectServerViews(); } MatcherAssert.assertThat(views, Matchers.aMapWithSize(5)); MatcherAssert.assertThat(views.get("/bar").title(), diff --git a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-admin.json b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-admin.json index 27a6e9e451..4861c09ee6 100644 --- a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-admin.json +++ b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-admin.json @@ -1,90 +1,103 @@ { - "/home": { - "title": "Home", + "/foo": { + "params": {}, + "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, - "route": "/home", - "lazy": false, - "register": false, - "menu": null, - "params": {} - }, - "/profile": { - "title": "Profile", - "rolesAllowed": ["ROLE_USER", "ROLE_ADMIN"], - "requiresLogin": true, - "route": "/profile", + "loginRequired": false, + "route": "/foo", "lazy": false, "register": false, "menu": null, - "params": {} + "children": null }, "/user/:userId": { + "params": { + ":userId": "req" + }, "title": "User Profile", - "rolesAllowed": ["ROLE_ADMIN"], - "requiresLogin": true, + "rolesAllowed": [ + "ROLE_ADMIN" + ], + "loginRequired": true, "route": "/user/:userId", "lazy": false, "register": false, "menu": null, - "params": { - ":userId": "req" - } + "children": [] }, "/bar": { + "params": {}, "title": "Component", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/bar", "lazy": false, "register": false, "menu": null, - "params": {} + "children": null }, - "/foo": { - "title": "RouteTarget", + "/home": { + "params": {}, + "title": "Home", "rolesAllowed": null, - "requiresLogin": false, - "route": "/foo", + "loginRequired": false, + "route": "/home", "lazy": false, "register": false, "menu": null, - "params": {} + "children": [] }, "/wildcard/:___wildcard*": { + "params": { + ":___wildcard*": "*" + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/wildcard/:___wildcard*", "lazy": false, "register": false, "menu": null, - "params": { - ":___wildcard*": "*" - } + "children": null }, - "//:___userId/edit": { + "/comments/:___commentId?": { + "params": { + ":___commentId?": "opt" + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, - "route": "//:___userId/edit", + "loginRequired": false, + "route": "/comments/:___commentId?", + "lazy": false, + "register": false, + "menu": null, + "children": null + }, + "/profile": { + "params": {}, + "title": "Profile", + "rolesAllowed": [ + "ROLE_USER", + "ROLE_ADMIN" + ], + "loginRequired": true, + "route": "/profile", "lazy": false, "register": false, "menu": null, + "children": [] + }, + "//:___userId/edit": { "params": { ":___userId": "req" - } - }, - "/comments/:___commentId?": { + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, - "route": "/comments/:___commentId?", + "loginRequired": false, + "route": "//:___userId/edit", "lazy": false, "register": false, "menu": null, - "params": { - ":___commentId?": "opt" - } + "children": null } } diff --git a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-anonymous.json b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-anonymous.json index bbb369ba77..2a04fe5756 100644 --- a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-anonymous.json +++ b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-anonymous.json @@ -1,68 +1,74 @@ { "/home": { + "params": {}, "title": "Home", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/home", "lazy": false, "register": false, "menu": null, - "params": {} - }, - "/bar": { - "title": "Component", - "rolesAllowed": null, - "requiresLogin": false, - "route": "/bar", - "lazy": false, - "register": false, - "menu": null, - "params": {} + "children": [] }, "/foo": { + "params": {}, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/foo", "lazy": false, "register": false, "menu": null, - "params": {} + "children": null }, "/wildcard/:___wildcard*": { + "params": { + ":___wildcard*": "*" + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/wildcard/:___wildcard*", "lazy": false, "register": false, "menu": null, - "params": { - ":___wildcard*": "*" - } + "children": null }, - "//:___userId/edit": { - "title": "RouteTarget", + "/bar": { + "params": {}, + "title": "Component", "rolesAllowed": null, - "requiresLogin": false, - "route": "//:___userId/edit", + "loginRequired": false, + "route": "/bar", "lazy": false, "register": false, "menu": null, - "params": { - ":___userId": "req" - } + "children": null }, "/comments/:___commentId?": { + "params": { + ":___commentId?": "opt" + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/comments/:___commentId?", "lazy": false, "register": false, "menu": null, + "children": null + }, + "//:___userId/edit": { "params": { - ":___commentId?": "opt" - } + ":___userId": "req" + }, + "title": "RouteTarget", + "rolesAllowed": null, + "loginRequired": false, + "route": "//:___userId/edit", + "lazy": false, + "register": false, + "menu": null, + "children": null } } diff --git a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-user.json b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-user.json index f42289ec19..be68119c02 100644 --- a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-user.json +++ b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/available-views-user.json @@ -1,78 +1,88 @@ { - "/home": { - "title": "Home", + "/foo": { + "params": {}, + "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, - "route": "/home", - "lazy": false, - "register": false, - "menu": null, - "params": {} - }, - "/profile": { - "title": "Profile", - "rolesAllowed": ["ROLE_USER", "ROLE_ADMIN"], - "requiresLogin": true, - "route": "/profile", + "loginRequired": false, + "route": "/foo", "lazy": false, "register": false, "menu": null, - "params": {} + "children": null }, "/bar": { + "params": {}, "title": "Component", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/bar", "lazy": false, "register": false, "menu": null, - "params": {} + "children": null }, - "/foo": { - "title": "RouteTarget", + "/home": { + "params": {}, + "title": "Home", "rolesAllowed": null, - "requiresLogin": false, - "route": "/foo", + "loginRequired": false, + "route": "/home", "lazy": false, "register": false, "menu": null, - "params": {} + "children": [] }, "/wildcard/:___wildcard*": { + "params": { + ":___wildcard*": "*" + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/wildcard/:___wildcard*", "lazy": false, "register": false, "menu": null, - "params": { - ":___wildcard*": "*" - } + "children": null }, - "//:___userId/edit": { + "/comments/:___commentId?": { + "params": { + ":___commentId?": "opt" + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, - "route": "//:___userId/edit", + "loginRequired": false, + "route": "/comments/:___commentId?", + "lazy": false, + "register": false, + "menu": null, + "children": null + }, + "/profile": { + "params": {}, + "title": "Profile", + "rolesAllowed": [ + "ROLE_USER", + "ROLE_ADMIN" + ], + "loginRequired": true, + "route": "/profile", "lazy": false, "register": false, "menu": null, + "children": [] + }, + "//:___userId/edit": { "params": { ":___userId": "req" - } - }, - "/comments/:___commentId?": { + }, "title": "RouteTarget", "rolesAllowed": null, - "requiresLogin": false, - "route": "/comments/:___commentId?", + "loginRequired": false, + "route": "//:___userId/edit", "lazy": false, "register": false, "menu": null, - "params": { - ":___commentId?": "opt" - } + "children": null } } diff --git a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/only-client-views.json b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/only-client-views.json index 732a08ee0d..1806d47f02 100644 --- a/packages/java/endpoint/src/test/resources/META-INF/VAADIN/only-client-views.json +++ b/packages/java/endpoint/src/test/resources/META-INF/VAADIN/only-client-views.json @@ -1,34 +1,42 @@ { "/home": { + "params": {}, "title": "Home", "rolesAllowed": null, - "requiresLogin": false, + "loginRequired": false, "route": "/home", "lazy": false, "register": false, "menu": null, - "params": {} + "children": [] }, - "/profile": { - "title": "Profile", - "rolesAllowed": ["ROLE_USER", "ROLE_ADMIN"], - "requiresLogin": true, - "route": "/profile", + "/user/:userId": { + "params": { + ":userId": "req" + }, + "title": "User Profile", + "rolesAllowed": [ + "ROLE_ADMIN" + ], + "loginRequired": true, + "route": "/user/:userId", "lazy": false, "register": false, "menu": null, - "params": {} + "children": [] }, - "/user/:userId": { - "title": "User Profile", - "rolesAllowed": ["ROLE_ADMIN"], - "requiresLogin": true, - "route": "/user/:userId", + "/profile": { + "params": {}, + "title": "Profile", + "rolesAllowed": [ + "ROLE_USER", + "ROLE_ADMIN" + ], + "loginRequired": true, + "route": "/profile", "lazy": false, "register": false, "menu": null, - "params": { - ":userId": "req" - } + "children": [] } }