mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
fix Function types
This commit is contained in:
parent
89183a77eb
commit
e370dd118d
@ -96,6 +96,8 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
@ -614,8 +614,10 @@ export default class ProbeMonitorResponseService {
|
||||
input.probeApiIngestResponse.rootCause =
|
||||
rootCause +
|
||||
' ' +
|
||||
((input.dataToProcess as ProbeMonitorResponse)
|
||||
.failureCause || '').replace("Error:", "");
|
||||
(
|
||||
(input.dataToProcess as ProbeMonitorResponse)
|
||||
.failureCause || ''
|
||||
).replace('Error:', '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,4 @@
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import Card from '../Card/Card';
|
||||
@ -17,6 +12,7 @@ import { JSONObject } from 'Common/Types/JSON';
|
||||
import { ButtonStyleType } from '../Button/Button';
|
||||
import IconProp from 'Common/Types/Icon/IconProp';
|
||||
import API from '../../Utils/API/API';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps {
|
||||
title: string;
|
||||
@ -93,8 +89,8 @@ const CustomFieldsDetail: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
onLoad().catch();
|
||||
useAsyncEffect(async () => {
|
||||
await onLoad();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
@ -29,8 +29,6 @@ export interface ComponentProps {
|
||||
const Detail: (props: ComponentProps) => ReactElement = (
|
||||
props: ComponentProps
|
||||
): ReactElement => {
|
||||
|
||||
|
||||
const getMarkdownViewer: Function = (text: string): ReactElement | null => {
|
||||
if (!text) {
|
||||
return null;
|
||||
@ -90,7 +88,6 @@ const Detail: (props: ComponentProps) => ReactElement = (
|
||||
};
|
||||
|
||||
const getField: Function = (field: Field, index: number): ReactElement => {
|
||||
|
||||
const fieldKey: string = field.key;
|
||||
|
||||
if (!props.item) {
|
||||
@ -258,10 +255,10 @@ const Detail: (props: ComponentProps) => ReactElement = (
|
||||
style={
|
||||
props.showDetailsInNumberOfColumns
|
||||
? {
|
||||
width:
|
||||
100 / props.showDetailsInNumberOfColumns +
|
||||
'%',
|
||||
}
|
||||
width:
|
||||
100 / props.showDetailsInNumberOfColumns +
|
||||
'%',
|
||||
}
|
||||
: { width: '100%' }
|
||||
}
|
||||
>
|
||||
@ -285,14 +282,13 @@ const Detail: (props: ComponentProps) => ReactElement = (
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-${props.showDetailsInNumberOfColumns || 1
|
||||
} w-full`}
|
||||
className={`grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-${
|
||||
props.showDetailsInNumberOfColumns || 1
|
||||
} w-full`}
|
||||
>
|
||||
{props.fields &&
|
||||
props.fields.length > 0 &&
|
||||
@ -301,7 +297,6 @@ const Detail: (props: ComponentProps) => ReactElement = (
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
export default Detail;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { ReactElement, useEffect } from 'react';
|
||||
import React, { ReactElement } from 'react';
|
||||
|
||||
import BadDataException from 'Common/Types/Exception/BadDataException';
|
||||
import FormFieldSchemaType from '../Types/FormFieldSchemaType';
|
||||
@ -22,6 +22,7 @@ import FieldLabelElement from '../Fields/FieldLabel';
|
||||
import FormValues from '../Types/FormValues';
|
||||
import { JSONValue } from 'Common/Types/JSON';
|
||||
import ComponentLoader from '../../ComponentLoader/ComponentLoader';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps<T extends Object> {
|
||||
field: Field<T>;
|
||||
@ -47,22 +48,23 @@ const FormField: <T extends Object>(
|
||||
>(props.field.dropdownOptions || []);
|
||||
const [isFieldLoading, setIsFieldLoading] = React.useState<boolean>(false);
|
||||
|
||||
const fetchDropdownOptions: () => Promise<void> = async (): Promise<void> => {
|
||||
if (!props.field.fetchDropdownOptions) {
|
||||
return;
|
||||
}
|
||||
const fetchDropdownOptions: () => Promise<void> =
|
||||
async (): Promise<void> => {
|
||||
if (!props.field.fetchDropdownOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
setIsFieldLoading(true);
|
||||
setIsFieldLoading(true);
|
||||
|
||||
const options: Array<DropdownOption> =
|
||||
await props.field.fetchDropdownOptions();
|
||||
const options: Array<DropdownOption> =
|
||||
await props.field.fetchDropdownOptions();
|
||||
|
||||
setDropdownOptions(options);
|
||||
setIsFieldLoading(false);
|
||||
};
|
||||
setDropdownOptions(options);
|
||||
setIsFieldLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchDropdownOptions().catch();
|
||||
useAsyncEffect(async () => {
|
||||
await fetchDropdownOptions();
|
||||
}, [props.field]);
|
||||
|
||||
const getFieldType: Function = (fieldType: FormFieldSchemaType): string => {
|
||||
|
@ -16,6 +16,7 @@ import Detail from '../Detail/Detail';
|
||||
import API from '../../Utils/API/API';
|
||||
import JSONFunctions from 'Common/Types/JSONFunctions';
|
||||
import ErrorMessage from '../ErrorMessage/ErrorMessage';
|
||||
import { useAsyncEffect } from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps<TBaseModel extends BaseModel> {
|
||||
modelType: { new (): TBaseModel };
|
||||
@ -202,9 +203,9 @@ const ModelDetail: <TBaseModel extends BaseModel>(
|
||||
props.onLoadingChange && props.onLoadingChange(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
useAsyncEffect(async () => {
|
||||
if (props.modelId && props.modelType) {
|
||||
fetchItem();
|
||||
await fetchItem();
|
||||
}
|
||||
}, [props.modelId, props.refresher, props.modelType]);
|
||||
|
||||
@ -237,8 +238,8 @@ const ModelDetail: <TBaseModel extends BaseModel>(
|
||||
>
|
||||
{error} <br />{' '}
|
||||
<span
|
||||
onClick={() => {
|
||||
fetchItem();
|
||||
onClick={async () => {
|
||||
await fetchItem();
|
||||
}}
|
||||
className="underline primary-on-hover"
|
||||
>
|
||||
|
@ -1,10 +1,11 @@
|
||||
import Link from 'Common/Types/Link';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import React, { ReactElement, useState } from 'react';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import Page from './Page';
|
||||
import ModelAPI from '../../Utils/ModelAPI/ModelAPI';
|
||||
import API from '../../Utils/API/API';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps<TBaseModel extends BaseModel> {
|
||||
title?: string | undefined;
|
||||
@ -66,9 +67,9 @@ const ModelPage: <TBaseModel extends BaseModel>(
|
||||
|
||||
const [title, setTitle] = useState<string | undefined>(props.title);
|
||||
|
||||
useEffect(() => {
|
||||
useAsyncEffect(async () => {
|
||||
// fetch the model
|
||||
fetchItem();
|
||||
await fetchItem();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
@ -1,9 +1,4 @@
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import ErrorMessage from '../ErrorMessage/ErrorMessage';
|
||||
import API from '../../Utils/API/API';
|
||||
import ComponentLoader from '../ComponentLoader/ComponentLoader';
|
||||
@ -13,6 +8,7 @@ import URL from 'Common/Types/API/URL';
|
||||
import { DOMAIN, HOME_URL, HTTP_PROTOCOL } from '../../Config';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import HTTPResponse from 'Common/Types/API/HTTPResponse';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps {
|
||||
documentationLink: Route;
|
||||
@ -56,8 +52,8 @@ const DocumentationViewer: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadDocs();
|
||||
useAsyncEffect(async () => {
|
||||
await loadDocs();
|
||||
}, [props.documentationLink]);
|
||||
|
||||
return (
|
||||
|
@ -16,6 +16,8 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
@ -282,7 +282,7 @@ const App: () => JSX.Element = () => {
|
||||
};
|
||||
|
||||
useAsyncEffect(async () => {
|
||||
fetchProjects();
|
||||
await fetchProjects();
|
||||
}, []);
|
||||
|
||||
const commonPageProps: PageComponentProps = {
|
||||
@ -1553,10 +1553,10 @@ const App: () => JSX.Element = () => {
|
||||
}
|
||||
element={
|
||||
<SettingsDangerZone
|
||||
onProjectDeleted={() => {
|
||||
onProjectDeleted={async () => {
|
||||
setSelectedProject(null);
|
||||
setProjects([]);
|
||||
fetchProjects();
|
||||
await fetchProjects();
|
||||
Navigation.navigate(RouteMap[PageMap.INIT]!);
|
||||
}}
|
||||
{...commonPageProps}
|
||||
|
@ -19,6 +19,7 @@ import FieldLabelElement from 'CommonUI/src/Components/Forms/Fields/FieldLabel';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import SortOrder from 'Common/Types/Database/SortOrder';
|
||||
import OnCallDutyPolicy from 'Model/Models/OnCallDutyPolicy';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps extends CustomElementProps {
|
||||
error?: string | undefined;
|
||||
@ -49,119 +50,120 @@ const MonitorStepsElement: FunctionComponent<ComponentProps> = (
|
||||
setError(props.error);
|
||||
}, [props.error]);
|
||||
|
||||
const fetchDropdownOptions: () => Promise<void> = async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
const fetchDropdownOptions: () => Promise<void> =
|
||||
async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const monitorStatusList: ListResult<MonitorStatus> =
|
||||
await ModelAPI.getList(
|
||||
MonitorStatus,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
isOperationalState: true,
|
||||
isOfflineState: true,
|
||||
},
|
||||
try {
|
||||
const monitorStatusList: ListResult<MonitorStatus> =
|
||||
await ModelAPI.getList(
|
||||
MonitorStatus,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
isOperationalState: true,
|
||||
isOfflineState: true,
|
||||
},
|
||||
|
||||
{}
|
||||
);
|
||||
{}
|
||||
);
|
||||
|
||||
if (monitorStatusList.data) {
|
||||
setMonitorStatusDropdownOptions(
|
||||
monitorStatusList.data.map((i: MonitorStatus) => {
|
||||
return {
|
||||
value: i._id!,
|
||||
label: i.name!,
|
||||
};
|
||||
})
|
||||
);
|
||||
if (monitorStatusList.data) {
|
||||
setMonitorStatusDropdownOptions(
|
||||
monitorStatusList.data.map((i: MonitorStatus) => {
|
||||
return {
|
||||
value: i._id!,
|
||||
label: i.name!,
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const incidentSeverityList: ListResult<IncidentSeverity> =
|
||||
await ModelAPI.getList(
|
||||
IncidentSeverity,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
order: true,
|
||||
},
|
||||
{
|
||||
order: SortOrder.Ascending,
|
||||
}
|
||||
);
|
||||
|
||||
const onCallPolicyList: ListResult<OnCallDutyPolicy> =
|
||||
await ModelAPI.getList(
|
||||
OnCallDutyPolicy,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
if (incidentSeverityList.data) {
|
||||
setIncidentSeverityDropdownOptions(
|
||||
incidentSeverityList.data.map((i: IncidentSeverity) => {
|
||||
return {
|
||||
value: i._id!,
|
||||
label: i.name!,
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (onCallPolicyList.data) {
|
||||
setOnCallPolicyDropdownOptions(
|
||||
onCallPolicyList.data.map((i: OnCallDutyPolicy) => {
|
||||
return {
|
||||
value: i._id!,
|
||||
label: i.name!,
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// if there is no initial value then....
|
||||
|
||||
if (!monitorSteps) {
|
||||
setMonitorSteps(
|
||||
MonitorSteps.getDefaultMonitorSteps({
|
||||
monitorType: props.monitorType,
|
||||
defaultMonitorStatusId: monitorStatusList.data.find(
|
||||
(i: MonitorStatus) => {
|
||||
return i.isOperationalState;
|
||||
}
|
||||
)!.id!,
|
||||
onlineMonitorStatusId: monitorStatusList.data.find(
|
||||
(i: MonitorStatus) => {
|
||||
return i.isOperationalState;
|
||||
}
|
||||
)!.id!,
|
||||
offlineMonitorStatusId: monitorStatusList.data.find(
|
||||
(i: MonitorStatus) => {
|
||||
return i.isOfflineState;
|
||||
}
|
||||
)!.id!,
|
||||
defaultIncidentSeverityId:
|
||||
incidentSeverityList.data[0]!.id!,
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
const incidentSeverityList: ListResult<IncidentSeverity> =
|
||||
await ModelAPI.getList(
|
||||
IncidentSeverity,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
order: true,
|
||||
},
|
||||
{
|
||||
order: SortOrder.Ascending,
|
||||
}
|
||||
);
|
||||
|
||||
const onCallPolicyList: ListResult<OnCallDutyPolicy> =
|
||||
await ModelAPI.getList(
|
||||
OnCallDutyPolicy,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
if (incidentSeverityList.data) {
|
||||
setIncidentSeverityDropdownOptions(
|
||||
incidentSeverityList.data.map((i: IncidentSeverity) => {
|
||||
return {
|
||||
value: i._id!,
|
||||
label: i.name!,
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (onCallPolicyList.data) {
|
||||
setOnCallPolicyDropdownOptions(
|
||||
onCallPolicyList.data.map((i: OnCallDutyPolicy) => {
|
||||
return {
|
||||
value: i._id!,
|
||||
label: i.name!,
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// if there is no initial value then....
|
||||
|
||||
if (!monitorSteps) {
|
||||
setMonitorSteps(
|
||||
MonitorSteps.getDefaultMonitorSteps({
|
||||
monitorType: props.monitorType,
|
||||
defaultMonitorStatusId: monitorStatusList.data.find(
|
||||
(i: MonitorStatus) => {
|
||||
return i.isOperationalState;
|
||||
}
|
||||
)!.id!,
|
||||
onlineMonitorStatusId: monitorStatusList.data.find(
|
||||
(i: MonitorStatus) => {
|
||||
return i.isOperationalState;
|
||||
}
|
||||
)!.id!,
|
||||
offlineMonitorStatusId: monitorStatusList.data.find(
|
||||
(i: MonitorStatus) => {
|
||||
return i.isOfflineState;
|
||||
}
|
||||
)!.id!,
|
||||
defaultIncidentSeverityId:
|
||||
incidentSeverityList.data[0]!.id!,
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
fetchDropdownOptions().catch();
|
||||
setIsLoading(false);
|
||||
};
|
||||
useAsyncEffect(async () => {
|
||||
await fetchDropdownOptions();
|
||||
}, []);
|
||||
|
||||
const [monitorSteps, setMonitorSteps] = React.useState<
|
||||
|
@ -20,7 +20,6 @@ export interface ComponentProps {
|
||||
const MonitorCriteriaIncidentForm: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps
|
||||
): ReactElement => {
|
||||
|
||||
return (
|
||||
<div className="mt-4 bg-gray-50 rounded rounded-xl p-5">
|
||||
<Detail
|
||||
|
@ -1,10 +1,5 @@
|
||||
import MonitorSteps from 'Common/Types/Monitor/MonitorSteps';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import MonitorStepElement from './MonitorStep';
|
||||
import MonitorStep from 'Common/Types/Monitor/MonitorStep';
|
||||
import ModelAPI, { ListResult } from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
|
||||
@ -22,6 +17,7 @@ import Statusbubble from 'CommonUI/src/Components/StatusBubble/StatusBubble';
|
||||
import Color from 'Common/Types/Color';
|
||||
import { Black } from 'Common/Types/BrandColors';
|
||||
import OnCallDutyPolicy from 'Model/Models/OnCallDutyPolicy';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
export interface ComponentProps extends CustomElementProps {
|
||||
monitorSteps: MonitorSteps;
|
||||
@ -49,77 +45,78 @@ const MonitorStepsElement: FunctionComponent<ComponentProps> = (
|
||||
MonitorStatus | undefined
|
||||
>(undefined);
|
||||
|
||||
const fetchDropdownOptions: () => Promise<void> = async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
const fetchDropdownOptions: () => Promise<void> =
|
||||
async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const monitorStatusList: ListResult<MonitorStatus> =
|
||||
await ModelAPI.getList(
|
||||
MonitorStatus,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
color: true,
|
||||
isOperationalState: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
try {
|
||||
const monitorStatusList: ListResult<MonitorStatus> =
|
||||
await ModelAPI.getList(
|
||||
MonitorStatus,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
color: true,
|
||||
isOperationalState: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
if (monitorStatusList.data) {
|
||||
setMonitorStatusOptions(monitorStatusList.data);
|
||||
setDefaultMonitorStatus(
|
||||
monitorStatusList.data.find((status: MonitorStatus) => {
|
||||
return status?.isOperationalState;
|
||||
})
|
||||
);
|
||||
if (monitorStatusList.data) {
|
||||
setMonitorStatusOptions(monitorStatusList.data);
|
||||
setDefaultMonitorStatus(
|
||||
monitorStatusList.data.find((status: MonitorStatus) => {
|
||||
return status?.isOperationalState;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const incidentSeverityList: ListResult<IncidentSeverity> =
|
||||
await ModelAPI.getList(
|
||||
IncidentSeverity,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
color: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
const onCallPolicyList: ListResult<OnCallDutyPolicy> =
|
||||
await ModelAPI.getList(
|
||||
OnCallDutyPolicy,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
if (incidentSeverityList.data) {
|
||||
setIncidentSeverityOptions(
|
||||
incidentSeverityList.data as Array<IncidentSeverity>
|
||||
);
|
||||
}
|
||||
|
||||
if (onCallPolicyList.data) {
|
||||
setOnCallPolicyOptions(
|
||||
onCallPolicyList.data as Array<OnCallDutyPolicy>
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
const incidentSeverityList: ListResult<IncidentSeverity> =
|
||||
await ModelAPI.getList(
|
||||
IncidentSeverity,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
color: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
const onCallPolicyList: ListResult<OnCallDutyPolicy> =
|
||||
await ModelAPI.getList(
|
||||
OnCallDutyPolicy,
|
||||
{},
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
},
|
||||
{}
|
||||
);
|
||||
|
||||
if (incidentSeverityList.data) {
|
||||
setIncidentSeverityOptions(
|
||||
incidentSeverityList.data as Array<IncidentSeverity>
|
||||
);
|
||||
}
|
||||
|
||||
if (onCallPolicyList.data) {
|
||||
setOnCallPolicyOptions(
|
||||
onCallPolicyList.data as Array<OnCallDutyPolicy>
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
fetchDropdownOptions().catch();
|
||||
setIsLoading(false);
|
||||
};
|
||||
useAsyncEffect(async () => {
|
||||
await fetchDropdownOptions();
|
||||
}, []);
|
||||
|
||||
if (isLoading) {
|
||||
|
@ -1,11 +1,6 @@
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import ModelPage from 'CommonUI/src/Components/Page/ModelPage';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import PageMap from '../../../Utils/PageMap';
|
||||
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
|
||||
import PageComponentProps from '../../PageComponentProps';
|
||||
@ -33,6 +28,7 @@ import ComponentLoader from 'CommonUI/src/Components/ComponentLoader/ComponentLo
|
||||
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
|
||||
import EmptyState from 'CommonUI/src/Components/EmptyState/EmptyState';
|
||||
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
|
||||
import { useAsyncEffect } from 'use-async-effect';
|
||||
|
||||
const MonitorCriteria: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
@ -75,9 +71,9 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
|
||||
undefined
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
useAsyncEffect(async () => {
|
||||
// fetch the model
|
||||
fetchItem();
|
||||
await fetchItem();
|
||||
}, []);
|
||||
|
||||
const getPageContent: Function = (): ReactElement => {
|
||||
|
@ -1,11 +1,6 @@
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import ModelPage from 'CommonUI/src/Components/Page/ModelPage';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import PageMap from '../../../Utils/PageMap';
|
||||
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
|
||||
import PageComponentProps from '../../PageComponentProps';
|
||||
@ -26,6 +21,7 @@ import ComponentLoader from 'CommonUI/src/Components/ComponentLoader/ComponentLo
|
||||
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
|
||||
import EmptyState from 'CommonUI/src/Components/EmptyState/EmptyState';
|
||||
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
const MonitorCriteria: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
@ -68,9 +64,9 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
|
||||
undefined
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
useAsyncEffect(async () => {
|
||||
// fetch the model
|
||||
fetchItem();
|
||||
await fetchItem();
|
||||
}, []);
|
||||
|
||||
const getPageContent: Function = (): ReactElement => {
|
||||
|
@ -1,11 +1,6 @@
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import ModelPage from 'CommonUI/src/Components/Page/ModelPage';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import PageMap from '../../../Utils/PageMap';
|
||||
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
|
||||
import PageComponentProps from '../../PageComponentProps';
|
||||
@ -35,6 +30,7 @@ import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import Modal, { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
|
||||
import BadDataException from 'Common/Types/Exception/BadDataException';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
const MonitorProbes: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
@ -113,9 +109,9 @@ const MonitorProbes: FunctionComponent<PageComponentProps> = (
|
||||
undefined
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
useAsyncEffect(() => {
|
||||
// fetch the model
|
||||
fetchItem();
|
||||
await fetchItem();
|
||||
}, []);
|
||||
|
||||
const getPageContent: Function = (): ReactElement => {
|
||||
|
@ -1,11 +1,6 @@
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import ModelPage from 'CommonUI/src/Components/Page/ModelPage';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import PageMap from '../../../Utils/PageMap';
|
||||
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
|
||||
import PageComponentProps from '../../PageComponentProps';
|
||||
@ -24,6 +19,7 @@ import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
|
||||
import EmptyState from 'CommonUI/src/Components/EmptyState/EmptyState';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
|
||||
import useAsyncEffect from 'use-async-effect';
|
||||
|
||||
const MonitorCriteria: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
@ -69,9 +65,9 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
|
||||
undefined
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
useAsyncEffect(async () => {
|
||||
// fetch the model
|
||||
fetchItem();
|
||||
await fetchItem();
|
||||
}, []);
|
||||
|
||||
const getPageContent: Function = (): ReactElement => {
|
||||
|
@ -320,9 +320,9 @@ const Settings: FunctionComponent<ComponentProps> = (
|
||||
{
|
||||
title: 'Add Payment Method',
|
||||
icon: IconProp.Add,
|
||||
onClick: () => {
|
||||
fetchSetupIntent();
|
||||
onClick: async () => {
|
||||
setShowPaymentMethodModal(true);
|
||||
await fetchSetupIntent();
|
||||
},
|
||||
buttonStyle: ButtonStyleType.NORMAL,
|
||||
},
|
||||
|
@ -1,11 +1,6 @@
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import ModelPage from 'CommonUI/src/Components/Page/ModelPage';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import React, { FunctionComponent, ReactElement, useState } from 'react';
|
||||
import PageMap from '../../../Utils/PageMap';
|
||||
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
|
||||
import PageComponentProps from '../../PageComponentProps';
|
||||
@ -38,6 +33,7 @@ import API from 'CommonUI/src/Utils/API/API';
|
||||
import { WORKFLOW_URL } from 'CommonUI/src/Config';
|
||||
import URL from 'Common/Types/API/URL';
|
||||
import Banner from 'CommonUI/src/Components/Banner/Banner';
|
||||
import { useAsyncEffect } from 'use-async-effect';
|
||||
|
||||
const Delete: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
@ -257,8 +253,8 @@ const Delete: FunctionComponent<PageComponentProps> = (
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadGraph().catch();
|
||||
useAsyncEffect(async () => {
|
||||
await loadGraph();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
@ -973,4 +973,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -40,4 +40,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -41,4 +41,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -25,6 +25,8 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
@ -39,4 +39,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -52,4 +52,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -38,4 +38,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
// This script merges config.env.tpl to config.env
|
||||
|
||||
import logger from 'CommonServer/Utils/Logger';
|
||||
import fs from 'fs';
|
||||
|
||||
const init: Function = (): void => {
|
||||
@ -39,4 +40,6 @@ const init: Function = (): void => {
|
||||
fs.writeFileSync('./config.env', linesInEnv.join('\n'));
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
// This script merges config.env.tpl to config.env
|
||||
|
||||
import logger from 'CommonServer/Utils/Logger';
|
||||
import fs from 'fs';
|
||||
|
||||
const init: Function = (): void => {
|
||||
@ -50,4 +51,6 @@ const init: Function = (): void => {
|
||||
fs.writeFileSync('./config.env', linesToRender.join('\n'));
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -21,6 +21,8 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
@ -22,4 +22,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -114,4 +114,6 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
@ -71,6 +71,8 @@ const init: () => Promise<void> = async (): Promise<void> => {
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
init().catch((err: Error) => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
Loading…
Reference in New Issue
Block a user