Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public int setRouteNotFoundErrorParameter(BeforeEnterEvent event,
String template;
String routes = getRoutes(event);

boolean noRoutes = routes.isEmpty();
if (productionMode) {
template = AbstractRouteNotFoundError.LazyInit.PRODUCTION_MODE_TEMPLATE;
} else if (routes.isEmpty()) {
} else if (noRoutes) {
// Offer a way for people to get started
template = readHtmlFile("NoRoutesError_dev.html");
} else {
Expand All @@ -97,6 +98,18 @@ public int setRouteNotFoundErrorParameter(BeforeEnterEvent event,
template = template.replace("{{path}}", path);

getElement().setChild(0, new Html(template).getElement());
if (noRoutes && !productionMode) {
String copilotNoRoutes = """
(function poll() {
if (window.Vaadin?.copilot?.noRoutesInProject) {
window.Vaadin.copilot.noRoutesInProject();
} else {
setTimeout(poll, 100);
}
})();
""";
getElement().executeJs(copilotNoRoutes);
}
return HttpStatusCode.NOT_FOUND.getCode();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<div style="margin: 2rem;">
<h3>No views found</h3>
<p>To get started, you can either</p>
<p>To get started, you can</p>
<ul>
<li><a href onclick="window.Vaadin.copilot.initEmptyApp('flow')">Create a view for coding the UI in Java with Flow</a></li>
<li><a href onclick="window.Vaadin.copilot.initEmptyApp('hilla')">Create a view for coding the UI in TypeScript with Hilla and React</a></li>
<li>Use Vaadin Copilot to create a view</li>
<li>Create a view manually in your IDE, see <a target="_blank" href="https://vaadin.com/docs/latest/tutorial">the tutorial</a></li>
</ul>
<p>
You can also create a view manually in your IDE, see <a target="_blank" href="https://vaadin.com/docs/latest/tutorial">the tutorial</a>
</p>

<p>Learn more at <a target="_blank" href="https://vaadin.com/docs">https://vaadin.com/docs</a>.</p>
</div>
Loading