From 236fdbe8abc265fe0099ad5f06631eeb069474a4 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Mon, 12 Jun 2023 15:00:06 +0100 Subject: [PATCH] remove dup keys --- CommonServer/API/BaseAPI.ts | 5 +- CommonServer/API/StatusPageAPI.ts | 29 +++--- CommonServer/Services/AccessTokenService.ts | 5 +- CommonServer/Services/DomainService.ts | 2 +- .../Services/ScheduledMaintenanceService.ts | 2 +- .../Services/StatusPageDomainService.ts | 2 +- .../Services/StatusPageFooterLinkService.ts | 2 +- .../Services/StatusPageGroupService.ts | 2 +- .../Services/StatusPageHeaderLinkService.ts | 2 +- .../Services/StatusPageResourceService.ts | 2 +- CommonServer/Services/TeamMemberService.ts | 4 +- CommonServer/Services/TeamService.ts | 4 +- CommonServer/Types/Database/Select.ts | 5 +- CommonServer/Utils/ModelPermission.ts | 88 +++++++++++-------- .../CustomFields/CustomFieldsDetail.tsx | 2 +- CommonUI/src/Components/Forms/ModelForm.tsx | 3 +- .../Components/ModelDetail/ModelDetail.tsx | 28 +++--- .../src/Components/ModelList/ModelList.tsx | 2 +- .../src/Components/ModelTable/ModelTable.tsx | 80 +++++++++-------- Dashboard/src/App.tsx | 2 +- .../Components/Form/Monitor/MonitorSteps.tsx | 5 +- .../Monitor/MonitorSteps/MonitorSteps.tsx | 6 +- .../ScheduledMaintenance/ChangeState.tsx | 3 +- Dashboard/src/Pages/Incidents/View/Index.tsx | 3 +- Dashboard/src/Pages/Monitor/View/Index.tsx | 2 +- Dashboard/src/Pages/Monitor/View/Probes.tsx | 2 +- .../ScheduledMaintenanceEvents/View/Index.tsx | 2 +- Dashboard/src/Utils/ProjectUser.ts | 4 +- Model/Models/User.ts | 5 +- .../Jobs/Incident/SendEmailToSubscribers.ts | 2 - .../SendCreatedResourceEmail.ts | 1 - .../IncidentOwners/SendNotePostedEmail.ts | 1 - .../IncidentOwners/SendOwnerAddedEmail.ts | 1 - .../IncidentOwners/SendStateChangeEmail.ts | 2 - .../SendEmailToSubscribers.ts | 2 - .../SendEmailToSubscribers.ts | 3 - .../MonitorOwners/SendCreatedResourceEmail.ts | 1 - .../Jobs/MonitorOwners/SendOwnerAddedEmail.ts | 2 - .../MonitorOwners/SendStatusChangeEmail.ts | 1 - .../SendStateChangeEmail.ts | 1 - .../SendAnnouncementCreatedEmail.ts | 1 - 41 files changed, 156 insertions(+), 165 deletions(-) diff --git a/CommonServer/API/BaseAPI.ts b/CommonServer/API/BaseAPI.ts index 670a703178..eabf6ce8b7 100644 --- a/CommonServer/API/BaseAPI.ts +++ b/CommonServer/API/BaseAPI.ts @@ -20,7 +20,6 @@ import Query from '../Types/Database/Query'; import Select from '../Types/Database/Select'; import Sort from '../Types/Database/Sort'; import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax'; -import Populate from '../Types/Database/RelationSelect'; import PartialEntity from 'Common/Types/Database/PartialEntity'; import { UserPermission } from 'Common/Types/Permission'; import { IsBillingEnabled } from '../Config'; @@ -298,7 +297,6 @@ export default class BaseAPI< req.body['select'] ) as Select; - sort = JSONFunctions.deserialize( req.body['sort'] ) as Sort; @@ -364,12 +362,11 @@ export default class BaseAPI< const objectId: ObjectID = new ObjectID(req.params['id'] as string); await this.onBeforeGet(req, res); let select: Select = {}; - + if (req.body) { select = JSONFunctions.deserialize( req.body['select'] ) as Select; - } const item: BaseModel | null = await this.service.findOneById({ diff --git a/CommonServer/API/StatusPageAPI.ts b/CommonServer/API/StatusPageAPI.ts index 30ae84fbcf..11dddd175c 100644 --- a/CommonServer/API/StatusPageAPI.ts +++ b/CommonServer/API/StatusPageAPI.ts @@ -259,7 +259,6 @@ export default class StatusPageAPI extends BaseAPI< }, }); - const item: StatusPage | null = await this.service.findOneById({ id: objectId, @@ -487,7 +486,7 @@ export default class StatusPageAPI extends BaseAPI< currentMonitorStatusId: true, }, }, - + sort: { order: SortOrder.Ascending, }, @@ -584,7 +583,7 @@ export default class StatusPageAPI extends BaseAPI< sort: { createdAt: SortOrder.Ascending, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -649,7 +648,7 @@ export default class StatusPageAPI extends BaseAPI< isAcknowledgedState: true, }, }, - + sort: { createdAt: SortOrder.Descending, // new note first }, @@ -721,7 +720,7 @@ export default class StatusPageAPI extends BaseAPI< sort: { createdAt: SortOrder.Ascending, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -759,7 +758,7 @@ export default class StatusPageAPI extends BaseAPI< sort: { createdAt: SortOrder.Ascending, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -833,7 +832,7 @@ export default class StatusPageAPI extends BaseAPI< isOngoingState: true, }, }, - + sort: { createdAt: SortOrder.Descending, // new note first }, @@ -1220,7 +1219,7 @@ export default class StatusPageAPI extends BaseAPI< currentMonitorStatusId: true, }, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -1272,7 +1271,7 @@ export default class StatusPageAPI extends BaseAPI< sort: { startsAt: SortOrder.Descending, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -1379,7 +1378,7 @@ export default class StatusPageAPI extends BaseAPI< isOngoingState: true, }, }, - + sort: { createdAt: SortOrder.Descending, // new note first }, @@ -1501,7 +1500,7 @@ export default class StatusPageAPI extends BaseAPI< currentMonitorStatusId: true, }, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -1572,7 +1571,7 @@ export default class StatusPageAPI extends BaseAPI< currentMonitorStatusId: true, }, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -1631,7 +1630,7 @@ export default class StatusPageAPI extends BaseAPI< _id: true, }, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -1668,7 +1667,7 @@ export default class StatusPageAPI extends BaseAPI< sort: { createdAt: SortOrder.Descending, }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { @@ -1732,7 +1731,7 @@ export default class StatusPageAPI extends BaseAPI< sort: { createdAt: SortOrder.Descending, // new note first }, - + skip: 0, limit: LIMIT_PER_PROJECT, props: { diff --git a/CommonServer/Services/AccessTokenService.ts b/CommonServer/Services/AccessTokenService.ts index ab5260c630..7f66aa64bc 100644 --- a/CommonServer/Services/AccessTokenService.ts +++ b/CommonServer/Services/AccessTokenService.ts @@ -92,7 +92,7 @@ export default class AccessTokenService { _id: true, }, }, - + limit: LIMIT_MAX, skip: 0, props: { @@ -251,12 +251,11 @@ export default class AccessTokenService { }, select: { permission: true, - labels: true, labels: { _id: true, }, }, - + limit: LIMIT_MAX, skip: 0, props: { diff --git a/CommonServer/Services/DomainService.ts b/CommonServer/Services/DomainService.ts index 7aa7c51cc3..6c3b472fda 100644 --- a/CommonServer/Services/DomainService.ts +++ b/CommonServer/Services/DomainService.ts @@ -39,7 +39,7 @@ export class Service extends DatabaseService { domain: true, domainVerificationText: true, }, - + limit: 1, skip: 0, props: { diff --git a/CommonServer/Services/ScheduledMaintenanceService.ts b/CommonServer/Services/ScheduledMaintenanceService.ts index 3e65ed2e56..b7e6ebe15b 100644 --- a/CommonServer/Services/ScheduledMaintenanceService.ts +++ b/CommonServer/Services/ScheduledMaintenanceService.ts @@ -178,7 +178,7 @@ export class Service extends DatabaseService { name: true, }, }, - + props: { isRoot: true, }, diff --git a/CommonServer/Services/StatusPageDomainService.ts b/CommonServer/Services/StatusPageDomainService.ts index 7eba5cf554..21edfa5589 100644 --- a/CommonServer/Services/StatusPageDomainService.ts +++ b/CommonServer/Services/StatusPageDomainService.ts @@ -55,7 +55,7 @@ export class Service extends DatabaseService { ...deleteBy.query, isAddedtoGreenlock: true, }, - + skip: 0, limit: LIMIT_MAX, select: { fullDomain: true }, diff --git a/CommonServer/Services/StatusPageFooterLinkService.ts b/CommonServer/Services/StatusPageFooterLinkService.ts index 4d40b57898..c7fd2fca12 100644 --- a/CommonServer/Services/StatusPageFooterLinkService.ts +++ b/CommonServer/Services/StatusPageFooterLinkService.ts @@ -137,7 +137,7 @@ export class Service extends DatabaseService { query: { statusPageId: resource?.statusPageId!, }, - + limit: LIMIT_MAX, skip: 0, props: { diff --git a/CommonServer/Services/StatusPageGroupService.ts b/CommonServer/Services/StatusPageGroupService.ts index 5f74a9d44b..0dbb984ade 100644 --- a/CommonServer/Services/StatusPageGroupService.ts +++ b/CommonServer/Services/StatusPageGroupService.ts @@ -136,7 +136,7 @@ export class Service extends DatabaseService { query: { statusPageId: group?.statusPageId!, }, - + limit: LIMIT_MAX, skip: 0, props: { diff --git a/CommonServer/Services/StatusPageHeaderLinkService.ts b/CommonServer/Services/StatusPageHeaderLinkService.ts index 90df46abee..0b0a3ac715 100644 --- a/CommonServer/Services/StatusPageHeaderLinkService.ts +++ b/CommonServer/Services/StatusPageHeaderLinkService.ts @@ -137,7 +137,7 @@ export class Service extends DatabaseService { query: { statusPageId: resource?.statusPageId!, }, - + limit: LIMIT_MAX, skip: 0, props: { diff --git a/CommonServer/Services/StatusPageResourceService.ts b/CommonServer/Services/StatusPageResourceService.ts index 363550272a..65466289c7 100644 --- a/CommonServer/Services/StatusPageResourceService.ts +++ b/CommonServer/Services/StatusPageResourceService.ts @@ -154,7 +154,7 @@ export class Service extends DatabaseService { statusPageGroupId: resource?.statusPageGroupId || QueryHelper.isNull(), }, - + limit: LIMIT_MAX, skip: 0, props: { diff --git a/CommonServer/Services/TeamMemberService.ts b/CommonServer/Services/TeamMemberService.ts index 3cfb1f4729..7450dcbf90 100644 --- a/CommonServer/Services/TeamMemberService.ts +++ b/CommonServer/Services/TeamMemberService.ts @@ -157,7 +157,7 @@ export class TeamMemberService extends DatabaseService { }, limit: LIMIT_MAX, skip: 0, - + props: { isRoot: true, }, @@ -284,7 +284,7 @@ export class TeamMemberService extends DatabaseService { name: true, }, }, - + skip: 0, limit: LIMIT_MAX, }); diff --git a/CommonServer/Services/TeamService.ts b/CommonServer/Services/TeamService.ts index 61a8a67bc8..1b010f0365 100644 --- a/CommonServer/Services/TeamService.ts +++ b/CommonServer/Services/TeamService.ts @@ -24,7 +24,7 @@ export class Service extends DatabaseService { name: true, isTeamEditable: true, }, - + props: updateBy.props, }); @@ -52,7 +52,7 @@ export class Service extends DatabaseService { name: true, isTeamDeleteable: true, }, - + props: deleteBy.props, }); diff --git a/CommonServer/Types/Database/Select.ts b/CommonServer/Types/Database/Select.ts index 13cc03a3de..65c3caedc1 100644 --- a/CommonServer/Types/Database/Select.ts +++ b/CommonServer/Types/Database/Select.ts @@ -8,7 +8,10 @@ export type SelectPropertyOptions = Property extends DatabaseProperty ? boolean : Property extends JSONObject ? boolean - : FindOptionsSelectProperty | FindOptionsRelations | boolean; + : + | FindOptionsSelectProperty + | FindOptionsRelations + | boolean; /** * Select find options. diff --git a/CommonServer/Utils/ModelPermission.ts b/CommonServer/Utils/ModelPermission.ts index 510dec9ccc..d2b4c99451 100644 --- a/CommonServer/Utils/ModelPermission.ts +++ b/CommonServer/Utils/ModelPermission.ts @@ -47,7 +47,7 @@ export interface CheckReadPermissionType { export default class ModelPermission { public static async checkDeletePermission( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, query: Query, props: DatabaseCommonInteractionProps ): Promise> { @@ -69,7 +69,7 @@ export default class ModelPermission { } public static async checkUpdatePermissions( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, query: Query, data: QueryDeepPartialEntity, props: DatabaseCommonInteractionProps @@ -100,7 +100,7 @@ export default class ModelPermission { } public static checkCreatePermissions( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, data: TBaseModel, props: DatabaseCommonInteractionProps ): void { @@ -124,7 +124,7 @@ export default class ModelPermission { } private static checkDataColumnPermissions( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, data: TBaseModel, props: DatabaseCommonInteractionProps, requestType: DatabaseRequestType @@ -182,7 +182,7 @@ export default class ModelPermission { } public static async checkReadPermission( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, query: Query, select: Select | null, props: DatabaseCommonInteractionProps @@ -248,7 +248,7 @@ export default class ModelPermission { tableColumnMetadata.modelType && (tableColumnMetadata.type === TableColumnType.Entity || tableColumnMetadata.type === - TableColumnType.EntityArray) + TableColumnType.EntityArray) ) { const accessControlIds: Array = this.getAccessControlIdsForQuery( @@ -298,7 +298,7 @@ export default class ModelPermission { } private static serializeQuery( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, query: Query ): Query { const model: BaseModel = new modelType(); @@ -464,7 +464,7 @@ export default class ModelPermission { } private static getAccessControlIdsForQuery( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, query: Query, select: Select | null, props: DatabaseCommonInteractionProps @@ -511,7 +511,7 @@ export default class ModelPermission { for (const accessControlPermission of accessControlPermissions) { if ( accessControlPermission.permission === - readPermissions && + readPermissions && accessControlPermission.labelIds.length > 0 ) { labelIds = [ @@ -528,7 +528,7 @@ export default class ModelPermission { } private static sanitizeSelect( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, select: Select ): { select: Select; @@ -541,7 +541,10 @@ export default class ModelPermission { if (model.isEntityColumn(key)) { if (typeof (select as JSONObject)[key] === Typeof.Object) { (relationSelect as any)[key] = true; - (select as any)[key] = { ...(select as any)[key], _id: true }; + (select as any)[key] = { + ...(select as any)[key], + _id: true, + }; } else { // if you want to relationSelect the whole object, you only do the id because of security. (select as any)[key] = { @@ -557,7 +560,7 @@ export default class ModelPermission { } private static checkRelationQueryPermission( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, select: Select, props: DatabaseCommonInteractionProps ): void { @@ -579,10 +582,10 @@ export default class ModelPermission { if (!tableColumnMetadata.modelType) { throw new BadDataException( 'Select not supported on ' + - key + - ' of ' + - model.singularName + - ' because this column modelType is not found.' + key + + ' of ' + + model.singularName + + ' because this column modelType is not found.' ); } @@ -622,7 +625,9 @@ export default class ModelPermission { ); } - if (getRelatedTableColumnMetadata.canReadOnRelationQuery) { + if ( + getRelatedTableColumnMetadata.canReadOnRelationQuery + ) { continue; } @@ -648,8 +653,10 @@ export default class ModelPermission { } throw new NotAuthorizedException( - `You do not have permissions to read ${relatedModel.singularName - } on ${model.singularName + `You do not have permissions to read ${ + relatedModel.singularName + } on ${ + model.singularName }. You need one of these permissions: ${PermissionHelper.getPermissionTitles( readPermissions ).join(', ')}` @@ -675,7 +682,7 @@ export default class ModelPermission { } private static checkQueryPermission( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, query: Query, props: DatabaseCommonInteractionProps ): void { @@ -722,7 +729,7 @@ export default class ModelPermission { } private static async addTenantScopeToQuery( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, query: Query, select: Select | null, props: DatabaseCommonInteractionProps @@ -799,7 +806,7 @@ export default class ModelPermission { if (queries.length === 0) { throw new NotAuthorizedException( lastException?.message || - 'Does not have permission to read ' + model.singularName + 'Does not have permission to read ' + model.singularName ); } @@ -810,7 +817,7 @@ export default class ModelPermission { } private static getModelColumnsByPermissions( - modelType: { new(): TBaseModel }, + modelType: { new (): TBaseModel }, userPermissions: Array, requestType: DatabaseRequestType ): Columns { @@ -860,7 +867,7 @@ export default class ModelPermission { } private static checkSelectPermission( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, select: Select, props: DatabaseCommonInteractionProps ): void { @@ -889,7 +896,8 @@ export default class ModelPermission { if (!canReadOnTheseColumns.columns.includes(key)) { if (!tableColumns.includes(key)) { throw new BadDataException( - `Invalid select clause. Cannnot select on "${key}". This column does not exist on ${model.singularName + `Invalid select clause. Cannnot select on "${key}". This column does not exist on ${ + model.singularName }. Here are the columns you can select on instead: ${tableColumns.join( ', ' )}` @@ -909,7 +917,7 @@ export default class ModelPermission { } private static getModelPermissions( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, type: DatabaseRequestType ): Array { let modelPermissions: Array = []; @@ -935,7 +943,7 @@ export default class ModelPermission { } private static isPublicPermissionAllowed( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, type: DatabaseRequestType ): boolean { let isPublicAllowed: boolean = false; @@ -946,7 +954,7 @@ export default class ModelPermission { } public static checkIfUserIsLoggedIn( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, props: DatabaseCommonInteractionProps, type: DatabaseRequestType ): void { @@ -960,14 +968,15 @@ export default class ModelPermission { // this means the record is not publicly createable and the user is not logged in. throw new NotAuthenticatedException( - `A user should be logged in to ${type} record of ${new modelType().singularName + `A user should be logged in to ${type} record of ${ + new modelType().singularName }.` ); } } private static checkModelLevelPermissions( - modelType: { new(): BaseModel }, + modelType: { new (): BaseModel }, props: DatabaseCommonInteractionProps, type: DatabaseRequestType ): void { @@ -990,7 +999,8 @@ export default class ModelPermission { ) ) { throw new NotAuthorizedException( - `You do not have permissions to ${type} ${new modelType().singularName + `You do not have permissions to ${type} ${ + new modelType().singularName }. You need one of these permissions: ${PermissionHelper.getPermissionTitles( modelPermissions ).join(', ')}` @@ -1025,8 +1035,8 @@ export default class ModelPermission { ) { throw new PaymentRequiredException( 'Please upgrade your plan to ' + - model.createBillingPlan + - ' to access this feature' + model.createBillingPlan + + ' to access this feature' ); } } @@ -1044,8 +1054,8 @@ export default class ModelPermission { ) { throw new PaymentRequiredException( 'Please upgrade your plan to ' + - model.createBillingPlan + - ' to access this feature' + model.createBillingPlan + + ' to access this feature' ); } } @@ -1063,8 +1073,8 @@ export default class ModelPermission { ) { throw new PaymentRequiredException( 'Please upgrade your plan to ' + - model.createBillingPlan + - ' to access this feature' + model.createBillingPlan + + ' to access this feature' ); } } @@ -1079,8 +1089,8 @@ export default class ModelPermission { ) { throw new PaymentRequiredException( 'Please upgrade your plan to ' + - model.createBillingPlan + - ' to access this feature' + model.createBillingPlan + + ' to access this feature' ); } } diff --git a/CommonUI/src/Components/CustomFields/CustomFieldsDetail.tsx b/CommonUI/src/Components/CustomFields/CustomFieldsDetail.tsx index 62c6c1acda..d3e5b83b55 100644 --- a/CommonUI/src/Components/CustomFields/CustomFieldsDetail.tsx +++ b/CommonUI/src/Components/CustomFields/CustomFieldsDetail.tsx @@ -55,7 +55,7 @@ const CustomFieldsDetail: FunctionComponent = ( type: true, description: true, } as any, - {}, + {} ); const item: BaseModel | null = await ModelAPI.getItem( diff --git a/CommonUI/src/Components/Forms/ModelForm.tsx b/CommonUI/src/Components/Forms/ModelForm.tsx index 76e1048e3e..f9019add49 100644 --- a/CommonUI/src/Components/Forms/ModelForm.tsx +++ b/CommonUI/src/Components/Forms/ModelForm.tsx @@ -229,8 +229,7 @@ const ModelForm: Function = ( let item: BaseModel | null = await ModelAPI.getItem( props.modelType, props.modelIdToEdit, - { ...getSelectFields(), - ...getRelationSelect()} + { ...getSelectFields(), ...getRelationSelect() } ); if (!(item instanceof BaseModel) && item) { diff --git a/CommonUI/src/Components/ModelDetail/ModelDetail.tsx b/CommonUI/src/Components/ModelDetail/ModelDetail.tsx index 936b84ed08..58fa6da276 100644 --- a/CommonUI/src/Components/ModelDetail/ModelDetail.tsx +++ b/CommonUI/src/Components/ModelDetail/ModelDetail.tsx @@ -15,7 +15,7 @@ import Detail from '../Detail/Detail'; import API from '../../Utils/API/API'; export interface ComponentProps { - modelType: { new(): TBaseModel }; + modelType: { new (): TBaseModel }; id: string; fields: Array>; onLoadingChange?: undefined | ((isLoading: boolean) => void); @@ -114,12 +114,12 @@ const ModelDetail: Function = ( ...field, getElement: field.getElement ? (item: JSONObject): ReactElement => { - return field.getElement!( - item, - onBeforeFetchData, - fetchItem - ); - } + return field.getElement!( + item, + onBeforeFetchData, + fetchItem + ); + } : undefined, }); } @@ -128,12 +128,12 @@ const ModelDetail: Function = ( ...field, getElement: field.getElement ? (item: JSONObject): ReactElement => { - return field.getElement!( - item, - onBeforeFetchData, - fetchItem - ); - } + return field.getElement!( + item, + onBeforeFetchData, + fetchItem + ); + } : undefined, }); } @@ -164,7 +164,7 @@ const ModelDetail: Function = ( props.modelId, { ...getSelectFields(), - ...getRelationSelect() + ...getRelationSelect(), } ); diff --git a/CommonUI/src/Components/ModelList/ModelList.tsx b/CommonUI/src/Components/ModelList/ModelList.tsx index 94db436be5..99099d1c66 100644 --- a/CommonUI/src/Components/ModelList/ModelList.tsx +++ b/CommonUI/src/Components/ModelList/ModelList.tsx @@ -95,7 +95,7 @@ const ModelList: Function = ( 0, props.select, {}, - + props.fetchRequestOptions ); } diff --git a/CommonUI/src/Components/ModelTable/ModelTable.tsx b/CommonUI/src/Components/ModelTable/ModelTable.tsx index 504bca57f5..551e6b62a8 100644 --- a/CommonUI/src/Components/ModelTable/ModelTable.tsx +++ b/CommonUI/src/Components/ModelTable/ModelTable.tsx @@ -69,14 +69,14 @@ export enum ShowTableAs { } export interface ComponentProps { - modelType: { new(): TBaseModel }; + modelType: { new (): TBaseModel }; id: string; onFetchInit?: - | undefined - | ((pageNumber: number, itemsOnPage: number) => void); + | undefined + | ((pageNumber: number, itemsOnPage: number) => void); onFetchSuccess?: - | undefined - | ((data: Array, totalCount: number) => void); + | undefined + | ((data: Array, totalCount: number) => void); cardProps?: CardComponentProps | undefined; columns: Columns; selectMoreFields?: Select; @@ -212,8 +212,8 @@ const ModelTable: Function = ( alignItem: column.alignItem, getElement: column.getElement ? (item: JSONObject): ReactElement => { - return column.getElement!(item, onBeforeFetchData); - } + return column.getElement!(item, onBeforeFetchData); + } : undefined, }); @@ -444,8 +444,7 @@ const ModelTable: Function = ( [column.filterDropdownField.label]: true, [column.filterDropdownField.value]: true, }, - {}, - + {} ); classicColumn.filterDropdownOptions = []; @@ -494,8 +493,6 @@ const ModelTable: Function = ( setOnBeforeFetchData(jobject); } - - try { const listResult: ListResult = await ModelAPI.getList( @@ -508,12 +505,12 @@ const ModelTable: Function = ( (currentPageNumber - 1) * itemsOnPage, { ...getSelect(), - ...getRelationSelect() - }, + ...getRelationSelect(), + }, sortBy ? { - [sortBy as any]: sortOrder, - } + [sortBy as any]: sortOrder, + } : {}, props.fetchRequestOptions ); @@ -599,7 +596,9 @@ const ModelTable: Function = ( name: true, }; } else if (key && model.isEntityColumn(key)) { - (relationSelect as JSONObject)[key] = (column.field as any)[key]; + (relationSelect as JSONObject)[key] = (column.field as any)[ + key + ]; } } @@ -630,8 +629,9 @@ const ModelTable: Function = ( showTableAs !== ShowTableAs.OrderedStatesList ) { headerbuttons.push({ - title: `${props.createVerb || 'Create'} ${props.singularName || model.singularName - }`, + title: `${props.createVerb || 'Create'} ${ + props.singularName || model.singularName + }`, buttonStyle: ButtonStyleType.NORMAL, className: props.showFilterButton || props.showRefreshButton @@ -1049,9 +1049,9 @@ const ModelTable: Function = ( let getTitleElement: | (( - item: JSONObject, - onBeforeFetchData?: JSONObject | undefined - ) => ReactElement) + item: JSONObject, + onBeforeFetchData?: JSONObject | undefined + ) => ReactElement) | undefined = undefined; let getDescriptionElement: | ((item: JSONObject) => ReactElement) @@ -1095,10 +1095,10 @@ const ModelTable: Function = ( onCreateNewItem={ props.isCreateable ? (order: number) => { - setOrderedStatesListNewItemOrder(order); - setModalType(ModalType.Create); - setShowModal(true); - } + setOrderedStatesListNewItemOrder(order); + setModalType(ModalType.Create); + setShowModal(true); + } : undefined } singularLabel={ @@ -1165,8 +1165,9 @@ const ModelTable: Function = ( }} > @@ -1266,17 +1267,20 @@ const ModelTable: Function = ( title={ modalType === ModalType.Create - ? `${props.createVerb || 'Create'} New ${props.singularName || model.singularName - }` + ? `${props.createVerb || 'Create'} New ${ + props.singularName || model.singularName + }` : `Edit ${props.singularName || model.singularName}` } modalWidth={props.createEditModalWidth} name={ modalType === ModalType.Create - ? `${props.name} > ${props.createVerb || 'Create' - } New ${props.singularName || model.singularName}` - : `${props.name} > Edit ${props.singularName || model.singularName - }` + ? `${props.name} > ${ + props.createVerb || 'Create' + } New ${props.singularName || model.singularName}` + : `${props.name} > Edit ${ + props.singularName || model.singularName + }` } initialValues={ modalType === ModalType.Create @@ -1288,8 +1292,9 @@ const ModelTable: Function = ( }} submitButtonText={ modalType === ModalType.Create - ? `${props.createVerb || 'Create'} ${props.singularName || model.singularName - }` + ? `${props.createVerb || 'Create'} ${ + props.singularName || model.singularName + }` : `Save Changes` } onSuccess={async (item: TBaseModel) => { @@ -1384,8 +1389,9 @@ const ModelTable: Function = ( {showViewIdModal && ( diff --git a/Dashboard/src/App.tsx b/Dashboard/src/App.tsx index 7759603bff..81db0a2173 100644 --- a/Dashboard/src/App.tsx +++ b/Dashboard/src/App.tsx @@ -246,7 +246,7 @@ const App: FunctionComponent = () => { paymentProviderPlanId: true, }, {}, - + { isMultiTenantRequest: true, } diff --git a/Dashboard/src/Components/Form/Monitor/MonitorSteps.tsx b/Dashboard/src/Components/Form/Monitor/MonitorSteps.tsx index 4e92e86a4c..a5c7656e50 100644 --- a/Dashboard/src/Components/Form/Monitor/MonitorSteps.tsx +++ b/Dashboard/src/Components/Form/Monitor/MonitorSteps.tsx @@ -60,7 +60,7 @@ const MonitorStepsElement: FunctionComponent = ( isOperationalState: true, isOfflineState: true, }, - + {} ); @@ -87,8 +87,7 @@ const MonitorStepsElement: FunctionComponent = ( }, { order: SortOrder.Ascending, - }, - + } ); if (incidentSeverityList.data) { diff --git a/Dashboard/src/Components/Monitor/MonitorSteps/MonitorSteps.tsx b/Dashboard/src/Components/Monitor/MonitorSteps/MonitorSteps.tsx index bf4cd46c51..619dd8b3e2 100644 --- a/Dashboard/src/Components/Monitor/MonitorSteps/MonitorSteps.tsx +++ b/Dashboard/src/Components/Monitor/MonitorSteps/MonitorSteps.tsx @@ -59,8 +59,7 @@ const MonitorStepsElement: FunctionComponent = ( color: true, isOperationalState: true, }, - {}, - + {} ); if (monitorStatusList.data) { @@ -82,8 +81,7 @@ const MonitorStepsElement: FunctionComponent = ( name: true, color: true, }, - {}, - + {} ); if (incidentSeverityList.data) { diff --git a/Dashboard/src/Components/ScheduledMaintenance/ChangeState.tsx b/Dashboard/src/Components/ScheduledMaintenance/ChangeState.tsx index f124780d55..113a9603b9 100644 --- a/Dashboard/src/Components/ScheduledMaintenance/ChangeState.tsx +++ b/Dashboard/src/Components/ScheduledMaintenance/ChangeState.tsx @@ -120,8 +120,7 @@ const ChangeScheduledMaintenanceState: FunctionComponent = ( isOngoingState: true, isScheduledState: true, }, - {}, - + {} ); let stateId: ObjectID | null = null; diff --git a/Dashboard/src/Pages/Incidents/View/Index.tsx b/Dashboard/src/Pages/Incidents/View/Index.tsx index bd8a43bfc6..0b364cdcf0 100644 --- a/Dashboard/src/Pages/Incidents/View/Index.tsx +++ b/Dashboard/src/Pages/Incidents/View/Index.tsx @@ -162,8 +162,7 @@ const IncidentView: FunctionComponent = ( isAcknowledgedState: true, }, }, - {}, - + {} ); return incidentTimelines; diff --git a/Dashboard/src/Pages/Monitor/View/Index.tsx b/Dashboard/src/Pages/Monitor/View/Index.tsx index b5647a7d72..1c5a073798 100644 --- a/Dashboard/src/Pages/Monitor/View/Index.tsx +++ b/Dashboard/src/Pages/Monitor/View/Index.tsx @@ -70,7 +70,7 @@ const MonitorView: FunctionComponent = ( }, { createdAt: SortOrder.Ascending, - }, + } ); setData(monitorStatus.data); diff --git a/Dashboard/src/Pages/Monitor/View/Probes.tsx b/Dashboard/src/Pages/Monitor/View/Probes.tsx index 6e9c21891b..1513e0ec2b 100644 --- a/Dashboard/src/Pages/Monitor/View/Probes.tsx +++ b/Dashboard/src/Pages/Monitor/View/Probes.tsx @@ -76,7 +76,7 @@ const MonitorProbes: FunctionComponent = ( _id: true, }, {}, - {}, + {} ); const globalProbeList: ListResult = await ModelAPI.getList( diff --git a/Dashboard/src/Pages/ScheduledMaintenanceEvents/View/Index.tsx b/Dashboard/src/Pages/ScheduledMaintenanceEvents/View/Index.tsx index 80ce2fd7fa..10fc4017f0 100644 --- a/Dashboard/src/Pages/ScheduledMaintenanceEvents/View/Index.tsx +++ b/Dashboard/src/Pages/ScheduledMaintenanceEvents/View/Index.tsx @@ -216,7 +216,7 @@ const ScheduledMaintenanceView: FunctionComponent = ( isScheduledState: true, }, }, - {}, + {} ); return scheduledMaintenanceTimelines; diff --git a/Dashboard/src/Utils/ProjectUser.ts b/Dashboard/src/Utils/ProjectUser.ts index c63c514c51..2734e24f22 100644 --- a/Dashboard/src/Utils/ProjectUser.ts +++ b/Dashboard/src/Utils/ProjectUser.ts @@ -22,9 +22,7 @@ export default class ProjectUser { }, }, {}, - { - - } + {} ); return teamMembers.data.map((teamMember: TeamMember) => { diff --git a/Model/Models/User.ts b/Model/Models/User.ts index a0ea876568..d33319214e 100644 --- a/Model/Models/User.ts +++ b/Model/Models/User.ts @@ -280,7 +280,10 @@ class User extends UserModel { update: [Permission.CurrentUser], }) - @TableColumn({ type: TableColumnType.ObjectID, canReadOnRelationQuery: true }) + @TableColumn({ + type: TableColumnType.ObjectID, + canReadOnRelationQuery: true, + }) @Column({ type: ColumnType.ObjectID, nullable: true, diff --git a/Workers/Jobs/Incident/SendEmailToSubscribers.ts b/Workers/Jobs/Incident/SendEmailToSubscribers.ts index 31fd5a879f..50f455486b 100644 --- a/Workers/Jobs/Incident/SendEmailToSubscribers.ts +++ b/Workers/Jobs/Incident/SendEmailToSubscribers.ts @@ -48,7 +48,6 @@ RunCron( name: true, }, }, - }); for (const incident of incidents) { @@ -147,7 +146,6 @@ RunCron( secure: true, }, }, - }); for (const statuspage of statusPages) { diff --git a/Workers/Jobs/IncidentOwners/SendCreatedResourceEmail.ts b/Workers/Jobs/IncidentOwners/SendCreatedResourceEmail.ts index ac0ac3de5e..2eb3e9934b 100644 --- a/Workers/Jobs/IncidentOwners/SendCreatedResourceEmail.ts +++ b/Workers/Jobs/IncidentOwners/SendCreatedResourceEmail.ts @@ -40,7 +40,6 @@ RunCron( name: true, }, }, - }); for (const incident of incidents) { diff --git a/Workers/Jobs/IncidentOwners/SendNotePostedEmail.ts b/Workers/Jobs/IncidentOwners/SendNotePostedEmail.ts index a10fd0ec81..0eeade4300 100644 --- a/Workers/Jobs/IncidentOwners/SendNotePostedEmail.ts +++ b/Workers/Jobs/IncidentOwners/SendNotePostedEmail.ts @@ -114,7 +114,6 @@ RunCron( name: true, }, }, - } ); diff --git a/Workers/Jobs/IncidentOwners/SendOwnerAddedEmail.ts b/Workers/Jobs/IncidentOwners/SendOwnerAddedEmail.ts index 7f46f7e441..e199b96585 100644 --- a/Workers/Jobs/IncidentOwners/SendOwnerAddedEmail.ts +++ b/Workers/Jobs/IncidentOwners/SendOwnerAddedEmail.ts @@ -88,7 +88,6 @@ RunCron( name: true, }, }, - }); for (const incidentOwnerUser of incidentOwnerUsers) { diff --git a/Workers/Jobs/IncidentOwners/SendStateChangeEmail.ts b/Workers/Jobs/IncidentOwners/SendStateChangeEmail.ts index 7a4087aee1..d6698347c1 100644 --- a/Workers/Jobs/IncidentOwners/SendStateChangeEmail.ts +++ b/Workers/Jobs/IncidentOwners/SendStateChangeEmail.ts @@ -47,7 +47,6 @@ RunCron( name: true, }, }, - }); for (const incidentStateTimeline of incidentStateTimelines) { @@ -68,7 +67,6 @@ RunCron( name: true, }, }, - }); if (!incidentWithSeverity) { diff --git a/Workers/Jobs/IncidentPublicNote/SendEmailToSubscribers.ts b/Workers/Jobs/IncidentPublicNote/SendEmailToSubscribers.ts index 2344d4bf43..d3dab77b7a 100644 --- a/Workers/Jobs/IncidentPublicNote/SendEmailToSubscribers.ts +++ b/Workers/Jobs/IncidentPublicNote/SendEmailToSubscribers.ts @@ -73,7 +73,6 @@ RunCron( name: true, }, }, - } ); @@ -176,7 +175,6 @@ RunCron( secure: true, }, }, - }); for (const statuspage of statusPages) { diff --git a/Workers/Jobs/IncidentStateTimeline/SendEmailToSubscribers.ts b/Workers/Jobs/IncidentStateTimeline/SendEmailToSubscribers.ts index 3e0f70f693..ee2cda514e 100644 --- a/Workers/Jobs/IncidentStateTimeline/SendEmailToSubscribers.ts +++ b/Workers/Jobs/IncidentStateTimeline/SendEmailToSubscribers.ts @@ -48,7 +48,6 @@ RunCron( name: true, }, }, - }); for (const incidentStateTimeline of incidentStateTimelines) { @@ -93,7 +92,6 @@ RunCron( name: true, }, }, - } ); @@ -185,7 +183,6 @@ RunCron( secure: true, }, }, - }); for (const statuspage of statusPages) { diff --git a/Workers/Jobs/MonitorOwners/SendCreatedResourceEmail.ts b/Workers/Jobs/MonitorOwners/SendCreatedResourceEmail.ts index e475dc1cd1..351d02eed1 100644 --- a/Workers/Jobs/MonitorOwners/SendCreatedResourceEmail.ts +++ b/Workers/Jobs/MonitorOwners/SendCreatedResourceEmail.ts @@ -37,7 +37,6 @@ RunCron( name: true, }, }, - }); for (const monitor of monitors) { diff --git a/Workers/Jobs/MonitorOwners/SendOwnerAddedEmail.ts b/Workers/Jobs/MonitorOwners/SendOwnerAddedEmail.ts index 74195ad076..45ecbd9585 100644 --- a/Workers/Jobs/MonitorOwners/SendOwnerAddedEmail.ts +++ b/Workers/Jobs/MonitorOwners/SendOwnerAddedEmail.ts @@ -88,7 +88,6 @@ RunCron( name: true, }, }, - }); for (const monitorOwnerUser of monitorOwnerUsers) { @@ -147,7 +146,6 @@ RunCron( name: true, }, }, - }); if (!monitor) { diff --git a/Workers/Jobs/MonitorOwners/SendStatusChangeEmail.ts b/Workers/Jobs/MonitorOwners/SendStatusChangeEmail.ts index 14bb95c5b2..8fa4c63f02 100644 --- a/Workers/Jobs/MonitorOwners/SendStatusChangeEmail.ts +++ b/Workers/Jobs/MonitorOwners/SendStatusChangeEmail.ts @@ -47,7 +47,6 @@ RunCron( name: true, }, }, - }); for (const monitorStatusTimeline of monitorStatusTimelines) { diff --git a/Workers/Jobs/ScheduledMaintenanceOwners/SendStateChangeEmail.ts b/Workers/Jobs/ScheduledMaintenanceOwners/SendStateChangeEmail.ts index 8923c6fd5e..db2d9ed182 100644 --- a/Workers/Jobs/ScheduledMaintenanceOwners/SendStateChangeEmail.ts +++ b/Workers/Jobs/ScheduledMaintenanceOwners/SendStateChangeEmail.ts @@ -47,7 +47,6 @@ RunCron( name: true, }, }, - }); for (const scheduledMaintenanceStateTimeline of scheduledMaintenanceStateTimelines) { diff --git a/Workers/Jobs/StatusPageOwners/SendAnnouncementCreatedEmail.ts b/Workers/Jobs/StatusPageOwners/SendAnnouncementCreatedEmail.ts index 50fa313d95..0dbdfaa519 100644 --- a/Workers/Jobs/StatusPageOwners/SendAnnouncementCreatedEmail.ts +++ b/Workers/Jobs/StatusPageOwners/SendAnnouncementCreatedEmail.ts @@ -31,7 +31,6 @@ RunCron( _id: true, title: true, description: true, - statusPages: true, projectId: true, statusPages: { _id: true,