Merge pull request #1336 from bluewave-labs/fix/fe/infra-button-vertical-spacing
Fix/fe/infra button vertical spacing, resolves #1332, resolves #1334
This commit is contained in:
2 files changed
+47
-29
No files matched your search
@@ -191,31 +191,26 @@ function Infrastructure() {
|
|||||||
<SkeletonLayout />
|
<SkeletonLayout />
|
||||||
) : monitorState.monitors?.length !== 0 ? (
|
) : monitorState.monitors?.length !== 0 ? (
|
||||||
<Stack gap={theme.spacing(8)}>
|
<Stack gap={theme.spacing(8)}>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Box>
|
||||||
<Stack
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
direction="row"
|
<Stack
|
||||||
sx={{
|
direction="row"
|
||||||
justifyContent: "end",
|
justifyContent="end"
|
||||||
alignItems: "center",
|
alignItems="center"
|
||||||
gap: "1rem",
|
mt={theme.spacing(5)}
|
||||||
flexWrap: "wrap",
|
|
||||||
marginBottom: "2rem",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/*
|
|
||||||
This will be removed from here, but keeping the commented code to remind me to add a max width to the greeting component
|
|
||||||
<Box style={{ maxWidth: "65ch" }}>
|
|
||||||
<Greeting type="uptime" />
|
|
||||||
</Box> */}
|
|
||||||
<Button
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
onClick={navigateToCreate}
|
|
||||||
sx={{ fontWeight: 500 }}
|
|
||||||
>
|
>
|
||||||
Create infrastructure monitor
|
{isAdmin && (
|
||||||
</Button>
|
<Button
|
||||||
</Stack>
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={() => navigate("/infrastructure/create")}
|
||||||
|
sx={{ whiteSpace: "nowrap" }}
|
||||||
|
>
|
||||||
|
Create new
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
<Stack
|
<Stack
|
||||||
sx={{
|
sx={{
|
||||||
gap: "1rem",
|
gap: "1rem",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import Breadcrumbs from "../../Components/Breadcrumbs";
|
|||||||
import SkeletonLayout from "./skeleton";
|
import SkeletonLayout from "./skeleton";
|
||||||
import Card from "./card";
|
import Card from "./card";
|
||||||
import { networkService } from "../../main";
|
import { networkService } from "../../main";
|
||||||
|
import { Heading } from "../../Components/Heading";
|
||||||
const PageSpeed = ({ isAdmin }) => {
|
const PageSpeed = ({ isAdmin }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -20,6 +20,7 @@ const PageSpeed = ({ isAdmin }) => {
|
|||||||
const { user, authToken } = useSelector((state) => state.auth);
|
const { user, authToken } = useSelector((state) => state.auth);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [monitors, setMonitors] = useState([]);
|
const [monitors, setMonitors] = useState([]);
|
||||||
|
const [monitorCount, setMonitorCount] = useState(0);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(getPageSpeedByTeamId(authToken));
|
dispatch(getPageSpeedByTeamId(authToken));
|
||||||
}, [authToken, dispatch]);
|
}, [authToken, dispatch]);
|
||||||
@@ -44,6 +45,7 @@ const PageSpeed = ({ isAdmin }) => {
|
|||||||
});
|
});
|
||||||
if (res?.data?.data?.monitors) {
|
if (res?.data?.data?.monitors) {
|
||||||
setMonitors(res.data.data.monitors);
|
setMonitors(res.data.data.monitors);
|
||||||
|
setMonitorCount(res.data.data.monitorCount);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@@ -53,7 +55,7 @@ const PageSpeed = ({ isAdmin }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchMonitors();
|
fetchMonitors();
|
||||||
}, []);
|
}, [authToken, user.teamId]);
|
||||||
|
|
||||||
// will show skeletons only on initial load
|
// will show skeletons only on initial load
|
||||||
// since monitor state is being added to redux persist, there's no reason to display skeletons on every render
|
// since monitor state is being added to redux persist, there's no reason to display skeletons on every render
|
||||||
@@ -76,8 +78,8 @@ const PageSpeed = ({ isAdmin }) => {
|
|||||||
{isActuallyLoading ? (
|
{isActuallyLoading ? (
|
||||||
<SkeletonLayout />
|
<SkeletonLayout />
|
||||||
) : monitors?.length !== 0 ? (
|
) : monitors?.length !== 0 ? (
|
||||||
<Box>
|
<Stack gap={theme.spacing(8)}>
|
||||||
<Box mb={theme.spacing(12)}>
|
<Box>
|
||||||
<Breadcrumbs list={[{ name: `pagespeed`, path: "/pagespeed" }]} />
|
<Breadcrumbs list={[{ name: `pagespeed`, path: "/pagespeed" }]} />
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
@@ -97,6 +99,27 @@ const PageSpeed = ({ isAdmin }) => {
|
|||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
sx={{
|
||||||
|
alignItems: "center",
|
||||||
|
gap: ".25rem",
|
||||||
|
flexWrap: "wrap",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Heading component="h2">PageSpeed monitors</Heading>
|
||||||
|
{/* TODO Correct the class current-monitors-counter, there are some unnecessary things there */}
|
||||||
|
<Box
|
||||||
|
component="span"
|
||||||
|
className="current-monitors-counter"
|
||||||
|
color={theme.palette.text.primary}
|
||||||
|
border={1}
|
||||||
|
borderColor={theme.palette.border.light}
|
||||||
|
backgroundColor={theme.palette.background.accent}
|
||||||
|
>
|
||||||
|
{monitorCount}
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
spacing={theme.spacing(12)}
|
spacing={theme.spacing(12)}
|
||||||
@@ -108,7 +131,7 @@ const PageSpeed = ({ isAdmin }) => {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
</Stack>
|
||||||
) : (
|
) : (
|
||||||
<Fallback
|
<Fallback
|
||||||
title="pagespeed monitor"
|
title="pagespeed monitor"
|
||||||
|
|||||||
Reference in new issue
Block a user