Skip to content

Commit 0530498

Browse files
add not-found page
1 parent 536d773 commit 0530498

2 files changed

Lines changed: 81 additions & 3 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { SerializedError } from "@reduxjs/toolkit";
2+
import { FetchBaseQueryError } from "@reduxjs/toolkit/query";
3+
import cx from "classnames";
4+
import { ArrowLeft } from "react-bootstrap-icons";
5+
import { Link, useParams } from "react-router";
6+
7+
import ContainerWrap from "../../../components/container/ContainerWrap";
8+
import RtkOrDataServicesError from "../../../components/errors/RtkOrDataServicesError";
9+
import { ABSOLUTE_ROUTES } from "../../../routing/routes.constants";
10+
import rkNotFoundImgV2 from "../../../styles/assets/not-foundV2.svg";
11+
12+
interface DataConnectorNotFoundProps {
13+
error?: FetchBaseQueryError | SerializedError | undefined | null;
14+
}
15+
16+
export default function DataConnectorNotFound({
17+
error,
18+
}: DataConnectorNotFoundProps) {
19+
const { dataConnectorNamespace, projectNamespace, slug } = useParams<{
20+
dataConnectorNamespace?: string;
21+
projectNamespace?: string;
22+
slug: string;
23+
}>();
24+
25+
const dataConnectorSlug = [projectNamespace, dataConnectorNamespace, slug]
26+
.filter((value) => value != null)
27+
.join("/");
28+
29+
const notFoundText = dataConnectorSlug ? (
30+
<>
31+
We could not find the data connector{" "}
32+
<span className={cx("fw-bold", "user-select-all")}>
33+
{dataConnectorSlug}
34+
</span>
35+
.
36+
</>
37+
) : (
38+
<>We could not find the requested data connector.</>
39+
);
40+
41+
return (
42+
<ContainerWrap>
43+
<div className="d-flex">
44+
<div className={cx("m-auto", "d-flex", "flex-column")}>
45+
<h3
46+
className={cx(
47+
"text-primary",
48+
"fw-bold",
49+
"my-0",
50+
"d-flex",
51+
"align-items-center",
52+
"gap-3"
53+
)}
54+
>
55+
<img src={rkNotFoundImgV2} />
56+
Data Connector not found
57+
</h3>
58+
<div className={cx("text-start", "mt-3")}>
59+
<p>{notFoundText}</p>
60+
<p>
61+
It is possible that the data connector has been deleted by its
62+
owner or you do not have the necessary permissions to view it.
63+
</p>
64+
{error && (
65+
<RtkOrDataServicesError error={error} dismissible={false} />
66+
)}
67+
<Link
68+
to={`${ABSOLUTE_ROUTES.v2.search}?type=DataConnector`}
69+
className={cx("btn", "btn-primary")}
70+
>
71+
<ArrowLeft className={cx("bi", "me-1")} />
72+
Go to the data connectors list
73+
</Link>
74+
</div>
75+
</div>
76+
</div>
77+
</ContainerWrap>
78+
);
79+
}

client/src/routes/dataConnectors/root.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
useGetNamespacesByNamespaceProjectsAndProjectDataConnectorsSlugQuery,
1818
} from "~/features/dataConnectorsV2/api/data-connectors.enhanced-api";
1919
import DataConnectorPageLayout from "~/features/dataConnectorsV2/show/DataConnectorPageLayout";
20+
import DataConnectorNotFound from "~/features/projectsV2/notFound/DataConnectorNotFound";
2021
import { NamespaceContextType } from "~/features/searchV2/hooks/useNamespaceContext.hook";
2122
import { ABSOLUTE_ROUTES } from "~/routing/routes.constants";
2223
import { store } from "~/store/store";
@@ -426,9 +427,7 @@ export default function DataConnectorPagesRoot({
426427
}
427428

428429
if (error || dataConnector == null) {
429-
return <h1>TODO: DC not found</h1>;
430-
// ! Implement that "not found" page
431-
// return <DataConnectorNotFound error={error ?? loaderData.error} />;
430+
return <DataConnectorNotFound error={error ?? loaderData.error} />;
432431
}
433432

434433
const routeParams = {

0 commit comments

Comments
 (0)