mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Fix PromiseRejectErrorFunctionType in code
This commit is contained in:
@@ -19,7 +19,10 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
|
||||
import AdminModelAPI from '../../../Utils/ModelAPI';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
|
||||
const Settings: FunctionComponent = (): ReactElement => {
|
||||
const [showKeyModal, setShowKeyModal] = useState<boolean>(false);
|
||||
|
||||
@@ -25,7 +25,7 @@ const Settings: FunctionComponent = (): ReactElement => {
|
||||
|
||||
const [error, setError] = React.useState<string>('');
|
||||
|
||||
const fetchItem: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
const fetchItem: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
|
||||
const globalConfig: GlobalConfig | null =
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class QueueWorker {
|
||||
jobCallback: Function
|
||||
): Promise<void> {
|
||||
const timeoutPromise: Function = (ms: number): Promise<void> => {
|
||||
return new Promise((_resolve: Function, reject: Function) => {
|
||||
return new Promise((_resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
setTimeout(() => {
|
||||
return reject(new TimeoutException('Job Timeout'));
|
||||
}, ms);
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class Domain extends DomainCommon {
|
||||
domain: Domain | string,
|
||||
verificationText: string
|
||||
): Promise<boolean> {
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
return new Promise((resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
dns.resolveTxt(
|
||||
domain.toString(),
|
||||
(
|
||||
|
||||
@@ -2,7 +2,7 @@ import fs from 'fs';
|
||||
|
||||
export default class LocalFile {
|
||||
public static async makeDirectory(path: string): Promise<void> {
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
return new Promise((resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
fs.mkdir(path, { recursive: true }, (err: unknown) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
@@ -13,7 +13,7 @@ export default class LocalFile {
|
||||
}
|
||||
|
||||
public static async write(path: string, data: string): Promise<void> {
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
return new Promise((resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
fs.writeFile(path, data, (err: unknown) => {
|
||||
if (err) {
|
||||
return reject();
|
||||
@@ -25,7 +25,7 @@ export default class LocalFile {
|
||||
|
||||
public static async read(path: string): Promise<string> {
|
||||
return new Promise(
|
||||
(resolve: (data: string) => void, reject: Function) => {
|
||||
(resolve: (data: string) => void, reject: PromiseRejectErrorFunctionType) => {
|
||||
fs.readFile(
|
||||
path,
|
||||
{ encoding: 'utf-8' },
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Stream } from 'stream';
|
||||
|
||||
export default class StreamUtil {
|
||||
public static convertStreamToText(stream: Stream): Promise<string> {
|
||||
return new Promise<string>((resolve: Function, reject: Function) => {
|
||||
return new Promise<string>((resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
const chunks: Array<any> = [];
|
||||
|
||||
stream.on('data', (chunk: any) => {
|
||||
|
||||
@@ -2,7 +2,10 @@ import { JSONObject } from 'Common/Types/JSON';
|
||||
import { ButtonStyleType } from '../Button/Button';
|
||||
|
||||
import IconProp from 'Common/Types/Icon/IconProp';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
|
||||
interface ActionButtonSchema {
|
||||
title: string;
|
||||
|
||||
@@ -6,7 +6,10 @@ import React, {
|
||||
useState,
|
||||
} from 'react';
|
||||
import Columns from './Columns';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import Table from '../Table/Table';
|
||||
import TableColumn from '../Table/Types/Column';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
@@ -770,11 +773,15 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
|
||||
|
||||
type ShouldDisableSortFunctionType = (columnName: string) => boolean;
|
||||
|
||||
const shouldDisableSort: ShouldDisableSortFunctionType = (columnName: string): boolean => {
|
||||
const shouldDisableSort: ShouldDisableSortFunctionType = (
|
||||
columnName: string
|
||||
): boolean => {
|
||||
return model.isEntityColumn(columnName);
|
||||
};
|
||||
|
||||
type GetColumnKeyFunctionType = (column: ModelTableColumn<TBaseModel>) => string | null;
|
||||
type GetColumnKeyFunctionType = (
|
||||
column: ModelTableColumn<TBaseModel>
|
||||
) => string | null;
|
||||
|
||||
const getColumnKey: GetColumnKeyFunctionType = (
|
||||
column: ModelTableColumn<TBaseModel>
|
||||
@@ -786,7 +793,9 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
|
||||
return key;
|
||||
};
|
||||
|
||||
type HasPermissionToReadColumnFunctionType = (column: ModelTableColumn<TBaseModel>) => boolean;
|
||||
type HasPermissionToReadColumnFunctionType = (
|
||||
column: ModelTableColumn<TBaseModel>
|
||||
) => boolean;
|
||||
|
||||
const hasPermissionToReadColumn: HasPermissionToReadColumnFunctionType = (
|
||||
column: ModelTableColumn<TBaseModel>
|
||||
@@ -826,27 +835,28 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
|
||||
|
||||
type GetUserPermissionsFunctionType = () => Array<Permission>;
|
||||
|
||||
const getUserPermissions: GetUserPermissionsFunctionType = (): Array<Permission> => {
|
||||
let userPermissions: Array<Permission> =
|
||||
PermissionUtil.getGlobalPermissions()?.globalPermissions || [];
|
||||
if (
|
||||
PermissionUtil.getProjectPermissions() &&
|
||||
PermissionUtil.getProjectPermissions()?.permissions &&
|
||||
PermissionUtil.getProjectPermissions()!.permissions.length > 0
|
||||
) {
|
||||
userPermissions = userPermissions.concat(
|
||||
PermissionUtil.getProjectPermissions()!.permissions.map(
|
||||
(i: UserPermission) => {
|
||||
return i.permission;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
const getUserPermissions: GetUserPermissionsFunctionType =
|
||||
(): Array<Permission> => {
|
||||
let userPermissions: Array<Permission> =
|
||||
PermissionUtil.getGlobalPermissions()?.globalPermissions || [];
|
||||
if (
|
||||
PermissionUtil.getProjectPermissions() &&
|
||||
PermissionUtil.getProjectPermissions()?.permissions &&
|
||||
PermissionUtil.getProjectPermissions()!.permissions.length > 0
|
||||
) {
|
||||
userPermissions = userPermissions.concat(
|
||||
PermissionUtil.getProjectPermissions()!.permissions.map(
|
||||
(i: UserPermission) => {
|
||||
return i.permission;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
userPermissions.push(Permission.Public);
|
||||
userPermissions.push(Permission.Public);
|
||||
|
||||
return userPermissions;
|
||||
};
|
||||
return userPermissions;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
serializeToTableColumns();
|
||||
|
||||
@@ -5,7 +5,10 @@ import React, {
|
||||
useState,
|
||||
} from 'react';
|
||||
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import ProjectCallSMSConfig from 'Model/Models/ProjectCallSMSConfig';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
|
||||
|
||||
@@ -5,7 +5,10 @@ import React, {
|
||||
useState,
|
||||
} from 'react';
|
||||
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import ProjectSmtpConfig from 'Model/Models/ProjectSmtpConfig';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
|
||||
|
||||
@@ -26,26 +26,27 @@ const CurrentStatusElement: FunctionComponent<ComponentProps> = (
|
||||
|
||||
const [error, setError] = React.useState<string | undefined>(undefined);
|
||||
|
||||
const loadCurrentStatus: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
const loadCurrentStatus: PromiseVoidFunctionType =
|
||||
async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const currentStatus: MonitorStatus | null =
|
||||
await ModelAPI.post<MonitorStatus>({
|
||||
modelType: MonitorStatus,
|
||||
apiUrl: URL.fromString(APP_API_URL.toString())
|
||||
.addRoute(new MonitorGroup().getCrudApiPath()!)
|
||||
.addRoute('/current-status/')
|
||||
.addRoute(`/${props.monitorGroupId.toString()}`),
|
||||
});
|
||||
try {
|
||||
const currentStatus: MonitorStatus | null =
|
||||
await ModelAPI.post<MonitorStatus>({
|
||||
modelType: MonitorStatus,
|
||||
apiUrl: URL.fromString(APP_API_URL.toString())
|
||||
.addRoute(new MonitorGroup().getCrudApiPath()!)
|
||||
.addRoute('/current-status/')
|
||||
.addRoute(`/${props.monitorGroupId.toString()}`),
|
||||
});
|
||||
|
||||
setCurrentGroupStatus(currentStatus);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
setCurrentGroupStatus(currentStatus);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadCurrentStatus().catch(() => {});
|
||||
|
||||
@@ -7,7 +7,10 @@ import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
|
||||
import User from 'CommonUI/src/Utils/User';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import URL from 'Common/Types/API/URL';
|
||||
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
|
||||
|
||||
@@ -8,7 +8,10 @@ import User from 'CommonUI/src/Utils/User';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import URL from 'Common/Types/API/URL';
|
||||
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
|
||||
import HTTPResponse from 'Common/Types/API/HTTPResponse';
|
||||
|
||||
@@ -9,7 +9,10 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import URL from 'Common/Types/API/URL';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
|
||||
import HTTPResponse from 'Common/Types/API/HTTPResponse';
|
||||
import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse';
|
||||
|
||||
@@ -9,7 +9,10 @@ import { Green, Red, Yellow } from 'Common/Types/BrandColors';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
|
||||
import IncidentView from '../../../Components/Incident/Incident';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import Incident from 'Model/Models/Incident';
|
||||
import OnCallDutyPolicyStatus from 'Common/Types/OnCallDutyPolicy/OnCallDutyPolicyStatus';
|
||||
import UserElement from '../../../Components/User/User';
|
||||
|
||||
@@ -12,7 +12,10 @@ import OnCallDutyExecutionLogTimelineStatus from 'Common/Types/OnCallDutyPolicy/
|
||||
import UserElement from '../../User/User';
|
||||
import User from 'Model/Models/User';
|
||||
import EscalationRule from '../EscalationRule/EscalationRule';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import OnCallDutyPolicyEscalationRule from 'Model/Models/OnCallDutyPolicyEscalationRule';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
|
||||
|
||||
@@ -13,7 +13,10 @@ import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import ModelAPI, { RequestOptions } from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import GlobalEvents from 'CommonUI/src/Utils/GlobalEvents';
|
||||
import EventName from '../../Utils/EventName';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
|
||||
@@ -27,37 +27,41 @@ const MonitorIncidents: FunctionComponent<PageComponentProps> = (
|
||||
|
||||
const [error, setError] = React.useState<string | undefined>(undefined);
|
||||
|
||||
const loadMonitorsIds: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
const loadMonitorsIds: PromiseVoidFunctionType =
|
||||
async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const monitorGroupResources: ListResult<MonitorGroupResource> =
|
||||
await ModelAPI.getList({
|
||||
modelType: MonitorGroupResource,
|
||||
query: {
|
||||
monitorGroupId: modelId.toString(),
|
||||
},
|
||||
limit: LIMIT_PER_PROJECT,
|
||||
skip: 0,
|
||||
select: {
|
||||
monitorId: true,
|
||||
},
|
||||
sort: {},
|
||||
});
|
||||
try {
|
||||
const monitorGroupResources: ListResult<MonitorGroupResource> =
|
||||
await ModelAPI.getList({
|
||||
modelType: MonitorGroupResource,
|
||||
query: {
|
||||
monitorGroupId: modelId.toString(),
|
||||
},
|
||||
limit: LIMIT_PER_PROJECT,
|
||||
skip: 0,
|
||||
select: {
|
||||
monitorId: true,
|
||||
},
|
||||
sort: {},
|
||||
});
|
||||
|
||||
const monitorIds: Array<ObjectID> = monitorGroupResources.data.map(
|
||||
(monitorGroupResource: MonitorGroupResource): ObjectID => {
|
||||
return monitorGroupResource.monitorId!;
|
||||
}
|
||||
);
|
||||
const monitorIds: Array<ObjectID> =
|
||||
monitorGroupResources.data.map(
|
||||
(
|
||||
monitorGroupResource: MonitorGroupResource
|
||||
): ObjectID => {
|
||||
return monitorGroupResource.monitorId!;
|
||||
}
|
||||
);
|
||||
|
||||
setMonitorIds(monitorIds);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
setMonitorIds(monitorIds);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadMonitorsIds().catch(() => {});
|
||||
|
||||
@@ -39,34 +39,35 @@ const MonitorGroupResources: FunctionComponent<PageComponentProps> = (
|
||||
|
||||
const [error, setError] = React.useState<string | undefined>(undefined);
|
||||
|
||||
const loadMonitorStatuses: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
const loadMonitorStatuses: PromiseVoidFunctionType =
|
||||
async (): Promise<void> => {
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
const monitorStatuses: ListResult<MonitorStatus> =
|
||||
await ModelAPI.getList<MonitorStatus>({
|
||||
modelType: MonitorStatus,
|
||||
query: {
|
||||
projectId:
|
||||
DashboardNavigation.getProjectId()?.toString(),
|
||||
},
|
||||
limit: LIMIT_PER_PROJECT,
|
||||
skip: 0,
|
||||
select: {
|
||||
_id: true,
|
||||
name: true,
|
||||
color: true,
|
||||
},
|
||||
sort: {},
|
||||
});
|
||||
try {
|
||||
const monitorStatuses: ListResult<MonitorStatus> =
|
||||
await ModelAPI.getList<MonitorStatus>({
|
||||
modelType: MonitorStatus,
|
||||
query: {
|
||||
projectId:
|
||||
DashboardNavigation.getProjectId()?.toString(),
|
||||
},
|
||||
limit: LIMIT_PER_PROJECT,
|
||||
skip: 0,
|
||||
select: {
|
||||
_id: true,
|
||||
name: true,
|
||||
color: true,
|
||||
},
|
||||
sort: {},
|
||||
});
|
||||
|
||||
setMonitorStatuses(monitorStatuses.data);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
setMonitorStatuses(monitorStatuses.data);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadMonitorStatuses().catch(() => {});
|
||||
|
||||
@@ -13,7 +13,10 @@ import IconProp from 'Common/Types/Icon/IconProp';
|
||||
import Domain from 'Model/Models/Domain';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
|
||||
|
||||
@@ -7,7 +7,10 @@ import React, {
|
||||
import PageComponentProps from '../PageComponentProps';
|
||||
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
|
||||
import Probe from 'Model/Models/Probe';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
|
||||
@@ -19,7 +19,10 @@ import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
|
||||
const StatusPageDelete: FunctionComponent<PageComponentProps> = (
|
||||
props: PageComponentProps
|
||||
|
||||
@@ -59,37 +59,43 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
|
||||
setCategoryCheckboxOptionsAndCategories(result);
|
||||
};
|
||||
|
||||
const fetchStatusPage: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const fetchStatusPage: PromiseVoidFunctionType =
|
||||
async (): Promise<void> => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const statusPage: StatusPage | null = await ModelAPI.getItem({
|
||||
modelType: StatusPage,
|
||||
id: modelId,
|
||||
select: {
|
||||
allowSubscribersToChooseResources: true,
|
||||
enableEmailSubscribers: true,
|
||||
},
|
||||
});
|
||||
const statusPage: StatusPage | null = await ModelAPI.getItem({
|
||||
modelType: StatusPage,
|
||||
id: modelId,
|
||||
select: {
|
||||
allowSubscribersToChooseResources: true,
|
||||
enableEmailSubscribers: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (statusPage && statusPage.allowSubscribersToChooseResources) {
|
||||
setAllowSubscribersToChooseResources(
|
||||
if (
|
||||
statusPage &&
|
||||
statusPage.allowSubscribersToChooseResources
|
||||
);
|
||||
await fetchCheckboxOptionsAndCategories();
|
||||
}
|
||||
) {
|
||||
setAllowSubscribersToChooseResources(
|
||||
statusPage.allowSubscribersToChooseResources
|
||||
);
|
||||
await fetchCheckboxOptionsAndCategories();
|
||||
}
|
||||
|
||||
if (statusPage && statusPage.enableEmailSubscribers) {
|
||||
setIsEmailSubscribersEnabled(statusPage.enableEmailSubscribers);
|
||||
if (statusPage && statusPage.enableEmailSubscribers) {
|
||||
setIsEmailSubscribersEnabled(
|
||||
statusPage.enableEmailSubscribers
|
||||
);
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchStatusPage().catch((err: Error) => {
|
||||
|
||||
@@ -60,37 +60,41 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
|
||||
setCategoryCheckboxOptionsAndCategories(result);
|
||||
};
|
||||
|
||||
const fetchStatusPage: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const fetchStatusPage: PromiseVoidFunctionType =
|
||||
async (): Promise<void> => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const statusPage: StatusPage | null = await ModelAPI.getItem({
|
||||
modelType: StatusPage,
|
||||
id: modelId,
|
||||
select: {
|
||||
allowSubscribersToChooseResources: true,
|
||||
enableSmsSubscribers: true,
|
||||
},
|
||||
});
|
||||
const statusPage: StatusPage | null = await ModelAPI.getItem({
|
||||
modelType: StatusPage,
|
||||
id: modelId,
|
||||
select: {
|
||||
allowSubscribersToChooseResources: true,
|
||||
enableSmsSubscribers: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (statusPage && statusPage.allowSubscribersToChooseResources) {
|
||||
setAllowSubscribersToChooseResources(
|
||||
if (
|
||||
statusPage &&
|
||||
statusPage.allowSubscribersToChooseResources
|
||||
);
|
||||
await fetchCheckboxOptionsAndCategories();
|
||||
}
|
||||
) {
|
||||
setAllowSubscribersToChooseResources(
|
||||
statusPage.allowSubscribersToChooseResources
|
||||
);
|
||||
await fetchCheckboxOptionsAndCategories();
|
||||
}
|
||||
|
||||
if (statusPage && statusPage.enableSmsSubscribers) {
|
||||
setIsSMSSubscribersEnabled(statusPage.enableSmsSubscribers);
|
||||
if (statusPage && statusPage.enableSmsSubscribers) {
|
||||
setIsSMSSubscribersEnabled(statusPage.enableSmsSubscribers);
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (err) {
|
||||
setError(API.getFriendlyMessage(err));
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
};
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchStatusPage().catch((err: Error) => {
|
||||
|
||||
@@ -63,7 +63,7 @@ const TraceView: FunctionComponent<PageComponentProps> = (
|
||||
null
|
||||
);
|
||||
|
||||
const fetchItems: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
const fetchItems: PromiseVoidFunctionType = async (): Promise<void> => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
@@ -225,7 +225,6 @@ const TraceView: FunctionComponent<PageComponentProps> = (
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
type SpanToBarFunctionProps = {
|
||||
span: Span;
|
||||
timelineStartTimeUnixNano: number;
|
||||
@@ -233,9 +232,13 @@ const TraceView: FunctionComponent<PageComponentProps> = (
|
||||
divisibilityFactorAndIntervalUnit: string;
|
||||
};
|
||||
|
||||
type SpanToBarFunctionType = (data: SpanToBarFunctionProps) => GanttChartBar;
|
||||
type SpanToBarFunctionType = (
|
||||
data: SpanToBarFunctionProps
|
||||
) => GanttChartBar;
|
||||
|
||||
const spanToBar: SpanToBarFunctionType = (data: SpanToBarFunctionProps): GanttChartBar => {
|
||||
const spanToBar: SpanToBarFunctionType = (
|
||||
data: SpanToBarFunctionProps
|
||||
): GanttChartBar => {
|
||||
const {
|
||||
span,
|
||||
timelineStartTimeUnixNano,
|
||||
@@ -279,9 +282,13 @@ const TraceView: FunctionComponent<PageComponentProps> = (
|
||||
divisibilityFactorAndIntervalUnit: string;
|
||||
};
|
||||
|
||||
type GetBarsFunctionType = (data: GetBarsFunctionProps) => Array<GanttChartBar>;
|
||||
type GetBarsFunctionType = (
|
||||
data: GetBarsFunctionProps
|
||||
) => Array<GanttChartBar>;
|
||||
|
||||
const getBars: GetBarsFunctionType = (data: GetBarsFunctionProps): Array<GanttChartBar> => {
|
||||
const getBars: GetBarsFunctionType = (
|
||||
data: GetBarsFunctionProps
|
||||
): Array<GanttChartBar> => {
|
||||
const {
|
||||
rootSpan,
|
||||
allSpans,
|
||||
@@ -362,7 +369,9 @@ const TraceView: FunctionComponent<PageComponentProps> = (
|
||||
};
|
||||
};
|
||||
|
||||
type GetRowsFromBarsFunctionType = (bars: Array<GanttChartBar>) => Array<GanttChartRow>;
|
||||
type GetRowsFromBarsFunctionType = (
|
||||
bars: Array<GanttChartBar>
|
||||
) => Array<GanttChartRow>;
|
||||
|
||||
const getRowsFromBars: GetRowsFromBarsFunctionType = (
|
||||
bars: Array<GanttChartBar>
|
||||
|
||||
@@ -12,17 +12,19 @@ import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
|
||||
const Settings: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
): ReactElement => {
|
||||
|
||||
|
||||
type GetModelTableFunctionTypeProps = {
|
||||
eventOptions: Array<NotificationSettingEventType>;
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
type GetModelTableFuncitonType = (options: GetModelTableFunctionTypeProps) => ReactElement;
|
||||
type GetModelTableFuncitonType = (
|
||||
options: GetModelTableFunctionTypeProps
|
||||
) => ReactElement;
|
||||
|
||||
const getModelTable: GetModelTableFuncitonType = (options: GetModelTableFunctionTypeProps): ReactElement => {
|
||||
const getModelTable: GetModelTableFuncitonType = (
|
||||
options: GetModelTableFunctionTypeProps
|
||||
): ReactElement => {
|
||||
return (
|
||||
<ModelTable<UserNotificationSetting>
|
||||
modelType={UserNotificationSetting}
|
||||
|
||||
@@ -22,7 +22,10 @@ import { Green, Red, Yellow } from 'Common/Types/BrandColors';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
|
||||
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
|
||||
import { ErrorFunctionType, VoidFunctionType } from 'Common/Types/FunctionTypes';
|
||||
import {
|
||||
ErrorFunctionType,
|
||||
VoidFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
|
||||
const Settings: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
|
||||
@@ -21,8 +21,10 @@ import UserOnCallLogTimeline from 'Model/Models/UserOnCallLogTimeline';
|
||||
import NotificationMethodView from '../../Components/NotificationMethods/NotificationMethod';
|
||||
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
|
||||
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
|
||||
import { VoidFunctionType, ErrorFunctionType } from 'Common/Types/FunctionTypes';
|
||||
|
||||
import {
|
||||
VoidFunctionType,
|
||||
ErrorFunctionType,
|
||||
} from 'Common/Types/FunctionTypes';
|
||||
|
||||
const Settings: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
|
||||
@@ -2,7 +2,7 @@ import { exec, ExecException } from 'node:child_process';
|
||||
|
||||
export default class SelfSignedSSL {
|
||||
public static generate(path: string, host: string): Promise<void> {
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
return new Promise((resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
exec(
|
||||
`mkdir -p ${path} && openssl req -new -x509 -nodes -subj "/C=US/ST=NY/L=NYC/O=Global Security/OU=IT Department/CN=example.com" -out ${path}/${host}.crt -keyout ${path}/${host}.key -days 99999 && chmod -R 777 ${path}`,
|
||||
(err: ExecException | null) => {
|
||||
|
||||
@@ -125,7 +125,7 @@ export default class SSLMonitor {
|
||||
port: port,
|
||||
};
|
||||
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
return new Promise((resolve: Function, reject: PromiseRejectErrorFunctionType) => {
|
||||
const req: tls.TLSSocket = tls.connect(options, () => {
|
||||
const cert: tls.PeerCertificate = req.getPeerCertificate();
|
||||
if (req.authorized) {
|
||||
|
||||
Reference in New Issue
Block a user