2h -> 1h
This commit is contained in:
1 parent
08d53b80b7
commit
caca71dce5
7 files changed
+12
-10
No files matched your search
@@ -52,10 +52,10 @@ export const HeaderRange = ({
|
|||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={() => setRange("2h")}
|
onClick={() => setRange("1h")}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
sx={
|
sx={
|
||||||
range === "2h"
|
range === "1h"
|
||||||
? {
|
? {
|
||||||
backgroundColor: theme.palette.secondary.dark,
|
backgroundColor: theme.palette.secondary.dark,
|
||||||
color: theme.palette.secondary.contrastText,
|
color: theme.palette.secondary.contrastText,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { config } from "@/config/index";
|
|||||||
const ChecksPage = () => {
|
const ChecksPage = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [selectedMonitorId, setSelectedMonitorId] = useState<string>("all");
|
const [selectedMonitorId, setSelectedMonitorId] = useState<string>("all");
|
||||||
const [range, setRange] = useState("2h");
|
const [range, setRange] = useState("1h");
|
||||||
const [status, setStatus] = useState<"up" | "down">("down");
|
const [status, setStatus] = useState<"up" | "down">("down");
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
const [rowsPerPage, setRowsPerPage] = useState(10);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const InfraDetailsPage = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [range, setRange] = useState("2h");
|
const [range, setRange] = useState("1h");
|
||||||
|
|
||||||
const { response, isValidating, refetch } = useGet<
|
const { response, isValidating, refetch } = useGet<
|
||||||
ApiResponse<IMonitorWithMonitorStats>
|
ApiResponse<IMonitorWithMonitorStats>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const PageSpeedDetailsPage = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [range, setRange] = useState("2h");
|
const [range, setRange] = useState("1h");
|
||||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
|
|
||||||
const { patch, loading: isPatching } = usePatch<any, IMonitor>();
|
const { patch, loading: isPatching } = usePatch<any, IMonitor>();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const UptimeDetailsPage = () => {
|
|||||||
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
// Local state
|
// Local state
|
||||||
const [range, setRange] = useState("2h");
|
const [range, setRange] = useState("1h");
|
||||||
|
|
||||||
const { response, loading, error, refetch } = useGet<
|
const { response, loading, error, refetch } = useGet<
|
||||||
ApiResponse<IMonitorWithMonitorStats>
|
ApiResponse<IMonitorWithMonitorStats>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const formatDateWithTz = (
|
|||||||
|
|
||||||
export const tickDateFormatLookup = (range: string) => {
|
export const tickDateFormatLookup = (range: string) => {
|
||||||
const tickFormatLookup: Record<string, string> = {
|
const tickFormatLookup: Record<string, string> = {
|
||||||
"2h": "h:mm A",
|
"1h": "h:mm A",
|
||||||
"24h": "h:mm A",
|
"24h": "h:mm A",
|
||||||
"7d": "MM/D, h:mm A",
|
"7d": "MM/D, h:mm A",
|
||||||
"30d": "ddd. M/D",
|
"30d": "ddd. M/D",
|
||||||
@@ -43,7 +43,7 @@ export const tickDateFormatLookup = (range: string) => {
|
|||||||
|
|
||||||
export const tooltipDateFormatLookup = (range: string) => {
|
export const tooltipDateFormatLookup = (range: string) => {
|
||||||
const dateFormatLookup: Record<string, string> = {
|
const dateFormatLookup: Record<string, string> = {
|
||||||
"2h": "ddd. MMMM D, YYYY, hh:mm A",
|
"1h": "ddd. MMMM D, YYYY, hh:mm A",
|
||||||
"24h": "ddd. MMMM D, YYYY, hh:mm A",
|
"24h": "ddd. MMMM D, YYYY, hh:mm A",
|
||||||
"7d": "ddd. MMMM D, YYYY, hh:mm A",
|
"7d": "ddd. MMMM D, YYYY, hh:mm A",
|
||||||
"30d": "ddd. MMMM D, YYYY",
|
"30d": "ddd. MMMM D, YYYY",
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ class MonitorService implements IMonitorService {
|
|||||||
private getStartDate(range: string): Date {
|
private getStartDate(range: string): Date {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
switch (range) {
|
switch (range) {
|
||||||
case "2h":
|
case "1h":
|
||||||
return new Date(now.getTime() - 2 * 60 * 60 * 1000);
|
return new Date(now.getTime() - 2 * 60 * 60 * 1000);
|
||||||
case "24h":
|
case "24h":
|
||||||
return new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
return new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||||
@@ -587,7 +587,9 @@ class MonitorService implements IMonitorService {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const checks = await Check.aggregate(pipeline);
|
const checks = await Check.aggregate(pipeline)
|
||||||
|
.allowDiskUse(true)
|
||||||
|
.hint({ "metadata.monitorId": 1, createdAt: 1 });
|
||||||
|
|
||||||
// Get monitor stats
|
// Get monitor stats
|
||||||
const monitorStats = await MonitorStats.findOne({
|
const monitorStats = await MonitorStats.findOne({
|
||||||
|
|||||||
Reference in new issue
Block a user