mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
Refactor import statements and update component types in multiple files
This commit is contained in:
parent
48b850d350
commit
96926ffa63
@ -25,7 +25,7 @@ const Email: () => JSX.Element = (): ReactElement => {
|
||||
useState<boolean>(false);
|
||||
|
||||
const [error, setError] = useState<string>('');
|
||||
const [currentItem, setCurrentItem] = useState<JSONObject | null>(null);
|
||||
const [currentItem, setCurrentItem] = useState<UserEmail | null>(null);
|
||||
const [refreshToggle, setRefreshToggle] = useState<boolean>(false);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
@ -58,7 +58,7 @@ const Email: () => JSX.Element = (): ReactElement => {
|
||||
title: 'Verify',
|
||||
buttonStyleType: ButtonStyleType.SUCCESS_OUTLINE,
|
||||
icon: IconProp.Check,
|
||||
isVisible: (item: JSONObject): boolean => {
|
||||
isVisible: (item: UserEmail): boolean => {
|
||||
if (item['isVerified']) {
|
||||
return false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ const Email: () => JSX.Element = (): ReactElement => {
|
||||
return true;
|
||||
},
|
||||
onClick: async (
|
||||
item: JSONObject,
|
||||
item: UserEmail,
|
||||
onCompleteAction: VoidFunction,
|
||||
onError: ErrorFunction
|
||||
) => {
|
||||
@ -84,7 +84,7 @@ const Email: () => JSX.Element = (): ReactElement => {
|
||||
title: 'Resend Code',
|
||||
buttonStyleType: ButtonStyleType.NORMAL,
|
||||
icon: IconProp.Email,
|
||||
isVisible: (item: JSONObject): boolean => {
|
||||
isVisible: (item: UserEmail): boolean => {
|
||||
if (item['isVerified']) {
|
||||
return false;
|
||||
}
|
||||
@ -92,7 +92,7 @@ const Email: () => JSX.Element = (): ReactElement => {
|
||||
return true;
|
||||
},
|
||||
onClick: async (
|
||||
item: JSONObject,
|
||||
item: UserEmail,
|
||||
onCompleteAction: VoidFunction,
|
||||
onError: ErrorFunction
|
||||
) => {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React, { FunctionComponent, ReactElement } from 'react';
|
||||
import BaseModel, { BaseModelType } from 'Common/Models/BaseModel';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import UserNotificationRule from 'Model/Models/UserNotificationRule';
|
||||
|
||||
export interface ComponentProps {
|
||||
item: JSONObject;
|
||||
item: UserNotificationRule;
|
||||
modelType: BaseModelType;
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ const NotificationMethodView: FunctionComponent<ComponentProps> = (
|
||||
return (
|
||||
<div>
|
||||
{item.getColumnValue('userEmail') &&
|
||||
(item.getColumnValue('userEmail') as JSONObject)['email'] && (
|
||||
(item.getColumnValue('userEmail'))['email'] && (
|
||||
<p>
|
||||
Email:{' '}
|
||||
{(item.getColumnValue('userEmail') as JSONObject)[
|
||||
|
@ -68,7 +68,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
|
||||
title: 'View Status Message',
|
||||
buttonStyleType: ButtonStyleType.NORMAL,
|
||||
onClick: async (
|
||||
item: JSONObject,
|
||||
item: UserOnCallLogTimeline,
|
||||
onCompleteAction: VoidFunction,
|
||||
onError: ErrorFunction
|
||||
) => {
|
||||
@ -117,7 +117,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
|
||||
},
|
||||
title: 'Notification Method',
|
||||
type: FieldType.Element,
|
||||
getElement: (item: JSONObject): ReactElement => {
|
||||
getElement: (item: UserOnCallLogTimeline): ReactElement => {
|
||||
return (
|
||||
<NotificationMethodView
|
||||
item={item}
|
||||
@ -140,7 +140,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
|
||||
title: 'Status',
|
||||
type: FieldType.Element,
|
||||
|
||||
getElement: (item: JSONObject): ReactElement => {
|
||||
getElement: (item: UserOnCallLogTimeline): ReactElement => {
|
||||
if (
|
||||
item['status'] === UserNotificationStatus.Sent
|
||||
) {
|
||||
|
@ -188,7 +188,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
|
||||
},
|
||||
title: 'Notification Method',
|
||||
type: FieldType.Text,
|
||||
getElement: (item: JSONObject): ReactElement => {
|
||||
getElement: (item: UserNotificationRule): ReactElement => {
|
||||
return (
|
||||
<NotificationMethodView
|
||||
item={item}
|
||||
@ -203,7 +203,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
|
||||
},
|
||||
title: 'Notify After',
|
||||
type: FieldType.Text,
|
||||
getElement: (item: JSONObject): ReactElement => {
|
||||
getElement: (item: UserNotificationRule): ReactElement => {
|
||||
return (
|
||||
<div>
|
||||
{item['notifyAfterMinutes'] === 0 && (
|
||||
|
@ -4,15 +4,12 @@ import React, {
|
||||
ReactElement,
|
||||
useState,
|
||||
} from 'react';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import PageComponentProps from '../PageComponentProps';
|
||||
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
|
||||
import WorkflowLogs from 'Model/Models/WorkflowLog';
|
||||
import FieldType from 'CommonUI/src/Components/Types/FieldType';
|
||||
import IconProp from 'Common/Types/Icon/IconProp';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import { JSONObject } from 'Common/Types/JSON';
|
||||
import Workflow from 'Model/Models/Workflow';
|
||||
import WorkflowElement from '../../Components/Workflow/WorkflowElement';
|
||||
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
|
||||
import Modal, { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
|
||||
@ -20,6 +17,7 @@ import BadDataException from 'Common/Types/Exception/BadDataException';
|
||||
import WorkflowStatus from 'Common/Types/Workflow/WorkflowStatus';
|
||||
import WorkflowStatusElement from 'CommonUI/src/Components/Workflow/WorkflowStatus';
|
||||
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
|
||||
import WorkflowLog from 'Model/Models/WorkflowLog';
|
||||
|
||||
const Workflows: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
@ -40,7 +38,7 @@ const Workflows: FunctionComponent<PageComponentProps> = (
|
||||
buttonStyleType: ButtonStyleType.NORMAL,
|
||||
icon: IconProp.List,
|
||||
onClick: async (
|
||||
item: JSONObject,
|
||||
item: WorkflowLogs,
|
||||
onCompleteAction: VoidFunction
|
||||
) => {
|
||||
setLogs(item['logs'] as string);
|
||||
@ -120,16 +118,11 @@ const Workflows: FunctionComponent<PageComponentProps> = (
|
||||
title: 'Workflow Name',
|
||||
type: FieldType.Text,
|
||||
|
||||
getElement: (item: JSONObject): ReactElement => {
|
||||
getElement: (item: WorkflowLogs): ReactElement => {
|
||||
return (
|
||||
<WorkflowElement
|
||||
workflow={
|
||||
BaseModel.fromJSON(
|
||||
(item[
|
||||
'workflow'
|
||||
] as JSONObject) || [],
|
||||
Workflow
|
||||
) as Workflow
|
||||
item.workflow!
|
||||
}
|
||||
/>
|
||||
);
|
||||
@ -142,7 +135,7 @@ const Workflows: FunctionComponent<PageComponentProps> = (
|
||||
|
||||
title: 'Workflow Status',
|
||||
type: FieldType.Text,
|
||||
getElement: (item: JSONObject): ReactElement => {
|
||||
getElement: (item: WorkflowLog): ReactElement => {
|
||||
if (!item['workflowStatus']) {
|
||||
throw new BadDataException(
|
||||
'Workflow Status not found'
|
||||
|
Loading…
Reference in New Issue
Block a user