From da5cc1877de84ef08ee8bf48f6d921c5306c5825 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Fri, 20 Mar 2026 19:00:45 +0000 Subject: [PATCH 1/3] refactor(monitor): remove unused Kubernetes form mode state and related logic --- .../KubernetesSimplifiedCriteriaForm.tsx | 388 ------------------ .../Components/Form/Monitor/MonitorStep.tsx | 6 - 2 files changed, 394 deletions(-) delete mode 100644 App/FeatureSet/Dashboard/src/Components/Form/Monitor/KubernetesMonitor/KubernetesSimplifiedCriteriaForm.tsx diff --git a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/KubernetesMonitor/KubernetesSimplifiedCriteriaForm.tsx b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/KubernetesMonitor/KubernetesSimplifiedCriteriaForm.tsx deleted file mode 100644 index 76868b4125..0000000000 --- a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/KubernetesMonitor/KubernetesSimplifiedCriteriaForm.tsx +++ /dev/null @@ -1,388 +0,0 @@ -import React, { - FunctionComponent, - ReactElement, - useEffect, - useState, -} from "react"; -import MonitorCriteria from "Common/Types/Monitor/MonitorCriteria"; -import MonitorCriteriaInstance from "Common/Types/Monitor/MonitorCriteriaInstance"; -import { - FilterType, - CriteriaFilterUtil, -} from "Common/Types/Monitor/CriteriaFilter"; -import { - buildOfflineCriteriaInstance, - buildOnlineCriteriaInstance, -} from "Common/Types/Monitor/KubernetesAlertTemplates"; -import ObjectID from "Common/Types/ObjectID"; -import Dropdown, { - DropdownOption, - DropdownValue, -} from "Common/UI/Components/Dropdown/Dropdown"; -import { InputType } from "Common/UI/Components/Input/Input"; -import Input from "Common/UI/Components/Input/Input"; -import FieldLabelElement from "Common/UI/Components/Forms/Fields/FieldLabel"; -import Toggle from "Common/UI/Components/Toggle/Toggle"; - -export interface ComponentProps { - metricAlias: string; - monitorName: string; - monitorStatusDropdownOptions: Array; - incidentSeverityDropdownOptions: Array; - alertSeverityDropdownOptions: Array; - onCallPolicyDropdownOptions: Array; - value?: MonitorCriteria | undefined; - onChange: (value: MonitorCriteria) => void; -} - -const operatorOptions: Array = [ - { label: "> Greater Than", value: FilterType.GreaterThan }, - { label: "< Less Than", value: FilterType.LessThan }, - { label: ">= Greater Than or Equal", value: FilterType.GreaterThanOrEqualTo }, - { label: "<= Less Than or Equal", value: FilterType.LessThanOrEqualTo }, - { label: "= Equal To", value: FilterType.EqualTo }, -]; - -function extractStateFromCriteria(criteria: MonitorCriteria | undefined): { - filterType: FilterType; - thresholdValue: number; - alertSeverityId: string; - incidentSeverityId: string; - autoResolve: boolean; - alertOnCallPolicyIds: Array; - incidentOnCallPolicyIds: Array; -} { - const defaults = { - filterType: FilterType.GreaterThan, - thresholdValue: 0, - alertSeverityId: "", - incidentSeverityId: "", - autoResolve: true, - alertOnCallPolicyIds: [] as Array, - incidentOnCallPolicyIds: [] as Array, - }; - - if (!criteria?.data?.monitorCriteriaInstanceArray?.length) { - return defaults; - } - - // Extract from the first criteria instance (the "unhealthy" one) - const firstInstance: MonitorCriteriaInstance | undefined = - criteria.data.monitorCriteriaInstanceArray[0]; - - if (!firstInstance?.data) { - return defaults; - } - - const firstFilter = firstInstance.data.filters?.[0]; - if (firstFilter) { - defaults.filterType = firstFilter.filterType || FilterType.GreaterThan; - defaults.thresholdValue = - typeof firstFilter.value === "number" - ? firstFilter.value - : parseFloat(String(firstFilter.value)) || 0; - } - - if (firstInstance.data.alerts?.length) { - const alert = firstInstance.data.alerts[0]; - if (alert) { - defaults.alertSeverityId = alert.alertSeverityId?.toString() || ""; - defaults.autoResolve = alert.autoResolveAlert !== false; - defaults.alertOnCallPolicyIds = - alert.onCallPolicyIds?.map((id: ObjectID) => id.toString()) || []; - } - } - - if (firstInstance.data.incidents?.length) { - const incident = firstInstance.data.incidents[0]; - if (incident) { - defaults.incidentSeverityId = - incident.incidentSeverityId?.toString() || ""; - defaults.incidentOnCallPolicyIds = - incident.onCallPolicyIds?.map((id: ObjectID) => id.toString()) || []; - } - } - - return defaults; -} - -const KubernetesSimplifiedCriteriaForm: FunctionComponent = ( - props: ComponentProps, -): ReactElement => { - const initialState = extractStateFromCriteria(props.value); - - const [filterType, setFilterType] = useState( - initialState.filterType, - ); - const [thresholdValue, setThresholdValue] = useState( - initialState.thresholdValue, - ); - const [alertSeverityId, setAlertSeverityId] = useState( - initialState.alertSeverityId || - (props.alertSeverityDropdownOptions[0]?.value?.toString() || ""), - ); - const [incidentSeverityId, setIncidentSeverityId] = useState( - initialState.incidentSeverityId || - (props.incidentSeverityDropdownOptions[0]?.value?.toString() || ""), - ); - const [autoResolve, setAutoResolve] = useState( - initialState.autoResolve, - ); - const [alertOnCallPolicyIds, setAlertOnCallPolicyIds] = useState< - Array - >(initialState.alertOnCallPolicyIds); - const [incidentOnCallPolicyIds, setIncidentOnCallPolicyIds] = useState< - Array - >(initialState.incidentOnCallPolicyIds); - - // Find online/offline status IDs from monitor status options - const offlineMonitorStatusId: ObjectID = new ObjectID( - props.monitorStatusDropdownOptions.length >= 2 - ? (props.monitorStatusDropdownOptions[1]?.value?.toString() || "") - : (props.monitorStatusDropdownOptions[0]?.value?.toString() || ""), - ); - - const onlineMonitorStatusId: ObjectID = new ObjectID( - props.monitorStatusDropdownOptions[0]?.value?.toString() || "", - ); - - const buildAndEmitCriteria = (): void => { - if (!props.metricAlias) { - return; - } - - const inverseFilterType: FilterType = - CriteriaFilterUtil.getInverseFilterType(filterType); - - const offlineInstance: MonitorCriteriaInstance = - buildOfflineCriteriaInstance({ - offlineMonitorStatusId, - incidentSeverityId: new ObjectID(incidentSeverityId), - alertSeverityId: new ObjectID(alertSeverityId), - monitorName: props.monitorName || "Kubernetes Monitor", - metricAlias: props.metricAlias, - filterType: filterType, - value: thresholdValue, - }); - - // Set auto-resolve and on-call policies on alerts and incidents - if (offlineInstance.data?.alerts) { - for (const alert of offlineInstance.data.alerts) { - alert.autoResolveAlert = autoResolve; - alert.onCallPolicyIds = alertOnCallPolicyIds.map( - (id: string) => new ObjectID(id), - ); - } - } - if (offlineInstance.data?.incidents) { - for (const incident of offlineInstance.data.incidents) { - incident.autoResolveIncident = autoResolve; - incident.onCallPolicyIds = incidentOnCallPolicyIds.map( - (id: string) => new ObjectID(id), - ); - } - } - - const onlineInstance: MonitorCriteriaInstance = buildOnlineCriteriaInstance({ - onlineMonitorStatusId, - metricAlias: props.metricAlias, - filterType: inverseFilterType, - value: thresholdValue, - }); - - const monitorCriteria: MonitorCriteria = new MonitorCriteria(); - monitorCriteria.data = { - monitorCriteriaInstanceArray: [offlineInstance, onlineInstance], - }; - - props.onChange(monitorCriteria); - }; - - useEffect(() => { - buildAndEmitCriteria(); - }, [ - filterType, - thresholdValue, - alertSeverityId, - incidentSeverityId, - autoResolve, - alertOnCallPolicyIds, - incidentOnCallPolicyIds, - props.metricAlias, - props.monitorName, - ]); - - return ( -
-

- Configure when this monitor should trigger an alert. The recovery - criteria will be auto-generated with the inverse condition. -

- - {/* Threshold Row */} -
- -
-
- o.value === filterType, - )} - onChange={( - value: DropdownValue | Array | null, - ) => { - setFilterType( - (value as FilterType) || FilterType.GreaterThan, - ); - }} - placeholder="Select operator..." - /> -
-
- { - setThresholdValue(parseFloat(value) || 0); - }} - placeholder="Threshold" - /> -
-
-
- - {/* Alert Severity */} -
- - o.value?.toString() === alertSeverityId, - )} - onChange={(value: DropdownValue | Array | null) => { - setAlertSeverityId(value?.toString() || ""); - }} - placeholder="Select alert severity..." - /> -
- - {/* Incident Severity */} -
- - o.value?.toString() === incidentSeverityId, - )} - onChange={(value: DropdownValue | Array | null) => { - setIncidentSeverityId(value?.toString() || ""); - }} - placeholder="Select incident severity..." - /> -
- - {/* Alert On-Call Policy */} -
- - - alertOnCallPolicyIds.includes(o.value?.toString() || ""), - )} - onChange={( - value: DropdownValue | Array | null, - ) => { - if (Array.isArray(value)) { - setAlertOnCallPolicyIds( - value.map((v: DropdownValue) => v.toString()), - ); - } else if (value) { - setAlertOnCallPolicyIds([value.toString()]); - } else { - setAlertOnCallPolicyIds([]); - } - }} - isMultiSelect={true} - placeholder="Select on-call policies..." - /> -
- - {/* Incident On-Call Policy */} -
- - - incidentOnCallPolicyIds.includes(o.value?.toString() || ""), - )} - onChange={( - value: DropdownValue | Array | null, - ) => { - if (Array.isArray(value)) { - setIncidentOnCallPolicyIds( - value.map((v: DropdownValue) => v.toString()), - ); - } else if (value) { - setIncidentOnCallPolicyIds([value.toString()]); - } else { - setIncidentOnCallPolicyIds([]); - } - }} - isMultiSelect={true} - placeholder="Select on-call policies..." - /> -
- - {/* Auto-Resolve */} -
- { - setAutoResolve(value); - }} - /> -
- - {/* Summary */} -
-

