← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~jonesogolo/maas-site-manager:1526-add-empty-states-to-regions-table into maas-site-manager:main

 


Diff comments:

> diff --git a/frontend/src/components/NoRegions/NoRegions.tsx b/frontend/src/components/NoRegions/NoRegions.tsx
> new file mode 100644
> index 0000000..a857257
> --- /dev/null
> +++ b/frontend/src/components/NoRegions/NoRegions.tsx
> @@ -0,0 +1,50 @@
> +import { Link } from "react-router-dom";
> +
> +import ExternalLink from "../ExternalLink";
> +import TableCaption from "../TableCaption";
> +
> +import docsUrls from "@/base/docsUrls";
> +import { useRequestsCountQuery } from "@/hooks/api";
> +
> +const NoRegions = () => {
> +  const { data, isLoading } = useRequestsCountQuery();
> +
> +  return (
> +    <TableCaption>
> +      <TableCaption.Title>No enroled MAAS regions</TableCaption.Title>
> +      {!isLoading && data!.total > 0 ? (

There are instances where `data` would be undefined if the query is still loading, removing this check means I would have to check that data is not undefined

> +        <>
> +          <TableCaption.Description>
> +            You have <strong>{data?.total} open enrolment requests, </strong>inspect them in the Requests page.
> +            <br />
> +            <ExternalLink to={docsUrls.enrollmentRequest}>
> +              Learn more about the enrolment process in the documentation.
> +            </ExternalLink>
> +          </TableCaption.Description>
> +          <TableCaption.Description>
> +            <Link className="p-button--positive" to="/requests">
> +              Go to Requests Page
> +            </Link>
> +          </TableCaption.Description>
> +        </>
> +      ) : (
> +        <>
> +          <TableCaption.Description>
> +            To enrol follow the steps in the Tokens page.
> +            <br />
> +            <ExternalLink to={docsUrls.enrollmentRequest}>
> +              Learn more about the enrolment process in the documentation.
> +            </ExternalLink>
> +          </TableCaption.Description>
> +          <TableCaption.Description>
> +            <Link className="p-button--positive" to="/tokens">
> +              Go to Tokens page
> +            </Link>
> +          </TableCaption.Description>
> +        </>
> +      )}
> +    </TableCaption>
> +  );
> +};
> +
> +export default NoRegions;


-- 
https://code.launchpad.net/~jonesogolo/maas-site-manager/+git/maas-site-manager/+merge/440258
Your team MAAS Committers is requested to review the proposed merge of ~jonesogolo/maas-site-manager:1526-add-empty-states-to-regions-table into maas-site-manager:main.