Fix formatting and remove unused imports

This commit is contained in:
Simon Larsen
2023-11-14 15:24:05 +00:00
parent 4ec5c0d7f1
commit 99af4fe826
76 changed files with 341 additions and 375 deletions

View File

@@ -11,7 +11,6 @@ import CommonModel from './CommonModel';
import Route from '../Types/API/Route';
export default class AnalyticsDataModel extends CommonModel {
public constructor(data: {
tableName: string;
singularName: string;
@@ -103,7 +102,7 @@ export default class AnalyticsDataModel extends CommonModel {
data.allowAccessIfSubscriptionIsUnpaid || false;
this.accessControl = data.accessControl;
this.enableWorkflowOn = data.enableWorkflowOn;
this.crudApiPath = data.crudApiPath;
this.crudApiPath = data.crudApiPath;
// initialize Arrays.
for (const column of this.tableColumns) {
@@ -189,16 +188,13 @@ export default class AnalyticsDataModel extends CommonModel {
this._allowAccessIfSubscriptionIsUnpaid = v;
}
private _crudApiPath! : Route;
public get crudApiPath() : Route {
private _crudApiPath!: Route;
public get crudApiPath(): Route {
return this._crudApiPath;
}
public set crudApiPath(v : Route) {
public set crudApiPath(v: Route) {
this._crudApiPath = v;
}
public getTenantColumn(): AnalyticsTableColumn | null {
const column: AnalyticsTableColumn | undefined = this.tableColumns.find(
@@ -273,6 +269,4 @@ export default class AnalyticsDataModel extends CommonModel {
public set updatedAt(v: Date | undefined) {
this.setColumnValue('updatedAt', v);
}
}

View File

@@ -144,7 +144,6 @@ export default class CommonModel {
return this;
}
public toJSON(): JSONObject {
const json: JSONObject = {};
@@ -159,10 +158,7 @@ export default class CommonModel {
}
if (recordValue instanceof Array) {
if (
recordValue.length > 0 &&
column.nestedModelType
) {
if (recordValue.length > 0 && column.nestedModelType) {
json[column.key] = CommonModel.toJSONArray(
recordValue as Array<CommonModel>,
column.nestedModelType
@@ -193,9 +189,10 @@ export default class CommonModel {
return models as Array<TBaseModel>;
}
public static toJSONArray(models: Array<CommonModel>, modelType: { new (): CommonModel }): Array<JSONObject> {
public static toJSONArray(
models: Array<CommonModel>,
modelType: { new (): CommonModel }
): Array<JSONObject> {
const json: Array<JSONObject> = [];
models.forEach((model: CommonModel) => {

View File

@@ -587,7 +587,6 @@ export default class BaseModel extends BaseEntity {
return json;
}
public static toJSONObjectArray(
list: Array<BaseModel>,
modelType: { new (): BaseModel }
@@ -668,7 +667,6 @@ export default class BaseModel extends BaseEntity {
return baseModel as T;
}
public static fromJSON<T extends BaseModel>(
json: JSONObject | JSONArray,
type: { new (): T }

View File

@@ -112,20 +112,17 @@ export default class AnalyticsTableColumn {
this._nestedModel = v;
}
private _nestedModelType?: { new(): NestedModel } | undefined;
public get nestedModelType(): { new(): NestedModel } | undefined {
private _nestedModelType?: { new (): NestedModel } | undefined;
public get nestedModelType(): { new (): NestedModel } | undefined {
return this._nestedModelType;
}
public set nestedModelType(v: { new(): NestedModel } | undefined) {
public set nestedModelType(v: { new (): NestedModel } | undefined) {
this._nestedModelType = v;
}
public constructor(data: {
key: string;
nestedModelType?: { new(): NestedModel } | undefined;
nestedModelType?: { new (): NestedModel } | undefined;
title: string;
description: string;
required: boolean;
@@ -136,10 +133,13 @@ export default class AnalyticsTableColumn {
accessControl?: ColumnAccessControl | undefined;
allowAccessIfSubscriptionIsUnpaid?: boolean | undefined;
forceGetDefaultValueOnCreate?:
| (() => Date | string | number | boolean)
| undefined;
| (() => Date | string | number | boolean)
| undefined;
}) {
if (data.type === TableColumnType.NestedModel && !data.nestedModelType) {
if (
data.type === TableColumnType.NestedModel &&
!data.nestedModelType
) {
throw new Error('NestedModel is required when type is NestedModel');
}
@@ -159,6 +159,5 @@ export default class AnalyticsTableColumn {
this.nestedModel = new data.nestedModelType();
this.nestedModelType = data.nestedModelType;
}
}
}

View File

@@ -14,7 +14,7 @@ enum IconProp {
Cube = 'Cube',
Squares = 'Squares',
RectangleStack = 'RectangleStack',
ChartBar = 'ChartBar',
ChartBar = 'ChartBar',
SquareStack = 'SquareStack',
Help = 'Help',
JSON = 'JSON',

View File

@@ -18,7 +18,6 @@ export default class JSONFunctions {
return Object.keys(obj).length === 0;
}
public static toCompressedString(val: JSONValue): string {
return JSON.stringify(val, null, 2);
}

View File

@@ -1836,7 +1836,8 @@ export class PermissionHelper {
{
permission: Permission.CanCreateTelemetryService,
title: 'Can Create Telemetry Service',
description: 'This permission can create Telemetry Service this project.',
description:
'This permission can create Telemetry Service this project.',
isAssignableToTenant: true,
isAccessControlPermission: true,
},

View File

@@ -35,7 +35,10 @@ export default class BaseAnalyticsAPI<
public router: ExpressRouter;
public service: TBaseService;
public constructor(type: { new (): TAnalyticsDataModel }, service: TBaseService) {
public constructor(
type: { new (): TAnalyticsDataModel },
service: TBaseService
) {
this.entityType = type;
const router: ExpressRouter = Express.getRouter();
// Create
@@ -108,9 +111,7 @@ export default class BaseAnalyticsAPI<
// Get Item
router.post(
`${new this.entityType()
.crudApiPath
?.toString()}/:id/get-item`,
`${new this.entityType().crudApiPath?.toString()}/:id/get-item`,
UserMiddleware.getUserMiddleware,
async (
req: ExpressRequest,
@@ -127,9 +128,7 @@ export default class BaseAnalyticsAPI<
// Get Item
router.get(
`${new this.entityType()
.crudApiPath
?.toString()}/:id/get-item`,
`${new this.entityType().crudApiPath?.toString()}/:id/get-item`,
UserMiddleware.getUserMiddleware,
async (
req: ExpressRequest,
@@ -213,7 +212,6 @@ export default class BaseAnalyticsAPI<
return null;
}
public async getList(
req: ExpressRequest,
res: ExpressResponse
@@ -354,10 +352,11 @@ export default class BaseAnalyticsAPI<
const objectIdString: string = objectId.toString();
const body: JSONObject = req.body;
const item: TAnalyticsDataModel = AnalyticsDataModel.fromJSON<TAnalyticsDataModel>(
body['data'] as JSONObject,
this.entityType
) as TAnalyticsDataModel;
const item: TAnalyticsDataModel =
AnalyticsDataModel.fromJSON<TAnalyticsDataModel>(
body['data'] as JSONObject,
this.entityType
) as TAnalyticsDataModel;
delete (item as any)['_id'];
delete (item as any)['createdAt'];
@@ -381,18 +380,20 @@ export default class BaseAnalyticsAPI<
await this.onBeforeCreate(req, res);
const body: JSONObject = req.body;
const item: TAnalyticsDataModel = AnalyticsDataModel.fromJSON<TAnalyticsDataModel>(
body['data'] as JSONObject,
this.entityType
) as TAnalyticsDataModel;
const item: TAnalyticsDataModel =
AnalyticsDataModel.fromJSON<TAnalyticsDataModel>(
body['data'] as JSONObject,
this.entityType
) as TAnalyticsDataModel;
const createBy: CreateBy<TAnalyticsDataModel> = {
data: item,
props: await CommonAPI.getDatabaseCommonInteractionProps(req),
};
const savedItem: AnalyticsDataModel = await this.service.create(createBy);
const savedItem: AnalyticsDataModel = await this.service.create(
createBy
);
return Response.sendEntityResponse(
req,

View File

@@ -6,7 +6,7 @@ import { ExpressRequest, OneUptimeRequest } from '../Utils/Express';
import DatabaseCommonInteractionProps from 'Common/Types/BaseDatabase/DatabaseCommonInteractionProps';
export default class CommonAPI {
public static async getDatabaseCommonInteractionProps(
public static async getDatabaseCommonInteractionProps(
req: ExpressRequest
): Promise<DatabaseCommonInteractionProps> {
const props: DatabaseCommonInteractionProps = {
@@ -62,4 +62,4 @@ export default class CommonAPI {
return props;
}
}
}

View File

@@ -48,7 +48,9 @@ export default class MonitorGroupAPI extends BaseAPI<
new ObjectID(
req.params['monitorGroupId'].toString()
),
await CommonAPI.getDatabaseCommonInteractionProps(req)
await CommonAPI.getDatabaseCommonInteractionProps(
req
)
);
return Response.sendEntityResponse(
@@ -92,7 +94,9 @@ export default class MonitorGroupAPI extends BaseAPI<
),
startDate,
endDate,
await CommonAPI.getDatabaseCommonInteractionProps(req)
await CommonAPI.getDatabaseCommonInteractionProps(
req
)
);
return Response.sendEntityArrayResponse(

View File

@@ -412,7 +412,9 @@ export default class StatusPageAPI extends BaseAPI<
if (
!(await this.service.hasReadAccess(
objectId,
await CommonAPI.getDatabaseCommonInteractionProps(req),
await CommonAPI.getDatabaseCommonInteractionProps(
req
),
req
))
) {
@@ -1069,7 +1071,9 @@ export default class StatusPageAPI extends BaseAPI<
if (
!(await this.service.hasReadAccess(
objectId,
await CommonAPI.getDatabaseCommonInteractionProps(req),
await CommonAPI.getDatabaseCommonInteractionProps(
req
),
req
))
) {
@@ -1175,7 +1179,9 @@ export default class StatusPageAPI extends BaseAPI<
await this.getScheduledMaintenanceEvents(
objectId,
null,
await CommonAPI.getDatabaseCommonInteractionProps(req),
await CommonAPI.getDatabaseCommonInteractionProps(
req
),
req
);
@@ -1271,7 +1277,9 @@ export default class StatusPageAPI extends BaseAPI<
await this.getScheduledMaintenanceEvents(
objectId,
scheduledMaintenanceId,
await CommonAPI.getDatabaseCommonInteractionProps(req),
await CommonAPI.getDatabaseCommonInteractionProps(
req
),
req
);

View File

@@ -16,7 +16,9 @@ import {
OnUpdate,
} from '../Types/AnalyticsDatabase/Hooks';
import Typeof from 'Common/Types/Typeof';
import ModelPermission, { CheckReadPermissionType } from '../Types/AnalyticsDatabase/ModelPermission';
import ModelPermission, {
CheckReadPermissionType,
} from '../Types/AnalyticsDatabase/ModelPermission';
import ObjectID from 'Common/Types/ObjectID';
import Exception from 'Common/Types/Exception/Exception';
import API from 'Common/Utils/API';
@@ -49,14 +51,14 @@ import UpdateOneBy from '../Types/AnalyticsDatabase/UpdateOneBy';
export default class AnalyticsDatabaseService<
TBaseModel extends AnalyticsBaseModel
> extends BaseService {
public modelType!: { new(): TBaseModel };
public modelType!: { new (): TBaseModel };
public database!: ClickhouseDatabase;
public model!: TBaseModel;
public databaseClient!: ClickhouseClient;
public statementGenerator!: StatementGenerator<TBaseModel>;
public constructor(data: {
modelType: { new(): TBaseModel };
modelType: { new (): TBaseModel };
database?: ClickhouseDatabase | undefined;
}) {
super();
@@ -76,8 +78,9 @@ export default class AnalyticsDatabaseService<
});
}
public async countBy(countBy: CountBy<TBaseModel>): Promise<PositiveNumber> {
public async countBy(
countBy: CountBy<TBaseModel>
): Promise<PositiveNumber> {
try {
if (!countBy.skip) {
countBy.skip = new PositiveNumber(0);
@@ -95,7 +98,6 @@ export default class AnalyticsDatabaseService<
countBy.limit = new PositiveNumber(countBy.limit);
}
const checkReadPermissionType: CheckReadPermissionType<TBaseModel> =
await ModelPermission.checkReadPermission(
this.modelType,
@@ -106,8 +108,7 @@ export default class AnalyticsDatabaseService<
countBy.query = checkReadPermissionType.query;
const countStatement: string =
this.toCountStatement(countBy);
const countStatement: string = this.toCountStatement(countBy);
const dbResult: ExecResult<Stream> = await this.execute(
countStatement
@@ -117,7 +118,6 @@ export default class AnalyticsDatabaseService<
dbResult.stream
);
let countPositive: PositiveNumber = new PositiveNumber(strResult);
countPositive = await this.onCountSuccess(countPositive);
@@ -165,12 +165,13 @@ export default class AnalyticsDatabaseService<
(onBeforeFind.select as any)['_id'] = true;
}
const result: CheckReadPermissionType<TBaseModel> = await ModelPermission.checkReadPermission(
this.modelType,
onBeforeFind.query,
onBeforeFind.select || null,
onBeforeFind.props
);
const result: CheckReadPermissionType<TBaseModel> =
await ModelPermission.checkReadPermission(
this.modelType,
onBeforeFind.query,
onBeforeFind.select || null,
onBeforeFind.props
);
onBeforeFind.query = result.query;
onBeforeFind.select = result.select || undefined;
@@ -280,26 +281,26 @@ export default class AnalyticsDatabaseService<
return Promise.resolve({ findBy, carryForward: null });
}
public toCountStatement(countBy: CountBy<TBaseModel>): string {
if (!this.database) {
this.useDefaultDatabase();
}
let statement: string = `SELECT count() FROM ${this.database.getDatasourceOptions().database
}.${this.model.tableName}
${Object.keys(countBy.query).length > 0 ? 'WHERE' : ''
} ${this.statementGenerator.toWhereStatement(countBy.query)}
let statement: string = `SELECT count() FROM ${
this.database.getDatasourceOptions().database
}.${this.model.tableName}
${
Object.keys(countBy.query).length > 0 ? 'WHERE' : ''
} ${this.statementGenerator.toWhereStatement(countBy.query)}
`;
if(countBy.limit){
if (countBy.limit) {
statement += `
LIMIT ${countBy.limit}
`;
}
if(countBy.skip){
if (countBy.skip) {
statement += `
OFFSET ${countBy.skip}
`;
@@ -321,10 +322,12 @@ export default class AnalyticsDatabaseService<
const select: { statement: string; columns: Array<string> } =
this.statementGenerator.toSelectStatement(findBy.select!);
const statement: string = `SELECT ${select.statement} FROM ${this.database.getDatasourceOptions().database
}.${this.model.tableName}
${Object.keys(findBy.query).length > 0 ? 'WHERE' : ''
} ${this.statementGenerator.toWhereStatement(findBy.query)}
const statement: string = `SELECT ${select.statement} FROM ${
this.database.getDatasourceOptions().database
}.${this.model.tableName}
${
Object.keys(findBy.query).length > 0 ? 'WHERE' : ''
} ${this.statementGenerator.toWhereStatement(findBy.query)}
ORDER BY ${this.statementGenerator.toSortStatemennt(findBy.sort!)}
LIMIT ${findBy.limit}
OFFSET ${findBy.skip}
@@ -341,19 +344,21 @@ export default class AnalyticsDatabaseService<
this.useDefaultDatabase();
}
let statement: string = `ALTER TABLE ${this.database.getDatasourceOptions().database
}.${this.model.tableName}
DELETE ${Object.keys(deleteBy.query).length > 0 ? 'WHERE' : 'WHERE 1=1'
let statement: string = `ALTER TABLE ${
this.database.getDatasourceOptions().database
}.${this.model.tableName}
DELETE ${
Object.keys(deleteBy.query).length > 0 ? 'WHERE' : 'WHERE 1=1'
} ${this.statementGenerator.toWhereStatement(deleteBy.query)}
`;
if(deleteBy.limit){
if (deleteBy.limit) {
statement += `
LIMIT ${deleteBy.limit}
`;
}
if(deleteBy.skip){
if (deleteBy.skip) {
statement += `
OFFSET ${deleteBy.skip}
`;
@@ -438,7 +443,9 @@ export default class AnalyticsDatabaseService<
});
}
public async updateOneBy(updateOneBy: UpdateOneBy<TBaseModel>): Promise<void> {
public async updateOneBy(
updateOneBy: UpdateOneBy<TBaseModel>
): Promise<void> {
return await this._updateBy({
...updateOneBy,
limit: 1,
@@ -611,16 +618,16 @@ export default class AnalyticsDatabaseService<
const onCreate: OnCreate<TBaseModel> = createBy.props.ignoreHooks
? {
createBy: {
data: data,
props: createBy.props,
},
carryForward: [],
}
createBy: {
data: data,
props: createBy.props,
},
carryForward: [],
}
: await this._onBeforeCreate({
data: data,
props: createBy.props,
});
data: data,
props: createBy.props,
});
data = onCreate.createBy.data;

View File

@@ -140,9 +140,7 @@ describe('BaseAPI', () => {
baseApiInstance = new BaseAPI(BaseModel, TestService);
emptyDatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
emptyRequest
);
await CommonAPI.getDatabaseCommonInteractionProps(emptyRequest);
});
afterEach(() => {
@@ -322,9 +320,7 @@ describe('BaseAPI', () => {
it('should initialize props with undefined values', async () => {
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props).toEqual(
expect.objectContaining({
tenantId: undefined,
@@ -340,45 +336,35 @@ describe('BaseAPI', () => {
it('should set userId if userAuthorization is present', async () => {
request.userAuthorization = { userId: new ObjectID('123') } as any;
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.userId).toEqual(new ObjectID('123'));
});
it('should set userGlobalAccessPermission if present in the request', async () => {
request.userGlobalAccessPermission = { canEdit: true } as any;
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.userGlobalAccessPermission).toEqual({ canEdit: true });
});
it('should set userTenantAccessPermission if present in the request', async () => {
request.userTenantAccessPermission = { canView: true } as any;
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.userTenantAccessPermission).toEqual({ canView: true });
});
it('should set tenantId if present in the request', async () => {
request.tenantId = new ObjectID('456');
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.tenantId).toEqual(new ObjectID('456'));
});
it('should set isMultiTenantRequest based on headers', async () => {
request.headers['is-multi-tenant-query'] = 'true';
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.isMultiTenantRequest).toBe(true);
});
@@ -395,18 +381,14 @@ describe('BaseAPI', () => {
);
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.currentPlan).toBe('Free');
expect(props.isSubscriptionUnpaid).toBe(false);
});
it('should set currentPlan and isSubscriptionUnpaid to undefined if tenantId is not present', async () => {
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.currentPlan).toBeUndefined();
expect(props.isSubscriptionUnpaid).toBeUndefined();
});
@@ -415,9 +397,7 @@ describe('BaseAPI', () => {
it('should set isMasterAdmin if userType is MasterAdmin', async () => {
request.userType = UserType.MasterAdmin;
const props: DatabaseCommonInteractionProps =
await CommonAPI.getDatabaseCommonInteractionProps(
request
);
await CommonAPI.getDatabaseCommonInteractionProps(request);
expect(props.isMasterAdmin).toBe(true);
});
});

View File

@@ -2,7 +2,8 @@ import BaseModel from 'Common/AnalyticsModels/BaseModel';
import PositiveNumber from 'Common/Types/PositiveNumber';
import DeleteOneBy from './DeleteOneBy';
export default interface DeleteBy<TBaseModel extends BaseModel> extends DeleteOneBy<TBaseModel> {
export default interface DeleteBy<TBaseModel extends BaseModel>
extends DeleteOneBy<TBaseModel> {
limit?: PositiveNumber | number | undefined;
skip?: PositiveNumber | number | undefined;
}

View File

@@ -2,6 +2,7 @@ import BaseModel from 'Common/AnalyticsModels/BaseModel';
import UpdateOneBy from './UpdateOneBy';
import PositiveNumber from 'Common/Types/PositiveNumber';
export default interface UpdateBy<TBaseModel extends BaseModel> extends UpdateOneBy<TBaseModel> {
export default interface UpdateBy<TBaseModel extends BaseModel>
extends UpdateOneBy<TBaseModel> {
limit?: PositiveNumber | number | undefined;
}

View File

@@ -109,10 +109,7 @@ export default class CreateOneBaseModel<
return {
returnValues: {
model: BaseModel.toJSON(
model,
this.modelService.modelType
),
model: BaseModel.toJSON(model, this.modelService.modelType),
},
executePort: successPort,
};

View File

@@ -144,10 +144,7 @@ export default class FindOneBaseModel<
return {
returnValues: {
model: model
? BaseModel.toJSON(
model,
this.modelService.modelType
)
? BaseModel.toJSON(model, this.modelService.modelType)
: null,
},
executePort: successPort,

View File

@@ -98,10 +98,7 @@ export default class OnTriggerBaseModel<
return {
returnValues: {
model: data
? BaseModel.toJSON(
data as any,
this.service!.modelType
)
? BaseModel.toJSON(data as any, this.service!.modelType)
: null,
},
executePort: successPort,
@@ -136,10 +133,7 @@ export default class OnTriggerBaseModel<
return {
returnValues: {
model: data
? BaseModel.toJSON(
model as any,
this.service!.modelType
)
? BaseModel.toJSON(model as any, this.service!.modelType)
: null,
},
executePort: successPort,

View File

@@ -38,7 +38,7 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
} ${this.toWhereStatement(updateBy.query)}
`;
if(updateBy.limit){
if (updateBy.limit) {
statement += ` LIMIT ${updateBy.limit}`;
}

View File

@@ -182,31 +182,31 @@ export default class Response {
count = new PositiveNumber(count);
}
let jsonArray: JSONArray = [];
let jsonArray: JSONArray = [];
const model: BaseModel | AnalyticsDataModel = new modelType();
if(model instanceof BaseModel) {
jsonArray = BaseModel.toJSONArray(list as Array<BaseModel>, modelType as { new (): BaseModel });
if (model instanceof BaseModel) {
jsonArray = BaseModel.toJSONArray(
list as Array<BaseModel>,
modelType as { new (): BaseModel }
);
}
if(model instanceof AnalyticsDataModel) {
jsonArray = AnalyticsDataModel.toJSONArray(list as Array<AnalyticsDataModel>, modelType as { new (): AnalyticsDataModel });
if (model instanceof AnalyticsDataModel) {
jsonArray = AnalyticsDataModel.toJSONArray(
list as Array<AnalyticsDataModel>,
modelType as { new (): AnalyticsDataModel }
);
}
return this.sendJsonArrayResponse(
req,
res,
jsonArray,
count
);
return this.sendJsonArrayResponse(req, res, jsonArray, count);
}
public static sendEntityResponse(
req: ExpressRequest,
res: ExpressResponse,
item: BaseModel |AnalyticsDataModel | null,
item: BaseModel | AnalyticsDataModel | null,
modelType: { new (): BaseModel | AnalyticsDataModel },
options?:
| {
@@ -217,11 +217,17 @@ export default class Response {
let response: JSONObject = {};
if (item && item instanceof BaseModel) {
response = BaseModel.toJSON(item, modelType as { new (): BaseModel });
response = BaseModel.toJSON(
item,
modelType as { new (): BaseModel }
);
}
if (item && item instanceof AnalyticsDataModel) {
response = AnalyticsDataModel.toJSON(item, modelType as { new (): AnalyticsDataModel });
response = AnalyticsDataModel.toJSON(
item,
modelType as { new (): AnalyticsDataModel }
);
}
if (options?.miscData) {

View File

@@ -1,16 +1,15 @@
import React, { FunctionComponent, ReactElement } from 'react';
import EmptyState from '../EmptyState/EmptyState';
import IconProp from 'Common/Types/Icon/IconProp';
const ComingSoon: FunctionComponent = (
): ReactElement => {
const ComingSoon: FunctionComponent = (): ReactElement => {
return (
<EmptyState id="coming-soon" icon={IconProp.CursorArrowRays} title="Coming soon!" description="We will be launching this feature very soon. Stay Tuned!" />
<EmptyState
id="coming-soon"
icon={IconProp.CursorArrowRays}
title="Coming soon!"
description="We will be launching this feature very soon. Stay Tuned!"
/>
);
};

View File

@@ -21,7 +21,10 @@ const EmptyState: FunctionComponent<ComponentProps> = (
{props.icon && (
<Icon
icon={props.icon}
className={props.iconClassName || `mx-auto h-12 w-12 text-gray-400`}
className={
props.iconClassName ||
`mx-auto h-12 w-12 text-gray-400`
}
/>
)}

View File

@@ -164,11 +164,19 @@ const Icon: FunctionComponent<ComponentProps> = ({
);
} else if (icon === IconProp.CursorArrowRays) {
return getSvgWrapper(
<path strokeLinecap="round" strokeLinejoin="round" d="M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59" />
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"
/>
);
} else if (icon === IconProp.ChartBar) {
return getSvgWrapper(
<path strokeLinecap="round" strokeLinejoin="round" d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z" />
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z"
/>
);
} else if (icon === IconProp.SquareStack) {
return getSvgWrapper(

View File

@@ -2,30 +2,27 @@ import React, { FunctionComponent, ReactElement, useEffect } from 'react';
import Log from 'Model/AnalyticsModels/Log';
export interface ComponentProps {
log: Log
log: Log;
}
const LogItem: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
const [isCollapsed, setIsCollapsed] = React.useState<boolean>(true);
useEffect(() => {
setIsCollapsed(true);
}, [])
}, []);
if(isCollapsed){
return (<div className='color-gray-100 flex'>
{/* Collapsable icon when clicked should expand */}
</div>)
if (isCollapsed) {
return (
<div className="color-gray-100 flex">
{/* Collapsable icon when clicked should expand */}
</div>
);
}
return (
<div className='color-gray-100'>
{props.log.body}
</div>
);
return <div className="color-gray-100">{props.log.body}</div>;
};
export default LogItem;

View File

@@ -12,7 +12,6 @@ export interface ComponentProps {
const LogsFilter: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
const [filterOptions, setFilterOptions] = React.useState<FiterOptions>({});
useEffect(() => {
@@ -21,11 +20,13 @@ const LogsFilter: FunctionComponent<ComponentProps> = (
return (
<div>
<Input onChange={(value: string) => {
setFilterOptions({
searchText: value
})
}} />
<Input
onChange={(value: string) => {
setFilterOptions({
searchText: value,
});
}}
/>
</div>
);
};

View File

@@ -3,16 +3,16 @@ import React, { FunctionComponent, ReactElement } from 'react';
import LogItem from './LogItem';
export interface ComponentProps {
logs: Array<Log>
logs: Array<Log>;
}
const LogsViewer: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
return (
<div className='shadow rounded bg-slate-600 p-2'>
{props.logs.map((log: Log) => {
return <LogItem log={log} />;
<div className="shadow rounded bg-slate-600 p-2">
{props.logs.map((log: Log, i: number) => {
return <LogItem key={i} log={log} />;
})}
</div>
);

View File

@@ -852,10 +852,7 @@ const ModelTable: <TBaseModel extends BaseModel>(
) => {
try {
const baseModel: TBaseModel =
BaseModel.fromJSONObject(
item,
props.modelType
);
BaseModel.fromJSONObject(item, props.modelType);
if (props.onBeforeView) {
item = BaseModel.toJSONObject(

View File

@@ -415,7 +415,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.TELEMETRY_SERVICES_VIEW
PageMap.TELEMETRY_SERVICES_VIEW
] as Route
}
/>
@@ -433,7 +433,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.TELEMETRY_SERVICES_VIEW_DELETE
PageMap.TELEMETRY_SERVICES_VIEW_DELETE
] as Route
}
/>
@@ -451,7 +451,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.TELEMETRY_SERVICES_VIEW_LOGS
PageMap.TELEMETRY_SERVICES_VIEW_LOGS
] as Route
}
/>
@@ -469,7 +469,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.TELEMETRY_SERVICES_VIEW_TRACES
PageMap.TELEMETRY_SERVICES_VIEW_TRACES
] as Route
}
/>
@@ -487,7 +487,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.TELEMETRY_SERVICES_VIEW_METRICS
PageMap.TELEMETRY_SERVICES_VIEW_METRICS
] as Route
}
/>
@@ -505,7 +505,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.TELEMETRY_SERVICES_VIEW_DASHBOARDS
PageMap.TELEMETRY_SERVICES_VIEW_DASHBOARDS
] as Route
}
/>
@@ -546,7 +546,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.HOME_NOT_OPERATIONAL_MONITORS
PageMap.HOME_NOT_OPERATIONAL_MONITORS
] as Route
}
/>
@@ -566,8 +566,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
PageMap
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>
@@ -595,7 +595,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITORS_INOPERATIONAL
PageMap.MONITORS_INOPERATIONAL
] as Route
}
/>
@@ -678,7 +678,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_VIEW_STATUS_TIMELINE
PageMap.MONITOR_VIEW_STATUS_TIMELINE
] as Route
}
/>
@@ -710,7 +710,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_VIEW_INCIDENTS
PageMap.MONITOR_VIEW_INCIDENTS
] as Route
}
/>
@@ -728,7 +728,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -826,7 +826,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.WORKFLOW_VIEW_SETTINGS
PageMap.WORKFLOW_VIEW_SETTINGS
] as Route
}
/>
@@ -925,7 +925,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_DELETE
PageMap.STATUS_PAGE_VIEW_DELETE
] as Route
}
/>
@@ -943,7 +943,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_BRANDING
PageMap.STATUS_PAGE_VIEW_BRANDING
] as Route
}
/>
@@ -961,7 +961,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_CUSTOM_HTML_CSS
PageMap.STATUS_PAGE_VIEW_CUSTOM_HTML_CSS
] as Route
}
/>
@@ -979,7 +979,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_ADVANCED_OPTIONS
PageMap.STATUS_PAGE_VIEW_ADVANCED_OPTIONS
] as Route
}
/>
@@ -997,7 +997,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1014,7 +1014,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_OWNERS
PageMap.STATUS_PAGE_VIEW_OWNERS
] as Route
}
/>
@@ -1046,7 +1046,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_EMAIL_SUBSCRIBERS
PageMap.STATUS_PAGE_VIEW_EMAIL_SUBSCRIBERS
] as Route
}
/>
@@ -1064,8 +1064,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.STATUS_PAGE_VIEW_AUTHENTICATION_SETTINGS
PageMap
.STATUS_PAGE_VIEW_AUTHENTICATION_SETTINGS
] as Route
}
/>
@@ -1083,7 +1083,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_CUSTOM_SMTP
PageMap.STATUS_PAGE_VIEW_CUSTOM_SMTP
] as Route
}
/>
@@ -1101,7 +1101,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_SETTINGS
PageMap.STATUS_PAGE_VIEW_SETTINGS
] as Route
}
/>
@@ -1119,7 +1119,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_PRIVATE_USERS
PageMap.STATUS_PAGE_VIEW_PRIVATE_USERS
] as Route
}
/>
@@ -1137,7 +1137,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_SMS_SUBSCRIBERS
PageMap.STATUS_PAGE_VIEW_SMS_SUBSCRIBERS
] as Route
}
/>
@@ -1155,7 +1155,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_HEADER_STYLE
PageMap.STATUS_PAGE_VIEW_HEADER_STYLE
] as Route
}
/>
@@ -1173,7 +1173,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_FOOTER_STYLE
PageMap.STATUS_PAGE_VIEW_FOOTER_STYLE
] as Route
}
/>
@@ -1191,7 +1191,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_NAVBAR_STYLE
PageMap.STATUS_PAGE_VIEW_NAVBAR_STYLE
] as Route
}
/>
@@ -1209,7 +1209,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_WEBHOOK_SUBSCRIBERS
PageMap.STATUS_PAGE_VIEW_WEBHOOK_SUBSCRIBERS
] as Route
}
/>
@@ -1227,7 +1227,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_EMBEDDED
PageMap.STATUS_PAGE_VIEW_EMBEDDED
] as Route
}
/>
@@ -1245,7 +1245,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_RESOURCES
PageMap.STATUS_PAGE_VIEW_RESOURCES
] as Route
}
/>
@@ -1263,7 +1263,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_DOMAINS
PageMap.STATUS_PAGE_VIEW_DOMAINS
] as Route
}
/>
@@ -1280,7 +1280,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_GROUPS
PageMap.STATUS_PAGE_VIEW_GROUPS
] as Route
}
/>
@@ -1298,7 +1298,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_ANNOUNCEMENTS
PageMap.STATUS_PAGE_VIEW_ANNOUNCEMENTS
] as Route
}
/>
@@ -1366,7 +1366,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.INCIDENT_VIEW_STATE_TIMELINE
PageMap.INCIDENT_VIEW_STATE_TIMELINE
] as Route
}
/>
@@ -1383,7 +1383,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.INCIDENT_INTERNAL_NOTE
PageMap.INCIDENT_INTERNAL_NOTE
] as Route
}
/>
@@ -1401,7 +1401,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1419,8 +1419,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.ON_CALL_DUTY_POLICY_VIEW_CUSTOM_FIELDS
PageMap
.ON_CALL_DUTY_POLICY_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1468,7 +1468,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_EVENTS
PageMap.SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>
@@ -1486,7 +1486,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ONGOING_SCHEDULED_MAINTENANCE_EVENTS
PageMap.ONGOING_SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>
@@ -1504,7 +1504,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_VIEW
PageMap.SCHEDULED_MAINTENANCE_VIEW
] as Route
}
/>
@@ -1522,8 +1522,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
PageMap
.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1541,7 +1541,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
] as Route
}
/>
@@ -1559,7 +1559,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_VIEW_OWNERS
PageMap.SCHEDULED_MAINTENANCE_VIEW_OWNERS
] as Route
}
/>
@@ -1577,8 +1577,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
PageMap
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
] as Route
}
/>
@@ -1596,7 +1596,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
] as Route
}
/>
@@ -1614,7 +1614,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
] as Route
}
/>
@@ -1668,7 +1668,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENT_TEMPLATES
PageMap.SETTINGS_INCIDENT_TEMPLATES
] as Route
}
/>
@@ -1686,7 +1686,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW
PageMap.SETTINGS_INCIDENT_TEMPLATES_VIEW
] as Route
}
/>
@@ -1703,7 +1703,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_FEATURE_FLAGS
PageMap.SETTINGS_FEATURE_FLAGS
] as Route
}
/>
@@ -1721,7 +1721,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES
PageMap.SETTINGS_INCIDENT_NOTE_TEMPLATES
] as Route
}
/>
@@ -1739,8 +1739,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW
PageMap
.SETTINGS_INCIDENT_NOTE_TEMPLATES_VIEW
] as Route
}
/>
@@ -1759,8 +1759,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_NOTE_TEMPLATES
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_NOTE_TEMPLATES
] as Route
}
/>
@@ -1779,8 +1779,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_NOTE_TEMPLATES_VIEW
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_NOTE_TEMPLATES_VIEW
] as Route
}
/>
@@ -1858,7 +1858,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_MONITORS_STATUS
PageMap.SETTINGS_MONITORS_STATUS
] as Route
}
/>
@@ -1876,7 +1876,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENTS_STATE
PageMap.SETTINGS_INCIDENTS_STATE
] as Route
}
/>
@@ -1894,7 +1894,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE
] as Route
}
/>
@@ -1922,7 +1922,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENTS_SEVERITY
PageMap.SETTINGS_INCIDENTS_SEVERITY
] as Route
}
/>
@@ -1992,7 +1992,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS
PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS
] as Route
}
/>
@@ -2010,7 +2010,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS
PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS
] as Route
}
/>
@@ -2028,8 +2028,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
] as Route
}
/>
@@ -2047,7 +2047,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS
PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS
] as Route
}
/>
@@ -2065,8 +2065,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_ON_CALL_DUTY_POLICY_CUSTOM_FIELDS
PageMap
.SETTINGS_ON_CALL_DUTY_POLICY_CUSTOM_FIELDS
] as Route
}
/>
@@ -2096,7 +2096,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_BILLING_INVOICES
PageMap.SETTINGS_BILLING_INVOICES
] as Route
}
/>
@@ -2176,7 +2176,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_EXECUTION_LOGS
PageMap.ON_CALL_DUTY_EXECUTION_LOGS
] as Route
}
/>
@@ -2194,7 +2194,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_EXECUTION_LOGS_TIMELINE
PageMap.ON_CALL_DUTY_EXECUTION_LOGS_TIMELINE
] as Route
}
/>
@@ -2227,7 +2227,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_POLICY_VIEW
PageMap.ON_CALL_DUTY_POLICY_VIEW
] as Route
}
/>
@@ -2245,7 +2245,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_POLICY_VIEW_DELETE
PageMap.ON_CALL_DUTY_POLICY_VIEW_DELETE
] as Route
}
/>
@@ -2263,7 +2263,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_POLICY_VIEW_ESCALATION
PageMap.ON_CALL_DUTY_POLICY_VIEW_ESCALATION
] as Route
}
/>
@@ -2281,8 +2281,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOGS
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOGS
] as Route
}
/>
@@ -2300,8 +2300,8 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOG_VIEW
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOG_VIEW
] as Route
}
/>
@@ -2413,7 +2413,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_ON_CALL_LOGS
PageMap.USER_SETTINGS_ON_CALL_LOGS
] as Route
}
/>
@@ -2431,7 +2431,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_ON_CALL_LOGS_TIMELINE
PageMap.USER_SETTINGS_ON_CALL_LOGS_TIMELINE
] as Route
}
/>
@@ -2449,7 +2449,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_NOTIFICATION_SETTINGS
PageMap.USER_SETTINGS_NOTIFICATION_SETTINGS
] as Route
}
/>
@@ -2467,7 +2467,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_NOTIFICATION_METHODS
PageMap.USER_SETTINGS_NOTIFICATION_METHODS
] as Route
}
/>
@@ -2485,7 +2485,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_ON_CALL_RULES
PageMap.USER_SETTINGS_ON_CALL_RULES
] as Route
}
/>
@@ -2531,7 +2531,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_GROUP_VIEW_DELETE
PageMap.MONITOR_GROUP_VIEW_DELETE
] as Route
}
/>
@@ -2549,7 +2549,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_GROUP_VIEW_MONITORS
PageMap.MONITOR_GROUP_VIEW_MONITORS
] as Route
}
/>
@@ -2567,15 +2567,13 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_GROUP_VIEW_INCIDENTS
PageMap.MONITOR_GROUP_VIEW_INCIDENTS
] as Route
}
/>
}
/>
<PageRoute
path={
RouteMap[
@@ -2587,7 +2585,7 @@ const App: () => JSX.Element = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_GROUP_VIEW_OWNERS
PageMap.MONITOR_GROUP_VIEW_OWNERS
] as Route
}
/>

View File

@@ -1,22 +1,25 @@
import ObjectID from 'Common/Types/ObjectID';
import React, { FunctionComponent, ReactElement } from 'react';
import React, { FunctionComponent, ReactElement, useEffect } from 'react';
import LogsViewer from 'CommonUI/src/Components/LogsViewer/LogsViewer';
import Log from 'Model/AnalyticsModels/Log';
export interface ComponentProps {
telemetryServiceIds: Array<ObjectID>;
}
const LabelsElement: FunctionComponent<ComponentProps> = (
props: ComponentProps
_props: ComponentProps
): ReactElement => {
const [logs, setLogs] = React.useState<Array<Log>>([]);
useEffect(() => {
setLogs([]);
}, []);
return (
<div>
{props.labels.map((label: Label, i: number) => {
return <LabelElement label={label} key={i} />;
})}
<LogsViewer logs={logs} />
</div>
);
};

View File

@@ -13,7 +13,6 @@ import MonitorStatus from 'Model/Models/MonitorStatus';
import Query from 'CommonUI/src/Utils/ModelAPI/Query';
import Route from 'Common/Types/API/Route';
import MonitorType from 'Common/Types/Monitor/MonitorType';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
import MonitorTypeUtil from '../../Utils/MonitorType';
import FormValues from 'CommonUI/src/Components/Forms/Types/FormValues';
@@ -26,6 +25,7 @@ import { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
import MonitoringInterval from '../../Utils/MonitorIntervalDropdownOptions';
import MonitorStepsType from 'Common/Types/Monitor/MonitorSteps';
import { Grey } from 'Common/Types/BrandColors';
import BaseModel from 'Common/Models/BaseModel';
export interface ComponentProps {
query?: Query<Monitor> | undefined;

View File

@@ -1,7 +1,6 @@
import React, { FunctionComponent, ReactElement } from 'react';
import BaseModel from 'Common/Models/BaseModel';
import { JSONObject } from 'Common/Types/JSON';
import JSONFunctions from 'Common/Types/JSONFunctions';
export interface ComponentProps {
item: JSONObject;

View File

@@ -12,7 +12,6 @@ import IncidentView from '../../../Components/Incident/Incident';
import Incident from 'Model/Models/Incident';
import OnCallDutyPolicyStatus from 'Common/Types/OnCallDutyPolicy/OnCallDutyPolicyStatus';
import UserElement from '../../../Components/User/User';
import JSONFunctions from 'Common/Types/JSONFunctions';
import User from 'Model/Models/User';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
import ObjectID from 'Common/Types/ObjectID';
@@ -21,6 +20,7 @@ import Columns from 'CommonUI/src/Components/ModelTable/Columns';
import OnCallPolicyView from '../OnCallPolicy';
import OnCallDutyPolicy from 'Model/Models/OnCallDutyPolicy';
import Navigation from 'CommonUI/src/Utils/Navigation';
import BaseModel from 'Common/Models/BaseModel';
export interface ComponentProps {
onCallDutyPolicyId?: ObjectID | undefined; // if this is undefined. then it'll show logs for all policies.

View File

@@ -11,11 +11,11 @@ import OnCallDutyPolicyExecutionLogTimeline from 'Model/Models/OnCallDutyPolicyE
import OnCallDutyExecutionLogTimelineStatus from 'Common/Types/OnCallDutyPolicy/OnCalDutyExecutionLogTimelineStatus';
import UserElement from '../../User/User';
import User from 'Model/Models/User';
import JSONFunctions from 'Common/Types/JSONFunctions';
import EscalationRule from '../EscalationRule/EscalationRule';
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';
export interface ComponentProps {
onCallPolicyExecutionLogId: ObjectID;

View File

@@ -16,11 +16,11 @@ import Route from 'Common/Types/API/Route';
import StatusPage from 'Model/Models/StatusPage';
import StatusPagesElement from '../StatusPage/StatusPagesLabel';
import MonitorStatus from 'Model/Models/MonitorStatus';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
import OneUptimeDate from 'Common/Types/Date';
import Team from 'Model/Models/Team';
import ProjectUser from '../../Utils/ProjectUser';
import BaseModel from 'Common/Models/BaseModel';
export interface ComponentProps {
query?: Query<ScheduledMaintenance> | undefined;

View File

@@ -14,7 +14,7 @@ import Monitor from 'Model/Models/Monitor';
import Color from 'Common/Types/Color';
import ProjectElement from '../../Components/Project/Project';
import Project from 'Model/Models/Project';
import JSONFunctions from 'Common/Types/JSONFunctions';
import BaseModel from 'Common/Models/BaseModel';
const Home: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps

View File

@@ -26,7 +26,6 @@ import BaseModel from 'Common/Models/BaseModel';
import IncidentSeverity from 'Model/Models/IncidentSeverity';
import Label from 'Model/Models/Label';
import LabelsElement from '../../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import GlobalEvent from 'CommonUI/src/Utils/GlobalEvents';
import EventName from '../../../Utils/EventName';
import OnCallDutyPoliciesView from '../../../Components/OnCallPolicy/OnCallPolicies';

View File

@@ -17,7 +17,6 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { JSONObject } from 'Common/Types/JSON';
import UserElement from '../../../Components/User/User';
import User from 'Model/Models/User';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import AlignItem from 'CommonUI/src/Types/AlignItem';
import { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';

View File

@@ -17,7 +17,6 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { JSONObject } from 'Common/Types/JSON';
import UserElement from '../../../Components/User/User';
import User from 'Model/Models/User';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import AlignItem from 'CommonUI/src/Types/AlignItem';
import { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';

View File

@@ -17,7 +17,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import MonitorStatus from 'Model/Models/MonitorStatus';
import Incident from 'Model/Models/Incident';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import IncidentSeverity from 'Model/Models/IncidentSeverity';
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';

View File

@@ -26,7 +26,6 @@ import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax';
import SortOrder from 'Common/Types/BaseDatabase/SortOrder';
import ModelAPI, { ListResult } from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import MonitorStatusTimeline from 'Model/Models/MonitorStatusTimeline';
import JSONFunctions from 'Common/Types/JSONFunctions';
import API from 'CommonUI/src/Utils/API/API';
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
import MonitorType from 'Common/Types/Monitor/MonitorType';

View File

@@ -12,7 +12,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import Label from 'Model/Models/Label';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import MonitorGroup from 'Model/Models/MonitorGroup';
import Navigation from 'CommonUI/src/Utils/Navigation';
import CurrentStatusElement from '../../Components/MonitorGroup/CurrentStatus';

View File

@@ -14,7 +14,6 @@ import { JSONArray, JSONObject } from 'Common/Types/JSON';
import ObjectID from 'Common/Types/ObjectID';
import LabelsElement from '../../../Components/Label/Labels';
import MonitorGroup from 'Model/Models/MonitorGroup';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Card from 'CommonUI/src/Components/Card/Card';
import MonitorUptimeGraph from 'CommonUI/src/Components/MonitorGraphs/Uptime';
import useAsyncEffect from 'use-async-effect';

View File

@@ -15,7 +15,6 @@ import BadDataException from 'Common/Types/Exception/BadDataException';
import Monitor from 'Model/Models/Monitor';
import { JSONObject } from 'Common/Types/JSON';
import MonitorElement from '../../../Components/Monitor/Monitor';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import MonitorStatus from 'Model/Models/MonitorStatus';
import ModelAPI, { ListResult } from 'CommonUI/src/Utils/ModelAPI/ModelAPI';

View File

@@ -11,7 +11,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import Label from 'Model/Models/Label';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
import Navigation from 'CommonUI/src/Utils/Navigation';
import DashboardSideMenu from './SideMenu';

View File

@@ -14,7 +14,6 @@ import { JSONArray, JSONObject } from 'Common/Types/JSON';
import ObjectID from 'Common/Types/ObjectID';
import LabelsElement from '../../../Components/Label/Labels';
import OnCallDutyPolicy from 'Model/Models/OnCallDutyPolicy';
import JSONFunctions from 'Common/Types/JSONFunctions';
const OnCallDutyPolicyView: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps

View File

@@ -27,7 +27,6 @@ import Label from 'Model/Models/Label';
import LabelsElement from '../../../Components/Label/Labels';
import StatusPage from 'Model/Models/StatusPage';
import StatusPagesElement from '../../../Components/StatusPage/StatusPagesLabel';
import JSONFunctions from 'Common/Types/JSONFunctions';
import OneUptimeDate from 'Common/Types/Date';
const ScheduledMaintenanceView: FunctionComponent<PageComponentProps> = (

View File

@@ -17,7 +17,6 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { JSONObject } from 'Common/Types/JSON';
import UserElement from '../../../Components/User/User';
import User from 'Model/Models/User';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import AlignItem from 'CommonUI/src/Types/AlignItem';
import { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
@@ -31,6 +30,7 @@ import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
import BasicFormModal from 'CommonUI/src/Components/FormModal/BasicFormModal';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
import ScheduledMaintenanceNoteTemplate from 'Model/Models/ScheduledMaintenanceNoteTemplate';
import BaseModel from 'Common/Models/BaseModel';
const ScheduledMaintenanceDelete: FunctionComponent<PageComponentProps> = (
props: PageComponentProps

View File

@@ -17,7 +17,6 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { JSONObject } from 'Common/Types/JSON';
import UserElement from '../../../Components/User/User';
import User from 'Model/Models/User';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import AlignItem from 'CommonUI/src/Types/AlignItem';
import { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';

View File

@@ -20,7 +20,6 @@ import ModelDelete from 'CommonUI/src/Components/ModelDelete/ModelDelete';
import ObjectID from 'Common/Types/ObjectID';
import LabelsElement from '../../Components/Label/Labels';
import BadDataException from 'Common/Types/Exception/BadDataException';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
const APIKeyView: FunctionComponent<PageComponentProps> = (
props: PageComponentProps

View File

@@ -22,7 +22,6 @@ import BadDataException from 'Common/Types/Exception/BadDataException';
import Pill from 'CommonUI/src/Components/Pill/Pill';
import Color from 'Common/Types/Color';
import MonitorsElement from '../../Components/Monitor/Monitors';
import JSONFunctions from 'Common/Types/JSONFunctions';
import OnCallDutyPoliciesView from '../../Components/OnCallPolicy/OnCallPolicies';
import LabelsElement from '../../Components/Label/Labels';
import DashboardNavigation from '../../Utils/Navigation';

View File

@@ -19,7 +19,6 @@ import Project from 'Model/Models/Project';
import Team from 'Model/Models/Team';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import TeamsElement from '../../Components/Team/TeamsElement';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Card from 'CommonUI/src/Components/Card/Card';
import Link from 'CommonUI/src/Components/Link/Link';
import URL from 'Common/Types/API/URL';

View File

@@ -26,8 +26,9 @@ import BadDataException from 'Common/Types/Exception/BadDataException';
import FormValues from 'CommonUI/src/Components/Forms/Types/FormValues';
import Pill from 'CommonUI/src/Components/Pill/Pill';
import { Green, Yellow } from 'Common/Types/BrandColors';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
import BaseModel from 'Common/Models/BaseModel';
const TeamView: FunctionComponent<PageComponentProps> = (
props: PageComponentProps
): ReactElement => {

View File

@@ -11,7 +11,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import Label from 'Model/Models/Label';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
import Navigation from 'CommonUI/src/Utils/Navigation';

View File

@@ -15,7 +15,6 @@ import ObjectID from 'Common/Types/ObjectID';
import LabelsElement from '../../../Components/Label/Labels';
import StatusPage from 'Model/Models/StatusPage';
import StatusPagePreviewLink from './StatusPagePreviewLink';
import JSONFunctions from 'Common/Types/JSONFunctions';
const StatusPageView: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps

View File

@@ -28,7 +28,6 @@ import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import ModelAPI, { ListResult } from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import StatusPageGroup from 'Model/Models/StatusPageGroup';
import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Navigation from 'CommonUI/src/Utils/Navigation';
import API from 'CommonUI/src/Utils/API/API';
import StatusPage from 'Model/Models/StatusPage';

View File

@@ -11,7 +11,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import Label from 'Model/Models/Label';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import DashboardNavigation from '../../Utils/Navigation';
import Navigation from 'CommonUI/src/Utils/Navigation';
import SideMenu from './SideMenu';

View File

@@ -62,9 +62,9 @@ const ServiceDelete: FunctionComponent<PageComponentProps> = (
]}
sideMenu={<SideMenu modelId={modelId} />}
>
<ComingSoon />
<ComingSoon />
</ModelPage>
)
);
};
export default ServiceDelete;

View File

@@ -13,7 +13,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Label from 'Model/Models/Label';
const ServiceDelete: FunctionComponent<PageComponentProps> = (

View File

@@ -14,7 +14,6 @@ const ServiceDelete: FunctionComponent<PageComponentProps> = (
): ReactElement => {
const modelId: ObjectID = Navigation.getLastParamAsObjectID(1);
return (
<ModelPage
title="Service"

View File

@@ -62,9 +62,9 @@ const ServiceDelete: FunctionComponent<PageComponentProps> = (
]}
sideMenu={<SideMenu modelId={modelId} />}
>
<ComingSoon />
<ComingSoon />
</ModelPage>
)
);
};
export default ServiceDelete;

View File

@@ -28,8 +28,8 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
}}
icon={IconProp.Info}
/>
</SideMenuSection>
<SideMenuSection title="Telemetry">
</SideMenuSection>
<SideMenuSection title="Telemetry">
<SideMenuItem
link={{
title: 'Logs',

View File

@@ -62,9 +62,9 @@ const ServiceDelete: FunctionComponent<PageComponentProps> = (
]}
sideMenu={<SideMenu modelId={modelId} />}
>
<ComingSoon />
<ComingSoon />
</ModelPage>
)
);
};
export default ServiceDelete;

View File

@@ -13,7 +13,6 @@ import WorkflowSideMenu from './SideMenu';
import { JSONObject } from 'Common/Types/JSON';
import Workflow from 'Model/Models/Workflow';
import WorkflowElement from '../../Components/Workflow/WorkflowElement';
import JSONFunctions from 'Common/Types/JSONFunctions';
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
import Modal, { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
import BadDataException from 'Common/Types/Exception/BadDataException';

View File

@@ -13,7 +13,6 @@ import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSc
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import Label from 'Model/Models/Label';
const Delete: FunctionComponent<PageComponentProps> = (

View File

@@ -14,7 +14,6 @@ import Label from 'Model/Models/Label';
import DashboardNavigation from '../../Utils/Navigation';
import { JSONArray, JSONObject } from 'Common/Types/JSON';
import LabelsElement from '../../Components/Label/Labels';
import JSONFunctions from 'Common/Types/JSONFunctions';
import ProjectUtil from 'CommonUI/src/Utils/Project';
import { PlanSelect } from 'Common/Types/Billing/SubscriptionPlan';
import ModelProgress from 'CommonUI/src/Components/ModelProgress/ModelProgress';

View File

@@ -23,7 +23,7 @@ enum PageMap {
// Metrics
TELEMETRY_SERVICES_VIEW_METRICS = 'TELEMETRY_SERVICE_VIEW_METRICS',
// Dashboard
// Dashboard
TELEMETRY_SERVICES_VIEW_DASHBOARDS = 'TELEMETRY_SERVICES_VIEW_DASHBOARDS',
HOME = 'HOME',

View File

@@ -23,8 +23,8 @@ import ClusterKeyAuthorization from 'CommonServer/Middleware/ClusterKeyAuthoriza
import LIMIT_MAX from 'Common/Types/Database/LimitMax';
import SortOrder from 'Common/Types/BaseDatabase/SortOrder';
import Query from 'CommonServer/Types/Database/Query';
import JSONFunctions from 'Common/Types/JSONFunctions';
import logger from 'CommonServer/Utils/Logger';
import BaseModel from 'Common/Models/BaseModel';
const router: ExpressRouter = Express.getRouter();

View File

@@ -72,8 +72,9 @@ router.use(
// check header.
const serviceTokenInHeader: string | undefined = req.headers['x-oneuptime-service-token'] as string | undefined;
const serviceTokenInHeader: string | undefined = req.headers[
'x-oneuptime-service-token'
] as string | undefined;
if (!serviceTokenInHeader) {
throw new BadRequestException(
@@ -92,20 +93,21 @@ router.use(
if (!cachedServiceId || !serviceProjectId) {
// load from the database and set the cache.
const service: TelemetryService | null = await TelemetryServiceService.findOneBy({
query: {
telemetryServiceToken: new ObjectID(
serviceTokenInHeader as string
),
},
select: {
_id: true,
projectId: true,
},
props: {
isRoot: true,
},
});
const service: TelemetryService | null =
await TelemetryServiceService.findOneBy({
query: {
telemetryServiceToken: new ObjectID(
serviceTokenInHeader as string
),
},
select: {
_id: true,
projectId: true,
},
props: {
isRoot: true,
},
});
if (!service) {
throw new BadRequestException('Invalid service token');
@@ -458,7 +460,6 @@ router.post(
next: NextFunction
): Promise<void> => {
try {
logger.info('OTel Ingestor API called');
req.body = req.body.toJSON();

View File

@@ -8,7 +8,6 @@ import HTTPMethod from 'Common/Types/API/HTTPMethod';
import ProbeAPIRequest from '../../Utils/ProbeAPIRequest';
import MonitorUtil from '../../Utils/Monitors/Monitor';
import logger from 'CommonServer/Utils/Logger';
import JSONFunctions from 'Common/Types/JSONFunctions';
import { JSONArray } from 'Common/Types/JSON';
import OneUptimeDate from 'Common/Types/Date';
import Sleep from 'Common/Types/Sleep';

View File

@@ -25,7 +25,6 @@ import Navigation from 'CommonUI/src/Utils/Navigation';
import EventItem, {
ComponentProps as EventItemComponentProps,
} from 'CommonUI/src/Components/EventItem/EventItem';
import JSONFunctions from 'Common/Types/JSONFunctions';
import EmptyState from 'CommonUI/src/Components/EmptyState/EmptyState';
import IconProp from 'Common/Types/Icon/IconProp';
import { Blue } from 'Common/Types/BrandColors';

View File

@@ -7,7 +7,6 @@ import React, {
import PageComponentProps from '../PageComponentProps';
import Page from '../../Components/Page/Page';
import URL from 'Common/Types/API/URL';
import JSONFunctions from 'Common/Types/JSONFunctions';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import useAsyncEffect from 'use-async-effect';

View File

@@ -8,7 +8,7 @@ import PageComponentProps from '../PageComponentProps';
import Page from '../../Components/Page/Page';
import URL from 'Common/Types/API/URL';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import BaseModel from 'Common/Models/BaseModel';
import JSONFunctions from 'Common/Types/JSONFunctions';
import useAsyncEffect from 'use-async-effect';
import { JSONArray, JSONObject } from 'Common/Types/JSON';

View File

@@ -4,6 +4,7 @@ import React, {
useEffect,
useState,
} from 'react';
import BaseModel from 'Common/Models/BaseModel';
import PageComponentProps from '../PageComponentProps';
import Page from '../../Components/Page/Page';
import Accordion from 'CommonUI/src/Components/Accordion/Accordion';
@@ -175,11 +176,10 @@ const Overview: FunctionComponent<PageComponentProps> = (
(data['incidentPublicNotes'] as JSONArray) || [],
IncidentPublicNote
);
const activeIncidents: Array<Incident> =
BaseModel.fromJSONArray(
(data['activeIncidents'] as JSONArray) || [],
Incident
);
const activeIncidents: Array<Incident> = BaseModel.fromJSONArray(
(data['activeIncidents'] as JSONArray) || [],
Incident
);
const monitorStatusTimelines: Array<MonitorStatusTimeline> =
BaseModel.fromJSONArray(
(data['monitorStatusTimelines'] as JSONArray) || [],

View File

@@ -41,6 +41,7 @@ import StatusPageResource from 'Model/Models/StatusPageResource';
import Dictionary from 'Common/Types/Dictionary';
import Monitor from 'Model/Models/Monitor';
import Label from 'Model/Models/Label';
import BaseModel from 'Common/Models/BaseModel';
export const getScheduledEventEventItem: Function = (
scheduledMaintenance: ScheduledMaintenance,

View File

@@ -38,6 +38,7 @@ import { STATUS_PAGE_API_URL } from '../../Utils/Config';
import StatusPageResource from 'Model/Models/StatusPageResource';
import ScheduledMaintenanceState from 'Model/Models/ScheduledMaintenanceState';
import Section from '../../Components/Section/Section';
import BaseModel from 'Common/Models/BaseModel';
const Overview: FunctionComponent<PageComponentProps> = (
props: PageComponentProps

View File

@@ -2,10 +2,10 @@ import UserUtil from './User';
import Email from 'Common/Types/Email';
import ObjectID from 'Common/Types/ObjectID';
import { JSONObject } from 'Common/Types/JSON';
import JSONFunctions from 'Common/Types/JSONFunctions';
import StatusPagePrivateUser from 'Model/Models/StatusPagePrivateUser';
import Cookie from 'CommonUI/src/Utils/Cookie';
import Route from 'Common/Types/API/Route';
import BaseModel from 'Common/Models/BaseModel';
export default abstract class LoginUtil {
public static login(value: JSONObject): void {