From 31875081e5cea8b2f9d8f96e42330f56e4db1e65 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Tue, 27 Feb 2024 15:17:39 +0000 Subject: [PATCH] Update function type names --- Accounts/src/Pages/Register.tsx | 4 +- .../src/Components/Header/ProjectPicker.tsx | 6 +- AdminDashboard/src/Pages/Logout/Logout.tsx | 4 +- AdminDashboard/src/Pages/Projects/Index.tsx | 6 +- .../src/Pages/Settings/Probes/Index.tsx | 10 ++-- .../src/Pages/Settings/SMTP/Index.tsx | 2 +- .../Workflow/Services/RunWorkflow.ts | 2 +- Common/Types/FunctionTypes.ts | 8 +-- CommonServer/Infrastructure/QueueWorker.ts | 2 +- CommonServer/Types/Domain.ts | 2 +- CommonServer/Types/FunctionTypes.ts | 2 +- CommonServer/Utils/LocalFile.ts | 6 +- CommonServer/Utils/Stream.ts | 2 +- .../ActionButton/ActionButtonSchema.ts | 10 ++-- .../src/Components/FilePicker/FilePicker.tsx | 2 +- CommonUI/src/Components/Forms/BasicForm.tsx | 4 +- .../src/Components/Forms/Fields/FormField.tsx | 10 ++-- .../HeaderAlert/HeaderModelAlert.tsx | 4 +- CommonUI/src/Components/List/List.tsx | 4 +- .../src/Components/LogsViewer/LogsViewer.tsx | 4 +- .../Components/ModelDelete/ModelDelete.tsx | 4 +- .../Components/ModelDetail/ModelDetail.tsx | 4 +- .../src/Components/ModelList/ModelList.tsx | 4 +- .../Components/ModelList/StaticModelList.tsx | 4 +- .../ModelProgress/ModelProgress.tsx | 4 +- .../Components/ModelTable/BaseModelTable.tsx | 60 +++++++++---------- .../ResetObjectID/ResetObjectID.tsx | 4 +- .../SideMenu/CountModelSideMenuItem.tsx | 4 +- CommonUI/src/Components/Table/Table.tsx | 4 +- CommonUI/src/Components/Workflow/Workflow.tsx | 4 +- .../Tests/Components/ComponentsModal.test.tsx | 4 +- .../src/Tests/Components/FilePicker.test.tsx | 8 +-- CommonUI/src/Types/FunctionTypes.ts | 4 +- .../Components/CallSMS/CallSMSConfigTable.tsx | 14 ++--- .../Components/CustomSMTP/CustomSMTPTable.tsx | 10 ++-- Dashboard/src/Components/Header/Header.tsx | 4 +- .../src/Components/Header/ProjectPicker.tsx | 8 +-- Dashboard/src/Components/Header/Upgrade.tsx | 4 +- .../src/Components/LogsViewer/LogsViewer.tsx | 4 +- .../Components/MonitorGroup/CurrentStatus.tsx | 4 +- Dashboard/src/Components/NavBar/NavBar.tsx | 8 +-- .../Components/NotificationMethods/Call.tsx | 14 ++--- .../Components/NotificationMethods/Email.tsx | 14 ++--- .../Components/NotificationMethods/SMS.tsx | 14 ++--- .../ExecutionLogs/ExecutionLogsTable.tsx | 10 ++-- .../ExecutionLogsTimelineTable.tsx | 14 ++--- .../OnCallScheduleLayer/LayerUser.tsx | 4 +- .../OnCallScheduleLayer/Layers.tsx | 8 +-- .../RestrictionTimesFieldElement.tsx | 4 +- .../src/Pages/Global/ProjectInvitations.tsx | 10 ++-- Dashboard/src/Pages/Monitor/View/Criteria.tsx | 4 +- Dashboard/src/Pages/Monitor/View/Interval.tsx | 4 +- Dashboard/src/Pages/Monitor/View/Probes.tsx | 4 +- Dashboard/src/Pages/Monitor/View/Settings.tsx | 4 +- .../src/Pages/MonitorGroup/View/Incidents.tsx | 2 +- .../src/Pages/MonitorGroup/View/Monitors.tsx | 2 +- Dashboard/src/Pages/Settings/Billing.tsx | 2 +- Dashboard/src/Pages/Settings/Domains.tsx | 10 ++-- Dashboard/src/Pages/Settings/Invoices.tsx | 4 +- Dashboard/src/Pages/Settings/Probes.tsx | 10 ++-- .../src/Pages/StatusPages/View/Domains.tsx | 14 ++--- .../StatusPages/View/EmailSubscribers.tsx | 2 +- .../src/Pages/StatusPages/View/Resources.tsx | 6 +- .../Pages/StatusPages/View/SMSSubscribers.tsx | 6 +- Dashboard/src/Pages/StatusPages/View/SSO.tsx | 4 +- .../Services/View/Traces/View/Index.tsx | 20 +++---- .../UserSettings/NotificationSettings.tsx | 6 +- .../src/Pages/UserSettings/OnCallLogs.tsx | 10 ++-- .../Pages/UserSettings/OnCallLogsTimeline.tsx | 14 ++--- Dashboard/src/Pages/Workflow/View/Builder.tsx | 4 +- Ingestor/API/IncomingRequest.ts | 4 +- Nginx/Utils/SelfSignedSSL.ts | 2 +- .../Monitors/MonitorTypes/PortMonitor.ts | 4 +- .../Utils/Monitors/MonitorTypes/SslMonitor.ts | 2 +- .../PaymentProvider/CouponCodeGenerator.ts | 4 +- StatusPage/src/App.tsx | 4 +- .../Components/Monitor/MonitorOverview.tsx | 4 +- StatusPage/src/Pages/Accounts/Logout.tsx | 4 +- StatusPage/src/Pages/Announcement/Detail.tsx | 10 ++-- StatusPage/src/Pages/Announcement/List.tsx | 4 +- StatusPage/src/Pages/Incidents/Detail.tsx | 4 +- StatusPage/src/Pages/Overview/Overview.tsx | 28 +++++---- StatusPage/src/Pages/ScheduledEvent/List.tsx | 10 ++-- .../src/Pages/Subscribe/EmailSubscribe.tsx | 4 +- .../src/Pages/Subscribe/SmsSubscribe.tsx | 4 +- .../Pages/Subscribe/UpdateSubscription.tsx | 4 +- TestServer/API/Main.ts | 4 +- 87 files changed, 296 insertions(+), 290 deletions(-) diff --git a/Accounts/src/Pages/Register.tsx b/Accounts/src/Pages/Register.tsx index 41aa5f4e0d..b90c04cebb 100644 --- a/Accounts/src/Pages/Register.tsx +++ b/Accounts/src/Pages/Register.tsx @@ -40,9 +40,9 @@ const RegisterPage: () => JSX.Element = () => { Navigation.navigate(DASHBOARD_URL); } - type FetchResellerFunctionType = (resellerId: string) => Promise; + type FetchResellerFunction = (resellerId: string) => Promise; - const fetchReseller: FetchResellerFunctionType = async ( + const fetchReseller: FetchResellerFunction = async ( resellerId: string ): Promise => { setIsLoading(true); diff --git a/AdminDashboard/src/Components/Header/ProjectPicker.tsx b/AdminDashboard/src/Components/Header/ProjectPicker.tsx index 02b91b58e3..bc593504d0 100644 --- a/AdminDashboard/src/Components/Header/ProjectPicker.tsx +++ b/AdminDashboard/src/Components/Header/ProjectPicker.tsx @@ -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; @@ -33,7 +33,7 @@ const DashboardProjectPicker: FunctionComponent = ( null ); - const getFooter: GetReactElementFunctionType = (): ReactElement => { + const getFooter: GetReactElementFunction = (): ReactElement => { if (!BILLING_ENABLED) { return <>; } @@ -110,7 +110,7 @@ const DashboardProjectPicker: FunctionComponent = ( refreshFields(); }, [isSubscriptionPlanYearly]); - const refreshFields: VoidFunctionType = (): void => { + const refreshFields: VoidFunction = (): void => { let formFields: Array> = [ { field: { diff --git a/AdminDashboard/src/Pages/Logout/Logout.tsx b/AdminDashboard/src/Pages/Logout/Logout.tsx index 78c2b35b6d..80081b917b 100644 --- a/AdminDashboard/src/Pages/Logout/Logout.tsx +++ b/AdminDashboard/src/Pages/Logout/Logout.tsx @@ -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(null); - const logout: PromiseVoidFunctionType = async (): Promise => { + const logout: PromiseVoidFunction = async (): Promise => { UiAnalytics.logout(); await UserUtil.logout(); Navigation.navigate(ACCOUNTS_URL); diff --git a/AdminDashboard/src/Pages/Projects/Index.tsx b/AdminDashboard/src/Pages/Projects/Index.tsx index ed1a59cad7..7c975e72da 100644 --- a/AdminDashboard/src/Pages/Projects/Index.tsx +++ b/AdminDashboard/src/Pages/Projects/Index.tsx @@ -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: { @@ -156,7 +156,7 @@ const Projects: FunctionComponent = (): ReactElement => { const [fields, setFields] = useState>>([]); - const getFooter: GetReactElementFunctionType = (): ReactElement => { + const getFooter: GetReactElementFunction = (): ReactElement => { if (!BILLING_ENABLED) { return <>; } diff --git a/AdminDashboard/src/Pages/Settings/Probes/Index.tsx b/AdminDashboard/src/Pages/Settings/Probes/Index.tsx index f6bc1a103d..5a304ed7cc 100644 --- a/AdminDashboard/src/Pages/Settings/Probes/Index.tsx +++ b/AdminDashboard/src/Pages/Settings/Probes/Index.tsx @@ -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(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); diff --git a/AdminDashboard/src/Pages/Settings/SMTP/Index.tsx b/AdminDashboard/src/Pages/Settings/SMTP/Index.tsx index de2f0a1dfb..988e5789e4 100644 --- a/AdminDashboard/src/Pages/Settings/SMTP/Index.tsx +++ b/AdminDashboard/src/Pages/Settings/SMTP/Index.tsx @@ -25,7 +25,7 @@ const Settings: FunctionComponent = (): ReactElement => { const [error, setError] = React.useState(''); - const fetchItem: PromiseVoidFunctionType = async (): Promise => { + const fetchItem: PromiseVoidFunction = async (): Promise => { setIsLoading(true); const globalConfig: GlobalConfig | null = diff --git a/App/FeatureSet/Workflow/Services/RunWorkflow.ts b/App/FeatureSet/Workflow/Services/RunWorkflow.ts index 06516dda3f..0f50ab8ae9 100644 --- a/App/FeatureSet/Workflow/Services/RunWorkflow.ts +++ b/App/FeatureSet/Workflow/Services/RunWorkflow.ts @@ -155,7 +155,7 @@ export default class RunWorkflow { ]; const componentsExecuted: Array = []; - const setDidErrorOut: VoidFunctionType = () => { + const setDidErrorOut: VoidFunction = () => { didWorkflowErrorOut = true; }; // make variable map diff --git a/Common/Types/FunctionTypes.ts b/Common/Types/FunctionTypes.ts index a8b85051c2..03ef0df312 100644 --- a/Common/Types/FunctionTypes.ts +++ b/Common/Types/FunctionTypes.ts @@ -1,4 +1,4 @@ -export type PromiseVoidFunctionType = () => Promise; -export type VoidFunctionType = () => void; -export type ErrorFunctionType = (err: Error) => void; -export type PromiseRejectErrorFunctionType = (err: Error) => void; +export type PromiseVoidFunction = () => Promise; +export type VoidFunction = () => void; +export type ErrorFunction = (err: Error) => void; +export type PromiseRejectErrorFunction = (err: Error) => void; diff --git a/CommonServer/Infrastructure/QueueWorker.ts b/CommonServer/Infrastructure/QueueWorker.ts index 3bbc7d2683..772b16bb41 100644 --- a/CommonServer/Infrastructure/QueueWorker.ts +++ b/CommonServer/Infrastructure/QueueWorker.ts @@ -33,7 +33,7 @@ export default class QueueWorker { return new Promise( ( _resolve: Function, - reject: PromiseRejectErrorFunctionType + reject: PromiseRejectErrorFunction ) => { setTimeout(() => { return reject(new TimeoutException('Job Timeout')); diff --git a/CommonServer/Types/Domain.ts b/CommonServer/Types/Domain.ts index 772c0e303c..26fc404227 100644 --- a/CommonServer/Types/Domain.ts +++ b/CommonServer/Types/Domain.ts @@ -8,7 +8,7 @@ export default class Domain extends DomainCommon { verificationText: string ): Promise { return new Promise( - (resolve: Function, reject: PromiseRejectErrorFunctionType) => { + (resolve: Function, reject: PromiseRejectErrorFunction) => { dns.resolveTxt( domain.toString(), ( diff --git a/CommonServer/Types/FunctionTypes.ts b/CommonServer/Types/FunctionTypes.ts index 5a2d28cd93..8b7f7987d1 100644 --- a/CommonServer/Types/FunctionTypes.ts +++ b/CommonServer/Types/FunctionTypes.ts @@ -4,7 +4,7 @@ import { NextFunction, } from '../Utils/Express'; -export type ExpressAPIFunctionType = ( +export type ExpressAPIFunction = ( req: ExpressRequest, res: ExpressResponse, next: NextFunction diff --git a/CommonServer/Utils/LocalFile.ts b/CommonServer/Utils/LocalFile.ts index f36268cbf7..a82eaf624a 100644 --- a/CommonServer/Utils/LocalFile.ts +++ b/CommonServer/Utils/LocalFile.ts @@ -3,7 +3,7 @@ import fs from 'fs'; export default class LocalFile { public static async makeDirectory(path: string): Promise { 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 { 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, diff --git a/CommonServer/Utils/Stream.ts b/CommonServer/Utils/Stream.ts index da96fc5a63..0eee273b07 100644 --- a/CommonServer/Utils/Stream.ts +++ b/CommonServer/Utils/Stream.ts @@ -3,7 +3,7 @@ import { Stream } from 'stream'; export default class StreamUtil { public static convertStreamToText(stream: Stream): Promise { return new Promise( - (resolve: Function, reject: PromiseRejectErrorFunctionType) => { + (resolve: Function, reject: PromiseRejectErrorFunction) => { const chunks: Array = []; stream.on('data', (chunk: any) => { diff --git a/CommonUI/src/Components/ActionButton/ActionButtonSchema.ts b/CommonUI/src/Components/ActionButton/ActionButtonSchema.ts index 09999449f6..85a8d021ca 100644 --- a/CommonUI/src/Components/ActionButton/ActionButtonSchema.ts +++ b/CommonUI/src/Components/ActionButton/ActionButtonSchema.ts @@ -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; } diff --git a/CommonUI/src/Components/FilePicker/FilePicker.tsx b/CommonUI/src/Components/FilePicker/FilePicker.tsx index 319bd4d5a1..1ed7a84833 100644 --- a/CommonUI/src/Components/FilePicker/FilePicker.tsx +++ b/CommonUI/src/Components/FilePicker/FilePicker.tsx @@ -59,7 +59,7 @@ const FilePicker: FunctionComponent = ( setInitialValue(); }, [props.initialValue]); - const setInitialValue: VoidFunctionType = () => { + const setInitialValue: VoidFunction = () => { if ( Array.isArray(props.initialValue) && props.initialValue && diff --git a/CommonUI/src/Components/Forms/BasicForm.tsx b/CommonUI/src/Components/Forms/BasicForm.tsx index fc91156272..df3075fe43 100644 --- a/CommonUI/src/Components/Forms/BasicForm.tsx +++ b/CommonUI/src/Components/Forms/BasicForm.tsx @@ -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 = FormikProps; export type FormErrors = FormikErrors; @@ -260,7 +260,7 @@ const BasicForm: ForwardRefExoticComponent = forwardRef( return fieldName; }; - const setAllTouched: VoidFunctionType = (): void => { + const setAllTouched: VoidFunction = (): void => { const touchedObj: Dictionary = {}; for (const field of formFields) { diff --git a/CommonUI/src/Components/Forms/Fields/FormField.tsx b/CommonUI/src/Components/Forms/Fields/FormField.tsx index 47bd5cedcc..243c756a54 100644 --- a/CommonUI/src/Components/Forms/Fields/FormField.tsx +++ b/CommonUI/src/Components/Forms/Fields/FormField.tsx @@ -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 { field: Field; @@ -79,7 +79,7 @@ const FormField: ( } }; - const getFormField: GetReactElementFunctionType = (): ReactElement => { + const getFormField: GetReactElementFunction = (): ReactElement => { const [ showMultiSelectCheckboxCategoryModal, setShowMultiSelectCheckboxCategoryModal, @@ -196,7 +196,7 @@ const FormField: ( OneUptimeDate.getCurrentTimezoneString(); } - const getFieldDescription: GetReactElementOrStringFunctionType = (): + const getFieldDescription: GetReactElementOrStringFunction = (): | ReactElement | string => { if ( diff --git a/CommonUI/src/Components/HeaderAlert/HeaderModelAlert.tsx b/CommonUI/src/Components/HeaderAlert/HeaderModelAlert.tsx index 18cb2905be..d386f9bcaa 100644 --- a/CommonUI/src/Components/HeaderAlert/HeaderModelAlert.tsx +++ b/CommonUI/src/Components/HeaderAlert/HeaderModelAlert.tsx @@ -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 { icon: IconProp; @@ -33,7 +33,7 @@ const HeaderModelAlert: ( fetchCount(); }, [props.refreshToggle]); - const fetchCount: PromiseVoidFunctionType = async (): Promise => { + const fetchCount: PromiseVoidFunction = async (): Promise => { setError(''); setIsLoading(true); diff --git a/CommonUI/src/Components/List/List.tsx b/CommonUI/src/Components/List/List.tsx index 0d8e52e43f..65c6f90daa 100644 --- a/CommonUI/src/Components/List/List.tsx +++ b/CommonUI/src/Components/List/List.tsx @@ -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; @@ -36,7 +36,7 @@ export interface ComponentProps { const List: FunctionComponent = ( props: ComponentProps ): ReactElement => { - const getListbody: GetReactElementFunctionType = (): ReactElement => { + const getListbody: GetReactElementFunction = (): ReactElement => { if (props.isLoading) { return ; } diff --git a/CommonUI/src/Components/LogsViewer/LogsViewer.tsx b/CommonUI/src/Components/LogsViewer/LogsViewer.tsx index 1405680f43..7b22031ddf 100644 --- a/CommonUI/src/Components/LogsViewer/LogsViewer.tsx +++ b/CommonUI/src/Components/LogsViewer/LogsViewer.tsx @@ -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; @@ -39,7 +39,7 @@ const LogsViewer: FunctionComponent = ( // Keep scroll to the bottom of the log - const scrollToBottom: VoidFunctionType = (): void => { + const scrollToBottom: VoidFunction = (): void => { const logsViewer: HTMLDivElement | null = logsViewerRef.current; if (logsViewer) { diff --git a/CommonUI/src/Components/ModelDelete/ModelDelete.tsx b/CommonUI/src/Components/ModelDelete/ModelDelete.tsx index ac13a534f2..b065f0b42e 100644 --- a/CommonUI/src/Components/ModelDelete/ModelDelete.tsx +++ b/CommonUI/src/Components/ModelDelete/ModelDelete.tsx @@ -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 { @@ -26,7 +26,7 @@ const ModelDelete: ( const [error, setError] = useState(''); const [showErrorModal, setShowErrorModal] = useState(false); - const deleteItem: PromiseVoidFunctionType = async (): Promise => { + const deleteItem: PromiseVoidFunction = async (): Promise => { setIsLoading(true); try { await ModelAPI.deleteItem({ diff --git a/CommonUI/src/Components/ModelDetail/ModelDetail.tsx b/CommonUI/src/Components/ModelDetail/ModelDetail.tsx index 8c5054fd4d..a5e38f48a5 100644 --- a/CommonUI/src/Components/ModelDetail/ModelDetail.tsx +++ b/CommonUI/src/Components/ModelDetail/ModelDetail.tsx @@ -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 { modelType: { new (): TBaseModel }; @@ -89,7 +89,7 @@ const ModelDetail: ( return relationSelect; }; - const setDetailFields: VoidFunctionType = (): void => { + const setDetailFields: VoidFunction = (): void => { // set fields. const userPermissions: Array = diff --git a/CommonUI/src/Components/ModelList/ModelList.tsx b/CommonUI/src/Components/ModelList/ModelList.tsx index c8809b6707..0275227f38 100644 --- a/CommonUI/src/Components/ModelList/ModelList.tsx +++ b/CommonUI/src/Components/ModelList/ModelList.tsx @@ -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: ( } }, [props.isSearchEnabled, modelList]); - const fetchItems: PromiseVoidFunctionType = async (): Promise => { + const fetchItems: PromiseVoidFunction = async (): Promise => { setError(''); setIsLoading(true); diff --git a/CommonUI/src/Components/ModelList/StaticModelList.tsx b/CommonUI/src/Components/ModelList/StaticModelList.tsx index d30dca2000..eab727dd68 100644 --- a/CommonUI/src/Components/ModelList/StaticModelList.tsx +++ b/CommonUI/src/Components/ModelList/StaticModelList.tsx @@ -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 { list: Array; @@ -173,7 +173,7 @@ const StaticModelList: ( ); }; - const getComponent: GetReactElementFunctionType = (): ReactElement => { + const getComponent: GetReactElementFunction = (): ReactElement => { if (props.enableDragAndDrop) { return ( diff --git a/CommonUI/src/Components/ModelProgress/ModelProgress.tsx b/CommonUI/src/Components/ModelProgress/ModelProgress.tsx index e40b3ff50c..8f5a91ede6 100644 --- a/CommonUI/src/Components/ModelProgress/ModelProgress.tsx +++ b/CommonUI/src/Components/ModelProgress/ModelProgress.tsx @@ -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 { title: string; @@ -26,7 +26,7 @@ const ModelProgress: ( const [error, setError] = useState(''); const [count, setCount] = useState(0); - const fetchCount: PromiseVoidFunctionType = async (): Promise => { + const fetchCount: PromiseVoidFunction = async (): Promise => { setError(''); setIsLoading(true); diff --git a/CommonUI/src/Components/ModelTable/BaseModelTable.tsx b/CommonUI/src/Components/ModelTable/BaseModelTable.tsx index c36e712d36..79bce3c0c1 100644 --- a/CommonUI/src/Components/ModelTable/BaseModelTable.tsx +++ b/CommonUI/src/Components/ModelTable/BaseModelTable.tsx @@ -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: ( setIsLoading(false); }; - const serializeToTableColumns: VoidFunctionType = (): void => { + const serializeToTableColumns: VoidFunction = (): void => { // Convert ModelColumns to TableColumns. const columns: Array = []; @@ -480,7 +480,7 @@ const BaseModelTable: ( setColumns(columns); }; - const getFilterDropdownItems: PromiseVoidFunctionType = + const getFilterDropdownItems: PromiseVoidFunction = async (): Promise => { setTableFilterError(''); setIsTableFilterFetchLoading(true); @@ -576,7 +576,7 @@ const BaseModelTable: ( setIsTableFilterFetchLoading(false); }; - const fetchItems: PromiseVoidFunctionType = async (): Promise => { + const fetchItems: PromiseVoidFunction = async (): Promise => { setError(''); setIsLoading(true); @@ -682,7 +682,7 @@ const BaseModelTable: ( return selectFields; }; - const setHeaderButtons: VoidFunctionType = (): void => { + const setHeaderButtons: VoidFunction = (): void => { // add header buttons. let headerbuttons: Array = []; @@ -771,19 +771,19 @@ const BaseModelTable: ( 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 ) => string | null; - const getColumnKey: GetColumnKeyFunctionType = ( + const getColumnKey: GetColumnKeyFunction = ( column: ModelTableColumn ): string | null => { const key: string | null = column.field @@ -793,11 +793,11 @@ const BaseModelTable: ( return key; }; - type HasPermissionToReadColumnFunctionType = ( + type HasPermissionToReadColumnFunction = ( column: ModelTableColumn ) => boolean; - const hasPermissionToReadColumn: HasPermissionToReadColumnFunctionType = ( + const hasPermissionToReadColumn: HasPermissionToReadColumnFunction = ( column: ModelTableColumn ): boolean => { const accessControl: Dictionary = @@ -833,9 +833,9 @@ const BaseModelTable: ( return hasPermission; }; - type GetUserPermissionsFunctionType = () => Array; + type GetUserPermissionsFunction = () => Array; - const getUserPermissions: GetUserPermissionsFunctionType = + const getUserPermissions: GetUserPermissionsFunction = (): Array => { let userPermissions: Array = PermissionUtil.getGlobalPermissions()?.globalPermissions || []; @@ -866,7 +866,7 @@ const BaseModelTable: ( serializeToTableColumns(); }, [data]); - const setActionSchema: VoidFunctionType = () => { + const setActionSchema: VoidFunction = () => { const permissions: Array = PermissionUtil.getAllPermissions(); @@ -878,8 +878,8 @@ const BaseModelTable: ( 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: ( 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: ( 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: ( 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: ( setActionButtonSchema(actionsSchema); }; - const getTable: GetReactElementFunctionType = (): ReactElement => { + const getTable: GetReactElementFunction = (): ReactElement => { return ( { @@ -1125,7 +1125,7 @@ const BaseModelTable: ( ); }; - const getOrderedStatesList: GetReactElementFunctionType = + const getOrderedStatesList: GetReactElementFunction = (): ReactElement => { if (!props.orderedStatesListProps) { throw new BadDataException( @@ -1197,7 +1197,7 @@ const BaseModelTable: ( ); }; - const getList: GetReactElementFunctionType = (): ReactElement => { + const getList: GetReactElementFunction = (): ReactElement => { return ( ( ); }; - const getCardComponent: GetReactElementFunctionType = (): ReactElement => { + const getCardComponent: GetReactElementFunction = (): ReactElement => { if (showTableAs === ShowTableAs.List) { return (
diff --git a/CommonUI/src/Components/ResetObjectID/ResetObjectID.tsx b/CommonUI/src/Components/ResetObjectID/ResetObjectID.tsx index f678b43c5e..c3ca3eedf9 100644 --- a/CommonUI/src/Components/ResetObjectID/ResetObjectID.tsx +++ b/CommonUI/src/Components/ResetObjectID/ResetObjectID.tsx @@ -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 { modelType: { new (): TBaseModel }; @@ -33,7 +33,7 @@ const ResetObjectID: ( const [newId, setNewId] = useState(null); - const resetKey: PromiseVoidFunctionType = async (): Promise => { + const resetKey: PromiseVoidFunction = async (): Promise => { setIsLoading(true); try { const resetIdTo: ObjectID = ObjectID.generate(); diff --git a/CommonUI/src/Components/SideMenu/CountModelSideMenuItem.tsx b/CommonUI/src/Components/SideMenu/CountModelSideMenuItem.tsx index cdb6d353cd..3fd66b37c5 100644 --- a/CommonUI/src/Components/SideMenu/CountModelSideMenuItem.tsx +++ b/CommonUI/src/Components/SideMenu/CountModelSideMenuItem.tsx @@ -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 { link: Link; @@ -29,7 +29,7 @@ const CountModelSideMenuItem: ( const [error, setError] = useState(''); const [count, setCount] = useState(0); - const fetchCount: PromiseVoidFunctionType = async (): Promise => { + const fetchCount: PromiseVoidFunction = async (): Promise => { if (!props.modelType) { return; } diff --git a/CommonUI/src/Components/Table/Table.tsx b/CommonUI/src/Components/Table/Table.tsx index 23bdaca499..a01b0eab59 100644 --- a/CommonUI/src/Components/Table/Table.tsx +++ b/CommonUI/src/Components/Table/Table.tsx @@ -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; @@ -48,7 +48,7 @@ const Table: FunctionComponent = ( colspan++; } - const getTablebody: GetReactElementFunctionType = (): ReactElement => { + const getTablebody: GetReactElementFunction = (): ReactElement => { if (props.isLoading) { return (
diff --git a/CommonUI/src/Components/Workflow/Workflow.tsx b/CommonUI/src/Components/Workflow/Workflow.tsx index 57c26f1fb5..135a9290ea 100644 --- a/CommonUI/src/Components/Workflow/Workflow.tsx +++ b/CommonUI/src/Components/Workflow/Workflow.tsx @@ -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 = (props: ComponentProps) => { props.onComponentPickerModalUpdate(showComponentsModal); }, [showComponentsModal]); - const refreshEdges: VoidFunctionType = (): void => { + const refreshEdges: VoidFunction = (): void => { setEdges((eds: Array) => { return eds.map((edge: Edge) => { return { diff --git a/CommonUI/src/Tests/Components/ComponentsModal.test.tsx b/CommonUI/src/Tests/Components/ComponentsModal.test.tsx index afa93defcd..aa2526bf8e 100644 --- a/CommonUI/src/Tests/Components/ComponentsModal.test.tsx +++ b/CommonUI/src/Tests/Components/ComponentsModal.test.tsx @@ -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(); diff --git a/CommonUI/src/Tests/Components/FilePicker.test.tsx b/CommonUI/src/Tests/Components/FilePicker.test.tsx index 2f0088c739..c23ee0cf52 100644 --- a/CommonUI/src/Tests/Components/FilePicker.test.tsx +++ b/CommonUI/src/Tests/Components/FilePicker.test.tsx @@ -69,9 +69,9 @@ const mockCreateResponse: MockCreateResponseFunction = async ( ); }; -type MockFileModelFunctionType = (file: File) => Promise; +type MockFileModelFunction = (file: File) => Promise; -const mockFileModel: MockFileModelFunctionType = async ( +const mockFileModel: MockFileModelFunction = async ( file: File ): Promise => { 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 diff --git a/CommonUI/src/Types/FunctionTypes.ts b/CommonUI/src/Types/FunctionTypes.ts index 154ada231f..4d4f0a4ba3 100644 --- a/CommonUI/src/Types/FunctionTypes.ts +++ b/CommonUI/src/Types/FunctionTypes.ts @@ -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; diff --git a/Dashboard/src/Components/CallSMS/CallSMSConfigTable.tsx b/Dashboard/src/Components/CallSMS/CallSMSConfigTable.tsx index e28aa520df..64a582e1e2 100644 --- a/Dashboard/src/Components/CallSMS/CallSMSConfigTable.tsx +++ b/Dashboard/src/Components/CallSMS/CallSMSConfigTable.tsx @@ -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); diff --git a/Dashboard/src/Components/CustomSMTP/CustomSMTPTable.tsx b/Dashboard/src/Components/CustomSMTP/CustomSMTPTable.tsx index 6da958aca9..2a23c33717 100644 --- a/Dashboard/src/Components/CustomSMTP/CustomSMTPTable.tsx +++ b/Dashboard/src/Components/CustomSMTP/CustomSMTPTable.tsx @@ -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); diff --git a/Dashboard/src/Components/Header/Header.tsx b/Dashboard/src/Components/Header/Header.tsx index f792b729d6..ad0cd63b25 100644 --- a/Dashboard/src/Components/Header/Header.tsx +++ b/Dashboard/src/Components/Header/Header.tsx @@ -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; @@ -47,7 +47,7 @@ const DashboardHeader: FunctionComponent = ( const [activeIncidentToggleRefresh, setActiveIncidentToggleRefresh] = useState(true); - const refreshIncidentCount: VoidFunctionType = () => { + const refreshIncidentCount: VoidFunction = () => { setActiveIncidentToggleRefresh(!activeIncidentToggleRefresh); }; diff --git a/Dashboard/src/Components/Header/ProjectPicker.tsx b/Dashboard/src/Components/Header/ProjectPicker.tsx index 76616e8b06..6ce76d58dc 100644 --- a/Dashboard/src/Components/Header/ProjectPicker.tsx +++ b/Dashboard/src/Components/Header/ProjectPicker.tsx @@ -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; @@ -53,7 +53,7 @@ const DashboardProjectPicker: FunctionComponent = ( refreshFields(); }, [initialValues]); - const getFooter: GetReactElementFunctionType = (): ReactElement => { + const getFooter: GetReactElementFunction = (): ReactElement => { if (!BILLING_ENABLED) { return <>; } @@ -130,7 +130,7 @@ const DashboardProjectPicker: FunctionComponent = ( refreshFields(); }, [isSubscriptionPlanYearly]); - const refreshFields: VoidFunctionType = (): void => { + const refreshFields: VoidFunction = (): void => { let formFields: Array> = [ { field: { diff --git a/Dashboard/src/Components/Header/Upgrade.tsx b/Dashboard/src/Components/Header/Upgrade.tsx index e46b134dd0..fcf7d1202d 100644 --- a/Dashboard/src/Components/Header/Upgrade.tsx +++ b/Dashboard/src/Components/Header/Upgrade.tsx @@ -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(false); const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] = useState(true); - const getFooter: GetReactElementFunctionType = (): ReactElement => { + const getFooter: GetReactElementFunction = (): ReactElement => { if (!BILLING_ENABLED) { return <>; } diff --git a/Dashboard/src/Components/LogsViewer/LogsViewer.tsx b/Dashboard/src/Components/LogsViewer/LogsViewer.tsx index 0d8416248d..daaece7010 100644 --- a/Dashboard/src/Components/LogsViewer/LogsViewer.tsx +++ b/Dashboard/src/Components/LogsViewer/LogsViewer.tsx @@ -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 = ( }); }, [filterOptions]); - const fetchItems: PromiseVoidFunctionType = async (): Promise => { + const fetchItems: PromiseVoidFunction = async (): Promise => { setError(''); setIsLoading(true); diff --git a/Dashboard/src/Components/MonitorGroup/CurrentStatus.tsx b/Dashboard/src/Components/MonitorGroup/CurrentStatus.tsx index 3bc30d00f3..8128e48719 100644 --- a/Dashboard/src/Components/MonitorGroup/CurrentStatus.tsx +++ b/Dashboard/src/Components/MonitorGroup/CurrentStatus.tsx @@ -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 = ( const [error, setError] = React.useState(undefined); - const loadCurrentStatus: PromiseVoidFunctionType = + const loadCurrentStatus: PromiseVoidFunction = async (): Promise => { setIsLoading(true); diff --git a/Dashboard/src/Components/NavBar/NavBar.tsx b/Dashboard/src/Components/NavBar/NavBar.tsx index a003f0474d..ecc25f539f 100644 --- a/Dashboard/src/Components/NavBar/NavBar.tsx +++ b/Dashboard/src/Components/NavBar/NavBar.tsx @@ -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 = ( 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 = ( setMoreMenuTimeout(timeout); }; - const forceHideMoreMenu: VoidFunctionType = (): void => { + const forceHideMoreMenu: VoidFunction = (): void => { if (moreMenuTimeout) { clearTimeout(moreMenuTimeout); setMoreMenuTimeout(null); @@ -45,7 +45,7 @@ const DashboardNavbar: FunctionComponent = ( setIsComponentVisible(false); }; - const showMoreMenu: VoidFunctionType = (): void => { + const showMoreMenu: VoidFunction = (): void => { if (moreMenuTimeout) { clearTimeout(moreMenuTimeout); } diff --git a/Dashboard/src/Components/NotificationMethods/Call.tsx b/Dashboard/src/Components/NotificationMethods/Call.tsx index f03abd5220..d7e189cd1c 100644 --- a/Dashboard/src/Components/NotificationMethods/Call.tsx +++ b/Dashboard/src/Components/NotificationMethods/Call.tsx @@ -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); diff --git a/Dashboard/src/Components/NotificationMethods/Email.tsx b/Dashboard/src/Components/NotificationMethods/Email.tsx index 530446114a..acc20cbca4 100644 --- a/Dashboard/src/Components/NotificationMethods/Email.tsx +++ b/Dashboard/src/Components/NotificationMethods/Email.tsx @@ -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); diff --git a/Dashboard/src/Components/NotificationMethods/SMS.tsx b/Dashboard/src/Components/NotificationMethods/SMS.tsx index 54566989e4..0109aac624 100644 --- a/Dashboard/src/Components/NotificationMethods/SMS.tsx +++ b/Dashboard/src/Components/NotificationMethods/SMS.tsx @@ -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); diff --git a/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx b/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx index 160d1dfb81..4316b4286d 100644 --- a/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx +++ b/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx @@ -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 = ( buttonStyleType: ButtonStyleType.NORMAL, onClick: async ( item: JSONObject, - onCompleteAction: VoidFunctionType, - onError: ErrorFunctionType + onCompleteAction: VoidFunction, + onError: ErrorFunction ) => { try { setStatusMessage( diff --git a/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTimelineTable.tsx b/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTimelineTable.tsx index 53db299f2a..3211586bd2 100644 --- a/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTimelineTable.tsx +++ b/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTimelineTable.tsx @@ -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 = ( useState(false); const [statusMessage, setStatusMessage] = useState(''); - const getModelTable: GetReactElementFunctionType = (): ReactElement => { + const getModelTable: GetReactElementFunction = (): ReactElement => { return ( modelType={OnCallDutyPolicyExecutionLogTimeline} @@ -65,8 +65,8 @@ const ExecutionLogTimelineTable: FunctionComponent = ( buttonStyleType: ButtonStyleType.NORMAL, onClick: async ( item: JSONObject, - onCompleteAction: VoidFunctionType, - onError: ErrorFunctionType + onCompleteAction: VoidFunction, + onError: ErrorFunction ) => { try { setStatusMessage( diff --git a/Dashboard/src/Components/OnCallPolicy/OnCallScheduleLayer/LayerUser.tsx b/Dashboard/src/Components/OnCallPolicy/OnCallScheduleLayer/LayerUser.tsx index 2c9f03568e..1e814645b8 100644 --- a/Dashboard/src/Components/OnCallPolicy/OnCallScheduleLayer/LayerUser.tsx +++ b/Dashboard/src/Components/OnCallPolicy/OnCallScheduleLayer/LayerUser.tsx @@ -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 = ( const [showAddUserModal, setShowAddUserModal] = useState(false); const [reloadList, setReloadList] = useState(false); - const getAddUserButton: GetReactElementFunctionType = (): ReactElement => { + const getAddUserButton: GetReactElementFunction = (): ReactElement => { return (