|
| 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 | +} |
0 commit comments