- Summary: This monitor will create an alert and - incident when the metric is{" "} - - {operatorOptions.find((o: DropdownOption) => o.value === filterType) - ?.label || filterType}{" "} - {thresholdValue} - - , and auto-recover when the condition clears. -

-
-
- ); -}; - -export default KubernetesSimplifiedCriteriaForm; diff --git a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorStep.tsx b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorStep.tsx index 4993f7019f..a2ba5e2690 100644 --- a/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorStep.tsx +++ b/App/FeatureSet/Dashboard/src/Components/Form/Monitor/MonitorStep.tsx @@ -68,7 +68,6 @@ import MonitorStepMetricMonitor, { MonitorStepMetricMonitorUtil, } from "Common/Types/Monitor/MonitorStepMetricMonitor"; import KubernetesMonitorStepForm from "./KubernetesMonitor/KubernetesMonitorStepForm"; -import { KubernetesFormMode } from "./KubernetesMonitor/KubernetesMonitorStepForm"; import MonitorStepKubernetesMonitor, { MonitorStepKubernetesMonitorUtil, } from "Common/Types/Monitor/MonitorStepKubernetesMonitor"; @@ -134,8 +133,6 @@ const MonitorStepElement: FunctionComponent = ( const [error, setError] = useState(""); const [isLoading, setIsLoading] = useState(true); - const [kubernetesFormMode, setKubernetesFormMode] = - useState("quick"); const fetchLogAttributes: PromiseVoidFunction = async (): Promise => { const attributeRepsonse: HTTPResponse | HTTPErrorResponse = @@ -764,9 +761,6 @@ return { monitorStep.setKubernetesMonitor(value); props.onChange?.(MonitorStep.clone(monitorStep)); }} - onModeChange={(mode: KubernetesFormMode) => { - setKubernetesFormMode(mode); - }} /> )} From e383a32e6e9ec175f46330ea8c24c281820814b2 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Sun, 22 Mar 2026 10:14:20 +0000 Subject: [PATCH 2/3] fix(docs): update OneUptime Helm repository URL in installation scripts --- .../src/Pages/Kubernetes/Utils/DocumentationMarkdown.ts | 2 +- HelmChart/Public/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/App/FeatureSet/Dashboard/src/Pages/Kubernetes/Utils/DocumentationMarkdown.ts b/App/FeatureSet/Dashboard/src/Pages/Kubernetes/Utils/DocumentationMarkdown.ts index 4ca61bf086..009f0bde4b 100644 --- a/App/FeatureSet/Dashboard/src/Pages/Kubernetes/Utils/DocumentationMarkdown.ts +++ b/App/FeatureSet/Dashboard/src/Pages/Kubernetes/Utils/DocumentationMarkdown.ts @@ -19,7 +19,7 @@ export function getKubernetesInstallationMarkdown( ## Step 1: Add the OneUptime Helm Repository \`\`\`bash -helm repo add oneuptime https://helm.oneuptime.com +helm repo add oneuptime https://helm-chart.oneuptime.com helm repo update \`\`\` diff --git a/HelmChart/Public/install.sh b/HelmChart/Public/install.sh index 3fa155dfa3..e52a097517 100755 --- a/HelmChart/Public/install.sh +++ b/HelmChart/Public/install.sh @@ -164,7 +164,7 @@ then exit 0 fi -# Install cluster with Helm. +# Install cluster with helm-chart. sudo helm repo add oneuptime https://oneuptime.com/chart || echo "OneUptime already added" sudo helm repo update From 910d7d00669cf7990fbaa93340be67001c810c16 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Mon, 23 Mar 2026 10:11:25 +0000 Subject: [PATCH 3/3] fix(cron): update condition for enabling e2e cron job --- HelmChart/Public/oneuptime/templates/e2e-cron.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HelmChart/Public/oneuptime/templates/e2e-cron.yml b/HelmChart/Public/oneuptime/templates/e2e-cron.yml index aa2479ffbf..3aced79f97 100644 --- a/HelmChart/Public/oneuptime/templates/e2e-cron.yml +++ b/HelmChart/Public/oneuptime/templates/e2e-cron.yml @@ -1,5 +1,5 @@ -{{- if $.Values.cronJobs.e2e.enabled }} +{{- if and $.Values.cronJobs.e2e.enabled (not $.Values.deployment.disableDeployments) }} apiVersion: batch/v1 kind: CronJob