additional no route routes

This commit is contained in:
Niels Lyngsø
2024-07-02 19:44:26 +02:00
parent 42d0d8a6da
commit 46c14d73a6
6 changed files with 38 additions and 21 deletions

View File

@@ -48,7 +48,9 @@ export class UmbBackofficeMainElement extends UmbLitElement {
const newRoutes = this._sections
.filter((x) => x.manifest)
.map((section) => {
const existingRoute = this._routes.find((r) => r.path === UMB_SECTION_PATH_PATTERN.generateLocal({ sectionName: section.manifest!.meta.pathname }));
const existingRoute = this._routes.find(
(r) => r.path === UMB_SECTION_PATH_PATTERN.generateLocal({ sectionName: section.manifest!.meta.pathname }),
);
if (existingRoute) {
return existingRoute;
} else {
@@ -63,18 +65,18 @@ export class UmbBackofficeMainElement extends UmbLitElement {
}
});
if(newRoutes.length > 0 ) {
if (newRoutes.length > 0) {
newRoutes.push({
path: ``,
redirectTo: newRoutes[0].path
redirectTo: newRoutes[0].path,
});
newRoutes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
}
newRoutes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
this._routes = newRoutes;
}

View File

@@ -207,7 +207,14 @@ export class UmbContentTypeDesignEditorElement extends UmbLitElement implements
redirectTo: routes[0]?.path,
guards: [() => this._activeTabId === undefined],
});
// TODO: Look at this case.
}
if (routes.length !== 0) {
routes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
guards: [() => this._activeTabId === undefined],
});
}
// If we have an active tab name, then we might have a active tab name re-name, then we will redirect to the new name if it has been changed: [NL]

View File

@@ -106,12 +106,12 @@ export class UmbContentWorkspaceViewEditElement extends UmbLitElement implements
path: '',
redirectTo: routes[0]?.path,
});
}
routes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
routes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
}
this._routes = routes;
}

View File

@@ -79,7 +79,15 @@ export class UmbSectionMainViewElement extends UmbLitElement {
});
const routes = [...dashboardRoutes, ...viewRoutes];
this._routes = routes?.length > 0 ? [...routes, { path: '', redirectTo: routes?.[0]?.path }] : [];
if (routes.length > 0) {
routes.push({ path: '', redirectTo: routes?.[0]?.path });
routes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
}
this._routes = routes;
}
override render() {

View File

@@ -73,12 +73,12 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
// Duplicate first workspace and use it for the empty path scenario. [NL]
newRoutes.push({ ...newRoutes[0], path: '' });
}
newRoutes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
newRoutes.push({
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
});
}
this._routes = newRoutes;
}

View File

@@ -33,7 +33,7 @@ export class UmbUserGroupSectionViewElement extends UmbLitElement {
{
path: `**`,
component: async () => (await import('@umbraco-cms/backoffice/router')).UmbRouteNotFoundElement,
}
},
];
override render() {