Skip to content

Commit

Permalink
Merge branch 'main' into taefi/add-full-stack-signals-1
Browse files Browse the repository at this point in the history
  • Loading branch information
taefi authored May 31, 2024
2 parents 4d76289 + c37fe6b commit 9b595ee
Show file tree
Hide file tree
Showing 54 changed files with 14,637 additions and 14,186 deletions.
1,252 changes: 634 additions & 618 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@nx/js": "^18.0.4",
"@types/karma": "^6.3.8",
"@types/node": "^20.11.19",
"@vaadin/react-components": "24.4.0-rc1",
"@vaadin/react-components": "24.5.0-alpha1",
"chai-dom": "^1.12.0",
"compare-versions": "^6.1.0",
"concurrently": "^8.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,6 @@
*/
package com.vaadin.hilla.route;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.vaadin.flow.function.DeploymentConfiguration;
import com.vaadin.flow.server.frontend.FrontendUtils;
import com.vaadin.hilla.route.records.ClientViewConfig;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import com.vaadin.flow.router.internal.ClientRoutesProvider;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand All @@ -36,10 +24,23 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import com.vaadin.flow.function.DeploymentConfiguration;
import com.vaadin.flow.router.internal.ClientRoutesProvider;
import com.vaadin.flow.server.frontend.FrontendUtils;
import com.vaadin.hilla.route.records.ClientViewConfig;

/**
* Keeps track of registered client side routes.
*/
Expand Down Expand Up @@ -228,10 +229,14 @@ private void registerAndRecurseChildren(String basePath,
var path = view.getRoute() == null || view.getRoute().isEmpty()
? basePath
: basePath + '/' + view.getRoute();

if (!hasMainLayout && isMainLayout(view)) {
hasMainLayout = true;
}
if (view.getChildren() == null || view.getChildren().isEmpty()) {

// Skip layout views without children.
// https://github.com/vaadin/hilla/issues/2379
if (view.getChildren() == null) {
addRoute(path, view);
} else {
view.getChildren().forEach(child -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ public void setUp() throws Exception {
}

private Map<String, ClientViewConfig> prepareClientRoutes() {
final Map<String, ClientViewConfig> routes = new LinkedHashMap<>();
final var routes = new LinkedHashMap<String, ClientViewConfig>();

ClientViewConfig homeConfig = new ClientViewConfig();
var homeConfig = new ClientViewConfig();
homeConfig.setTitle("Home");
homeConfig.setRolesAllowed(null);
homeConfig.setLoginRequired(false);
homeConfig.setRoute("/home");
homeConfig.setLazy(false);
homeConfig.setAutoRegistered(false);
homeConfig.setMenu(null);
homeConfig.setChildren(Collections.emptyList());
homeConfig.setChildren(null);
homeConfig.setRouteParameters(Collections.emptyMap());
routes.put("/home", homeConfig);

ClientViewConfig profileConfig = new ClientViewConfig();
var profileConfig = new ClientViewConfig();
profileConfig.setTitle("Profile");
profileConfig
.setRolesAllowed(new String[] { "ROLE_USER", "ROLE_ADMIN" });
Expand All @@ -134,19 +134,19 @@ private Map<String, ClientViewConfig> prepareClientRoutes() {
profileConfig.setLazy(false);
profileConfig.setAutoRegistered(false);
profileConfig.setMenu(null);
profileConfig.setChildren(Collections.emptyList());
profileConfig.setChildren(null);
profileConfig.setRouteParameters(Collections.emptyMap());
routes.put("/profile", profileConfig);

ClientViewConfig userProfileConfig = new ClientViewConfig();
var userProfileConfig = new ClientViewConfig();
userProfileConfig.setTitle("User Profile");
userProfileConfig.setRolesAllowed(new String[] { "ROLE_ADMIN" });
userProfileConfig.setLoginRequired(true);
userProfileConfig.setRoute("/user/:userId");
userProfileConfig.setLazy(false);
userProfileConfig.setAutoRegistered(false);
userProfileConfig.setMenu(null);
userProfileConfig.setChildren(Collections.emptyList());
userProfileConfig.setChildren(null);
userProfileConfig
.setRouteParameters(Map.of(":userId", RouteParamType.REQUIRED));
routes.put("/user/:userId", userProfileConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
{
"route": "about",
"title": "About",
"params": {},
"children": []
"params": {}
},
{
"route": "profile",
Expand All @@ -12,8 +11,7 @@
{
"route": "",
"title": "Profile",
"params": {},
"children": []
"params": {}
},
{
"route": "account",
Expand All @@ -27,14 +25,12 @@
{
"route": "password",
"params": {},
"title": "Password",
"children": []
"title": "Password"
},
{
"route": "two-factor-auth",
"params": {},
"title": "Two Factor Auth",
"children": []
"title": "Two Factor Auth"
}
]
}
Expand All @@ -51,8 +47,7 @@
"params": {},
"unknown": {
"anotherProp": "prop"
},
"children": []
}
},
{
"route": ":user?",
Expand All @@ -71,8 +66,7 @@
"title": "Friend Profile",
"params": {
":user": "req"
},
"children": []
}
}
]
},
Expand All @@ -96,31 +90,33 @@
"children": [
{
"route": "empty",
"params": {},
"children": []
"params": {}
},
{
"route": ":optional?",
"title": "Optional",
"params": {
":optional?": "opt"
},
"children": []
}
},
{
"route": "*",
"title": "Wildcard",
"params": {
"*": "*"
},
"children": []
}
},
{
"route": "no-default-export",
"title": "No Default Export",
"params": {},
"children": []
"params": {}
}
]
},
{
"route": "layout-only",
"title": "Layout Only",
"params": {},
"children": []
}
]
Loading

0 comments on commit 9b595ee

Please sign in to comment.