From 4ec5c0d7f1edeb77f557bde44f4fc65b9540ac71 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Tue, 14 Nov 2023 15:14:58 +0000 Subject: [PATCH] Add changes to various files --- Accounts/src/Utils/Login.ts | 2 +- .../DuplicateModel/DuplicateModel.tsx | 1 - CommonUI/src/Components/Forms/ModelForm.tsx | 1 - .../src/Components/LogsViewer/LogItem.tsx | 2 +- .../src/Components/LogsViewer/LogsFilters.tsx | 22 ++++++++++++++++--- .../Components/ModelDetail/ModelDetail.tsx | 1 - .../ModelFormModal/ModelFormModal.tsx | 1 - .../src/Components/ModelList/ModelList.tsx | 1 - .../src/Components/ModelTable/ModelTable.tsx | 1 - CommonUI/src/Components/Probe/Probe.tsx | 2 +- CommonUI/src/Utils/Project.ts | 2 +- .../Components/Incident/IncidentsTable.tsx | 2 +- Identity/API/Authentication.ts | 2 +- Identity/API/StatusPageAuthentication.ts | 1 + 14 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Accounts/src/Utils/Login.ts b/Accounts/src/Utils/Login.ts index de428a9504..46ed03e294 100644 --- a/Accounts/src/Utils/Login.ts +++ b/Accounts/src/Utils/Login.ts @@ -6,8 +6,8 @@ import Name from 'Common/Types/Name'; import { DASHBOARD_URL } from 'CommonUI/src/Config'; import { JSONObject } from 'Common/Types/JSON'; import User from 'Model/Models/User'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import Analytics from 'CommonUI/src/Utils/Analytics'; +import BaseModel from 'Common/Models/BaseModel'; export default abstract class LoginUtil { public static login(value: JSONObject): void { diff --git a/CommonUI/src/Components/DuplicateModel/DuplicateModel.tsx b/CommonUI/src/Components/DuplicateModel/DuplicateModel.tsx index 98ea9c71e2..4cea87a583 100644 --- a/CommonUI/src/Components/DuplicateModel/DuplicateModel.tsx +++ b/CommonUI/src/Components/DuplicateModel/DuplicateModel.tsx @@ -13,7 +13,6 @@ import HTTPResponse from 'Common/Types/API/HTTPResponse'; import Route from 'Common/Types/API/Route'; import Navigation from '../../Utils/Navigation'; import BasicFormModal from '../FormModal/BasicFormModal'; -import JSONFunctions from 'Common/Types/JSONFunctions'; export interface ComponentProps { modelType: { new (): TBaseModel }; diff --git a/CommonUI/src/Components/Forms/ModelForm.tsx b/CommonUI/src/Components/Forms/ModelForm.tsx index 8e0bf3ef66..2f75ce4834 100644 --- a/CommonUI/src/Components/Forms/ModelForm.tsx +++ b/CommonUI/src/Components/Forms/ModelForm.tsx @@ -30,7 +30,6 @@ import TableColumnType from 'Common/Types/Database/TableColumnType'; import Typeof from 'Common/Types/Typeof'; import { TableColumnMetadata } from 'Common/Types/Database/TableColumn'; import { ButtonStyleType } from '../Button/Button'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import API from '../../Utils/API/API'; import { FormStep } from './Types/FormStep'; import Field from './Types/Field'; diff --git a/CommonUI/src/Components/LogsViewer/LogItem.tsx b/CommonUI/src/Components/LogsViewer/LogItem.tsx index 60cd22cd54..628c6994a6 100644 --- a/CommonUI/src/Components/LogsViewer/LogItem.tsx +++ b/CommonUI/src/Components/LogsViewer/LogItem.tsx @@ -23,7 +23,7 @@ const LogItem: FunctionComponent = ( return (
- + {props.log.body}
); }; diff --git a/CommonUI/src/Components/LogsViewer/LogsFilters.tsx b/CommonUI/src/Components/LogsViewer/LogsFilters.tsx index f61c5d7a46..4613de7f4b 100644 --- a/CommonUI/src/Components/LogsViewer/LogsFilters.tsx +++ b/CommonUI/src/Components/LogsViewer/LogsFilters.tsx @@ -1,15 +1,31 @@ -import React, { FunctionComponent, ReactElement } from 'react'; +import React, { FunctionComponent, ReactElement, useEffect } from 'react'; +import Input from '../Input/Input'; + +export interface FiterOptions { + searchText?: string | undefined; +} export interface ComponentProps { - + onFilterChanged: (filterOptions: FiterOptions) => void; } const LogsFilter: FunctionComponent = ( props: ComponentProps ): ReactElement => { + + const [filterOptions, setFilterOptions] = React.useState({}); + + useEffect(() => { + props.onFilterChanged(filterOptions); + }, [filterOptions]); + return (
- + { + setFilterOptions({ + searchText: value + }) + }} />
); }; diff --git a/CommonUI/src/Components/ModelDetail/ModelDetail.tsx b/CommonUI/src/Components/ModelDetail/ModelDetail.tsx index 5c0c7b576b..87def65335 100644 --- a/CommonUI/src/Components/ModelDetail/ModelDetail.tsx +++ b/CommonUI/src/Components/ModelDetail/ModelDetail.tsx @@ -14,7 +14,6 @@ import Field from './Field'; import DetailField from '../Detail/Field'; import Detail from '../Detail/Detail'; import API from '../../Utils/API/API'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import ErrorMessage from '../ErrorMessage/ErrorMessage'; import { useAsyncEffect } from 'use-async-effect'; import User from '../../Utils/User'; diff --git a/CommonUI/src/Components/ModelFormModal/ModelFormModal.tsx b/CommonUI/src/Components/ModelFormModal/ModelFormModal.tsx index f63b03240d..ff9f90c593 100644 --- a/CommonUI/src/Components/ModelFormModal/ModelFormModal.tsx +++ b/CommonUI/src/Components/ModelFormModal/ModelFormModal.tsx @@ -10,7 +10,6 @@ import { JSONObject } from 'Common/Types/JSON'; import ObjectID from 'Common/Types/ObjectID'; import Alert, { AlertType } from '../Alerts/Alert'; import FormValues from '../Forms/Types/FormValues'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import ModelAPI from '../../Utils/ModelAPI/ModelAPI'; export interface ComponentProps { diff --git a/CommonUI/src/Components/ModelList/ModelList.tsx b/CommonUI/src/Components/ModelList/ModelList.tsx index ce36881f6a..f3721f9f9b 100644 --- a/CommonUI/src/Components/ModelList/ModelList.tsx +++ b/CommonUI/src/Components/ModelList/ModelList.tsx @@ -15,7 +15,6 @@ import API from '../../Utils/API/API'; import URL from 'Common/Types/API/URL'; import { JSONArray } from 'Common/Types/JSON'; import HTTPResponse from 'Common/Types/API/HTTPResponse'; -import JSONFunctions from 'Common/Types/JSONFunctions'; export interface ComponentProps { query?: Query; diff --git a/CommonUI/src/Components/ModelTable/ModelTable.tsx b/CommonUI/src/Components/ModelTable/ModelTable.tsx index 509d44244d..b2cf0c76d8 100644 --- a/CommonUI/src/Components/ModelTable/ModelTable.tsx +++ b/CommonUI/src/Components/ModelTable/ModelTable.tsx @@ -52,7 +52,6 @@ import SubscriptionPlan, { } from 'Common/Types/Billing/SubscriptionPlan'; import Pill from '../Pill/Pill'; import { Yellow } from 'Common/Types/BrandColors'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import { ModalWidth } from '../Modal/Modal'; import ProjectUtil from '../../Utils/Project'; import API from '../../Utils/API/API'; diff --git a/CommonUI/src/Components/Probe/Probe.tsx b/CommonUI/src/Components/Probe/Probe.tsx index c87424e484..2e50458041 100644 --- a/CommonUI/src/Components/Probe/Probe.tsx +++ b/CommonUI/src/Components/Probe/Probe.tsx @@ -1,5 +1,4 @@ import { JSONObject } from 'Common/Types/JSON'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import React, { FunctionComponent, ReactElement } from 'react'; import Image from '../Image/Image'; import URL from 'Common/Types/API/URL'; @@ -7,6 +6,7 @@ import { FILE_URL } from '../../Config'; import Probe from 'Model/Models/Probe'; import Icon from '../Icon/Icon'; import IconProp from 'Common/Types/Icon/IconProp'; +import BaseModel from 'Common/Models/BaseModel'; export interface ComponentProps { probe?: Probe | JSONObject | undefined | null; diff --git a/CommonUI/src/Utils/Project.ts b/CommonUI/src/Utils/Project.ts index 278635666c..e8d6a2e81b 100644 --- a/CommonUI/src/Utils/Project.ts +++ b/CommonUI/src/Utils/Project.ts @@ -1,12 +1,12 @@ import LocalStorage from './LocalStorage'; import { JSONObject } from 'Common/Types/JSON'; import Project from 'Model/Models/Project'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import SubscriptionPlan, { PlanSelect, } from 'Common/Types/Billing/SubscriptionPlan'; import { BILLING_ENABLED, getAllEnvVars } from '../Config'; import ObjectID from 'Common/Types/ObjectID'; +import BaseModel from 'Common/Models/BaseModel'; export default class ProjectUtil { public static getCurrentProject(): Project | null { diff --git a/Dashboard/src/Components/Incident/IncidentsTable.tsx b/Dashboard/src/Components/Incident/IncidentsTable.tsx index 3cdad20124..69805065df 100644 --- a/Dashboard/src/Components/Incident/IncidentsTable.tsx +++ b/Dashboard/src/Components/Incident/IncidentsTable.tsx @@ -15,7 +15,6 @@ import LabelsElement from '../../Components/Label/Labels'; import IncidentSeverity from 'Model/Models/IncidentSeverity'; import Query from 'CommonUI/src/Utils/ModelAPI/Query'; import Route from 'Common/Types/API/Route'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import GlobalEvents from 'CommonUI/src/Utils/GlobalEvents'; import EventName from '../../Utils/EventName'; import DashboardNavigation from '../../Utils/Navigation'; @@ -34,6 +33,7 @@ import IncidentTemplateOwnerUser from 'Model/Models/IncidentTemplateOwnerUser'; import IncidentTemplateOwnerTeam from 'Model/Models/IncidentTemplateOwnerTeam'; import ObjectID from 'Common/Types/ObjectID'; import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button'; +import BaseModel from 'Common/Models/BaseModel'; export interface ComponentProps { query?: Query | undefined; diff --git a/Identity/API/Authentication.ts b/Identity/API/Authentication.ts index f0f4e47379..6147e2a1ad 100644 --- a/Identity/API/Authentication.ts +++ b/Identity/API/Authentication.ts @@ -26,7 +26,6 @@ import OneUptimeDate from 'Common/Types/Date'; import PositiveNumber from 'Common/Types/PositiveNumber'; import Route from 'Common/Types/API/Route'; import logger from 'CommonServer/Utils/Logger'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import PartialEntity from 'Common/Types/Database/PartialEntity'; import Email from 'Common/Types/Email'; import Name from 'Common/Types/Name'; @@ -36,6 +35,7 @@ import Hostname from 'Common/Types/API/Hostname'; import Protocol from 'Common/Types/API/Protocol'; import DatabaseConfig from 'CommonServer/DatabaseConfig'; import CookieUtil from 'CommonServer/Utils/Cookie'; +import BaseModel from 'Common/Models/BaseModel'; const router: ExpressRouter = Express.getRouter(); diff --git a/Identity/API/StatusPageAuthentication.ts b/Identity/API/StatusPageAuthentication.ts index b3051e2ef7..f280688ad9 100644 --- a/Identity/API/StatusPageAuthentication.ts +++ b/Identity/API/StatusPageAuthentication.ts @@ -26,6 +26,7 @@ import Protocol from 'Common/Types/API/Protocol'; import Hostname from 'Common/Types/API/Hostname'; import DatabaseConfig from 'CommonServer/DatabaseConfig'; import CookieUtil from 'CommonServer/Utils/Cookie'; +import BaseModel from 'Common/Models/BaseModel'; const router: ExpressRouter = Express.getRouter();