fix last commit, update api-reports
Signed-off-by: Marko Simon <marko@ilert.com>
This commit is contained in:
@@ -406,10 +406,6 @@ export interface ILertApi {
|
||||
// (undocumented)
|
||||
fetchStatusPages(opts?: GetStatusPagesOpts): Promise<StatusPage[]>;
|
||||
// (undocumented)
|
||||
fetchUptimeMonitor(id: number): Promise<UptimeMonitor>;
|
||||
// (undocumented)
|
||||
fetchUptimeMonitors(): Promise<UptimeMonitor[]>;
|
||||
// (undocumented)
|
||||
fetchUsers(): Promise<User[]>;
|
||||
// (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<Schedule>;
|
||||
// (undocumented)
|
||||
pauseUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise<UptimeMonitor>;
|
||||
// (undocumented)
|
||||
resolveAlert(alert: Alert, userName: string): Promise<Alert>;
|
||||
// (undocumented)
|
||||
resumeUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise<UptimeMonitor>;
|
||||
// (undocumented)
|
||||
triggerAlertAction(alert: Alert, action: AlertAction): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -499,10 +489,6 @@ export class ILertClient implements ILertApi {
|
||||
// (undocumented)
|
||||
fetchStatusPages(opts?: GetStatusPagesOpts): Promise<StatusPage[]>;
|
||||
// (undocumented)
|
||||
fetchUptimeMonitor(id: number): Promise<UptimeMonitor>;
|
||||
// (undocumented)
|
||||
fetchUptimeMonitors(): Promise<UptimeMonitor[]>;
|
||||
// (undocumented)
|
||||
fetchUsers(): Promise<User[]>;
|
||||
// (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<Schedule>;
|
||||
// (undocumented)
|
||||
pauseUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise<UptimeMonitor>;
|
||||
// (undocumented)
|
||||
resolveAlert(alert: Alert, userName: string): Promise<Alert>;
|
||||
// (undocumented)
|
||||
resumeUptimeMonitor(uptimeMonitor: UptimeMonitor): Promise<UptimeMonitor>;
|
||||
// (undocumented)
|
||||
triggerAlertAction(alert: Alert, action: AlertAction): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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={<ILertCardHeaderStatus alertSource={alertSource} />}
|
||||
|
||||
@@ -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: <TimelineIcon />,
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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<UptimeMonitor | null>(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,
|
||||
|
||||
Reference in New Issue
Block a user