diff --git a/plugins/ilert/api-report.md b/plugins/ilert/api-report.md index 51e2020dee..6cc0c12a8f 100644 --- a/plugins/ilert/api-report.md +++ b/plugins/ilert/api-report.md @@ -406,10 +406,6 @@ export interface ILertApi { // (undocumented) fetchStatusPages(opts?: GetStatusPagesOpts): Promise; // (undocumented) - fetchUptimeMonitor(id: number): Promise; - // (undocumented) - fetchUptimeMonitors(): Promise; - // (undocumented) fetchUsers(): Promise; // (undocumented) getAlertDetailsURL(alert: Alert): string; @@ -426,8 +422,6 @@ export interface ILertApi { // (undocumented) getStatusPageURL(statusPage: StatusPage): string; // (undocumented) - getUptimeMonitorDetailsURL(uptimeMonitor: UptimeMonitor): string; - // (undocumented) getUserInitials(user: User | null): string; // (undocumented) getUserPhoneNumber(user: User | null): string; @@ -439,12 +433,8 @@ export interface ILertApi { end: string, ): Promise; // (undocumented) - pauseUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise; - // (undocumented) resolveAlert(alert: Alert, userName: string): Promise; // (undocumented) - resumeUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise; - // (undocumented) triggerAlertAction(alert: Alert, action: AlertAction): Promise; } @@ -499,10 +489,6 @@ export class ILertClient implements ILertApi { // (undocumented) fetchStatusPages(opts?: GetStatusPagesOpts): Promise; // (undocumented) - fetchUptimeMonitor(id: number): Promise; - // (undocumented) - fetchUptimeMonitors(): Promise; - // (undocumented) fetchUsers(): Promise; // (undocumented) static fromConfig( @@ -524,8 +510,6 @@ export class ILertClient implements ILertApi { // (undocumented) getStatusPageURL(statusPage: StatusPage): string; // (undocumented) - getUptimeMonitorDetailsURL(uptimeMonitor: UptimeMonitor): string; - // (undocumented) getUserInitials(user: User | null): string; // (undocumented) getUserPhoneNumber(user: User | null): string; @@ -537,12 +521,8 @@ export class ILertClient implements ILertApi { end: string, ): Promise; // (undocumented) - pauseUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise; - // (undocumented) resolveAlert(alert: Alert, userName: string): Promise; // (undocumented) - resumeUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise; - // (undocumented) triggerAlertAction(alert: Alert, action: AlertAction): Promise; } @@ -786,50 +766,6 @@ export interface Uptime { uptimePercentage: UptimePercentage; } -// @public (undocumented) -export interface UptimeMonitor { - // (undocumented) - checkParams: UptimeMonitorCheckParams; - // (undocumented) - checkType: 'http' | 'tcp' | 'udp' | 'ping'; - // (undocumented) - createAlertAfterFailedChecks: number; - // (undocumented) - embedUrl: string; - // (undocumented) - escalationPolicy: EscalationPolicy; - // (undocumented) - id: number; - // (undocumented) - intervalSec: number; - // (undocumented) - lastStatusChange: string; - // (undocumented) - name: string; - // (undocumented) - paused: boolean; - // (undocumented) - region: 'EU' | 'US'; - // (undocumented) - shareUrl: string; - // (undocumented) - status: string; - // (undocumented) - teams: TeamShort[]; - // (undocumented) - timeoutMs: number; -} - -// @public (undocumented) -export interface UptimeMonitorCheckParams { - // (undocumented) - host?: string; - // (undocumented) - port?: number; - // (undocumented) - url?: string; -} - // @public (undocumented) export interface UptimePercentage { // (undocumented) diff --git a/plugins/ilert/src/components/ILertCard/ILertCard.tsx b/plugins/ilert/src/components/ILertCard/ILertCard.tsx index d124751b2b..204c32369c 100644 --- a/plugins/ilert/src/components/ILertCard/ILertCard.tsx +++ b/plugins/ilert/src/components/ILertCard/ILertCard.tsx @@ -55,10 +55,8 @@ const useStyles = makeStyles({ export const ILertCard = () => { const classes = useStyles(); const { integrationKey, name } = useILertEntity(); - const [ - { alertSource, uptimeMonitor }, - { setAlertSource, refetchAlertSource }, - ] = useAlertSource(integrationKey); + const [{ alertSource }, { setAlertSource, refetchAlertSource }] = + useAlertSource(integrationKey); const [ { tableState, states, alerts, alertsCount, isLoading, error }, { @@ -99,7 +97,6 @@ export const ILertCard = () => { setAlertSource={setAlertSource} setIsNewAlertModalOpened={setIsNewAlertModalOpened} setIsMaintenanceModalOpened={setIsMaintenanceModalOpened} - uptimeMonitor={uptimeMonitor} /> } action={} diff --git a/plugins/ilert/src/components/ILertCard/ILertCardActionsHeader.tsx b/plugins/ilert/src/components/ILertCard/ILertCardActionsHeader.tsx index 49f2c789c4..85118b29b9 100644 --- a/plugins/ilert/src/components/ILertCard/ILertCardActionsHeader.tsx +++ b/plugins/ilert/src/components/ILertCard/ILertCardActionsHeader.tsx @@ -23,12 +23,11 @@ import AlarmAddIcon from '@material-ui/icons/AlarmAdd'; import BuildIcon from '@material-ui/icons/Build'; import PauseIcon from '@material-ui/icons/Pause'; import PlayArrowIcon from '@material-ui/icons/PlayArrow'; -import TimelineIcon from '@material-ui/icons/Timeline'; import WebIcon from '@material-ui/icons/Web'; import Alert from '@material-ui/lab/Alert'; import React from 'react'; import { ilertApiRef } from '../../api'; -import { AlertSource, UptimeMonitor } from '../../types'; +import { AlertSource } from '../../types'; import { HeaderIconLinkRow, @@ -41,13 +40,11 @@ export const ILertCardActionsHeader = ({ setAlertSource, setIsNewAlertModalOpened, setIsMaintenanceModalOpened, - uptimeMonitor, }: { alertSource: AlertSource | null; setAlertSource: (alertSource: AlertSource) => void; setIsNewAlertModalOpened: (isOpen: boolean) => void; setIsMaintenanceModalOpened: (isOpen: boolean) => void; - uptimeMonitor: UptimeMonitor | null; }) => { const ilertApi = useApi(ilertApiRef); const alertApi = useApi(alertApiRef); @@ -140,13 +137,6 @@ export const ILertCardActionsHeader = ({ disabled: !alertSource || isLoading, }; - const uptimeMonitorReportLink: IconLinkVerticalProps = { - label: 'Uptime Report', - href: uptimeMonitor ? uptimeMonitor.shareUrl : '', - icon: , - disabled: !alertSource || !uptimeMonitor || isLoading, - }; - const links: IconLinkVerticalProps[] = [ alertSourceLink, createAlertLink, @@ -155,10 +145,6 @@ export const ILertCardActionsHeader = ({ : enableAlertSourceLink, ]; - if (alertSource && alertSource.integrationType === 'MONITOR') { - links.push(uptimeMonitorReportLink); - } - if (alertSource && alertSource.status !== 'IN_MAINTENANCE') { links.push(maintenanceAlertSourceLink); } diff --git a/plugins/ilert/src/hooks/useAlertSource.ts b/plugins/ilert/src/hooks/useAlertSource.ts index c80b3d59eb..9048ee3031 100644 --- a/plugins/ilert/src/hooks/useAlertSource.ts +++ b/plugins/ilert/src/hooks/useAlertSource.ts @@ -18,7 +18,7 @@ import { AuthenticationError } from '@backstage/errors'; import React from 'react'; import useAsyncRetry from 'react-use/lib/useAsyncRetry'; import { ilertApiRef } from '../api'; -import { AlertSource, UptimeMonitor } from '../types'; +import { AlertSource } from '../types'; export const useAlertSource = (integrationKey: string) => { const ilertApi = useApi(ilertApiRef); @@ -28,10 +28,6 @@ export const useAlertSource = (integrationKey: string) => { null, ); const [isAlertSourceLoading, setIsAlertSourceLoading] = React.useState(false); - const [uptimeMonitor, setUptimeMonitor] = - React.useState(null); - const [isUptimeMonitorLoading, setIsUptimeMonitorLoading] = - React.useState(false); const fetchAlertSourceCall = async () => { try { @@ -56,38 +52,13 @@ export const useAlertSource = (integrationKey: string) => { [integrationKey], ); - const fetchUptimeMonitorCall = async () => { - try { - if (!alertSource || alertSource.integrationType !== 'MONITOR') { - return; - } - setIsUptimeMonitorLoading(true); - const data = await ilertApi.fetchUptimeMonitor(alertSource.id); - setUptimeMonitor(data || null); - setIsUptimeMonitorLoading(false); - } catch (e) { - setIsUptimeMonitorLoading(false); - if (!(e instanceof AuthenticationError)) { - errorApi.post(e); - } - throw e; - } - }; - - const { error: uptimeMonitorError, retry: uptimeMonitorRetry } = - useAsyncRetry(fetchUptimeMonitorCall, [alertSource]); - - const retry = () => { - alertSourceRetry(); - uptimeMonitorRetry(); - }; + const retry = () => alertSourceRetry(); return [ { alertSource, - uptimeMonitor, - error: alertSourceError || uptimeMonitorError, - isLoading: isAlertSourceLoading || isUptimeMonitorLoading, + error: alertSourceError, + isLoading: isAlertSourceLoading, }, { retry,