diff --git a/Dashboard/src/Pages/Monitor/View/Index.tsx b/Dashboard/src/Pages/Monitor/View/Index.tsx index fce5bf18b5d..f780e99d67e 100644 --- a/Dashboard/src/Pages/Monitor/View/Index.tsx +++ b/Dashboard/src/Pages/Monitor/View/Index.tsx @@ -30,7 +30,7 @@ import API from 'CommonUI/src/Utils/API/API'; import DisabledWarning from '../../../Components/Monitor/DisabledWarning'; import MonitorType from 'Common/Types/Monitor/MonitorType'; import IncomingMonitorLink from '../../../Components/Monitor/IncomingRequestMonitor/IncomingMonitorLink'; -import { Green, Gray500 } from 'Common/Types/BrandColors'; +import { Green, Gray500, Black } from 'Common/Types/BrandColors'; import UptimeUtil from 'CommonUI/src/Components/MonitorGraphs/UptimeUtil'; import MonitorStatus from 'Model/Models/MonitorStatus'; import { UptimePrecision } from 'Model/Models/StatusPageResource'; @@ -296,7 +296,7 @@ const MonitorView: FunctionComponent = ( {/* Monitor View */} - name="Monitor Details" formSteps={[ { @@ -384,7 +384,7 @@ const MonitorView: FunctionComponent = ( }, title: 'Current Status', fieldType: FieldType.Element, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: Monitor): ReactElement => { if (!item['currentMonitorStatus']) { throw new BadDataException( 'Monitor Status not found' @@ -404,19 +404,11 @@ const MonitorView: FunctionComponent = ( return ( ); @@ -438,15 +430,11 @@ const MonitorView: FunctionComponent = ( }, title: 'Labels', fieldType: FieldType.Element, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: Monitor): ReactElement => { return ( + item['labels'] || [] } /> ); diff --git a/Dashboard/src/Pages/Monitor/View/StatusTimeline.tsx b/Dashboard/src/Pages/Monitor/View/StatusTimeline.tsx index 7fa8a92894c..6616733813c 100644 --- a/Dashboard/src/Pages/Monitor/View/StatusTimeline.tsx +++ b/Dashboard/src/Pages/Monitor/View/StatusTimeline.tsx @@ -23,6 +23,7 @@ import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button'; import Modal, { ModalWidth } from 'CommonUI/src/Components/Modal/Modal'; import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal'; import OneUptimeDate from 'Common/Types/Date'; +import { Black } from 'Common/Types/BrandColors'; const StatusTimeline: FunctionComponent = ( props: PageComponentProps @@ -56,7 +57,7 @@ const StatusTimeline: FunctionComponent = ( buttonStyleType: ButtonStyleType.NORMAL, icon: IconProp.TransparentCube, onClick: async ( - item: JSONObject, + item: MonitorStatusTimeline, onCompleteAction: VoidFunction ) => { setRootCause( @@ -74,7 +75,7 @@ const StatusTimeline: FunctionComponent = ( buttonStyleType: ButtonStyleType.NORMAL, icon: IconProp.List, onClick: async ( - item: JSONObject, + item: MonitorStatusTimeline, onCompleteAction: VoidFunction ) => { setLogs( @@ -175,7 +176,7 @@ const StatusTimeline: FunctionComponent = ( }, title: 'Monitor Status', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: MonitorStatusTimeline): ReactElement => { if (!item['monitorStatus']) { throw new BadDataException( 'Monitor Status not found' @@ -185,15 +186,11 @@ const StatusTimeline: FunctionComponent = ( return ( ); @@ -220,7 +217,7 @@ const StatusTimeline: FunctionComponent = ( }, title: 'Duration', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: MonitorStatusTimeline): ReactElement => { return (

{OneUptimeDate.differenceBetweenTwoDatesAsFromattedString( diff --git a/Dashboard/src/Pages/Settings/MonitorStatus.tsx b/Dashboard/src/Pages/Settings/MonitorStatus.tsx index 968cf47f750..ff3b2796f25 100644 --- a/Dashboard/src/Pages/Settings/MonitorStatus.tsx +++ b/Dashboard/src/Pages/Settings/MonitorStatus.tsx @@ -119,7 +119,7 @@ const Monitors: FunctionComponent = ( title: 'Name', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: MonitorStatus): ReactElement => { return ( = ( title: 'Description', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: MonitorStatus): ReactElement => { return (

{`${item['description']}`}

diff --git a/Dashboard/src/Pages/Settings/Probes.tsx b/Dashboard/src/Pages/Settings/Probes.tsx index 544bdceb766..0831c50f3d7 100644 --- a/Dashboard/src/Pages/Settings/Probes.tsx +++ b/Dashboard/src/Pages/Settings/Probes.tsx @@ -30,7 +30,7 @@ const ProbePage: FunctionComponent = ( ): ReactElement => { const [showKeyModal, setShowKeyModal] = useState(false); - const [currentProbe, setCurrentProbe] = useState(null); + const [currentProbe, setCurrentProbe] = useState(null); return ( @@ -78,7 +78,7 @@ const ProbePage: FunctionComponent = ( title: 'Name', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: Probe): ReactElement => { return ; }, }, @@ -96,7 +96,7 @@ const ProbePage: FunctionComponent = ( title: 'Probe Status', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: Probe): ReactElement => { return ; }, }, @@ -181,7 +181,7 @@ const ProbePage: FunctionComponent = ( title: 'Show ID and Key', buttonStyleType: ButtonStyleType.NORMAL, onClick: async ( - item: JSONObject, + item: Probe, onCompleteAction: VoidFunction, onError: ErrorFunction ) => { @@ -228,7 +228,7 @@ const ProbePage: FunctionComponent = ( title: 'Name', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: Probe): ReactElement => { return ; }, }, @@ -253,14 +253,12 @@ const ProbePage: FunctionComponent = ( title: 'Status', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: Probe): ReactElement => { if ( item && item['lastAlive'] && OneUptimeDate.getNumberOfMinutesBetweenDates( - OneUptimeDate.fromString( - item['lastAlive'] as string - ), + item['lastAlive'], OneUptimeDate.getCurrentDate() ) < 5 ) { diff --git a/Dashboard/src/Pages/Settings/SSO.tsx b/Dashboard/src/Pages/Settings/SSO.tsx index e71bbeeabad..129ed0745a0 100644 --- a/Dashboard/src/Pages/Settings/SSO.tsx +++ b/Dashboard/src/Pages/Settings/SSO.tsx @@ -211,7 +211,7 @@ const SSOPage: FunctionComponent = ( title: 'View SSO URL', buttonStyleType: ButtonStyleType.NORMAL, onClick: async ( - item: JSONObject, + item: ProjectSSO, onCompleteAction: VoidFunction ) => { setShowSingleSignOnUrlId( @@ -269,15 +269,11 @@ const SSOPage: FunctionComponent = ( }, title: 'Add User to Team', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: ProjectSSO): ReactElement => { return ( + item['teams'] || [] } /> ); diff --git a/Dashboard/src/Pages/Settings/SmsLog.tsx b/Dashboard/src/Pages/Settings/SmsLog.tsx index 95ad8bbce48..695e1c15ec8 100644 --- a/Dashboard/src/Pages/Settings/SmsLog.tsx +++ b/Dashboard/src/Pages/Settings/SmsLog.tsx @@ -109,7 +109,7 @@ const SMSLogs: FunctionComponent = ( }, title: 'Status', type: FieldType.Text, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: SmsLog): ReactElement => { if (item['status']) { return ( = ( buttonStyleType: ButtonStyleType.NORMAL, icon: IconProp.List, onClick: async ( - item: JSONObject, + item: SmsLog, onCompleteAction: VoidFunction ) => { setSmsText(item['smsText'] as string); @@ -180,7 +180,7 @@ const SMSLogs: FunctionComponent = ( buttonStyleType: ButtonStyleType.NORMAL, icon: IconProp.Error, onClick: async ( - item: JSONObject, + item: SmsLog, onCompleteAction: VoidFunction ) => { setSmsText(item['statusMessage'] as string); diff --git a/Dashboard/src/Pages/StatusPages/StatusPages.tsx b/Dashboard/src/Pages/StatusPages/StatusPages.tsx index dd53f9d7211..327578b4f3f 100644 --- a/Dashboard/src/Pages/StatusPages/StatusPages.tsx +++ b/Dashboard/src/Pages/StatusPages/StatusPages.tsx @@ -144,14 +144,11 @@ const StatusPages: FunctionComponent = ( title: 'Labels', type: FieldType.EntityArray, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: StatusPage): ReactElement => { return ( + item['labels'] || [] } /> ); diff --git a/Dashboard/src/Pages/StatusPages/View/Domains.tsx b/Dashboard/src/Pages/StatusPages/View/Domains.tsx index 06e6e6602ce..0e12b266188 100644 --- a/Dashboard/src/Pages/StatusPages/View/Domains.tsx +++ b/Dashboard/src/Pages/StatusPages/View/Domains.tsx @@ -68,7 +68,8 @@ const StatusPageDelete: FunctionComponent = ( title: 'Add CNAME', buttonStyleType: ButtonStyleType.SUCCESS_OUTLINE, icon: IconProp.Check, - isVisible: (item: JSONObject): boolean => { + isVisible: (item: StatusPageDomain): boolean => { + if (item['isCnameVerified']) { return false; } @@ -76,7 +77,7 @@ const StatusPageDelete: FunctionComponent = ( return true; }, onClick: async ( - item: JSONObject, + item: StatusPageDomain, onCompleteAction: VoidFunction, onError: ErrorFunction ) => { @@ -94,7 +95,7 @@ const StatusPageDelete: FunctionComponent = ( title: 'Provision SSL', buttonStyleType: ButtonStyleType.SUCCESS_OUTLINE, icon: IconProp.Check, - isVisible: (item: JSONObject): boolean => { + isVisible: (item: StatusPageDomain): boolean => { if ( item['isCnameVerified'] && !item['isSslProvisioned'] @@ -105,7 +106,7 @@ const StatusPageDelete: FunctionComponent = ( return false; }, onClick: async ( - _item: JSONObject, + _item: StatusPageDomain, onCompleteAction: VoidFunction, onError: ErrorFunction ) => { diff --git a/Dashboard/src/Pages/UserSettings/OnCallLogs.tsx b/Dashboard/src/Pages/UserSettings/OnCallLogs.tsx index 5fbde9c499d..539f93f7ee3 100644 --- a/Dashboard/src/Pages/UserSettings/OnCallLogs.tsx +++ b/Dashboard/src/Pages/UserSettings/OnCallLogs.tsx @@ -62,7 +62,7 @@ const Settings: FunctionComponent = ( title: 'View Status Message', buttonStyleType: ButtonStyleType.NORMAL, onClick: async ( - item: JSONObject, + item: UserOnCallLog, onCompleteAction: VoidFunction, onError: ErrorFunction ) => { @@ -147,7 +147,7 @@ const Settings: FunctionComponent = ( title: 'On-Call Policy', type: FieldType.Element, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: UserOnCallLog): ReactElement => { if (item['onCallDutyPolicy']) { return ( = ( title: 'Escalation Rule', type: FieldType.Element, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: UserOnCallLog): ReactElement => { if (item['onCallDutyPolicyEscalationRule']) { return ( = ( title: 'Status', type: FieldType.Element, - getElement: (item: JSONObject): ReactElement => { + getElement: (item: UserOnCallLog): ReactElement => { if ( item['status'] === UserNotificationExecutionStatus.Completed