@upsnap/strapi 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,7 +20,7 @@ const SideNav = () => {
|
|
|
20
20
|
const CustomSubNavLink = designSystem.SubNavLink;
|
|
21
21
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNav, { "aria-label": "Upsnap navigation", children: [
|
|
22
22
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavHeader, { label: "Upsnap" }),
|
|
23
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNavSection, { label: "
|
|
23
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNavSection, { label: "", children: [
|
|
24
24
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25
25
|
CustomSubNavLink,
|
|
26
26
|
{
|
|
@@ -132,6 +132,7 @@ const PLAN_LIMITS = {
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
const DASHBOARD_URL = "https://upsnap.ai";
|
|
135
|
+
const STATS_PAGE_URL = "https://stats.upsnap.ai";
|
|
135
136
|
const DEFAULT_REGION = {
|
|
136
137
|
id: "default",
|
|
137
138
|
name: "Default (Server Region)"
|
|
@@ -7850,7 +7851,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
|
|
|
7850
7851
|
}
|
|
7851
7852
|
};
|
|
7852
7853
|
const RenderHealthCard = ({ data, name }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { paddingLeft: 1, width: "100%", children: loading === name ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7853
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.CardHeader, { fontSize: 3, children: formatTitleToUppercase(name) }),
|
|
7854
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.CardHeader, { fontSize: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "start", width: "100%", children: formatTitleToUppercase(name) }) }),
|
|
7854
7855
|
data && (data?.status === "error" || data?.status === "warning" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardTitle, { marginTop: 3, fontSize: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "row", alignItems: "center", gap: 1, children: [
|
|
7855
7856
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { width: "20px", children: [
|
|
7856
7857
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8162,7 +8163,7 @@ const IncidentsTable = ({
|
|
|
8162
8163
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Message" }) }),
|
|
8163
8164
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Occurred At" }) })
|
|
8164
8165
|
] }) }),
|
|
8165
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "Loading..." }) }) }) : incidentsData?.incidents && incidentsData?.incidents?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8166
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "Loading..." }) }) }) }) : incidentsData?.incidents && incidentsData?.incidents?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8166
8167
|
designSystem.Flex,
|
|
8167
8168
|
{
|
|
8168
8169
|
width: "100%",
|
|
@@ -8287,6 +8288,19 @@ function PageHeader({
|
|
|
8287
8288
|
}
|
|
8288
8289
|
);
|
|
8289
8290
|
}
|
|
8291
|
+
const LoadingCard = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8292
|
+
designSystem.Flex,
|
|
8293
|
+
{
|
|
8294
|
+
direction: "column",
|
|
8295
|
+
justifyContent: "center",
|
|
8296
|
+
margin: 8,
|
|
8297
|
+
height: { initial: "300px", medium: "400px" },
|
|
8298
|
+
children: [
|
|
8299
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}),
|
|
8300
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Loading..." })
|
|
8301
|
+
]
|
|
8302
|
+
}
|
|
8303
|
+
);
|
|
8290
8304
|
function Dashboard() {
|
|
8291
8305
|
const [monitorData, setMonitorData] = React.useState(null);
|
|
8292
8306
|
const [uptimeStats, setUptimeStats] = React.useState(null);
|
|
@@ -8312,6 +8326,7 @@ function Dashboard() {
|
|
|
8312
8326
|
}
|
|
8313
8327
|
return "default";
|
|
8314
8328
|
});
|
|
8329
|
+
const MAX_MONITOR_RETRIES = 3;
|
|
8315
8330
|
React.useEffect(() => {
|
|
8316
8331
|
(async () => {
|
|
8317
8332
|
const fetchedMonitorId = await getPrimaryMonitorId();
|
|
@@ -8352,17 +8367,29 @@ function Dashboard() {
|
|
|
8352
8367
|
React.useEffect(() => {
|
|
8353
8368
|
getRegionResponseTimeData();
|
|
8354
8369
|
}, [responseTimeData, selectedRegion]);
|
|
8355
|
-
const
|
|
8370
|
+
const fetchMonitorDataWithRetry = async (retries = MAX_MONITOR_RETRIES) => {
|
|
8371
|
+
for (let attempt = 0; attempt < retries; attempt++) {
|
|
8372
|
+
try {
|
|
8373
|
+
const res = await request(`/monitor/${monitorId}`, { method: "GET" });
|
|
8374
|
+
if (res?.monitor?.message === "Invalid authentication token") {
|
|
8375
|
+
navigate("/plugins/upsnap/settings");
|
|
8376
|
+
return null;
|
|
8377
|
+
}
|
|
8378
|
+
if (res.monitor?.data) {
|
|
8379
|
+
return res.monitor.data;
|
|
8380
|
+
}
|
|
8381
|
+
} catch (err) {
|
|
8382
|
+
}
|
|
8383
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
8384
|
+
}
|
|
8385
|
+
return null;
|
|
8386
|
+
};
|
|
8387
|
+
const handleRefresh = async () => {
|
|
8356
8388
|
const { start, end } = getRangeTimestamps(responseTimeRange || "last_24_hours");
|
|
8357
8389
|
setIsLoading(true);
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
if (res?.monitor?.message === "Invalid authentication token") {
|
|
8362
|
-
navigate("/plugins/upsnap/settings");
|
|
8363
|
-
}
|
|
8364
|
-
setMonitorData(res.monitor?.data || null);
|
|
8365
|
-
});
|
|
8390
|
+
if (!monitorId) return;
|
|
8391
|
+
const monitor = await fetchMonitorDataWithRetry();
|
|
8392
|
+
setMonitorData(monitor);
|
|
8366
8393
|
request(`/monitor/${monitorId}/uptime-stats?region=${selectedRegion}`, {
|
|
8367
8394
|
method: "GET"
|
|
8368
8395
|
}).then((res) => {
|
|
@@ -8388,7 +8415,7 @@ function Dashboard() {
|
|
|
8388
8415
|
setMonitorIncidents(res.incidentsData?.data || null);
|
|
8389
8416
|
});
|
|
8390
8417
|
};
|
|
8391
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.
|
|
8418
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 1, children: !monitorData || isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingCard, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8392
8419
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8393
8420
|
PageHeader,
|
|
8394
8421
|
{
|
|
@@ -8414,26 +8441,36 @@ function Dashboard() {
|
|
|
8414
8441
|
alignItems: "start",
|
|
8415
8442
|
style: { alignContent: "space-around", justifyItems: "stretch" },
|
|
8416
8443
|
children: [
|
|
8417
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8444
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8445
|
+
designSystem.Flex,
|
|
8446
|
+
{
|
|
8447
|
+
direction: "column",
|
|
8448
|
+
gap: 4,
|
|
8449
|
+
height: "100%",
|
|
8450
|
+
alignItems: "start",
|
|
8451
|
+
style: { flexWrap: "wrap" },
|
|
8452
|
+
children: [
|
|
8453
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8454
|
+
StatisticsCards,
|
|
8455
|
+
{
|
|
8456
|
+
monitorData,
|
|
8457
|
+
uptimeStats,
|
|
8458
|
+
histogramData,
|
|
8459
|
+
isLoading
|
|
8460
|
+
}
|
|
8461
|
+
),
|
|
8462
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8463
|
+
ResponseTimeChart,
|
|
8464
|
+
{
|
|
8465
|
+
monitor: monitorData?.monitor,
|
|
8466
|
+
regionResponseTimeData,
|
|
8467
|
+
timeRange: responseTimeRange || "last_24_hours",
|
|
8468
|
+
onTimeRangeChange: handleTimeRangeChange
|
|
8469
|
+
}
|
|
8470
|
+
)
|
|
8471
|
+
]
|
|
8472
|
+
}
|
|
8473
|
+
) }),
|
|
8437
8474
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(HealthCards, { monitorData, isLoading }) })
|
|
8438
8475
|
]
|
|
8439
8476
|
}
|
|
@@ -8446,7 +8483,7 @@ function Dashboard() {
|
|
|
8446
8483
|
isLoading
|
|
8447
8484
|
}
|
|
8448
8485
|
)
|
|
8449
|
-
] }) });
|
|
8486
|
+
] }) }) });
|
|
8450
8487
|
}
|
|
8451
8488
|
const DetailRow = ({ label, value, isUrl = false, isChip = false }) => {
|
|
8452
8489
|
const renderValue = () => {
|
|
@@ -8535,19 +8572,6 @@ const StatusCard = ({ status, message, error, cardData }) => {
|
|
|
8535
8572
|
}
|
|
8536
8573
|
) }) }) }) });
|
|
8537
8574
|
};
|
|
8538
|
-
const LoadingCard = () => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8539
|
-
designSystem.Flex,
|
|
8540
|
-
{
|
|
8541
|
-
direction: "column",
|
|
8542
|
-
justifyContent: "center",
|
|
8543
|
-
margin: 8,
|
|
8544
|
-
height: { initial: "300px", medium: "400px" },
|
|
8545
|
-
children: [
|
|
8546
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}),
|
|
8547
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "Loading..." })
|
|
8548
|
-
]
|
|
8549
|
-
}
|
|
8550
|
-
);
|
|
8551
8575
|
function RegionWiseCards({
|
|
8552
8576
|
regions,
|
|
8553
8577
|
regionNames,
|
|
@@ -8750,20 +8774,23 @@ const RegionResponseTimeChart = ({
|
|
|
8750
8774
|
}
|
|
8751
8775
|
};
|
|
8752
8776
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Card, { children: [
|
|
8753
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.CardHeader, { display: "flex",
|
|
8754
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8755
|
-
|
|
8756
|
-
designSystem.
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8777
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.CardHeader, { display: "flex", direction: "column", gap: 1, children: [
|
|
8778
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", width: "100%", children: [
|
|
8779
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", marginLeft: 2, padding: 3, children: "Response Time" }),
|
|
8780
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, style: { minWidth: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8781
|
+
designSystem.SingleSelect,
|
|
8782
|
+
{
|
|
8783
|
+
value: timeRange,
|
|
8784
|
+
onChange: onTimeRangeChange,
|
|
8785
|
+
disabled: monitor?.is_enabled === false,
|
|
8786
|
+
children: timeRanges.map((tr) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: tr.value, children: tr.label }, tr.value))
|
|
8787
|
+
}
|
|
8788
|
+
) })
|
|
8789
|
+
] }),
|
|
8790
|
+
visibleSeries.size === 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, background: "neutral100", marginTop: 1, width: "100%", marginBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: "No regions selected. Please select at least one region to view response time results." }) })
|
|
8764
8791
|
] }),
|
|
8765
8792
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.CardContent, { style: { width: "100%" }, children: [
|
|
8766
|
-
monitor?.is_enabled === false ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: "Monitoring is Paused. Enable monitoring to see response time results." }) }) :
|
|
8793
|
+
monitor?.is_enabled === false ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, background: "neutral100", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: "Monitoring is Paused. Enable monitoring to see response time results." }) }) : /* @__PURE__ */ jsxRuntime.jsx(Chart__default.default, { type: "area", height: 350, series, options: chartOptions }),
|
|
8767
8794
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
8768
8795
|
designSystem.Flex,
|
|
8769
8796
|
{
|
|
@@ -9726,6 +9753,7 @@ function Lighthouse() {
|
|
|
9726
9753
|
data: { monitorUrl: url, strategy: selectedStrategy, force_fetch: forceFetch }
|
|
9727
9754
|
});
|
|
9728
9755
|
setData(res?.lighthouseHealthCheckData || null);
|
|
9756
|
+
return;
|
|
9729
9757
|
} catch (err) {
|
|
9730
9758
|
setData(null);
|
|
9731
9759
|
} finally {
|
|
@@ -9738,10 +9766,13 @@ function Lighthouse() {
|
|
|
9738
9766
|
}
|
|
9739
9767
|
}, [monitorUrl, strategy]);
|
|
9740
9768
|
const handleRefresh = async () => {
|
|
9769
|
+
let url = monitorUrl || selectedMonitor?.monitor?.config?.meta?.url || "";
|
|
9741
9770
|
if (monitorUrl) {
|
|
9742
9771
|
setRefreshing(true);
|
|
9743
|
-
await getLighthouseData(strategy,
|
|
9772
|
+
await getLighthouseData(strategy, url, true);
|
|
9744
9773
|
setRefreshing(false);
|
|
9774
|
+
} else if (!monitorUrl) {
|
|
9775
|
+
reactToastify.toast.error("Something went wrong. Please try again or refresh the page.");
|
|
9745
9776
|
}
|
|
9746
9777
|
};
|
|
9747
9778
|
if (loading) return /* @__PURE__ */ jsxRuntime.jsx(LoadingCard, {});
|
|
@@ -10278,7 +10309,7 @@ function ListStatusPages() {
|
|
|
10278
10309
|
onClick: () => {
|
|
10279
10310
|
if (!page.is_published || !page.shareable_id) return;
|
|
10280
10311
|
window.open(
|
|
10281
|
-
`${
|
|
10312
|
+
`${STATS_PAGE_URL}/shared/${page.shareable_id}`,
|
|
10282
10313
|
"_blank",
|
|
10283
10314
|
"noopener,noreferrer"
|
|
10284
10315
|
);
|
|
@@ -13,7 +13,7 @@ const SideNav = () => {
|
|
|
13
13
|
const CustomSubNavLink = SubNavLink;
|
|
14
14
|
return /* @__PURE__ */ jsxs(SubNav, { "aria-label": "Upsnap navigation", children: [
|
|
15
15
|
/* @__PURE__ */ jsx(SubNavHeader, { label: "Upsnap" }),
|
|
16
|
-
/* @__PURE__ */ jsxs(SubNavSection, { label: "
|
|
16
|
+
/* @__PURE__ */ jsxs(SubNavSection, { label: "", children: [
|
|
17
17
|
/* @__PURE__ */ jsx(
|
|
18
18
|
CustomSubNavLink,
|
|
19
19
|
{
|
|
@@ -125,6 +125,7 @@ const PLAN_LIMITS = {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
const DASHBOARD_URL = "https://upsnap.ai";
|
|
128
|
+
const STATS_PAGE_URL = "https://stats.upsnap.ai";
|
|
128
129
|
const DEFAULT_REGION = {
|
|
129
130
|
id: "default",
|
|
130
131
|
name: "Default (Server Region)"
|
|
@@ -7843,7 +7844,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
|
|
|
7843
7844
|
}
|
|
7844
7845
|
};
|
|
7845
7846
|
const RenderHealthCard = ({ data, name }) => /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(CardContent, { paddingLeft: 1, width: "100%", children: loading === name ? /* @__PURE__ */ jsx(Loader, { small: true }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7846
|
-
/* @__PURE__ */ jsx(CardHeader, { fontSize: 3, children: formatTitleToUppercase(name) }),
|
|
7847
|
+
/* @__PURE__ */ jsx(CardHeader, { fontSize: 3, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "start", width: "100%", children: formatTitleToUppercase(name) }) }),
|
|
7847
7848
|
data && (data?.status === "error" || data?.status === "warning" ? /* @__PURE__ */ jsx(CardTitle, { marginTop: 3, fontSize: 3, children: /* @__PURE__ */ jsxs(Flex, { direction: "row", alignItems: "center", gap: 1, children: [
|
|
7848
7849
|
/* @__PURE__ */ jsxs(Box, { width: "20px", children: [
|
|
7849
7850
|
/* @__PURE__ */ jsx(
|
|
@@ -8155,7 +8156,7 @@ const IncidentsTable = ({
|
|
|
8155
8156
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Message" }) }),
|
|
8156
8157
|
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Occurred At" }) })
|
|
8157
8158
|
] }) }),
|
|
8158
|
-
/* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 6, children: /* @__PURE__ */ jsx(Typography, { children: "Loading..." }) }) }) : incidentsData?.incidents && incidentsData?.incidents?.length === 0 ? /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 6, children: /* @__PURE__ */ jsxs(
|
|
8159
|
+
/* @__PURE__ */ jsx(Tbody, { children: isLoading ? /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 6, children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Typography, { children: "Loading..." }) }) }) }) : incidentsData?.incidents && incidentsData?.incidents?.length === 0 ? /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 6, children: /* @__PURE__ */ jsxs(
|
|
8159
8160
|
Flex,
|
|
8160
8161
|
{
|
|
8161
8162
|
width: "100%",
|
|
@@ -8280,6 +8281,19 @@ function PageHeader({
|
|
|
8280
8281
|
}
|
|
8281
8282
|
);
|
|
8282
8283
|
}
|
|
8284
|
+
const LoadingCard = () => /* @__PURE__ */ jsxs(
|
|
8285
|
+
Flex,
|
|
8286
|
+
{
|
|
8287
|
+
direction: "column",
|
|
8288
|
+
justifyContent: "center",
|
|
8289
|
+
margin: 8,
|
|
8290
|
+
height: { initial: "300px", medium: "400px" },
|
|
8291
|
+
children: [
|
|
8292
|
+
/* @__PURE__ */ jsx(Loader, {}),
|
|
8293
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", children: "Loading..." })
|
|
8294
|
+
]
|
|
8295
|
+
}
|
|
8296
|
+
);
|
|
8283
8297
|
function Dashboard() {
|
|
8284
8298
|
const [monitorData, setMonitorData] = useState(null);
|
|
8285
8299
|
const [uptimeStats, setUptimeStats] = useState(null);
|
|
@@ -8305,6 +8319,7 @@ function Dashboard() {
|
|
|
8305
8319
|
}
|
|
8306
8320
|
return "default";
|
|
8307
8321
|
});
|
|
8322
|
+
const MAX_MONITOR_RETRIES = 3;
|
|
8308
8323
|
useEffect(() => {
|
|
8309
8324
|
(async () => {
|
|
8310
8325
|
const fetchedMonitorId = await getPrimaryMonitorId();
|
|
@@ -8345,17 +8360,29 @@ function Dashboard() {
|
|
|
8345
8360
|
useEffect(() => {
|
|
8346
8361
|
getRegionResponseTimeData();
|
|
8347
8362
|
}, [responseTimeData, selectedRegion]);
|
|
8348
|
-
const
|
|
8363
|
+
const fetchMonitorDataWithRetry = async (retries = MAX_MONITOR_RETRIES) => {
|
|
8364
|
+
for (let attempt = 0; attempt < retries; attempt++) {
|
|
8365
|
+
try {
|
|
8366
|
+
const res = await request(`/monitor/${monitorId}`, { method: "GET" });
|
|
8367
|
+
if (res?.monitor?.message === "Invalid authentication token") {
|
|
8368
|
+
navigate("/plugins/upsnap/settings");
|
|
8369
|
+
return null;
|
|
8370
|
+
}
|
|
8371
|
+
if (res.monitor?.data) {
|
|
8372
|
+
return res.monitor.data;
|
|
8373
|
+
}
|
|
8374
|
+
} catch (err) {
|
|
8375
|
+
}
|
|
8376
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
8377
|
+
}
|
|
8378
|
+
return null;
|
|
8379
|
+
};
|
|
8380
|
+
const handleRefresh = async () => {
|
|
8349
8381
|
const { start, end } = getRangeTimestamps(responseTimeRange || "last_24_hours");
|
|
8350
8382
|
setIsLoading(true);
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
if (res?.monitor?.message === "Invalid authentication token") {
|
|
8355
|
-
navigate("/plugins/upsnap/settings");
|
|
8356
|
-
}
|
|
8357
|
-
setMonitorData(res.monitor?.data || null);
|
|
8358
|
-
});
|
|
8383
|
+
if (!monitorId) return;
|
|
8384
|
+
const monitor = await fetchMonitorDataWithRetry();
|
|
8385
|
+
setMonitorData(monitor);
|
|
8359
8386
|
request(`/monitor/${monitorId}/uptime-stats?region=${selectedRegion}`, {
|
|
8360
8387
|
method: "GET"
|
|
8361
8388
|
}).then((res) => {
|
|
@@ -8381,7 +8408,7 @@ function Dashboard() {
|
|
|
8381
8408
|
setMonitorIncidents(res.incidentsData?.data || null);
|
|
8382
8409
|
});
|
|
8383
8410
|
};
|
|
8384
|
-
return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */
|
|
8411
|
+
return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */ jsx(Box, { padding: 1, children: !monitorData || isLoading ? /* @__PURE__ */ jsx(LoadingCard, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8385
8412
|
/* @__PURE__ */ jsx(
|
|
8386
8413
|
PageHeader,
|
|
8387
8414
|
{
|
|
@@ -8407,26 +8434,36 @@ function Dashboard() {
|
|
|
8407
8434
|
alignItems: "start",
|
|
8408
8435
|
style: { alignContent: "space-around", justifyItems: "stretch" },
|
|
8409
8436
|
children: [
|
|
8410
|
-
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8437
|
+
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(
|
|
8438
|
+
Flex,
|
|
8439
|
+
{
|
|
8440
|
+
direction: "column",
|
|
8441
|
+
gap: 4,
|
|
8442
|
+
height: "100%",
|
|
8443
|
+
alignItems: "start",
|
|
8444
|
+
style: { flexWrap: "wrap" },
|
|
8445
|
+
children: [
|
|
8446
|
+
/* @__PURE__ */ jsx(
|
|
8447
|
+
StatisticsCards,
|
|
8448
|
+
{
|
|
8449
|
+
monitorData,
|
|
8450
|
+
uptimeStats,
|
|
8451
|
+
histogramData,
|
|
8452
|
+
isLoading
|
|
8453
|
+
}
|
|
8454
|
+
),
|
|
8455
|
+
/* @__PURE__ */ jsx(
|
|
8456
|
+
ResponseTimeChart,
|
|
8457
|
+
{
|
|
8458
|
+
monitor: monitorData?.monitor,
|
|
8459
|
+
regionResponseTimeData,
|
|
8460
|
+
timeRange: responseTimeRange || "last_24_hours",
|
|
8461
|
+
onTimeRangeChange: handleTimeRangeChange
|
|
8462
|
+
}
|
|
8463
|
+
)
|
|
8464
|
+
]
|
|
8465
|
+
}
|
|
8466
|
+
) }),
|
|
8430
8467
|
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsx(HealthCards, { monitorData, isLoading }) })
|
|
8431
8468
|
]
|
|
8432
8469
|
}
|
|
@@ -8439,7 +8476,7 @@ function Dashboard() {
|
|
|
8439
8476
|
isLoading
|
|
8440
8477
|
}
|
|
8441
8478
|
)
|
|
8442
|
-
] }) });
|
|
8479
|
+
] }) }) });
|
|
8443
8480
|
}
|
|
8444
8481
|
const DetailRow = ({ label, value, isUrl = false, isChip = false }) => {
|
|
8445
8482
|
const renderValue = () => {
|
|
@@ -8528,19 +8565,6 @@ const StatusCard = ({ status, message, error, cardData }) => {
|
|
|
8528
8565
|
}
|
|
8529
8566
|
) }) }) }) });
|
|
8530
8567
|
};
|
|
8531
|
-
const LoadingCard = () => /* @__PURE__ */ jsxs(
|
|
8532
|
-
Flex,
|
|
8533
|
-
{
|
|
8534
|
-
direction: "column",
|
|
8535
|
-
justifyContent: "center",
|
|
8536
|
-
margin: 8,
|
|
8537
|
-
height: { initial: "300px", medium: "400px" },
|
|
8538
|
-
children: [
|
|
8539
|
-
/* @__PURE__ */ jsx(Loader, {}),
|
|
8540
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", children: "Loading..." })
|
|
8541
|
-
]
|
|
8542
|
-
}
|
|
8543
|
-
);
|
|
8544
8568
|
function RegionWiseCards({
|
|
8545
8569
|
regions,
|
|
8546
8570
|
regionNames,
|
|
@@ -8743,20 +8767,23 @@ const RegionResponseTimeChart = ({
|
|
|
8743
8767
|
}
|
|
8744
8768
|
};
|
|
8745
8769
|
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
8746
|
-
/* @__PURE__ */ jsxs(CardHeader, { display: "flex",
|
|
8747
|
-
/* @__PURE__ */
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8770
|
+
/* @__PURE__ */ jsxs(CardHeader, { display: "flex", direction: "column", gap: 1, children: [
|
|
8771
|
+
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", width: "100%", children: [
|
|
8772
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", marginLeft: 2, padding: 3, children: "Response Time" }),
|
|
8773
|
+
/* @__PURE__ */ jsx(Box, { padding: 3, style: { minWidth: 200 }, children: /* @__PURE__ */ jsx(
|
|
8774
|
+
SingleSelect,
|
|
8775
|
+
{
|
|
8776
|
+
value: timeRange,
|
|
8777
|
+
onChange: onTimeRangeChange,
|
|
8778
|
+
disabled: monitor?.is_enabled === false,
|
|
8779
|
+
children: timeRanges.map((tr) => /* @__PURE__ */ jsx(SingleSelectOption, { value: tr.value, children: tr.label }, tr.value))
|
|
8780
|
+
}
|
|
8781
|
+
) })
|
|
8782
|
+
] }),
|
|
8783
|
+
visibleSeries.size === 0 && /* @__PURE__ */ jsx(Box, { padding: 4, background: "neutral100", marginTop: 1, width: "100%", marginBottom: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "No regions selected. Please select at least one region to view response time results." }) })
|
|
8757
8784
|
] }),
|
|
8758
8785
|
/* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsxs(CardContent, { style: { width: "100%" }, children: [
|
|
8759
|
-
monitor?.is_enabled === false ? /* @__PURE__ */ jsx(Box, { padding: 4, background: "neutral100", children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "Monitoring is Paused. Enable monitoring to see response time results." }) }) :
|
|
8786
|
+
monitor?.is_enabled === false ? /* @__PURE__ */ jsx(Box, { padding: 4, background: "neutral100", children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: "Monitoring is Paused. Enable monitoring to see response time results." }) }) : /* @__PURE__ */ jsx(Chart, { type: "area", height: 350, series, options: chartOptions }),
|
|
8760
8787
|
/* @__PURE__ */ jsxs(
|
|
8761
8788
|
Flex,
|
|
8762
8789
|
{
|
|
@@ -9719,6 +9746,7 @@ function Lighthouse() {
|
|
|
9719
9746
|
data: { monitorUrl: url, strategy: selectedStrategy, force_fetch: forceFetch }
|
|
9720
9747
|
});
|
|
9721
9748
|
setData(res?.lighthouseHealthCheckData || null);
|
|
9749
|
+
return;
|
|
9722
9750
|
} catch (err) {
|
|
9723
9751
|
setData(null);
|
|
9724
9752
|
} finally {
|
|
@@ -9731,10 +9759,13 @@ function Lighthouse() {
|
|
|
9731
9759
|
}
|
|
9732
9760
|
}, [monitorUrl, strategy]);
|
|
9733
9761
|
const handleRefresh = async () => {
|
|
9762
|
+
let url = monitorUrl || selectedMonitor?.monitor?.config?.meta?.url || "";
|
|
9734
9763
|
if (monitorUrl) {
|
|
9735
9764
|
setRefreshing(true);
|
|
9736
|
-
await getLighthouseData(strategy,
|
|
9765
|
+
await getLighthouseData(strategy, url, true);
|
|
9737
9766
|
setRefreshing(false);
|
|
9767
|
+
} else if (!monitorUrl) {
|
|
9768
|
+
toast.error("Something went wrong. Please try again or refresh the page.");
|
|
9738
9769
|
}
|
|
9739
9770
|
};
|
|
9740
9771
|
if (loading) return /* @__PURE__ */ jsx(LoadingCard, {});
|
|
@@ -10271,7 +10302,7 @@ function ListStatusPages() {
|
|
|
10271
10302
|
onClick: () => {
|
|
10272
10303
|
if (!page.is_published || !page.shareable_id) return;
|
|
10273
10304
|
window.open(
|
|
10274
|
-
`${
|
|
10305
|
+
`${STATS_PAGE_URL}/shared/${page.shareable_id}`,
|
|
10275
10306
|
"_blank",
|
|
10276
10307
|
"noopener,noreferrer"
|
|
10277
10308
|
);
|
package/dist/admin/index.js
CHANGED
|
@@ -35,10 +35,10 @@ const index = {
|
|
|
35
35
|
icon: PluginIcon,
|
|
36
36
|
intlLabel: {
|
|
37
37
|
id: `${PLUGIN_ID}.plugin.name`,
|
|
38
|
-
defaultMessage: PLUGIN_ID
|
|
38
|
+
defaultMessage: PLUGIN_ID.slice(0, 1).toUpperCase() + PLUGIN_ID.slice(1)
|
|
39
39
|
},
|
|
40
40
|
Component: async () => {
|
|
41
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
41
|
+
const { App } = await Promise.resolve().then(() => require("./App-Bo_F3q6I.js"));
|
|
42
42
|
return App;
|
|
43
43
|
}
|
|
44
44
|
});
|
package/dist/admin/index.mjs
CHANGED
|
@@ -33,10 +33,10 @@ const index = {
|
|
|
33
33
|
icon: PluginIcon,
|
|
34
34
|
intlLabel: {
|
|
35
35
|
id: `${PLUGIN_ID}.plugin.name`,
|
|
36
|
-
defaultMessage: PLUGIN_ID
|
|
36
|
+
defaultMessage: PLUGIN_ID.slice(0, 1).toUpperCase() + PLUGIN_ID.slice(1)
|
|
37
37
|
},
|
|
38
38
|
Component: async () => {
|
|
39
|
-
const { App } = await import("./App-
|
|
39
|
+
const { App } = await import("./App-DQN0F1ZK.mjs");
|
|
40
40
|
return App;
|
|
41
41
|
}
|
|
42
42
|
});
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.6",
|
|
3
3
|
"repository": {
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/Appfoster/upsnap-strapi"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"kind": "plugin",
|
|
68
68
|
"name": "upsnap",
|
|
69
69
|
"displayName": "Upsnap",
|
|
70
|
-
"description": "
|
|
70
|
+
"description": "Complete website health monitoring for Strapi, including uptime, SSL certificates, broken links, performance metrics, domain health, and mixed content issues."
|
|
71
71
|
},
|
|
72
72
|
"name": "@upsnap/strapi",
|
|
73
73
|
"description": "Complete website health monitoring for Strapi, including uptime, SSL certificates, broken links, performance metrics, domain health, and mixed content issues.",
|