mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
chore: Update ProbeStatusElement component to use connectionStatus field
This commit updates the ProbeStatusElement component to use the new connectionStatus field from the Probe model. The component previously relied on the lastAlive field to determine the probe's connection status, but now it directly checks the connectionStatus field. This change ensures that the component accurately reflects the probe's current connection status, improving the reliability of the application.
This commit is contained in:
@@ -61,6 +61,10 @@ import QueueWorker from "CommonServer/Infrastructure/QueueWorker";
|
||||
import FeatureSet from "CommonServer/Types/FeatureSet";
|
||||
import logger from "CommonServer/Utils/Logger";
|
||||
|
||||
// Probes
|
||||
import "./Jobs/Probe/SendOwnerAddedNotification";
|
||||
import "./Jobs/Probe/UpdateConnectionStatus";
|
||||
|
||||
const WorkersFeatureSet: FeatureSet = {
|
||||
init: async (): Promise<void> => {
|
||||
try {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Green, Red } from "Common/Types/BrandColors";
|
||||
import OneUptimeDate from "Common/Types/Date";
|
||||
import { JSONObject } from "Common/Types/JSON";
|
||||
import Statusbubble from "CommonUI/src/Components/StatusBubble/StatusBubble";
|
||||
import Probe from "Model/Models/Probe";
|
||||
import Probe, { ProbeConnectionStatus } from "Model/Models/Probe";
|
||||
import React, { FunctionComponent, ReactElement } from "react";
|
||||
|
||||
export interface ComponentProps {
|
||||
@@ -14,11 +13,7 @@ const ProbeStatusElement: FunctionComponent<ComponentProps> = (
|
||||
): ReactElement => {
|
||||
if (
|
||||
props.probe &&
|
||||
props.probe["lastAlive"] &&
|
||||
OneUptimeDate.getNumberOfMinutesBetweenDates(
|
||||
OneUptimeDate.fromString(props.probe["lastAlive"] as string),
|
||||
OneUptimeDate.getCurrentDate(),
|
||||
) < 5
|
||||
props.probe["connectionStatus"] === ProbeConnectionStatus.Connected
|
||||
) {
|
||||
return (
|
||||
<Statusbubble text={"Connected"} color={Green} shouldAnimate={true} />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import DisabledWarning from "../../../Components/Monitor/DisabledWarning";
|
||||
import ProbeStatusElement from "../../../Components/Probe/ProbeConnectionStatus";
|
||||
import ProbeStatusElement from "../../../Components/Probe/ProbeStatus";
|
||||
import DashboardNavigation from "../../../Utils/Navigation";
|
||||
import ProbeUtil from "../../../Utils/Probe";
|
||||
import PageComponentProps from "../../PageComponentProps";
|
||||
@@ -228,7 +228,7 @@ const MonitorProbes: FunctionComponent<
|
||||
{
|
||||
field: {
|
||||
probe: {
|
||||
lastAlive: true,
|
||||
connectionStatus: true,
|
||||
},
|
||||
},
|
||||
title: "Probe Status",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import ProbeStatusElement from "../../Components/Probe/ProbeConnectionStatus";
|
||||
import ProbeStatusElement from "../../Components/Probe/ProbeStatus";
|
||||
import DashboardNavigation from "../../Utils/Navigation";
|
||||
import PageComponentProps from "../PageComponentProps";
|
||||
import Route from "Common/Types/API/Route";
|
||||
@@ -90,7 +90,7 @@ const ProbePage: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
},
|
||||
{
|
||||
field: {
|
||||
lastAlive: true,
|
||||
connectionStatus: true,
|
||||
},
|
||||
title: "Probe Status",
|
||||
type: FieldType.Text,
|
||||
|
||||
Reference in New Issue
Block a user