Update function type names

This commit is contained in:
Simon Larsen
2024-02-27 15:17:39 +00:00
parent 50770eb6e8
commit 31875081e5
87 changed files with 296 additions and 290 deletions

View File

@@ -40,9 +40,9 @@ const RegisterPage: () => JSX.Element = () => {
Navigation.navigate(DASHBOARD_URL);
}
type FetchResellerFunctionType = (resellerId: string) => Promise<void>;
type FetchResellerFunction = (resellerId: string) => Promise<void>;
const fetchReseller: FetchResellerFunctionType = async (
const fetchReseller: FetchResellerFunction = async (
resellerId: string
): Promise<void> => {
setIsLoading(true);

View File

@@ -16,7 +16,7 @@ import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
import Field from 'CommonUI/src/Components/Forms/Types/Field';
import { RadioButton } from 'CommonUI/src/Components/RadioButtons/GroupRadioButtons';
import Toggle from 'CommonUI/src/Components/Toggle/Toggle';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
export interface ComponentProps {
projects: Array<Project>;
@@ -33,7 +33,7 @@ const DashboardProjectPicker: FunctionComponent<ComponentProps> = (
null
);
const getFooter: GetReactElementFunctionType = (): ReactElement => {
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}
@@ -110,7 +110,7 @@ const DashboardProjectPicker: FunctionComponent<ComponentProps> = (
refreshFields();
}, [isSubscriptionPlanYearly]);
const refreshFields: VoidFunctionType = (): void => {
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {

View File

@@ -10,12 +10,12 @@ import Navigation from 'CommonUI/src/Utils/Navigation';
import { ACCOUNTS_URL } from 'CommonUI/src/Config';
import UiAnalytics from 'CommonUI/src/Utils/Analytics';
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
const Logout: FunctionComponent = (): ReactElement => {
const [error, setError] = React.useState<string | null>(null);
const logout: PromiseVoidFunctionType = async (): Promise<void> => {
const logout: PromiseVoidFunction = async (): Promise<void> => {
UiAnalytics.logout();
await UserUtil.logout();
Navigation.navigate(ACCOUNTS_URL);

View File

@@ -20,7 +20,7 @@ import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
import { RadioButton } from 'CommonUI/src/Components/RadioButtons/GroupRadioButtons';
import Toggle from 'CommonUI/src/Components/Toggle/Toggle';
import AdminModelAPI from '../../Utils/ModelAPI';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
const Projects: FunctionComponent = (): ReactElement => {
const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] =
@@ -30,7 +30,7 @@ const Projects: FunctionComponent = (): ReactElement => {
refreshFields();
}, [isSubscriptionPlanYearly]);
const refreshFields: VoidFunctionType = (): void => {
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {
@@ -156,7 +156,7 @@ const Projects: FunctionComponent = (): ReactElement => {
const [fields, setFields] = useState<Array<Field<Project>>>([]);
const getFooter: GetReactElementFunctionType = (): ReactElement => {
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}

View File

@@ -20,9 +20,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
const Settings: FunctionComponent = (): ReactElement => {
const [showKeyModal, setShowKeyModal] = useState<boolean>(false);
@@ -134,8 +134,8 @@ const Settings: FunctionComponent = (): ReactElement => {
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentProbe(item);

View File

@@ -25,7 +25,7 @@ const Settings: FunctionComponent = (): ReactElement => {
const [error, setError] = React.useState<string>('');
const fetchItem: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchItem: PromiseVoidFunction = async (): Promise<void> => {
setIsLoading(true);
const globalConfig: GlobalConfig | null =

View File

@@ -155,7 +155,7 @@ export default class RunWorkflow {
];
const componentsExecuted: Array<string> = [];
const setDidErrorOut: VoidFunctionType = () => {
const setDidErrorOut: VoidFunction = () => {
didWorkflowErrorOut = true;
};
// make variable map

View File

@@ -1,4 +1,4 @@
export type PromiseVoidFunctionType = () => Promise<void>;
export type VoidFunctionType = () => void;
export type ErrorFunctionType = (err: Error) => void;
export type PromiseRejectErrorFunctionType = (err: Error) => void;
export type PromiseVoidFunction = () => Promise<void>;
export type VoidFunction = () => void;
export type ErrorFunction = (err: Error) => void;
export type PromiseRejectErrorFunction = (err: Error) => void;

View File

@@ -33,7 +33,7 @@ export default class QueueWorker {
return new Promise(
(
_resolve: Function,
reject: PromiseRejectErrorFunctionType
reject: PromiseRejectErrorFunction
) => {
setTimeout(() => {
return reject(new TimeoutException('Job Timeout'));

View File

@@ -8,7 +8,7 @@ export default class Domain extends DomainCommon {
verificationText: string
): Promise<boolean> {
return new Promise(
(resolve: Function, reject: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
dns.resolveTxt(
domain.toString(),
(

View File

@@ -4,7 +4,7 @@ import {
NextFunction,
} from '../Utils/Express';
export type ExpressAPIFunctionType = (
export type ExpressAPIFunction = (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction

View File

@@ -3,7 +3,7 @@ import fs from 'fs';
export default class LocalFile {
public static async makeDirectory(path: string): Promise<void> {
return new Promise(
(resolve: Function, reject: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
fs.mkdir(path, { recursive: true }, (err: unknown) => {
if (err) {
return reject(err);
@@ -16,7 +16,7 @@ export default class LocalFile {
public static async write(path: string, data: string): Promise<void> {
return new Promise(
(resolve: Function, reject: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
fs.writeFile(path, data, (err: unknown) => {
if (err) {
return reject();
@@ -31,7 +31,7 @@ export default class LocalFile {
return new Promise(
(
resolve: (data: string) => void,
reject: PromiseRejectErrorFunctionType
reject: PromiseRejectErrorFunction
) => {
fs.readFile(
path,

View File

@@ -3,7 +3,7 @@ import { Stream } from 'stream';
export default class StreamUtil {
public static convertStreamToText(stream: Stream): Promise<string> {
return new Promise<string>(
(resolve: Function, reject: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
const chunks: Array<any> = [];
stream.on('data', (chunk: any) => {

View File

@@ -3,9 +3,9 @@ import { ButtonStyleType } from '../Button/Button';
import IconProp from 'Common/Types/Icon/IconProp';
import {
ErrorFunctionType,
VoidFunctionType,
} from 'Common/Types/FunctionTypes';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
interface ActionButtonSchema {
title: string;
@@ -15,8 +15,8 @@ interface ActionButtonSchema {
isVisible?: (item: JSONObject) => boolean | undefined;
onClick: (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => void;
}

View File

@@ -59,7 +59,7 @@ const FilePicker: FunctionComponent<ComponentProps> = (
setInitialValue();
}, [props.initialValue]);
const setInitialValue: VoidFunctionType = () => {
const setInitialValue: VoidFunction = () => {
if (
Array.isArray(props.initialValue) &&
props.initialValue &&

View File

@@ -31,7 +31,7 @@ import useAsyncEffect from 'use-async-effect';
import API from '../../Utils/API/API';
import ErrorMessage from '../ErrorMessage/ErrorMessage';
import { FormikErrors, FormikProps } from 'formik';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
export type FormProps<T> = FormikProps<T>;
export type FormErrors<T> = FormikErrors<T>;
@@ -260,7 +260,7 @@ const BasicForm: ForwardRefExoticComponent<any> = forwardRef(
return fieldName;
};
const setAllTouched: VoidFunctionType = (): void => {
const setAllTouched: VoidFunction = (): void => {
const touchedObj: Dictionary<boolean> = {};
for (const field of formFields) {

View File

@@ -29,9 +29,9 @@ import Typeof from 'Common/Types/Typeof';
import Modal from '../../Modal/Modal';
import Link from '../../Link/Link';
import {
GetReactElementFunctionType,
GetReactElementOrStringFunctionType,
} from '../../../Types/FunctionTypes';
GetReactElementFunction,
GetReactElementOrStringFunction,
} from '../../../Types/Functions';
export interface ComponentProps<T extends Object> {
field: Field<T>;
@@ -79,7 +79,7 @@ const FormField: <T extends Object>(
}
};
const getFormField: GetReactElementFunctionType = (): ReactElement => {
const getFormField: GetReactElementFunction = (): ReactElement => {
const [
showMultiSelectCheckboxCategoryModal,
setShowMultiSelectCheckboxCategoryModal,
@@ -196,7 +196,7 @@ const FormField: <T extends Object>(
OneUptimeDate.getCurrentTimezoneString();
}
const getFieldDescription: GetReactElementOrStringFunctionType = ():
const getFieldDescription: GetReactElementOrStringFunction = ():
| ReactElement
| string => {
if (

View File

@@ -5,7 +5,7 @@ import ModelAPI, { RequestOptions } from '../../Utils/ModelAPI/ModelAPI';
import API from '../../Utils/API/API';
import IconProp from 'Common/Types/Icon/IconProp';
import HeaderAlert from './HeaderAlert';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
export interface ComponentProps<TBaseModel extends BaseModel> {
icon: IconProp;
@@ -33,7 +33,7 @@ const HeaderModelAlert: <TBaseModel extends BaseModel>(
fetchCount();
}, [props.refreshToggle]);
const fetchCount: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchCount: PromiseVoidFunction = async (): Promise<void> => {
setError('');
setIsLoading(true);

View File

@@ -8,7 +8,7 @@ import ListBody from './ListBody';
import Field from '../Detail/Field';
import { DragDropContext, DropResult } from 'react-beautiful-dnd';
import { ListDetailProps } from './ListRow';
import { GetReactElementFunctionType } from '../../Types/FunctionTypes';
import { GetReactElementFunction } from '../../Types/Functions';
export interface ComponentProps {
data: Array<JSONObject>;
@@ -36,7 +36,7 @@ export interface ComponentProps {
const List: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
const getListbody: GetReactElementFunctionType = (): ReactElement => {
const getListbody: GetReactElementFunction = (): ReactElement => {
if (props.isLoading) {
return <ComponentLoader />;
}

View File

@@ -3,7 +3,7 @@ import React, { FunctionComponent, ReactElement, Ref } from 'react';
import LogItem from './LogItem';
import LogsFilters, { FilterOption } from './LogsFilters';
import ComponentLoader from '../ComponentLoader/ComponentLoader';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
export interface ComponentProps {
logs: Array<Log>;
@@ -39,7 +39,7 @@ const LogsViewer: FunctionComponent<ComponentProps> = (
// Keep scroll to the bottom of the log
const scrollToBottom: VoidFunctionType = (): void => {
const scrollToBottom: VoidFunction = (): void => {
const logsViewer: HTMLDivElement | null = logsViewerRef.current;
if (logsViewer) {

View File

@@ -6,7 +6,7 @@ import { ButtonStyleType } from '../Button/Button';
import Card from '../Card/Card';
import API from '../../Utils/API/API';
import IconProp from 'Common/Types/Icon/IconProp';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import ConfirmModal from '../Modal/ConfirmModal';
export interface ComponentProps<TBaseModel extends BaseModel> {
@@ -26,7 +26,7 @@ const ModelDelete: <TBaseModel extends BaseModel>(
const [error, setError] = useState<string>('');
const [showErrorModal, setShowErrorModal] = useState<boolean>(false);
const deleteItem: PromiseVoidFunctionType = async (): Promise<void> => {
const deleteItem: PromiseVoidFunction = async (): Promise<void> => {
setIsLoading(true);
try {
await ModelAPI.deleteItem<TBaseModel>({

View File

@@ -17,7 +17,7 @@ import API from '../../Utils/API/API';
import ErrorMessage from '../ErrorMessage/ErrorMessage';
import { useAsyncEffect } from 'use-async-effect';
import User from '../../Utils/User';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
export interface ComponentProps<TBaseModel extends BaseModel> {
modelType: { new (): TBaseModel };
@@ -89,7 +89,7 @@ const ModelDetail: <TBaseModel extends BaseModel>(
return relationSelect;
};
const setDetailFields: VoidFunctionType = (): void => {
const setDetailFields: VoidFunction = (): void => {
// set fields.
const userPermissions: Array<Permission> =

View File

@@ -7,7 +7,7 @@ import ModelAPI, {
ListResult,
RequestOptions,
} from '../../Utils/ModelAPI/ModelAPI';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax';
import Select from '../../Utils/BaseDatabase/Select';
import Input from '../Input/Input';
@@ -76,7 +76,7 @@ const ModelList: <TBaseModel extends BaseModel>(
}
}, [props.isSearchEnabled, modelList]);
const fetchItems: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchItems: PromiseVoidFunction = async (): Promise<void> => {
setError('');
setIsLoading(true);

View File

@@ -12,7 +12,7 @@ import {
DroppableProvided,
} from 'react-beautiful-dnd';
import Icon from '../Icon/Icon';
import { GetReactElementFunctionType } from '../../Types/FunctionTypes';
import { GetReactElementFunction } from '../../Types/Functions';
export interface ComponentProps<TBaseModel extends BaseModel> {
list: Array<TBaseModel>;
@@ -173,7 +173,7 @@ const StaticModelList: <TBaseModel extends BaseModel>(
);
};
const getComponent: GetReactElementFunctionType = (): ReactElement => {
const getComponent: GetReactElementFunction = (): ReactElement => {
if (props.enableDragAndDrop) {
return (
<Droppable droppableId={props.dragAndDropScope || ''}>

View File

@@ -7,7 +7,7 @@ import ComponentLoader from '../ComponentLoader/ComponentLoader';
import ErrorMessage from '../ErrorMessage/ErrorMessage';
import ProgressBar from '../ProgressBar/ProgressBar';
import API from '../../Utils/API/API';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
export interface ComponentProps<TBaseModel extends BaseModel> {
title: string;
@@ -26,7 +26,7 @@ const ModelProgress: <TBaseModel extends BaseModel>(
const [error, setError] = useState<string>('');
const [count, setCount] = useState<number>(0);
const fetchCount: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchCount: PromiseVoidFunction = async (): Promise<void> => {
setError('');
setIsLoading(true);

View File

@@ -7,9 +7,9 @@ import React, {
} from 'react';
import Columns from './Columns';
import {
ErrorFunctionType,
VoidFunctionType,
} from 'Common/Types/FunctionTypes';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import Table from '../Table/Table';
import TableColumn from '../Table/Types/Column';
import { JSONObject } from 'Common/Types/JSON';
@@ -72,8 +72,8 @@ import AnalyticsBaseModel, {
} from 'Common/AnalyticsModels/BaseModel';
import Sort from '../../Utils/BaseDatabase/Sort';
import { FormProps } from '../Forms/BasicForm';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { GetReactElementFunctionType } from '../../Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import { GetReactElementFunction } from '../../Types/Functions';
export enum ShowTableAs {
Table,
@@ -352,7 +352,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
setIsLoading(false);
};
const serializeToTableColumns: VoidFunctionType = (): void => {
const serializeToTableColumns: VoidFunction = (): void => {
// Convert ModelColumns to TableColumns.
const columns: Array<TableColumn> = [];
@@ -480,7 +480,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
setColumns(columns);
};
const getFilterDropdownItems: PromiseVoidFunctionType =
const getFilterDropdownItems: PromiseVoidFunction =
async (): Promise<void> => {
setTableFilterError('');
setIsTableFilterFetchLoading(true);
@@ -576,7 +576,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
setIsTableFilterFetchLoading(false);
};
const fetchItems: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchItems: PromiseVoidFunction = async (): Promise<void> => {
setError('');
setIsLoading(true);
@@ -682,7 +682,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
return selectFields;
};
const setHeaderButtons: VoidFunctionType = (): void => {
const setHeaderButtons: VoidFunction = (): void => {
// add header buttons.
let headerbuttons: Array<CardButtonSchema> = [];
@@ -771,19 +771,19 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
props.refreshToggle,
]);
type ShouldDisableSortFunctionType = (columnName: string) => boolean;
type ShouldDisableSortFunction = (columnName: string) => boolean;
const shouldDisableSort: ShouldDisableSortFunctionType = (
const shouldDisableSort: ShouldDisableSortFunction = (
columnName: string
): boolean => {
return model.isEntityColumn(columnName);
};
type GetColumnKeyFunctionType = (
type GetColumnKeyFunction = (
column: ModelTableColumn<TBaseModel>
) => string | null;
const getColumnKey: GetColumnKeyFunctionType = (
const getColumnKey: GetColumnKeyFunction = (
column: ModelTableColumn<TBaseModel>
): string | null => {
const key: string | null = column.field
@@ -793,11 +793,11 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
return key;
};
type HasPermissionToReadColumnFunctionType = (
type HasPermissionToReadColumnFunction = (
column: ModelTableColumn<TBaseModel>
) => boolean;
const hasPermissionToReadColumn: HasPermissionToReadColumnFunctionType = (
const hasPermissionToReadColumn: HasPermissionToReadColumnFunction = (
column: ModelTableColumn<TBaseModel>
): boolean => {
const accessControl: Dictionary<ColumnAccessControl> =
@@ -833,9 +833,9 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
return hasPermission;
};
type GetUserPermissionsFunctionType = () => Array<Permission>;
type GetUserPermissionsFunction = () => Array<Permission>;
const getUserPermissions: GetUserPermissionsFunctionType =
const getUserPermissions: GetUserPermissionsFunction =
(): Array<Permission> => {
let userPermissions: Array<Permission> =
PermissionUtil.getGlobalPermissions()?.globalPermissions || [];
@@ -866,7 +866,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
serializeToTableColumns();
}, [data]);
const setActionSchema: VoidFunctionType = () => {
const setActionSchema: VoidFunction = () => {
const permissions: Array<Permission> =
PermissionUtil.getAllPermissions();
@@ -878,8 +878,8 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
buttonStyleType: ButtonStyleType.OUTLINE,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setViewId(item['_id'] as string);
@@ -911,8 +911,8 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
const baseModel: TBaseModel =
@@ -969,8 +969,8 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
buttonStyleType: ButtonStyleType.OUTLINE,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
if (props.onBeforeEdit) {
@@ -1000,8 +1000,8 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
buttonStyleType: ButtonStyleType.DANGER_OUTLINE,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
if (props.onBeforeDelete) {
@@ -1026,7 +1026,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
setActionButtonSchema(actionsSchema);
};
const getTable: GetReactElementFunctionType = (): ReactElement => {
const getTable: GetReactElementFunction = (): ReactElement => {
return (
<Table
onFilterChanged={(filterData: FilterData) => {
@@ -1125,7 +1125,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
);
};
const getOrderedStatesList: GetReactElementFunctionType =
const getOrderedStatesList: GetReactElementFunction =
(): ReactElement => {
if (!props.orderedStatesListProps) {
throw new BadDataException(
@@ -1197,7 +1197,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
);
};
const getList: GetReactElementFunctionType = (): ReactElement => {
const getList: GetReactElementFunction = (): ReactElement => {
return (
<List
singularLabel={
@@ -1299,7 +1299,7 @@ const BaseModelTable: <TBaseModel extends BaseModel | AnalyticsBaseModel>(
);
};
const getCardComponent: GetReactElementFunctionType = (): ReactElement => {
const getCardComponent: GetReactElementFunction = (): ReactElement => {
if (showTableAs === ShowTableAs.List) {
return (
<div>

View File

@@ -8,7 +8,7 @@ import { ButtonStyleType } from '../Button/Button';
import IconProp from 'Common/Types/Icon/IconProp';
import ConfirmModal from '../Modal/ConfirmModal';
import { TableColumnMetadata } from 'Common/Types/Database/TableColumn';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
export interface ComponentProps<TBaseModel extends BaseModel> {
modelType: { new (): TBaseModel };
@@ -33,7 +33,7 @@ const ResetObjectID: <TBaseModel extends BaseModel>(
const [newId, setNewId] = useState<ObjectID | null>(null);
const resetKey: PromiseVoidFunctionType = async (): Promise<void> => {
const resetKey: PromiseVoidFunction = async (): Promise<void> => {
setIsLoading(true);
try {
const resetIdTo: ObjectID = ObjectID.generate();

View File

@@ -7,7 +7,7 @@ import { BadgeType } from '../Badge/Badge';
import SideMenuItem from './SideMenuItem';
import API from '../../Utils/API/API';
import IconProp from 'Common/Types/Icon/IconProp';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
export interface ComponentProps<TBaseModel extends BaseModel> {
link: Link;
@@ -29,7 +29,7 @@ const CountModelSideMenuItem: <TBaseModel extends BaseModel>(
const [error, setError] = useState<string>('');
const [count, setCount] = useState<number>(0);
const fetchCount: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchCount: PromiseVoidFunction = async (): Promise<void> => {
if (!props.modelType) {
return;
}

View File

@@ -10,7 +10,7 @@ import ErrorMessage from '../ErrorMessage/ErrorMessage';
import ComponentLoader from '../ComponentLoader/ComponentLoader';
import { DragDropContext, DropResult } from 'react-beautiful-dnd';
import Filter, { FilterData } from './Filter';
import { GetReactElementFunctionType } from '../../Types/FunctionTypes';
import { GetReactElementFunction } from '../../Types/Functions';
export interface ComponentProps {
data: Array<JSONObject>;
@@ -48,7 +48,7 @@ const Table: FunctionComponent<ComponentProps> = (
colspan++;
}
const getTablebody: GetReactElementFunctionType = (): ReactElement => {
const getTablebody: GetReactElementFunction = (): ReactElement => {
if (props.isLoading) {
return (
<tbody>

View File

@@ -5,7 +5,7 @@ import React, {
useEffect,
useState,
} from 'react';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
import ReactFlow, {
MiniMap,
Controls,
@@ -315,7 +315,7 @@ const Workflow: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
props.onComponentPickerModalUpdate(showComponentsModal);
}, [showComponentsModal]);
const refreshEdges: VoidFunctionType = (): void => {
const refreshEdges: VoidFunction = (): void => {
setEdges((eds: Array<Edge>) => {
return eds.map((edge: Edge) => {
return {

View File

@@ -13,11 +13,11 @@ import ComponentsModal from '../../Components/Workflow/ComponentsModal';
/// @dev we use different UUID for (id & title), description, and category to ensure that the component is unique
type GetComponentMetadataFunctionType = (
type GetComponentMetadataFunction = (
category?: string
) => ComponentMetadata;
const getComponentMetadata: GetComponentMetadataFunctionType = (
const getComponentMetadata: GetComponentMetadataFunction = (
category?: string
): ComponentMetadata => {
const id: string = faker.datatype.uuid();

View File

@@ -69,9 +69,9 @@ const mockCreateResponse: MockCreateResponseFunction = async (
);
};
type MockFileModelFunctionType = (file: File) => Promise<FileModel>;
type MockFileModelFunction = (file: File) => Promise<FileModel>;
const mockFileModel: MockFileModelFunctionType = async (
const mockFileModel: MockFileModelFunction = async (
file: File
): Promise<FileModel> => {
const fileModel: FileModel = new FileModel(new ObjectID('123'));
@@ -83,9 +83,9 @@ const mockFileModel: MockFileModelFunctionType = async (
return fileModel;
};
type MockFileFunctionType = () => File;
type MockFileFunction = () => File;
const mockFile: MockFileFunctionType = (): File => {
const mockFile: MockFileFunction = (): File => {
const mockArrayBuffer: jest.Mock = jest.fn();
mockArrayBuffer.mockResolvedValue(new ArrayBuffer(10)); // Mocked array buffer of size 10

View File

@@ -1,5 +1,5 @@
import { ReactElement } from 'react';
export type GetReactElementFunctionType = () => ReactElement;
export type GetReactElementFunction = () => ReactElement;
export type GetReactElementOrStringFunctionType = () => ReactElement | string;
export type GetReactElementOrStringFunction = () => ReactElement | string;

View File

@@ -6,9 +6,9 @@ import React, {
} from 'react';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import {
ErrorFunctionType,
VoidFunctionType,
} from 'Common/Types/FunctionTypes';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import ProjectCallSMSConfig from 'Model/Models/ProjectCallSMSConfig';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
@@ -59,8 +59,8 @@ const CustomCallSMSTable: FunctionComponent = (): ReactElement => {
icon: IconProp.SMS,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentCallSMSTestConfig(item);
@@ -79,8 +79,8 @@ const CustomCallSMSTable: FunctionComponent = (): ReactElement => {
icon: IconProp.Call,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentCallSMSTestConfig(item);

View File

@@ -6,9 +6,9 @@ import React, {
} from 'react';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import {
ErrorFunctionType,
VoidFunctionType,
} from 'Common/Types/FunctionTypes';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import ProjectSmtpConfig from 'Model/Models/ProjectSmtpConfig';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
@@ -51,8 +51,8 @@ const CustomSMTPTable: FunctionComponent = (): ReactElement => {
icon: IconProp.Play,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentSMTPTestConfig(item);

View File

@@ -30,7 +30,7 @@ import Incident from 'Model/Models/Incident';
import OneUptimeDate from 'Common/Types/Date';
import HeaderModelAlert from 'CommonUI/src/Components/HeaderAlert/HeaderModelAlert';
import HeaderAlert from 'CommonUI/src/Components/HeaderAlert/HeaderAlert';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
export interface ComponentProps {
projects: Array<Project>;
@@ -47,7 +47,7 @@ const DashboardHeader: FunctionComponent<ComponentProps> = (
const [activeIncidentToggleRefresh, setActiveIncidentToggleRefresh] =
useState<boolean>(true);
const refreshIncidentCount: VoidFunctionType = () => {
const refreshIncidentCount: VoidFunction = () => {
setActiveIncidentToggleRefresh(!activeIncidentToggleRefresh);
};

View File

@@ -18,8 +18,8 @@ import { RadioButton } from 'CommonUI/src/Components/RadioButtons/GroupRadioButt
import Toggle from 'CommonUI/src/Components/Toggle/Toggle';
import LocalStorage from 'CommonUI/src/Utils/LocalStorage';
import { JSONValue } from 'Common/Types/JSON';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
import { VoidFunction } from 'Common/Types/Functions';
export interface ComponentProps {
projects: Array<Project>;
@@ -53,7 +53,7 @@ const DashboardProjectPicker: FunctionComponent<ComponentProps> = (
refreshFields();
}, [initialValues]);
const getFooter: GetReactElementFunctionType = (): ReactElement => {
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}
@@ -130,7 +130,7 @@ const DashboardProjectPicker: FunctionComponent<ComponentProps> = (
refreshFields();
}, [isSubscriptionPlanYearly]);
const refreshFields: VoidFunctionType = (): void => {
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {

View File

@@ -11,14 +11,14 @@ import Button, { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
import { BILLING_ENABLED, getAllEnvVars } from 'CommonUI/src/Config';
import DashboardNavigation from '../../Utils/Navigation';
import Toggle from 'CommonUI/src/Components/Toggle/Toggle';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
const Upgrade: () => JSX.Element = (): ReactElement => {
const [showModal, setShowModal] = useState<boolean>(false);
const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] =
useState<boolean>(true);
const getFooter: GetReactElementFunctionType = (): ReactElement => {
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}

View File

@@ -18,7 +18,7 @@ import Search from 'Common/Types/BaseDatabase/Search';
import InBetween from 'Common/Types/BaseDatabase/InBetween';
import Select from 'CommonUI/src/Utils/BaseDatabase/Select';
import Includes from 'Common/Types/BaseDatabase/Includes';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
export interface ComponentProps {
id: string;
@@ -85,7 +85,7 @@ const DashboardLogsViewer: FunctionComponent<ComponentProps> = (
});
}, [filterOptions]);
const fetchItems: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchItems: PromiseVoidFunction = async (): Promise<void> => {
setError('');
setIsLoading(true);

View File

@@ -11,7 +11,7 @@ import Statusbubble from 'CommonUI/src/Components/StatusBubble/StatusBubble';
import Color from 'Common/Types/Color';
import MonitorGroup from 'Model/Models/MonitorGroup';
import Loader from 'CommonUI/src/Components/Loader/Loader';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
export interface ComponentProps {
monitorGroupId: ObjectID;
@@ -27,7 +27,7 @@ const CurrentStatusElement: FunctionComponent<ComponentProps> = (
const [error, setError] = React.useState<string | undefined>(undefined);
const loadCurrentStatus: PromiseVoidFunctionType =
const loadCurrentStatus: PromiseVoidFunction =
async (): Promise<void> => {
setIsLoading(true);

View File

@@ -8,7 +8,7 @@ import IconProp from 'Common/Types/Icon/IconProp';
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import URL from 'Common/Types/API/URL';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
export interface ComponentProps {
show: boolean;
@@ -23,7 +23,7 @@ const DashboardNavbar: FunctionComponent<ComponentProps> = (
typeof setTimeout
> | null>(null);
const hideMoreMenu: VoidFunctionType = (): void => {
const hideMoreMenu: VoidFunction = (): void => {
if (moreMenuTimeout) {
clearTimeout(moreMenuTimeout);
setMoreMenuTimeout(null);
@@ -36,7 +36,7 @@ const DashboardNavbar: FunctionComponent<ComponentProps> = (
setMoreMenuTimeout(timeout);
};
const forceHideMoreMenu: VoidFunctionType = (): void => {
const forceHideMoreMenu: VoidFunction = (): void => {
if (moreMenuTimeout) {
clearTimeout(moreMenuTimeout);
setMoreMenuTimeout(null);
@@ -45,7 +45,7 @@ const DashboardNavbar: FunctionComponent<ComponentProps> = (
setIsComponentVisible(false);
};
const showMoreMenu: VoidFunctionType = (): void => {
const showMoreMenu: VoidFunction = (): void => {
if (moreMenuTimeout) {
clearTimeout(moreMenuTimeout);
}

View File

@@ -8,9 +8,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import { JSONObject } from 'Common/Types/JSON';
import URL from 'Common/Types/API/URL';
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
@@ -70,8 +70,8 @@ const Call: () => JSX.Element = (): ReactElement => {
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentItem(item);
@@ -96,8 +96,8 @@ const Call: () => JSX.Element = (): ReactElement => {
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentItem(item);

View File

@@ -9,9 +9,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import URL from 'Common/Types/API/URL';
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
import HTTPResponse from 'Common/Types/API/HTTPResponse';
@@ -70,8 +70,8 @@ const Email: () => JSX.Element = (): ReactElement => {
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentItem(item);
@@ -96,8 +96,8 @@ const Email: () => JSX.Element = (): ReactElement => {
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentItem(item);

View File

@@ -10,9 +10,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
import HTTPResponse from 'Common/Types/API/HTTPResponse';
import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse';
@@ -70,8 +70,8 @@ const SMS: () => JSX.Element = (): ReactElement => {
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentItem(item);
@@ -96,8 +96,8 @@ const SMS: () => JSX.Element = (): ReactElement => {
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentItem(item);

View File

@@ -10,9 +10,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import Incident from 'Model/Models/Incident';
import OnCallDutyPolicyStatus from 'Common/Types/OnCallDutyPolicy/OnCallDutyPolicyStatus';
import UserElement from '../../../Components/User/User';
@@ -212,8 +212,8 @@ const ExecutionLogsTable: FunctionComponent<ComponentProps> = (
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setStatusMessage(

View File

@@ -13,14 +13,14 @@ import UserElement from '../../User/User';
import User from 'Model/Models/User';
import EscalationRule from '../EscalationRule/EscalationRule';
import {
ErrorFunctionType,
VoidFunctionType,
} from 'Common/Types/FunctionTypes';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import OnCallDutyPolicyEscalationRule from 'Model/Models/OnCallDutyPolicyEscalationRule';
import ObjectID from 'Common/Types/ObjectID';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
import BaseModel from 'Common/Models/BaseModel';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
export interface ComponentProps {
onCallPolicyExecutionLogId: ObjectID;
@@ -33,7 +33,7 @@ const ExecutionLogTimelineTable: FunctionComponent<ComponentProps> = (
useState<boolean>(false);
const [statusMessage, setStatusMessage] = useState<string>('');
const getModelTable: GetReactElementFunctionType = (): ReactElement => {
const getModelTable: GetReactElementFunction = (): ReactElement => {
return (
<ModelTable<OnCallDutyPolicyExecutionLogTimeline>
modelType={OnCallDutyPolicyExecutionLogTimeline}
@@ -65,8 +65,8 @@ const ExecutionLogTimelineTable: FunctionComponent<ComponentProps> = (
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setStatusMessage(

View File

@@ -10,7 +10,7 @@ import DashboardNavigation from '../../../Utils/Navigation';
import ProjectUser from '../../../Utils/ProjectUser';
import UserElement from '../../User/User';
import SortOrder from 'Common/Types/BaseDatabase/SortOrder';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
export interface ComponentProps {
layer: OnCallDutyPolicyScheduleLayer;
@@ -25,7 +25,7 @@ const LayerUser: FunctionComponent<ComponentProps> = (
const [showAddUserModal, setShowAddUserModal] = useState<boolean>(false);
const [reloadList, setReloadList] = useState<boolean>(false);
const getAddUserButton: GetReactElementFunctionType = (): ReactElement => {
const getAddUserButton: GetReactElementFunction = (): ReactElement => {
return (
<div className="flex w-full justify-center mt-5">
<Button

View File

@@ -14,7 +14,7 @@ import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax';
import SortOrder from 'Common/Types/BaseDatabase/SortOrder';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import HTTPResponse from 'Common/Types/API/HTTPResponse';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import EmptyState from 'CommonUI/src/Components/EmptyState/EmptyState';
@@ -63,7 +63,7 @@ const Layers: FunctionComponent<ComponentProps> = (
});
}, []);
const addLayer: PromiseVoidFunctionType = async (): Promise<void> => {
const addLayer: PromiseVoidFunction = async (): Promise<void> => {
setIsAddButtonLoading(true);
try {
@@ -156,7 +156,7 @@ const Layers: FunctionComponent<ComponentProps> = (
);
};
const addLayerButton: GetReactElementFunctionType = (): ReactElement => {
const addLayerButton: GetReactElementFunction = (): ReactElement => {
return (
<div className="-ml-3 mt-5">
<Button
@@ -171,7 +171,7 @@ const Layers: FunctionComponent<ComponentProps> = (
);
};
const fetchLayers: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchLayers: PromiseVoidFunction = async (): Promise<void> => {
setIsLoading(true);
try {

View File

@@ -40,7 +40,7 @@ const RestrictionTimesFieldElement: FunctionComponent<ComponentProps> = (
}
}, [props.value]);
const getDailyRestriction: GetReactElementFunctionType =
const getDailyRestriction: GetReactElementFunction =
(): ReactElement => {
// show start time to end time input fields
@@ -132,7 +132,7 @@ const RestrictionTimesFieldElement: FunctionComponent<ComponentProps> = (
);
};
const getWeeklyTimeRestrictions: GetReactElementFunctionType =
const getWeeklyTimeRestrictions: GetReactElementFunction =
(): ReactElement => {
return (
<div>

View File

@@ -14,9 +14,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import GlobalEvents from 'CommonUI/src/Utils/GlobalEvents';
import EventName from '../../Utils/EventName';
import Navigation from 'CommonUI/src/Utils/Navigation';
@@ -87,8 +87,8 @@ const Home: FunctionComponent<PageComponentProps> = (
icon: IconProp.Check,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
// accept invite.

View File

@@ -29,7 +29,7 @@ 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';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
const MonitorCriteria: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
@@ -76,7 +76,7 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
await fetchItem();
}, []);
const getPageContent: GetReactElementFunctionType = (): ReactElement => {
const getPageContent: GetReactElementFunction = (): ReactElement => {
if (!monitorType || isLoading) {
return <ComponentLoader />;
}

View File

@@ -22,7 +22,7 @@ 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';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
const MonitorCriteria: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
@@ -69,7 +69,7 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
await fetchItem();
}, []);
const getPageContent: GetReactElementFunctionType = (): ReactElement => {
const getPageContent: GetReactElementFunction = (): ReactElement => {
if (!monitorType || isLoading) {
return <ComponentLoader />;
}

View File

@@ -32,7 +32,7 @@ import Modal, { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
import BadDataException from 'Common/Types/Exception/BadDataException';
import useAsyncEffect from 'use-async-effect';
import ProbeStatusElement from '../../../Components/Probe/ProbeStatus';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
const MonitorProbes: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
@@ -114,7 +114,7 @@ const MonitorProbes: FunctionComponent<PageComponentProps> = (
await fetchItem();
}, []);
const getPageContent: GetReactElementFunctionType = (): ReactElement => {
const getPageContent: GetReactElementFunction = (): ReactElement => {
if (!monitorType || isLoading) {
return <ComponentLoader />;
}

View File

@@ -22,7 +22,7 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
import useAsyncEffect from 'use-async-effect';
import DuplicateModel from 'CommonUI/src/Components/DuplicateModel/DuplicateModel';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
const MonitorCriteria: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
@@ -73,7 +73,7 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
await fetchItem();
}, []);
const getPageContent: GetReactElementFunctionType = (): ReactElement => {
const getPageContent: GetReactElementFunction = (): ReactElement => {
if (!monitorType || isLoading) {
return <ComponentLoader />;
}

View File

@@ -27,7 +27,7 @@ const MonitorIncidents: FunctionComponent<PageComponentProps> = (
const [error, setError] = React.useState<string | undefined>(undefined);
const loadMonitorsIds: PromiseVoidFunctionType =
const loadMonitorsIds: PromiseVoidFunction =
async (): Promise<void> => {
setIsLoading(true);

View File

@@ -39,7 +39,7 @@ const MonitorGroupResources: FunctionComponent<PageComponentProps> = (
const [error, setError] = React.useState<string | undefined>(undefined);
const loadMonitorStatuses: PromiseVoidFunctionType =
const loadMonitorStatuses: PromiseVoidFunction =
async (): Promise<void> => {
setIsLoading(true);

View File

@@ -139,7 +139,7 @@ const Settings: FunctionComponent<ComponentProps> = (
}
};
const getFooter: GetReactElementFunctionType = (): ReactElement => {
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}

View File

@@ -14,9 +14,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import ObjectID from 'Common/Types/ObjectID';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
@@ -75,8 +75,8 @@ const Domains: FunctionComponent<PageComponentProps> = (
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentVerificationDomain(item);

View File

@@ -32,12 +32,12 @@ const Settings: FunctionComponent<ComponentProps> = (
const [error, setError] = useState<string | null>(null);
const [isLoading, setIsLoading] = useState<boolean>(false);
type PayInvoiceFunctionType = (
type PayInvoiceFunction = (
customerId: string,
invoiceId: string
) => Promise<void>;
const payInvoice: PayInvoiceFunctionType = async (
const payInvoice: PayInvoiceFunction = async (
customerId: string,
invoiceId: string
): Promise<void> => {

View File

@@ -8,9 +8,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import { JSONObject } from 'Common/Types/JSON';
@@ -173,8 +173,8 @@ const ProbePage: FunctionComponent<PageComponentProps> = (
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentProbe(item);

View File

@@ -20,9 +20,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
const StatusPageDelete: FunctionComponent<PageComponentProps> = (
props: PageComponentProps
@@ -80,8 +80,8 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
},
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCnameModalText(`${item['fullDomain']}`);
@@ -109,8 +109,8 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
},
onClick: async (
_item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setShowSslProvisioningModal(true);

View File

@@ -59,7 +59,7 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
setCategoryCheckboxOptionsAndCategories(result);
};
const fetchStatusPage: PromiseVoidFunctionType =
const fetchStatusPage: PromiseVoidFunction =
async (): Promise<void> => {
try {
setIsLoading(true);

View File

@@ -33,7 +33,7 @@ import Link from 'CommonUI/src/Components/Link/Link';
import MonitorGroupElement from '../../../Components/MonitorGroup/MonitorGroupElement';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
import FormValues from 'CommonUI/src/Components/Forms/Types/FormValues';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
const StatusPageDelete: FunctionComponent<PageComponentProps> = (
props: PageComponentProps
@@ -46,7 +46,7 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
const [addMonitorGroup, setAddMonitorGroup] = useState<boolean>(false);
const fetchGroups: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchGroups: PromiseVoidFunction = async (): Promise<void> => {
setError('');
setIsLoading(true);
@@ -82,7 +82,7 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
fetchGroups();
}, []);
const getFooterForMonitor: GetReactElementFunctionType =
const getFooterForMonitor: GetReactElementFunction =
(): ReactElement => {
if (props.currentProject?.isFeatureFlagMonitorGroupsEnabled) {
if (!addMonitorGroup) {

View File

@@ -6,7 +6,7 @@ import React, {
useState,
} from 'react';
import PageComponentProps from '../../PageComponentProps';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import DashboardNavigation from '../../../Utils/Navigation';
import ObjectID from 'Common/Types/ObjectID';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
@@ -50,7 +50,7 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
options: [],
});
const fetchCheckboxOptionsAndCategories: PromiseVoidFunctionType =
const fetchCheckboxOptionsAndCategories: PromiseVoidFunction =
async (): Promise<void> => {
const result: CategoryCheckboxOptionsAndCategories =
await SubscriberUtil.getCategoryCheckboxPropsBasedOnResources(
@@ -60,7 +60,7 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
setCategoryCheckboxOptionsAndCategories(result);
};
const fetchStatusPage: PromiseVoidFunctionType =
const fetchStatusPage: PromiseVoidFunction =
async (): Promise<void> => {
try {
setIsLoading(true);

View File

@@ -26,7 +26,7 @@ import ObjectID from 'Common/Types/ObjectID';
import StatusPage from 'Model/Models/StatusPage';
import BadDataException from 'Common/Types/Exception/BadDataException';
import Banner from 'CommonUI/src/Components/Banner/Banner';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
const SSOPage: FunctionComponent<PageComponentProps> = (
props: PageComponentProps
@@ -216,7 +216,7 @@ const SSOPage: FunctionComponent<PageComponentProps> = (
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType
onCompleteAction: VoidFunction
) => {
setShowSingleSignOnUrlId(
(item['_id'] as string) || ''

View File

@@ -24,7 +24,7 @@ import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import DashboardNavigation from '../../../../../../Utils/Navigation';
import { GanttChartBar } from 'CommonUI/src/Components/GanttChart/Bar/Index';
import { GanttChartRow } from 'CommonUI/src/Components/GanttChart/Row/Index';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
type BarTooltipFunctionProps = {
span: Span;
@@ -35,7 +35,7 @@ type BarTooltipFunctionProps = {
};
};
type GetBarTooltipFunctionType = (
type GetBarTooltipFunction = (
data: BarTooltipFunctionProps
) => ReactElement;
@@ -63,7 +63,7 @@ const TraceView: FunctionComponent<PageComponentProps> = (
null
);
const fetchItems: PromiseVoidFunctionType = async (): Promise<void> => {
const fetchItems: PromiseVoidFunction = async (): Promise<void> => {
try {
setIsLoading(true);
@@ -156,7 +156,7 @@ const TraceView: FunctionComponent<PageComponentProps> = (
}
};
const getBarTooltip: GetBarTooltipFunctionType = (
const getBarTooltip: GetBarTooltipFunction = (
data: BarTooltipFunctionProps
): ReactElement => {
const {
@@ -232,11 +232,11 @@ const TraceView: FunctionComponent<PageComponentProps> = (
divisibilityFactorAndIntervalUnit: string;
};
type SpanToBarFunctionType = (
type SpanToBarFunction = (
data: SpanToBarFunctionProps
) => GanttChartBar;
const spanToBar: SpanToBarFunctionType = (
const spanToBar: SpanToBarFunction = (
data: SpanToBarFunctionProps
): GanttChartBar => {
const {
@@ -282,11 +282,11 @@ const TraceView: FunctionComponent<PageComponentProps> = (
divisibilityFactorAndIntervalUnit: string;
};
type GetBarsFunctionType = (
type GetBarsFunction = (
data: GetBarsFunctionProps
) => Array<GanttChartBar>;
const getBars: GetBarsFunctionType = (
const getBars: GetBarsFunction = (
data: GetBarsFunctionProps
): Array<GanttChartBar> => {
const {
@@ -369,11 +369,11 @@ const TraceView: FunctionComponent<PageComponentProps> = (
};
};
type GetRowsFromBarsFunctionType = (
type GetRowsFromBarsFunction = (
bars: Array<GanttChartBar>
) => Array<GanttChartRow>;
const getRowsFromBars: GetRowsFromBarsFunctionType = (
const getRowsFromBars: GetRowsFromBarsFunction = (
bars: Array<GanttChartBar>
): Array<GanttChartRow> => {
return bars.map((bars: GanttChartBar) => {

View File

@@ -12,18 +12,18 @@ import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
const Settings: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
): ReactElement => {
type GetModelTableFunctionTypeProps = {
type GetModelTableFunctionProps = {
eventOptions: Array<NotificationSettingEventType>;
title: string;
description: string;
};
type GetModelTableFuncitonType = (
options: GetModelTableFunctionTypeProps
options: GetModelTableFunctionProps
) => ReactElement;
const getModelTable: GetModelTableFuncitonType = (
options: GetModelTableFunctionTypeProps
options: GetModelTableFunctionProps
): ReactElement => {
return (
<ModelTable<UserNotificationSetting>

View File

@@ -23,9 +23,9 @@ 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';
ErrorFunction,
VoidFunction,
} from 'Common/Types/Functions';
const Settings: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
@@ -67,8 +67,8 @@ const Settings: FunctionComponent<PageComponentProps> = (
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setStatusMessage(

View File

@@ -20,11 +20,11 @@ import ObjectID from 'Common/Types/ObjectID';
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 { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
import {
VoidFunctionType,
ErrorFunctionType,
} from 'Common/Types/FunctionTypes';
VoidFunction,
ErrorFunction,
} from 'Common/Types/Functions';
const Settings: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
@@ -35,7 +35,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
useState<boolean>(false);
const [statusMessage, setStatusMessage] = useState<string>('');
const getModelTable: GetReactElementFunctionType = (): ReactElement => {
const getModelTable: GetReactElementFunction = (): ReactElement => {
return (
<ModelTable<UserOnCallLogTimeline>
modelType={UserOnCallLogTimeline}
@@ -73,8 +73,8 @@ const Settings: FunctionComponent<PageComponentProps> = (
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: JSONObject,
onCompleteAction: VoidFunctionType,
onError: ErrorFunctionType
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setStatusMessage(

View File

@@ -180,12 +180,12 @@ const Delete: FunctionComponent<PageComponentProps> = (
setIsLoading(false);
};
type SaveGraphFunctionType = (
type SaveGraphFunction = (
nodes: Array<Node>,
edges: Array<Edge>
) => Promise<void>;
const saveGraph: SaveGraphFunctionType = async (
const saveGraph: SaveGraphFunction = async (
nodes: Array<Node>,
edges: Array<Edge>
): Promise<void> => {

View File

@@ -12,11 +12,11 @@ import { JSONObject } from 'Common/Types/JSON';
import ObjectID from 'Common/Types/ObjectID';
import IncomingMonitorRequest from 'Common/Types/Monitor/IncomingMonitor/IncomingMonitorRequest';
import OneUptimeDate from 'Common/Types/Date';
import { ExpressAPIFunctionType } from 'CommonServer/Types/FunctionTypes';
import { ExpressAPIFunction } from 'CommonServer/Types/Functions';
const router: ExpressRouter = Express.getRouter();
const processIncomingRequest: ExpressAPIFunctionType = async (
const processIncomingRequest: ExpressAPIFunction = async (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction

View File

@@ -3,7 +3,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: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
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) => {

View File

@@ -10,7 +10,7 @@ import Sleep from 'Common/Types/Sleep';
import BadDataException from 'Common/Types/Exception/BadDataException';
import Port from 'Common/Types/Port';
import UnableToReachServer from 'Common/Types/Exception/UnableToReachServer';
import { PromiseRejectErrorFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseRejectErrorFunction } from 'Common/Types/Functions';
// TODO - make sure it work for the IPV6
export interface PortMonitorResponse {
@@ -139,7 +139,7 @@ export default class PortMonitor {
// Ping a host with port
const promiseResult: Promise<PositiveNumber> = new Promise(
(resolve: Function, reject: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
const startTime: [number, number] = process.hrtime();
const socket: net.Socket = new net.Socket();

View File

@@ -126,7 +126,7 @@ export default class SSLMonitor {
};
return new Promise(
(resolve: Function, reject: PromiseRejectErrorFunctionType) => {
(resolve: Function, reject: PromiseRejectErrorFunction) => {
const req: tls.TLSSocket = tls.connect(options, () => {
const cert: tls.PeerCertificate = req.getPeerCertificate();
if (req.authorized) {

View File

@@ -3,9 +3,9 @@
import BillingService from 'CommonServer/Services/BillingService';
import Sleep from 'Common/Types/Sleep';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
const main: PromiseVoidFunctionType = async (): Promise<void> => {
const main: PromiseVoidFunction = async (): Promise<void> => {
for (let i: number = 0; i < 2000; i++) {
const code: string = await BillingService.generateCouponCode({
name: 'Name',

View File

@@ -37,7 +37,7 @@ import ObjectID from 'Common/Types/ObjectID';
import Logout from './Pages/Accounts/Logout';
import StatusPageUtil from './Utils/StatusPage';
import UpdateSubscription from './Pages/Subscribe/UpdateSubscription';
import { VoidFunctionType } from 'Common/Types/FunctionTypes';
import { VoidFunction } from 'Common/Types/Functions';
const App: () => JSX.Element = () => {
Navigation.setNavigateHook(useNavigate());
@@ -70,7 +70,7 @@ const App: () => JSX.Element = () => {
// js.
const [javascript, setJavaScript] = useState<string | null>(null);
const onPageLoadComplete: VoidFunctionType = (): void => {
const onPageLoadComplete: VoidFunction = (): void => {
if (javascript) {
// run custom javascipt.
new Function(javascript)();

View File

@@ -11,7 +11,7 @@ import { UptimePrecision } from 'Model/Models/StatusPageResource';
import UptimeUtil from 'CommonUI/src/Components/MonitorGraphs/UptimeUtil';
import StatusPageHistoryChartBarColorRule from 'Model/Models/StatusPageHistoryChartBarColorRule';
import Color from 'Common/Types/Color';
import { GetReactElementFunctionType } from 'CommonUI/src/Types/FunctionTypes';
import { GetReactElementFunction } from 'CommonUI/src/Types/Functions';
export interface ComponentProps {
monitorName: string;
@@ -35,7 +35,7 @@ export interface ComponentProps {
const MonitorOverview: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
const getCurrentStatus: GetReactElementFunctionType = (): ReactElement => {
const getCurrentStatus: GetReactElementFunction = (): ReactElement => {
// if the current status is operational then show uptime Percent.
let precision: UptimePrecision = UptimePrecision.ONE_DECIMAL;

View File

@@ -7,12 +7,12 @@ import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import StatusPageUtil from '../../Utils/StatusPage';
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import Route from 'Common/Types/API/Route';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
const Logout: () => JSX.Element = () => {
const [error, setError] = React.useState<string | null>(null);
const logout: PromiseVoidFunctionType = async (): Promise<void> => {
const logout: PromiseVoidFunction = async (): Promise<void> => {
if (StatusPageUtil.getStatusPageId()) {
await UserUtil.logout(StatusPageUtil.getStatusPageId()!);
const navRoute: Route = StatusPageUtil.isPreviewPage()

View File

@@ -34,18 +34,18 @@ import API from '../../Utils/API';
import StatusPageUtil from '../../Utils/StatusPage';
import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse';
type GetAnnouncementEventItemFunctionTypeProps = {
type GetAnnouncementEventItemFunctionProps = {
announcement: StatusPageAnnouncement;
isPreviewPage: boolean;
isSummary: boolean;
};
type GetAnnouncementEventItemFunctionType = (
data: GetAnnouncementEventItemFunctionTypeProps
type GetAnnouncementEventItemFunction = (
data: GetAnnouncementEventItemFunctionProps
) => EventItemComponentProps;
export const getAnnouncementEventItem: GetAnnouncementEventItemFunctionType = (
data: GetAnnouncementEventItemFunctionTypeProps
export const getAnnouncementEventItem: GetAnnouncementEventItemFunction = (
data: GetAnnouncementEventItemFunctionProps
): EventItemComponentProps => {
const { announcement, isPreviewPage, isSummary } = data;

View File

@@ -100,11 +100,11 @@ const Overview: FunctionComponent<PageComponentProps> = (
}
}, []);
type GetAnnouncementsParsedDataFunctionType = (
type GetAnnouncementsParsedDataFunction = (
announcements: Array<StatusPageAnnouncement>
) => EventHistoryListComponentProps;
const getAnouncementsParsedData: GetAnnouncementsParsedDataFunctionType = (
const getAnouncementsParsedData: GetAnnouncementsParsedDataFunction = (
announcements: Array<StatusPageAnnouncement>
): EventHistoryListComponentProps => {
const eventHistoryListComponentProps: EventHistoryListComponentProps = {

View File

@@ -53,11 +53,11 @@ type GetIncidentEventItemFunctionProps = {
isSummary: boolean;
};
type GetIncidentEventItemFunctionType = (
type GetIncidentEventItemFunction = (
props: GetIncidentEventItemFunctionProps
) => EventItemComponentProps;
export const getIncidentEventItem: GetIncidentEventItemFunctionType = (
export const getIncidentEventItem: GetIncidentEventItemFunction = (
props: GetIncidentEventItemFunctionProps
): EventItemComponentProps => {
const {

View File

@@ -54,7 +54,7 @@ import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse';
import { STATUS_PAGE_API_URL } from '../../Utils/Config';
import Section from '../../Components/Section/Section';
import StatusPageHistoryChartBarColorRule from 'Model/Models/StatusPageHistoryChartBarColorRule';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
const Overview: FunctionComponent<PageComponentProps> = (
props: PageComponentProps
@@ -130,7 +130,7 @@ const Overview: FunctionComponent<PageComponentProps> = (
StatusPageUtil.checkIfUserHasLoggedIn();
const loadPage: PromiseVoidFunctionType = async (): Promise<void> => {
const loadPage: PromiseVoidFunction = async (): Promise<void> => {
try {
if (!StatusPageUtil.getStatusPageId()) {
return;
@@ -309,7 +309,13 @@ const Overview: FunctionComponent<PageComponentProps> = (
StatusPageUtil.isPrivateStatusPage(),
]);
const getOverallMonitorStatus: Function = (
type GetOverallMonitorStatusFunction = (
statusPageResources: Array<StatusPageResource>,
monitorStatuses: Array<MonitorStatus>,
monitorGroupCurrentStatuses: Dictionary<ObjectID>
) => MonitorStatus | null;
const getOverallMonitorStatus: GetOverallMonitorStatusFunction = (
statusPageResources: Array<StatusPageResource>,
monitorStatuses: Array<MonitorStatus>,
monitorGroupCurrentStatuses: Dictionary<ObjectID>
@@ -370,11 +376,11 @@ const Overview: FunctionComponent<PageComponentProps> = (
return <ErrorMessage error={error} />;
}
type GetMonitorOverviewListInGroupFunctionType = (
type GetMonitorOverviewListInGroupFunction = (
group: StatusPageGroup | null
) => Array<ReactElement>;
const getMonitorOverviewListInGroup: GetMonitorOverviewListInGroupFunctionType =
const getMonitorOverviewListInGroup: GetMonitorOverviewListInGroupFunction =
(group: StatusPageGroup | null): Array<ReactElement> => {
const elements: Array<ReactElement> = [];
@@ -552,9 +558,9 @@ const Overview: FunctionComponent<PageComponentProps> = (
return elements;
};
type GetActiveIncidentsFunctionType = () => Array<IncidentGroup>;
type GetActiveIncidentsFunction = () => Array<IncidentGroup>;
const getActiveIncidents: GetActiveIncidentsFunctionType =
const getActiveIncidents: GetActiveIncidentsFunction =
(): Array<IncidentGroup> => {
const groups: Array<IncidentGroup> = [];
@@ -600,10 +606,10 @@ const Overview: FunctionComponent<PageComponentProps> = (
return groups;
};
type GetOngoingScheduledEventsFunctionType =
type GetOngoingScheduledEventsFunction =
() => Array<ScheduledMaintenanceGroup>;
const getOngoingScheduledEvents: GetOngoingScheduledEventsFunctionType =
const getOngoingScheduledEvents: GetOngoingScheduledEventsFunction =
(): Array<ScheduledMaintenanceGroup> => {
const groups: Array<ScheduledMaintenanceGroup> = [];
@@ -651,11 +657,11 @@ const Overview: FunctionComponent<PageComponentProps> = (
return groups;
};
type GetRightAccordionElementFunctionType = (
type GetRightAccordionElementFunction = (
group: StatusPageGroup
) => ReactElement;
const getRightAccordionElement: GetRightAccordionElementFunctionType = (
const getRightAccordionElement: GetRightAccordionElementFunction = (
group: StatusPageGroup
): ReactElement => {
let currentStatus: MonitorStatus = new MonitorStatus();

View File

@@ -76,7 +76,7 @@ const Overview: FunctionComponent<PageComponentProps> = (
StatusPageUtil.checkIfUserHasLoggedIn();
type GetEventHistoryFunctionTypeProps = {
type GetEventHistoryFunctionProps = {
scheduledMaintenanceEvents: ScheduledMaintenance[];
scheduledMaintenanceEventsPublicNotes: ScheduledMaintenancePublicNote[];
scheduledMaintenanceStateTimelines: ScheduledMaintenanceStateTimeline[];
@@ -84,12 +84,12 @@ const Overview: FunctionComponent<PageComponentProps> = (
monitorsInGroup: Dictionary<ObjectID[]>;
};
type GetEventHistoryFunctionType = (
data: GetEventHistoryFunctionTypeProps
type GetEventHistoryFunction = (
data: GetEventHistoryFunctionProps
) => EventHistoryListComponentProps;
const getEventHistoryListComponentProps: GetEventHistoryFunctionType = (
data: GetEventHistoryFunctionTypeProps
const getEventHistoryListComponentProps: GetEventHistoryFunction = (
data: GetEventHistoryFunctionProps
): EventHistoryListComponentProps => {
const {
scheduledMaintenanceEvents,

View File

@@ -5,7 +5,7 @@ import React, {
useState,
} from 'react';
import Page from '../../Components/Page/Page';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import ModelForm, {
FormType,
ModelField,
@@ -49,7 +49,7 @@ const SubscribePage: FunctionComponent<SubscribePageProps> = (
const [isLaoding, setIsLoading] = useState<boolean>(false);
const [error, setError] = useState<string | undefined>(undefined);
const fetchCheckboxOptionsAndCategories: PromiseVoidFunctionType =
const fetchCheckboxOptionsAndCategories: PromiseVoidFunction =
async (): Promise<void> => {
try {
setIsLoading(true);

View File

@@ -5,7 +5,7 @@ import React, {
useState,
} from 'react';
import Page from '../../Components/Page/Page';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
import ModelForm, {
FormType,
ModelField,
@@ -49,7 +49,7 @@ const SubscribePage: FunctionComponent<SubscribePageProps> = (
const [isLaoding, setIsLoading] = useState<boolean>(false);
const [error, setError] = useState<string | undefined>(undefined);
const fetchCheckboxOptionsAndCategories: PromiseVoidFunctionType =
const fetchCheckboxOptionsAndCategories: PromiseVoidFunction =
async (): Promise<void> => {
try {
setIsLoading(true);

View File

@@ -27,7 +27,7 @@ import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import SubscriberUtil from 'CommonUI/src/Utils/StatusPage';
import FormValues from 'CommonUI/src/Components/Forms/Types/FormValues';
import Navigation from 'CommonUI/src/Utils/Navigation';
import { PromiseVoidFunctionType } from 'Common/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/Functions';
const SubscribePage: FunctionComponent<SubscribePageProps> = (
props: SubscribePageProps
@@ -66,7 +66,7 @@ const SubscribePage: FunctionComponent<SubscribePageProps> = (
const [isLaoding, setIsLoading] = useState<boolean>(false);
const [error, setError] = useState<string | undefined>(undefined);
const fetchCheckboxOptionsAndCategories: PromiseVoidFunctionType =
const fetchCheckboxOptionsAndCategories: PromiseVoidFunction =
async (): Promise<void> => {
try {
setIsLoading(true);

View File

@@ -10,7 +10,7 @@ import Sleep from 'Common/Types/Sleep';
import Typeof from 'Common/Types/Typeof';
import { JSONValue } from 'Common/Types/JSON';
import logger from 'CommonServer/Utils/Logger';
import { ExpressAPIFunctionType } from 'CommonServer/Types/FunctionTypes';
import { ExpressAPIFunction } from 'CommonServer/Types/Functions';
const router: ExpressRouter = Express.getRouter();
@@ -36,7 +36,7 @@ router.post(
}
);
const returnResponse: ExpressAPIFunctionType = async (
const returnResponse: ExpressAPIFunction = async (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction