2021-08-10 18:25:34 +00:00
|
|
|
import React from "react";
|
2023-04-27 12:43:20 +00:00
|
|
|
import classnames from "classnames";
|
2021-08-10 18:25:34 +00:00
|
|
|
|
2022-10-27 18:06:57 +00:00
|
|
|
import CustomLink from "components/CustomLink";
|
2022-11-08 15:06:58 +00:00
|
|
|
import Icon from "components/Icon";
|
2021-08-10 18:25:34 +00:00
|
|
|
|
2022-05-03 20:57:08 +00:00
|
|
|
const baseClass = "data-error";
|
2021-08-10 18:25:34 +00:00
|
|
|
|
2022-07-01 14:21:25 +00:00
|
|
|
interface IDataErrorProps {
|
2023-06-22 14:08:21 +00:00
|
|
|
children?: React.ReactNode;
|
2022-07-01 14:21:25 +00:00
|
|
|
card?: boolean;
|
2023-04-27 12:43:20 +00:00
|
|
|
className?: string;
|
2022-07-01 14:21:25 +00:00
|
|
|
}
|
|
|
|
|
|
2023-04-27 12:43:20 +00:00
|
|
|
const DataError = ({
|
|
|
|
|
children,
|
|
|
|
|
card,
|
|
|
|
|
className,
|
|
|
|
|
}: IDataErrorProps): JSX.Element => {
|
|
|
|
|
const classes = classnames(baseClass, className);
|
|
|
|
|
|
2021-08-10 18:25:34 +00:00
|
|
|
return (
|
2023-04-27 12:43:20 +00:00
|
|
|
<div className={classes}>
|
2022-07-01 14:21:25 +00:00
|
|
|
<div className={`${baseClass}__${card ? "card" : "inner"}`}>
|
2021-08-10 18:25:34 +00:00
|
|
|
<div className="info">
|
|
|
|
|
<span className="info__header">
|
2022-11-08 15:06:58 +00:00
|
|
|
<Icon name="alert" />
|
2021-08-10 18:25:34 +00:00
|
|
|
Something's gone wrong.
|
|
|
|
|
</span>
|
2022-11-08 15:06:58 +00:00
|
|
|
|
|
|
|
|
<>
|
|
|
|
|
{children || (
|
|
|
|
|
<>
|
|
|
|
|
<span className="info__data">
|
|
|
|
|
Refresh the page or log in again.
|
|
|
|
|
</span>
|
|
|
|
|
<span className="info__data">
|
|
|
|
|
If this keeps happening, please
|
|
|
|
|
<CustomLink
|
|
|
|
|
url="https://github.com/fleetdm/fleet/issues/new/choose"
|
|
|
|
|
text="file an issue"
|
|
|
|
|
newTab
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
2021-08-10 18:25:34 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-03 20:57:08 +00:00
|
|
|
export default DataError;
|