remove unused
This commit is contained in:
1 parent
853e21623e
commit
75d3644b36
4 files changed
-184
No files matched your search
@@ -1,107 +0,0 @@
|
|||||||
import DataTable from "@/Components/v1/Table/index.jsx";
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import { StatusLabel } from "@/Components/v1/Label/index.jsx";
|
|
||||||
import Icon from "@/Components/v1/Icon";
|
|
||||||
import { Stack, Typography } from "@mui/material";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
const StatusPagesTable = ({ data }) => {
|
|
||||||
const theme = useTheme();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const headers = [
|
|
||||||
{
|
|
||||||
id: "name",
|
|
||||||
content: t("statusPageName"),
|
|
||||||
render: (row) => {
|
|
||||||
return row.companyName;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "url",
|
|
||||||
content: t("publicURL"),
|
|
||||||
onClick: (e, row) => {
|
|
||||||
if (row.isPublished) {
|
|
||||||
e.stopPropagation();
|
|
||||||
const url = `/status/uptime/public/${row.url}`;
|
|
||||||
window.open(url, "_blank", "noopener,noreferrer");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
render: (row) => {
|
|
||||||
const content = row.isPublished ? `/${row.url}` : "Unpublished";
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
alignItems="center"
|
|
||||||
justifyContent="center"
|
|
||||||
gap={theme.spacing(2)}
|
|
||||||
paddingLeft={theme.spacing(2)}
|
|
||||||
paddingRight={theme.spacing(2)}
|
|
||||||
sx={{
|
|
||||||
...(row.isPublished && {
|
|
||||||
display: "inline-flex",
|
|
||||||
":hover": {
|
|
||||||
cursor: "pointer",
|
|
||||||
borderBottom: 1,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography>{content}</Typography>
|
|
||||||
{row.isPublished && (
|
|
||||||
<Icon
|
|
||||||
name="ExternalLink"
|
|
||||||
size={18}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "type",
|
|
||||||
content: t("type"),
|
|
||||||
render: (row) => {
|
|
||||||
return row.type;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "status",
|
|
||||||
content: t("status"),
|
|
||||||
render: (row) => {
|
|
||||||
const status = row.isPublished ? "published" : "unpublished";
|
|
||||||
return (
|
|
||||||
<StatusLabel
|
|
||||||
status={status}
|
|
||||||
text={row.isPublished ? "Published" : "Unpublished"}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleRowClick = (statusPage) => {
|
|
||||||
navigate(`/status/uptime/${statusPage.url}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DataTable
|
|
||||||
config={{
|
|
||||||
rowSX: {
|
|
||||||
cursor: "pointer",
|
|
||||||
"&:hover td": {
|
|
||||||
backgroundColor: theme.palette.tertiary.main,
|
|
||||||
transition: "background-color .3s ease",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
onRowClick: (row) => {
|
|
||||||
handleRowClick(row);
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
headers={headers}
|
|
||||||
data={data}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default StatusPagesTable;
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { useState, useEffect } from "react";
|
|
||||||
import { networkService } from "../../../../main.jsx";
|
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
import { createToast } from "../../../../Utils/toastUtils.jsx";
|
|
||||||
|
|
||||||
const useStatusPagesFetch = () => {
|
|
||||||
const { user } = useSelector((state) => state.auth);
|
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
|
||||||
const [networkError, setNetworkError] = useState(false);
|
|
||||||
const [statusPages, setStatusPages] = useState(undefined);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const fetchStatusPages = async () => {
|
|
||||||
try {
|
|
||||||
const res = await networkService.getStatusPagesByTeamId();
|
|
||||||
setStatusPages(res?.data?.data || []);
|
|
||||||
} catch (error) {
|
|
||||||
setNetworkError(true);
|
|
||||||
createToast({
|
|
||||||
body: error.message,
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
fetchStatusPages();
|
|
||||||
}, [user]);
|
|
||||||
return [isLoading, networkError, statusPages];
|
|
||||||
};
|
|
||||||
|
|
||||||
export { useStatusPagesFetch };
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// Components
|
|
||||||
import { Stack } from "@mui/material";
|
|
||||||
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
|
|
||||||
import MonitorCreateHeader from "@/Components/v1/MonitorCreateHeader/index.jsx";
|
|
||||||
import StatusPagesTable from "./Components/StatusPagesTable/index.jsx";
|
|
||||||
import PageStateWrapper from "@/Components/v1/PageStateWrapper/index.jsx";
|
|
||||||
// Utils
|
|
||||||
import { useTheme } from "@emotion/react";
|
|
||||||
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch.jsx";
|
|
||||||
import { useIsAdmin } from "@/Hooks/useIsAdmin.js";
|
|
||||||
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
|
|
||||||
|
|
||||||
const StatusPages = () => {
|
|
||||||
// Utils
|
|
||||||
const theme = useTheme();
|
|
||||||
const isAdmin = useIsAdmin();
|
|
||||||
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<PageStateWrapper
|
|
||||||
networkError={networkError}
|
|
||||||
isLoading={isLoading}
|
|
||||||
items={statusPages}
|
|
||||||
type="statusPage"
|
|
||||||
fallbackLink="/status/uptime/create"
|
|
||||||
>
|
|
||||||
<Stack gap={theme.spacing(10)}>
|
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
|
||||||
<MonitorCreateHeader
|
|
||||||
label="Create status page"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
path="/status/uptime/create"
|
|
||||||
isLoading={isLoading}
|
|
||||||
/>
|
|
||||||
<StatusPagesTable data={statusPages} />
|
|
||||||
</Stack>
|
|
||||||
</PageStateWrapper>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default StatusPages;
|
|
||||||
@@ -534,8 +534,6 @@
|
|||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"statusPageName": "Status page name",
|
|
||||||
"publicURL": "Public URL",
|
|
||||||
"repeat": "Repeat",
|
"repeat": "Repeat",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"createA": "Create a",
|
"createA": "Create a",
|
||||||
|
|||||||
Reference in new issue
Block a user