Merge remote-tracking branch 'upstream/develop' into fix/remove-double-login-protection

This commit is contained in:
Alex Holliday
2024-08-15 11:48:41 -07:00
7 changed files with 33 additions and 87 deletions
+4 -4
View File
@@ -2655,12 +2655,12 @@
}
},
"node_modules/axios": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
"integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz",
"integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.0",
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
+5 -40
View File
@@ -9,7 +9,6 @@ import { useNavigate } from "react-router-dom";
import Button from "../../Components/Button";
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
import { useTheme } from "@emotion/react";
import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded";
import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react";
import Settings from "../../assets/icons/settings-bold.svg?react";
@@ -153,49 +152,17 @@ const Monitors = () => {
const down = monitorState.monitors.length - up;
// State variable for sorting -> default of 1 for ascending
const [sortOrder, setSortOrder] = useState(1);
// State variable for updating sorting of default monitors
const [sortedMonitors, setSortedMonitors] = useState(monitorState.monitors);
// Bool for sorting arrow
const [isSorted, setIsSorted] = useState(false);
// Function to handle sorting on click of status text
const handleSort = () => {
setSortOrder((prevOrder) => prevOrder * -1);
// Sort existing monitors with start of ascending order
const monitors = [...monitorState.monitors].sort((a) => {
return a.status ? -1 * sortOrder : 1 * sortOrder;
});
// Update state of monitors
setSortedMonitors(monitors);
// Trigger arrow visibility and direction
setIsSorted(true);
};
const data = {
cols: [
{ id: 1, name: "Host" },
{
id: 2,
name: (
<Box
width="max-content"
onClick={handleSort}
style={{ cursor: "pointer" }}
>
<Box width="max-content">
Status
{isSorted ? (
<span>
{sortOrder === -1 ? (
<ArrowUpwardRoundedIcon />
) : (
<ArrowDownwardRoundedIcon />
)}
</span>
) : null}
<span>
<ArrowDownwardRoundedIcon />
</span>
</Box>
),
},
@@ -206,9 +173,7 @@ const Monitors = () => {
rows: [],
};
console.log(monitorState.monitors);
// Render out sorted monitors/default monitors
data.rows = sortedMonitors.map((monitor, idx) => {
data.rows = monitorState.monitors.map((monitor, idx) => {
const params = {
url: monitor.url,
title: monitor.name,