mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
Refactor SideMenu component in Settings page
This commit is contained in:
parent
b5596968a5
commit
54cd18896a
@ -55,8 +55,6 @@ export default class MonitorResourceUtil {
|
||||
public static async monitorResource(
|
||||
dataToProcess: DataToProcess,
|
||||
): Promise<ProbeApiIngestResponse> {
|
||||
debugger;
|
||||
|
||||
let response: ProbeApiIngestResponse = {
|
||||
monitorId: dataToProcess.monitorId,
|
||||
criteriaMetId: undefined,
|
||||
@ -432,40 +430,37 @@ export default class MonitorResourceUtil {
|
||||
);
|
||||
}
|
||||
|
||||
const monitorStatusTimeline: MonitorStatusTimeline | null =
|
||||
await MonitorStatusTimelineUtil.getNewMonitorStatusTimeline({
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
dataToProcess: dataToProcess,
|
||||
criteriaInstance: criteriaInstanceMap[response.criteriaMetId!]!,
|
||||
props: {
|
||||
telemetryQuery: telemetryQuery,
|
||||
},
|
||||
});
|
||||
await MonitorStatusTimelineUtil.updateMonitorStatusTimeline({
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
dataToProcess: dataToProcess,
|
||||
criteriaInstance: criteriaInstanceMap[response.criteriaMetId!]!,
|
||||
props: {
|
||||
telemetryQuery: telemetryQuery,
|
||||
},
|
||||
});
|
||||
|
||||
if (monitorStatusTimeline) {
|
||||
await MonitorIncident.criteriaMetCreateIncidentsAndUpdateMonitorStatus({
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
dataToProcess: dataToProcess,
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary,
|
||||
criteriaInstance: criteriaInstanceMap[response.criteriaMetId!]!,
|
||||
props: {
|
||||
telemetryQuery: telemetryQuery,
|
||||
},
|
||||
});
|
||||
await MonitorIncident.criteriaMetCreateIncidentsAndUpdateMonitorStatus({
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
dataToProcess: dataToProcess,
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary,
|
||||
criteriaInstance: criteriaInstanceMap[response.criteriaMetId!]!,
|
||||
props: {
|
||||
telemetryQuery: telemetryQuery,
|
||||
},
|
||||
});
|
||||
|
||||
await MonitorAlert.criteriaMetCreateAlertsAndUpdateMonitorStatus({
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
dataToProcess: dataToProcess,
|
||||
autoResolveCriteriaInstanceIdAlertIdsDictionary,
|
||||
criteriaInstance: criteriaInstanceAlertMap[response.criteriaMetId!]!,
|
||||
props: {
|
||||
telemetryQuery: telemetryQuery,
|
||||
},
|
||||
});
|
||||
}
|
||||
await MonitorAlert.criteriaMetCreateAlertsAndUpdateMonitorStatus({
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
dataToProcess: dataToProcess,
|
||||
autoResolveCriteriaInstanceIdAlertIdsDictionary,
|
||||
criteriaInstance: criteriaInstanceAlertMap[response.criteriaMetId!]!,
|
||||
props: {
|
||||
telemetryQuery: telemetryQuery,
|
||||
},
|
||||
});
|
||||
} else if (
|
||||
!response.criteriaMetId &&
|
||||
monitorSteps.data.defaultMonitorStatusId &&
|
||||
|
@ -10,7 +10,7 @@ import logger from "../Logger";
|
||||
import DataToProcess from "./DataToProcess";
|
||||
|
||||
export default class MonitorStatusTimelineUtil {
|
||||
public static async getNewMonitorStatusTimeline(input: {
|
||||
public static async updateMonitorStatusTimeline(input: {
|
||||
criteriaInstance: MonitorCriteriaInstance;
|
||||
monitor: Monitor;
|
||||
dataToProcess: DataToProcess;
|
||||
|
@ -66,9 +66,7 @@ const AlertsTable: FunctionComponent<ComponentProps> = (
|
||||
noItemsMessage={props.noItemsMessage || "No alerts found."}
|
||||
showRefreshButton={true}
|
||||
showViewIdButton={true}
|
||||
viewPageRoute={RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.ALERTS]!,
|
||||
)}
|
||||
viewPageRoute={RouteUtil.populateRouteParams(RouteMap[PageMap.ALERTS]!)}
|
||||
filters={[
|
||||
{
|
||||
title: "Alert ID",
|
||||
|
@ -21,9 +21,9 @@ const AlertNoteTemplates: FunctionComponent<PageComponentProps> = (
|
||||
isCreateable={true}
|
||||
isViewable={true}
|
||||
cardProps={{
|
||||
title: "Public or Private Note Templates for Alerts",
|
||||
title: "Private Note Templates for Alerts",
|
||||
description:
|
||||
"Here is a list of all the public and private note templates for alerts.",
|
||||
"Here is a list of all the private note templates for alerts.",
|
||||
}}
|
||||
noItemsMessage={"No note templates found."}
|
||||
query={{
|
||||
|
@ -11,9 +11,7 @@ import Navigation from "Common/UI/Utils/Navigation";
|
||||
import AlertState from "Common/Models/DatabaseModels/AlertState";
|
||||
import React, { Fragment, FunctionComponent, ReactElement } from "react";
|
||||
|
||||
const AlertsPage: FunctionComponent<
|
||||
PageComponentProps
|
||||
> = (): ReactElement => {
|
||||
const AlertsPage: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
return (
|
||||
<Fragment>
|
||||
<ModelTable<AlertState>
|
||||
|
@ -160,7 +160,7 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
|
||||
}}
|
||||
icon={IconProp.Alert}
|
||||
/>
|
||||
|
||||
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: "Note Templates",
|
||||
|
@ -93,20 +93,16 @@ const SettingsMonitors: LazyExoticComponent<FunctionComponent<ComponentProps>> =
|
||||
return import("../Pages/Settings/MonitorStatus");
|
||||
});
|
||||
|
||||
|
||||
const SettingsIncidents: LazyExoticComponent<
|
||||
const SettingsIncidents: LazyExoticComponent<
|
||||
FunctionComponent<ComponentProps>
|
||||
> = lazy(() => {
|
||||
return import("../Pages/Settings/IncidentState");
|
||||
});
|
||||
|
||||
|
||||
const SettingsAlerts: LazyExoticComponent<
|
||||
FunctionComponent<ComponentProps>
|
||||
> = lazy(() => {
|
||||
return import("../Pages/Settings/AlertState");
|
||||
});
|
||||
|
||||
const SettingsAlerts: LazyExoticComponent<FunctionComponent<ComponentProps>> =
|
||||
lazy(() => {
|
||||
return import("../Pages/Settings/AlertState");
|
||||
});
|
||||
|
||||
const SettingsAlertSeverity: LazyExoticComponent<
|
||||
FunctionComponent<ComponentProps>
|
||||
@ -120,7 +116,6 @@ const AlertCustomFields: LazyExoticComponent<
|
||||
return import("../Pages/Settings/AlertCustomFields");
|
||||
});
|
||||
|
||||
|
||||
const AlertNoteTemplates: LazyExoticComponent<
|
||||
FunctionComponent<ComponentProps>
|
||||
> = lazy(() => {
|
||||
@ -227,7 +222,6 @@ const ScheduledMaintenanceCustomFields: LazyExoticComponent<
|
||||
return import("../Pages/Settings/ScheduledMaintenanceCusomFields");
|
||||
});
|
||||
|
||||
|
||||
const ScheduledMaintenanceNoteTemplates: LazyExoticComponent<
|
||||
FunctionComponent<ComponentProps>
|
||||
> = lazy(() => {
|
||||
@ -293,8 +287,6 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(
|
||||
PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW,
|
||||
@ -389,8 +381,7 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(
|
||||
PageMap.SETTINGS_ALERT_NOTE_TEMPLATES,
|
||||
)}
|
||||
@ -425,7 +416,7 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(
|
||||
PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW,
|
||||
2,
|
||||
@ -435,9 +426,7 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
<AlertNoteTemplateView
|
||||
{...props}
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW
|
||||
] as Route
|
||||
RouteMap[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW] as Route
|
||||
}
|
||||
/>
|
||||
</Suspense>
|
||||
@ -545,8 +534,7 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(PageMap.SETTINGS_ALERTS_STATE)}
|
||||
element={
|
||||
<Suspense fallback={Loader}>
|
||||
@ -604,18 +592,13 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(
|
||||
PageMap.SETTINGS_ALERTS_SEVERITY,
|
||||
)}
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(PageMap.SETTINGS_ALERTS_SEVERITY)}
|
||||
element={
|
||||
<Suspense fallback={Loader}>
|
||||
<SettingsAlertSeverity
|
||||
{...props}
|
||||
pageRoute={
|
||||
RouteMap[PageMap.SETTINGS_ALERTS_SEVERITY] as Route
|
||||
}
|
||||
pageRoute={RouteMap[PageMap.SETTINGS_ALERTS_SEVERITY] as Route}
|
||||
/>
|
||||
</Suspense>
|
||||
}
|
||||
@ -770,8 +753,7 @@ const SettingsRoutes: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
<PageRoute
|
||||
path={RouteUtil.getLastPathForKey(
|
||||
PageMap.SETTINGS_ALERT_CUSTOM_FIELDS,
|
||||
)}
|
||||
|
@ -176,7 +176,18 @@ export const SettingsRoutePath: Dictionary<string> = {
|
||||
[PageMap.SETTINGS_MONITOR_SECRETS]: "monitor-secrets",
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS]: "incident-custom-fields",
|
||||
[PageMap.SETTINGS_INCIDENTS_STATE]: "incidents-state",
|
||||
[PageMap.SETTINGS_INCIDENTS_SEVERITY]: "incidents-severity",
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES]: "incident-templates",
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW]: `incident-templates/${RouteParams.ModelID}`,
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES]: "incident-note-templates",
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW]: `incident-note-templates/${RouteParams.ModelID}`,
|
||||
|
||||
[PageMap.SETTINGS_ALERT_CUSTOM_FIELDS]: "alert-custom-fields",
|
||||
[PageMap.SETTINGS_ALERTS_STATE]: "alerts-state",
|
||||
[PageMap.SETTINGS_ALERTS_SEVERITY]: "alerts-severity",
|
||||
[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES]: "alert-note-templates",
|
||||
[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW]: `alert-note-templates/${RouteParams.ModelID}`,
|
||||
|
||||
[PageMap.SETTINGS_ON_CALL_DUTY_POLICY_CUSTOM_FIELDS]:
|
||||
"on-call-duty-policy-custom-fields",
|
||||
@ -184,26 +195,13 @@ export const SettingsRoutePath: Dictionary<string> = {
|
||||
"scheduled-maintenance-custom-fields",
|
||||
[PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS]: "status-page-custom-fields",
|
||||
|
||||
[PageMap.SETTINGS_INCIDENTS_STATE]: "incidents-state",
|
||||
[PageMap.SETTINGS_ALERTS_STATE]: "alerts-state",
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE]: "scheduled-maintenance-state",
|
||||
|
||||
[PageMap.SETTINGS_INCIDENTS_SEVERITY]: "incidents-severity",
|
||||
|
||||
[PageMap.SETTINGS_ALERTS_SEVERITY]: "alerts-severity",
|
||||
|
||||
[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES]: "alert-note-templates",
|
||||
[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW]: `alert-note-templates/${RouteParams.ModelID}`,
|
||||
|
||||
[PageMap.SETTINGS_DOMAINS]: "domains",
|
||||
[PageMap.SETTINGS_FEATURE_FLAGS]: "feature-flags",
|
||||
[PageMap.SETTINGS_SSO]: "sso",
|
||||
[PageMap.SETTINGS_TEAMS]: "teams",
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES]: "incident-templates",
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW]: `incident-templates/${RouteParams.ModelID}`,
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES]: "incident-note-templates",
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW]: `incident-note-templates/${RouteParams.ModelID}`,
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_TEMPLATES]:
|
||||
"scheduled-maintenance-templates",
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_TEMPLATES_VIEW]: `scheduled-maintenance-templates/${RouteParams.ModelID}`,
|
||||
@ -1252,15 +1250,21 @@ const RouteMap: Dictionary<Route> = {
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENTS_STATE]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENTS_STATE]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE]: new Route(
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE]
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_TEMPLATES]
|
||||
}`,
|
||||
),
|
||||
|
||||
@ -1270,6 +1274,60 @@ const RouteMap: Dictionary<Route> = {
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_ALERT_CUSTOM_FIELDS]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_ALERT_CUSTOM_FIELDS]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_ALERTS_STATE]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_ALERTS_STATE]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_ALERTS_SEVERITY]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_ALERTS_SEVERITY]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_ALERT_NOTE_TEMPLATES_VIEW]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_DOMAINS]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_DOMAINS]
|
||||
@ -1294,12 +1352,6 @@ const RouteMap: Dictionary<Route> = {
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_TEMPLATES]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_TEMPLATES]
|
||||
@ -1312,24 +1364,6 @@ const RouteMap: Dictionary<Route> = {
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_NOTE_TEMPLATES]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_NOTE_TEMPLATES]
|
||||
@ -1463,12 +1497,6 @@ const RouteMap: Dictionary<Route> = {
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS]
|
||||
}`,
|
||||
),
|
||||
|
||||
[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/${
|
||||
SettingsRoutePath[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS]
|
||||
|
Loading…
Reference in New Issue
Block a user