mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Show dedicated Notfound page for invalid routes (#2070)
This commit is contained in:
2
gradle/changelog/404.yaml
Normal file
2
gradle/changelog/404.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
- type: added
|
||||||
|
description: Show dedicated notfound page for invalid routes ([#2070](https://github.com/scm-manager/scm-manager/pull/2070))
|
||||||
@@ -133,7 +133,7 @@ export class Binder {
|
|||||||
predicate,
|
predicate,
|
||||||
extension,
|
extension,
|
||||||
extensionName: extensionName ? extensionName : "",
|
extensionName: extensionName ? extensionName : "",
|
||||||
priority,
|
priority: priority || 0,
|
||||||
} as ExtensionRegistration<E["props"], E["type"]>;
|
} as ExtensionRegistration<E["props"], E["type"]>;
|
||||||
this.extensionPoints[extensionPoint].push(registration);
|
this.extensionPoints[extensionPoint].push(registration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,5 +260,6 @@
|
|||||||
},
|
},
|
||||||
"tag": {
|
"tag": {
|
||||||
"delete": "Löschen"
|
"delete": "Löschen"
|
||||||
}
|
},
|
||||||
|
"pageNotFound": "Die angefragte Seite existiert nicht."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,5 +261,6 @@
|
|||||||
},
|
},
|
||||||
"tag": {
|
"tag": {
|
||||||
"delete": "Delete"
|
"delete": "Delete"
|
||||||
}
|
},
|
||||||
|
"pageNotFound": "The requested page does not exist."
|
||||||
}
|
}
|
||||||
|
|||||||
37
scm-ui/ui-webapp/src/containers/NotFoundPage.tsx
Normal file
37
scm-ui/ui-webapp/src/containers/NotFoundPage.tsx
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React, { FC } from "react";
|
||||||
|
import { Notification, Page } from "@scm-manager/ui-components";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
const NotFoundPage: FC = () => {
|
||||||
|
const [t] = useTranslation("commons");
|
||||||
|
return (
|
||||||
|
<Page>
|
||||||
|
<Notification type="danger">404: {t("pageNotFound")}</Notification>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default NotFoundPage;
|
||||||
@@ -36,8 +36,10 @@ import ChangesetShortLink from "./repos/components/changesets/ChangesetShortLink
|
|||||||
|
|
||||||
import "./tokenExpired";
|
import "./tokenExpired";
|
||||||
import { ApiProvider } from "@scm-manager/ui-api";
|
import { ApiProvider } from "@scm-manager/ui-api";
|
||||||
|
import NotFoundPage from "./containers/NotFoundPage";
|
||||||
|
|
||||||
binder.bind<extensionPoints.ChangesetDescriptionTokens>("changeset.description.tokens", ChangesetShortLink);
|
binder.bind<extensionPoints.ChangesetDescriptionTokens>("changeset.description.tokens", ChangesetShortLink);
|
||||||
|
binder.bind<extensionPoints.MainRoute>("main.route", NotFoundPage, { priority: -1 });
|
||||||
|
|
||||||
const root = document.getElementById("root");
|
const root = document.getElementById("root");
|
||||||
if (!root) {
|
if (!root) {
|
||||||
|
|||||||
Reference in New Issue
Block a user