mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Refactor comments across multiple files to improve clarity and consistency
- Updated comments in Probe/Config.ts to use block comments for proxy configuration. - Refactored comments in PortMonitor.ts, SyntheticMonitor.ts, and OnlineCheck.ts to block comments for better readability. - Adjusted comments in ProbeIngest/API/Monitor.ts and ProbeIngest/API/Probe.ts to block comments for clarity. - Standardized comments in various data migration scripts to block comments for consistency. - Modified eslint.config.js to enforce multiline comment style as an error.
This commit is contained in:
@@ -40,8 +40,10 @@ import Name from "Common/Types/Name";
|
||||
|
||||
const router: ExpressRouter = Express.getRouter();
|
||||
|
||||
// This route is used to get the SSO config for the user.
|
||||
// when the user logs in from OneUptime and not from the IDP.
|
||||
/*
|
||||
* This route is used to get the SSO config for the user.
|
||||
* when the user logs in from OneUptime and not from the IDP.
|
||||
*/
|
||||
|
||||
router.get(
|
||||
"/service-provider-login",
|
||||
@@ -434,8 +436,10 @@ const loginUserWithSso: LoginUserWithSsoFunction = async (
|
||||
isNewUser = true;
|
||||
}
|
||||
|
||||
// If he does not then add him to teams that he should belong and log in.
|
||||
// This should never happen because email is verified before he logs in with SSO.
|
||||
/*
|
||||
* If he does not then add him to teams that he should belong and log in.
|
||||
* This should never happen because email is verified before he logs in with SSO.
|
||||
*/
|
||||
if (!alreadySavedUser.isEmailVerified && !isNewUser) {
|
||||
await AuthenticationEmail.sendVerificationEmail(alreadySavedUser!);
|
||||
|
||||
|
||||
@@ -184,15 +184,17 @@ export default class SSOUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
// get displayName attribute.
|
||||
// {
|
||||
// "$": {
|
||||
// "Name": "http://schemas.microsoft.com/identity/claims/displayname"
|
||||
// },
|
||||
// "AttributeValue": [
|
||||
// "Nawaz Dhandala"
|
||||
// ]
|
||||
// },
|
||||
/*
|
||||
* get displayName attribute.
|
||||
* {
|
||||
* "$": {
|
||||
* "Name": "http://schemas.microsoft.com/identity/claims/displayname"
|
||||
* },
|
||||
* "AttributeValue": [
|
||||
* "Nawaz Dhandala"
|
||||
* ]
|
||||
* },
|
||||
*/
|
||||
|
||||
for (let i: number = 0; i < samlAttribute.length; i++) {
|
||||
const attribute: JSONObject = samlAttribute[i] as JSONObject;
|
||||
|
||||
@@ -47,9 +47,11 @@ function extractSayMessagesFromCallRequest(callRequest: CallRequest): string {
|
||||
if ((item as GatherInput).introMessage) {
|
||||
sayMessages.push((item as GatherInput).introMessage);
|
||||
}
|
||||
// NOTE: Excluding noInputMessage and onInputCallRequest messages from summary
|
||||
// as they contain system responses like "Good bye", "Invalid input", "You have acknowledged"
|
||||
// which should not be included in the call summary according to user requirements
|
||||
/*
|
||||
* NOTE: Excluding noInputMessage and onInputCallRequest messages from summary
|
||||
* as they contain system responses like "Good bye", "Invalid input", "You have acknowledged"
|
||||
* which should not be included in the call summary according to user requirements
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,11 @@ export default class OnCallDutyPolicyUserOverride extends BaseModel {
|
||||
})
|
||||
public projectId?: ObjectID = undefined;
|
||||
|
||||
// If this is null then it's a global override
|
||||
// If this is set then it's a policy specific override
|
||||
// Policy specifc override will take precedence over global override
|
||||
/*
|
||||
* If this is null then it's a global override
|
||||
* If this is set then it's a policy specific override
|
||||
* Policy specifc override will take precedence over global override
|
||||
*/
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
|
||||
@@ -1292,8 +1292,10 @@ export default class Project extends TenantModel {
|
||||
})
|
||||
public letCustomerSupportAccessProject?: boolean = undefined;
|
||||
|
||||
// This is an internal field. This is used for internal analytics for example: Metabase.
|
||||
// Values can be between 0 and 100.
|
||||
/*
|
||||
* This is an internal field. This is used for internal analytics for example: Metabase.
|
||||
* Values can be between 0 and 100.
|
||||
*/
|
||||
@ColumnAccessControl({
|
||||
create: [],
|
||||
read: [],
|
||||
|
||||
@@ -336,8 +336,10 @@ export default class ProjectSmtpConfig extends BaseModel {
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
// This is not required because some SMTP servers do not require authentication.
|
||||
// eg: https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#option-2-send-mail-directly-from-your-printer-or-application-to-microsoft-365-or-office-365-direct-send
|
||||
/*
|
||||
* This is not required because some SMTP servers do not require authentication.
|
||||
* eg: https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#option-2-send-mail-directly-from-your-printer-or-application-to-microsoft-365-or-office-365-direct-send
|
||||
*/
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
|
||||
@@ -420,10 +420,12 @@ export default class StatusPageDomain extends BaseModel {
|
||||
@JoinColumn({ name: "deletedByUserId" })
|
||||
public deletedByUser?: User = undefined;
|
||||
|
||||
// This token is used by the Worker.
|
||||
// worker pings the status page of customers - eg: status.company.com/verify-token/:id
|
||||
// and the end point on Status Page project returns 200.
|
||||
// when that happens the isCnameVerified is set to True and the certificate is added to Greenlock.
|
||||
/*
|
||||
* This token is used by the Worker.
|
||||
* worker pings the status page of customers - eg: status.company.com/verify-token/:id
|
||||
* and the end point on Status Page project returns 200.
|
||||
* when that happens the isCnameVerified is set to True and the certificate is added to Greenlock.
|
||||
*/
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
|
||||
@@ -235,8 +235,10 @@ export default class BaseAPI<
|
||||
): Promise<void> {
|
||||
await this.onBeforeList(req, res);
|
||||
|
||||
// Extract pagination parameters from query or body (for POST requests)
|
||||
// Support both 'skip' and 'offset' parameters (offset is alias for skip)
|
||||
/*
|
||||
* Extract pagination parameters from query or body (for POST requests)
|
||||
* Support both 'skip' and 'offset' parameters (offset is alias for skip)
|
||||
*/
|
||||
let skipValue: number = 0;
|
||||
let limitValue: number = DEFAULT_LIMIT;
|
||||
|
||||
|
||||
@@ -21,20 +21,24 @@ export default class GlobalConfigAPI extends BaseAPI<
|
||||
`${new this.entityType().getCrudApiPath()?.toString()}/vars`,
|
||||
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
|
||||
try {
|
||||
// const globalConfig: GlobalConfig | null =
|
||||
// await GlobalConfigService.findOneById({
|
||||
// id: ObjectID.getZeroObjectID(),
|
||||
// select: {
|
||||
// useHttps: true,
|
||||
// },
|
||||
// props: {
|
||||
// isRoot: true,
|
||||
// },
|
||||
// });
|
||||
/*
|
||||
* const globalConfig: GlobalConfig | null =
|
||||
* await GlobalConfigService.findOneById({
|
||||
* id: ObjectID.getZeroObjectID(),
|
||||
* select: {
|
||||
* useHttps: true,
|
||||
* },
|
||||
* props: {
|
||||
* isRoot: true,
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
|
||||
return Response.sendJsonObjectResponse(req, res, {
|
||||
// USE_HTTPS:
|
||||
// globalConfig?.useHttps?.toString() || 'false',
|
||||
/*
|
||||
* USE_HTTPS:
|
||||
* globalConfig?.useHttps?.toString() || 'false',
|
||||
*/
|
||||
});
|
||||
} catch (err) {
|
||||
next(err);
|
||||
|
||||
@@ -227,9 +227,11 @@ export default class MicrosoftTeamsAPI {
|
||||
},
|
||||
);
|
||||
|
||||
// Microsoft Teams OAuth callback endpoint for project integration
|
||||
// New (preferred) static redirect URI that uses state param to carry projectId and userId
|
||||
// State format: <projectId>:<userId>
|
||||
/*
|
||||
* Microsoft Teams OAuth callback endpoint for project integration
|
||||
* New (preferred) static redirect URI that uses state param to carry projectId and userId
|
||||
* State format: <projectId>:<userId>
|
||||
*/
|
||||
router.get(
|
||||
"/microsoft-teams/auth",
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
@@ -509,9 +511,11 @@ export default class MicrosoftTeamsAPI {
|
||||
);
|
||||
}
|
||||
|
||||
// Persist project auth now that team is selected.
|
||||
// IMPORTANT: Do NOT overwrite project-level auth token (admin-consent app token)
|
||||
// with the user delegated token. Preserve existing project auth token if present.
|
||||
/*
|
||||
* Persist project auth now that team is selected.
|
||||
* IMPORTANT: Do NOT overwrite project-level auth token (admin-consent app token)
|
||||
* with the user delegated token. Preserve existing project auth token if present.
|
||||
*/
|
||||
const existingProjectAuth: WorkspaceProjectAuthToken | null =
|
||||
await WorkspaceProjectAuthTokenService.getProjectAuth({
|
||||
projectId: projectId,
|
||||
@@ -569,8 +573,10 @@ export default class MicrosoftTeamsAPI {
|
||||
},
|
||||
);
|
||||
|
||||
// Admin consent - start flow (tenant-wide admin consent)
|
||||
// Uses state in the same format as OAuth: <projectId>:<userId>
|
||||
/*
|
||||
* Admin consent - start flow (tenant-wide admin consent)
|
||||
* Uses state in the same format as OAuth: <projectId>:<userId>
|
||||
*/
|
||||
router.get(
|
||||
"/microsoft-teams/admin-consent",
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
@@ -651,8 +657,10 @@ export default class MicrosoftTeamsAPI {
|
||||
},
|
||||
);
|
||||
|
||||
// Admin consent - callback handler
|
||||
// Receives: state=<projectId>:<userId>, tenant=<tenantId>, admin_consent=True | error params
|
||||
/*
|
||||
* Admin consent - callback handler
|
||||
* Receives: state=<projectId>:<userId>, tenant=<tenantId>, admin_consent=True | error params
|
||||
*/
|
||||
router.get(
|
||||
"/microsoft-teams/admin-consent/callback",
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
@@ -912,8 +920,10 @@ export default class MicrosoftTeamsAPI {
|
||||
},
|
||||
);
|
||||
|
||||
// Microsoft Bot Framework endpoint - this is what Teams calls for bot messages
|
||||
// Now uses the Bot Framework SDK's adapter.processActivity for proper protocol handling
|
||||
/*
|
||||
* Microsoft Bot Framework endpoint - this is what Teams calls for bot messages
|
||||
* Now uses the Bot Framework SDK's adapter.processActivity for proper protocol handling
|
||||
*/
|
||||
router.post(
|
||||
"/microsoft-bot/messages",
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
@@ -1150,9 +1160,11 @@ export default class MicrosoftTeamsAPI {
|
||||
authResult: MicrosoftTeamsRequest,
|
||||
_activity: JSONObject,
|
||||
): Promise<void> {
|
||||
// Handle adaptive card button clicks
|
||||
// const value: JSONObject = activity["value"] as JSONObject;
|
||||
// const actionType: string = value["action"] as string;
|
||||
/*
|
||||
* Handle adaptive card button clicks
|
||||
* const value: JSONObject = activity["value"] as JSONObject;
|
||||
* const actionType: string = value["action"] as string;
|
||||
*/
|
||||
|
||||
for (const action of authResult.actions || []) {
|
||||
if (!action.actionType) {
|
||||
|
||||
@@ -30,8 +30,10 @@ export default class ResellerPlanAPI extends BaseAPI<
|
||||
public constructor() {
|
||||
super(ResellerPlan, ResellerPlanService);
|
||||
|
||||
// Reseller Plan Action API
|
||||
// TODO: Refactor this API and make it partner specific.
|
||||
/*
|
||||
* Reseller Plan Action API
|
||||
* TODO: Refactor this API and make it partner specific.
|
||||
*/
|
||||
this.router.post(
|
||||
`${new this.entityType()
|
||||
.getCrudApiPath()
|
||||
|
||||
@@ -181,29 +181,31 @@ export default class SlackAPI {
|
||||
let botUserId: string | undefined = undefined;
|
||||
let slackUserAccessToken: string | undefined = undefined;
|
||||
|
||||
// ReponseBody is in this format.
|
||||
// {
|
||||
// "ok": true,
|
||||
// "access_token": "sample-token",
|
||||
// "token_type": "bot",
|
||||
// "scope": "commands,incoming-webhook",
|
||||
// "bot_user_id": "U0KRQLJ9H",
|
||||
// "app_id": "A0KRD7HC3",
|
||||
// "team": {
|
||||
// "name": "Slack Pickleball Team",
|
||||
// "id": "T9TK3CUKW"
|
||||
// },
|
||||
// "enterprise": {
|
||||
// "name": "slack-pickleball",
|
||||
// "id": "E12345678"
|
||||
// },
|
||||
// "authed_user": {
|
||||
// "id": "U1234",
|
||||
// "scope": "chat:write",
|
||||
// "access_token": "sample-token",
|
||||
// "token_type": "user"
|
||||
// }
|
||||
// }
|
||||
/*
|
||||
* ReponseBody is in this format.
|
||||
* {
|
||||
* "ok": true,
|
||||
* "access_token": "sample-token",
|
||||
* "token_type": "bot",
|
||||
* "scope": "commands,incoming-webhook",
|
||||
* "bot_user_id": "U0KRQLJ9H",
|
||||
* "app_id": "A0KRD7HC3",
|
||||
* "team": {
|
||||
* "name": "Slack Pickleball Team",
|
||||
* "id": "T9TK3CUKW"
|
||||
* },
|
||||
* "enterprise": {
|
||||
* "name": "slack-pickleball",
|
||||
* "id": "E12345678"
|
||||
* },
|
||||
* "authed_user": {
|
||||
* "id": "U1234",
|
||||
* "scope": "chat:write",
|
||||
* "access_token": "sample-token",
|
||||
* "token_type": "user"
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
if (responseBody["ok"] !== true) {
|
||||
return Response.sendErrorResponse(
|
||||
@@ -407,31 +409,35 @@ export default class SlackAPI {
|
||||
"id_token"
|
||||
] as JSONObject;
|
||||
|
||||
// Example of Response Body
|
||||
// {
|
||||
// "iss": "https://slack.com",
|
||||
// "sub": "U123ABC456",
|
||||
// "aud": "25259531569.1115258246291",
|
||||
// "exp": 1626874955,
|
||||
// "iat": 1626874655,
|
||||
// "auth_time": 1626874655,
|
||||
// "nonce": "abcd",
|
||||
// "at_hash": "abc...123",
|
||||
// "https://slack.com/team_id": "T0123ABC456",
|
||||
// "https://slack.com/user_id": "U123ABC456",
|
||||
// "email": "alice@example.com",
|
||||
// "email_verified": true,
|
||||
// "date_email_verified": 1622128723,
|
||||
// "locale": "en-US",
|
||||
// "name": "Alice",
|
||||
// "given_name": "",
|
||||
// "family_name": "",
|
||||
// "https://slack.com/team_image_230": "https://secure.gravatar.com/avatar/bc.png",
|
||||
// "https://slack.com/team_image_default": true
|
||||
// }
|
||||
/*
|
||||
* Example of Response Body
|
||||
* {
|
||||
* "iss": "https://slack.com",
|
||||
* "sub": "U123ABC456",
|
||||
* "aud": "25259531569.1115258246291",
|
||||
* "exp": 1626874955,
|
||||
* "iat": 1626874655,
|
||||
* "auth_time": 1626874655,
|
||||
* "nonce": "abcd",
|
||||
* "at_hash": "abc...123",
|
||||
* "https://slack.com/team_id": "T0123ABC456",
|
||||
* "https://slack.com/user_id": "U123ABC456",
|
||||
* "email": "alice@example.com",
|
||||
* "email_verified": true,
|
||||
* "date_email_verified": 1622128723,
|
||||
* "locale": "en-US",
|
||||
* "name": "Alice",
|
||||
* "given_name": "",
|
||||
* "family_name": "",
|
||||
* "https://slack.com/team_image_230": "https://secure.gravatar.com/avatar/bc.png",
|
||||
* "https://slack.com/team_image_default": true
|
||||
* }
|
||||
*/
|
||||
|
||||
// check if the team id matches the project id.
|
||||
// get project auth.
|
||||
/*
|
||||
* check if the team id matches the project id.
|
||||
* get project auth.
|
||||
*/
|
||||
|
||||
const projectAuth: WorkspaceProjectAuthToken | null =
|
||||
await WorkspaceProjectAuthTokenService.findOneBy({
|
||||
|
||||
@@ -735,9 +735,11 @@ export default class StatusPageAPI extends BaseAPI<
|
||||
req: req,
|
||||
});
|
||||
|
||||
// get start and end date from request body.
|
||||
// if no end date is provided then it will be current date.
|
||||
// if no start date is provided then it will be 14 days ago from end date.
|
||||
/*
|
||||
* get start and end date from request body.
|
||||
* if no end date is provided then it will be current date.
|
||||
* if no start date is provided then it will be 14 days ago from end date.
|
||||
*/
|
||||
|
||||
let startDate: Date = OneUptimeDate.getSomeDaysAgo(14);
|
||||
let endDate: Date = OneUptimeDate.getCurrentDate();
|
||||
|
||||
@@ -93,9 +93,11 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI<
|
||||
},
|
||||
);
|
||||
|
||||
// We have this ack page to show the user a confirmation page before acknowledging the notification.
|
||||
// this is because email clients automatically make a get request to the url in the email and ack the notification automatically which is not what we want.
|
||||
// so we need to create this page for the user to confirm that they want to acknowledge the notification.
|
||||
/*
|
||||
* We have this ack page to show the user a confirmation page before acknowledging the notification.
|
||||
* this is because email clients automatically make a get request to the url in the email and ack the notification automatically which is not what we want.
|
||||
* so we need to create this page for the user to confirm that they want to acknowledge the notification.
|
||||
*/
|
||||
this.router.get(
|
||||
`${new this.entityType()
|
||||
.getCrudApiPath()
|
||||
|
||||
@@ -11,8 +11,10 @@ export class AddEnableCustomSubscriberEmailNotificationFooterText1753131488925
|
||||
`ALTER TABLE "StatusPage" ADD "enableCustomSubscriberEmailNotificationFooterText" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
|
||||
// Data migration: Set existing status pages to have enableCustomSubscriberEmailNotificationFooterText = true
|
||||
// This ensures backward compatibility for existing status pages that already have custom footer text
|
||||
/*
|
||||
* Data migration: Set existing status pages to have enableCustomSubscriberEmailNotificationFooterText = true
|
||||
* This ensures backward compatibility for existing status pages that already have custom footer text
|
||||
*/
|
||||
await queryRunner.query(
|
||||
`UPDATE "StatusPage" SET "enableCustomSubscriberEmailNotificationFooterText" = true WHERE "subscriberEmailNotificationFooterText" IS NOT NULL AND "subscriberEmailNotificationFooterText" != ''`,
|
||||
);
|
||||
|
||||
@@ -93,8 +93,10 @@ export default class Queue {
|
||||
removeOnComplete: { count: 500 }, // keep last 1000 completed jobs
|
||||
removeOnFail: { count: 100 }, // keep last 500 failed jobs
|
||||
},
|
||||
// Optionally cap the event stream length (supported in BullMQ >= v5)
|
||||
// This helps prevent the :events stream from growing indefinitely
|
||||
/*
|
||||
* Optionally cap the event stream length (supported in BullMQ >= v5)
|
||||
* This helps prevent the :events stream from growing indefinitely
|
||||
*/
|
||||
streams: {
|
||||
events: { maxLen: 1000 },
|
||||
},
|
||||
|
||||
@@ -26,8 +26,10 @@ export default abstract class IO {
|
||||
);
|
||||
}
|
||||
|
||||
// const pubClient: ClientType = Redis.getClient()!.duplicate();
|
||||
// const subClient: ClientType = Redis.getClient()!.duplicate();
|
||||
/*
|
||||
* const pubClient: ClientType = Redis.getClient()!.duplicate();
|
||||
* const subClient: ClientType = Redis.getClient()!.duplicate();
|
||||
*/
|
||||
|
||||
// this.socketServer.adapter(createAdapter(pubClient, subClient));
|
||||
}
|
||||
|
||||
@@ -107,9 +107,11 @@ export default class ProjectMiddleware {
|
||||
|
||||
if (apiKeyModel) {
|
||||
(req as OneUptimeRequest).userType = UserType.API;
|
||||
// TODO: Add API key permissions.
|
||||
// (req as OneUptimeRequest).permissions =
|
||||
// apiKeyModel.permissions || [];
|
||||
/*
|
||||
* TODO: Add API key permissions.
|
||||
* (req as OneUptimeRequest).permissions =
|
||||
* apiKeyModel.permissions || [];
|
||||
*/
|
||||
(req as OneUptimeRequest).userGlobalAccessPermission =
|
||||
await APIKeyAccessPermission.getDefaultApiGlobalPermission(
|
||||
tenantId,
|
||||
|
||||
@@ -44,8 +44,10 @@ export default class TelemetryIngest {
|
||||
logger.error("Missing header: x-oneuptime-token");
|
||||
|
||||
if (isOpenTelemetryAPI) {
|
||||
// then accept the response and return success.
|
||||
// do not return error because it causes Otel to retry the request.
|
||||
/*
|
||||
* then accept the response and return success.
|
||||
* do not return error because it causes Otel to retry the request.
|
||||
*/
|
||||
return Response.sendEmptySuccessResponse(req, res);
|
||||
}
|
||||
|
||||
@@ -71,8 +73,10 @@ export default class TelemetryIngest {
|
||||
logger.error("Invalid service token: " + oneuptimeToken);
|
||||
|
||||
if (isOpenTelemetryAPI) {
|
||||
// then accept the response and return success.
|
||||
// do not return error because it causes Otel to retry the request.
|
||||
/*
|
||||
* then accept the response and return success.
|
||||
* do not return error because it causes Otel to retry the request.
|
||||
*/
|
||||
return Response.sendEmptySuccessResponse(req, res);
|
||||
}
|
||||
|
||||
@@ -89,8 +93,10 @@ export default class TelemetryIngest {
|
||||
);
|
||||
|
||||
if (isOpenTelemetryAPI) {
|
||||
// then accept the response and return success.
|
||||
// do not return error because it causes Otel to retry the request.
|
||||
/*
|
||||
* then accept the response and return success.
|
||||
* do not return error because it causes Otel to retry the request.
|
||||
*/
|
||||
return Response.sendEmptySuccessResponse(req, res);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,8 +145,10 @@ export class Service extends DatabaseService<AlertStateTimeline> {
|
||||
createBy.data.isOwnerNotified = true;
|
||||
}
|
||||
|
||||
// check if this new state and the previous state are same.
|
||||
// if yes, then throw bad data exception.
|
||||
/*
|
||||
* check if this new state and the previous state are same.
|
||||
* if yes, then throw bad data exception.
|
||||
*/
|
||||
|
||||
if (stateBeforeThis && stateBeforeThis.alertStateId && alertStateId) {
|
||||
if (
|
||||
@@ -211,8 +213,10 @@ export class Service extends DatabaseService<AlertStateTimeline> {
|
||||
createBy.data.endsAt = stateAfterThis.startsAt;
|
||||
}
|
||||
|
||||
// check if this new state and the previous state are same.
|
||||
// if yes, then throw bad data exception.
|
||||
/*
|
||||
* check if this new state and the previous state are same.
|
||||
* if yes, then throw bad data exception.
|
||||
*/
|
||||
|
||||
if (stateAfterThis && stateAfterThis.alertStateId && alertStateId) {
|
||||
if (
|
||||
@@ -295,14 +299,18 @@ export class Service extends DatabaseService<AlertStateTimeline> {
|
||||
logger.debug("Created Item");
|
||||
logger.debug(createdItem);
|
||||
|
||||
// now there are three cases.
|
||||
// 1. This is the first status OR there's no status after this.
|
||||
/*
|
||||
* now there are three cases.
|
||||
* 1. This is the first status OR there's no status after this.
|
||||
*/
|
||||
if (!onCreate.carryForward.statusTimelineBeforeThisStatus) {
|
||||
// This is the first status, no need to update previous status.
|
||||
logger.debug("This is the first status.");
|
||||
} else if (!onCreate.carryForward.statusTimelineAfterThisStatus) {
|
||||
// 2. This is the last status.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 2. This is the last status.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -314,8 +322,10 @@ export class Service extends DatabaseService<AlertStateTimeline> {
|
||||
});
|
||||
logger.debug("This is the last status.");
|
||||
} else {
|
||||
// 3. This is in the middle.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 3. This is in the middle.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -549,10 +559,12 @@ ${createdItem.rootCause}`,
|
||||
);
|
||||
}
|
||||
|
||||
// There are three cases.
|
||||
// 1. This is the first state.
|
||||
// 2. This is the last state.
|
||||
// 3. This is in the middle.
|
||||
/*
|
||||
* There are three cases.
|
||||
* 1. This is the first state.
|
||||
* 2. This is the last state.
|
||||
* 3. This is in the middle.
|
||||
*/
|
||||
|
||||
const stateBeforeThis: AlertStateTimeline | null = await this.findOneBy(
|
||||
{
|
||||
@@ -601,8 +613,10 @@ ${createdItem.rootCause}`,
|
||||
// This is the first state, no need to update previous state.
|
||||
logger.debug("This is the first state.");
|
||||
} else if (!stateAfterThis) {
|
||||
// This is the last state.
|
||||
// Update the previous state to end at the end of this state.
|
||||
/*
|
||||
* This is the last state.
|
||||
* Update the previous state to end at the end of this state.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
@@ -614,8 +628,10 @@ ${createdItem.rootCause}`,
|
||||
});
|
||||
logger.debug("This is the last state.");
|
||||
} else {
|
||||
// This state is in the middle.
|
||||
// Update the previous state to end at the start of the next state.
|
||||
/*
|
||||
* This state is in the middle.
|
||||
* Update the previous state to end at the start of the next state.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
|
||||
@@ -67,8 +67,10 @@ export class Service extends DatabaseService<Model> {
|
||||
},
|
||||
});
|
||||
|
||||
// refresh the subscription status. This is a hack to ensure that the subscription status is always up to date.
|
||||
// This is because the subscription status can change at any time and we need to ensure that the subscription status is always up to date.
|
||||
/*
|
||||
* refresh the subscription status. This is a hack to ensure that the subscription status is always up to date.
|
||||
* This is because the subscription status can change at any time and we need to ensure that the subscription status is always up to date.
|
||||
*/
|
||||
|
||||
if (!project) {
|
||||
throw new BadDataException("Project not found");
|
||||
@@ -207,8 +209,10 @@ export class Service extends DatabaseService<Model> {
|
||||
},
|
||||
});
|
||||
|
||||
// refresh the subscription status. This is a hack to ensure that the subscription status is always up to date.
|
||||
// This is because the subscription status can change at any time and we need to ensure that the subscription status is always up to date.
|
||||
/*
|
||||
* refresh the subscription status. This is a hack to ensure that the subscription status is always up to date.
|
||||
* This is because the subscription status can change at any time and we need to ensure that the subscription status is always up to date.
|
||||
*/
|
||||
|
||||
await this.refreshSubscriptionStatus({ projectId: findBy.props.tenantId! });
|
||||
|
||||
|
||||
@@ -90,13 +90,15 @@ export class BillingService extends BaseService {
|
||||
if (!this.isBillingEnabled()) {
|
||||
throw new BadDataException(Errors.BillingService.BILLING_NOT_ENABLED);
|
||||
}
|
||||
// Goal: Update Stripe Customer "Billing details" (address fields) rather than invoice footer.
|
||||
// We only have a single free-form textarea. We'll map:
|
||||
// First non-empty line -> address.line1
|
||||
// Second non-empty line (if any) and remaining (joined, truncated) -> address.line2
|
||||
// We also persist full text in metadata so we can reconstruct or improve parsing later.
|
||||
// NOTE: Because Stripe requires structured address, any city/state/postal/country detection
|
||||
// would be heuristic; we keep it simple unless we later add structured fields.
|
||||
/*
|
||||
* Goal: Update Stripe Customer "Billing details" (address fields) rather than invoice footer.
|
||||
* We only have a single free-form textarea. We'll map:
|
||||
* First non-empty line -> address.line1
|
||||
* Second non-empty line (if any) and remaining (joined, truncated) -> address.line2
|
||||
* We also persist full text in metadata so we can reconstruct or improve parsing later.
|
||||
* NOTE: Because Stripe requires structured address, any city/state/postal/country detection
|
||||
* would be heuristic; we keep it simple unless we later add structured fields.
|
||||
*/
|
||||
|
||||
const lines: Array<string> = businessDetails
|
||||
.split(/\r?\n/)
|
||||
@@ -137,8 +139,10 @@ export class BillingService extends BaseService {
|
||||
address: {},
|
||||
};
|
||||
|
||||
// If finance / accounting email provided, set it as the customer email so Stripe sends
|
||||
// invoices / receipts there. (Stripe only supports a single email via API currently.)
|
||||
/*
|
||||
* If finance / accounting email provided, set it as the customer email so Stripe sends
|
||||
* invoices / receipts there. (Stripe only supports a single email via API currently.)
|
||||
*/
|
||||
if (financeAccountingEmail && financeAccountingEmail.trim().length > 0) {
|
||||
updateParams.email = financeAccountingEmail.trim();
|
||||
}
|
||||
|
||||
@@ -1090,21 +1090,25 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
||||
},
|
||||
});
|
||||
|
||||
// We are hard deleting anyway. So, this does not make sense. Please uncomment if
|
||||
// we change the code to soft-delete.
|
||||
/*
|
||||
* We are hard deleting anyway. So, this does not make sense. Please uncomment if
|
||||
* we change the code to soft-delete.
|
||||
*/
|
||||
|
||||
// await this._updateBy({
|
||||
// query: deleteBy.query,
|
||||
// data: {
|
||||
// deletedByUserId: deleteBy.props.userId,
|
||||
// } as any,
|
||||
// limit: deleteBy.limit,
|
||||
// skip: deleteBy.skip,
|
||||
// props: {
|
||||
// isRoot: true,
|
||||
// ignoreHooks: true,
|
||||
// },
|
||||
// });
|
||||
/*
|
||||
* await this._updateBy({
|
||||
* query: deleteBy.query,
|
||||
* data: {
|
||||
* deletedByUserId: deleteBy.props.userId,
|
||||
* } as any,
|
||||
* limit: deleteBy.limit,
|
||||
* skip: deleteBy.skip,
|
||||
* props: {
|
||||
* isRoot: true,
|
||||
* ignoreHooks: true,
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
|
||||
let numberOfDocsAffected: number = 0;
|
||||
|
||||
@@ -1407,9 +1411,11 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
||||
for (const key of dataKeys) {
|
||||
dataColumns.push([key, true]);
|
||||
}
|
||||
// Select the `_id` column and the columns in `data`.
|
||||
// `_id` is used for locating database records for updates, and `data`
|
||||
// columns are used for checking if the update causes a change in values.
|
||||
/*
|
||||
* Select the `_id` column and the columns in `data`.
|
||||
* `_id` is used for locating database records for updates, and `data`
|
||||
* columns are used for checking if the update causes a change in values.
|
||||
*/
|
||||
const selectColumns: Select<TBaseModel> = {
|
||||
_id: true,
|
||||
...Object.fromEntries(dataColumns),
|
||||
@@ -1467,16 +1473,20 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
// Cant Update relations.
|
||||
// https://github.com/typeorm/typeorm/issues/2821
|
||||
/*
|
||||
* Cant Update relations.
|
||||
* https://github.com/typeorm/typeorm/issues/2821
|
||||
*/
|
||||
|
||||
// const numberOfDocsAffected: number =
|
||||
// (
|
||||
// await this.getRepository().update(
|
||||
// query as any,
|
||||
// data
|
||||
// )
|
||||
// ).affected || 0;
|
||||
/*
|
||||
* const numberOfDocsAffected: number =
|
||||
* (
|
||||
* await this.getRepository().update(
|
||||
* query as any,
|
||||
* data
|
||||
* )
|
||||
* ).affected || 0;
|
||||
*/
|
||||
|
||||
if (!updateBy.props.ignoreHooks) {
|
||||
await this.onUpdateSuccess(
|
||||
@@ -1499,8 +1509,10 @@ class DatabaseService<TBaseModel extends BaseModel> extends BaseService {
|
||||
const columns: string[] = Object.keys(updatedItem);
|
||||
for (const column of columns) {
|
||||
if (
|
||||
// `toString()` is necessary so we can compare wrapped values
|
||||
// (e.g. `ObjectID`) with raw values (e.g. `string`)
|
||||
/*
|
||||
* `toString()` is necessary so we can compare wrapped values
|
||||
* (e.g. `ObjectID`) with raw values (e.g. `string`)
|
||||
*/
|
||||
item.getColumnValue(column)?.toString() !==
|
||||
updatedItem[column]?.toString()
|
||||
) {
|
||||
|
||||
@@ -343,9 +343,11 @@ export class Service extends DatabaseService<Model> {
|
||||
protected override async onBeforeUpdate(
|
||||
updateBy: UpdateBy<Model>,
|
||||
): Promise<OnUpdate<Model>> {
|
||||
// get monitors for this incident.
|
||||
// if the monitors are removed then change them to operational state.
|
||||
// then change all of the monitors in this incident to the changeMonitorStatusToId.
|
||||
/*
|
||||
* get monitors for this incident.
|
||||
* if the monitors are removed then change them to operational state.
|
||||
* then change all of the monitors in this incident to the changeMonitorStatusToId.
|
||||
*/
|
||||
|
||||
const carryForward: UpdateCarryForward = {};
|
||||
|
||||
|
||||
@@ -169,8 +169,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
||||
createBy.data.isOwnerNotified = true;
|
||||
}
|
||||
|
||||
// check if this new state and the previous state are same.
|
||||
// if yes, then throw bad data exception.
|
||||
/*
|
||||
* check if this new state and the previous state are same.
|
||||
* if yes, then throw bad data exception.
|
||||
*/
|
||||
|
||||
if (
|
||||
stateBeforeThis &&
|
||||
@@ -222,8 +224,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
||||
createBy.data.endsAt = stateAfterThis.startsAt;
|
||||
}
|
||||
|
||||
// check if this new state and the previous state are same.
|
||||
// if yes, then throw bad data exception.
|
||||
/*
|
||||
* check if this new state and the previous state are same.
|
||||
* if yes, then throw bad data exception.
|
||||
*/
|
||||
|
||||
if (stateAfterThis && stateAfterThis.incidentStateId && incidentStateId) {
|
||||
if (
|
||||
@@ -314,14 +318,18 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
||||
logger.debug("Created Item");
|
||||
logger.debug(createdItem);
|
||||
|
||||
// now there are three cases.
|
||||
// 1. This is the first status OR there's no status after this.
|
||||
/*
|
||||
* now there are three cases.
|
||||
* 1. This is the first status OR there's no status after this.
|
||||
*/
|
||||
if (!onCreate.carryForward.statusTimelineBeforeThisStatus) {
|
||||
// This is the first status, no need to update previous status.
|
||||
logger.debug("This is the first status.");
|
||||
} else if (!onCreate.carryForward.statusTimelineAfterThisStatus) {
|
||||
// 2. This is the last status.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 2. This is the last status.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -333,8 +341,10 @@ export class Service extends DatabaseService<IncidentStateTimeline> {
|
||||
});
|
||||
logger.debug("This is the last status.");
|
||||
} else {
|
||||
// 3. This is in the middle.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 3. This is in the middle.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -598,10 +608,12 @@ ${createdItem.rootCause}`,
|
||||
);
|
||||
}
|
||||
|
||||
// There are three cases.
|
||||
// 1. This is the first state.
|
||||
// 2. This is the last state.
|
||||
// 3. This is in the middle.
|
||||
/*
|
||||
* There are three cases.
|
||||
* 1. This is the first state.
|
||||
* 2. This is the last state.
|
||||
* 3. This is in the middle.
|
||||
*/
|
||||
|
||||
const stateBeforeThis: IncidentStateTimeline | null =
|
||||
await this.findOneBy({
|
||||
@@ -650,8 +662,10 @@ ${createdItem.rootCause}`,
|
||||
// This is the first state, no need to update previous state.
|
||||
logger.debug("This is the first state.");
|
||||
} else if (!stateAfterThis) {
|
||||
// This is the last state.
|
||||
// Update the previous state to end at the end of this state.
|
||||
/*
|
||||
* This is the last state.
|
||||
* Update the previous state to end at the end of this state.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
@@ -663,8 +677,10 @@ ${createdItem.rootCause}`,
|
||||
});
|
||||
logger.debug("This is the last state.");
|
||||
} else {
|
||||
// This state is in the middle.
|
||||
// Update the previous state to end at the start of the next state.
|
||||
/*
|
||||
* This state is in the middle.
|
||||
* Update the previous state to end at the start of the next state.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
|
||||
@@ -107,8 +107,10 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
createBy.data.isOwnerNotified = true;
|
||||
}
|
||||
|
||||
// check if this new state and the previous state are same.
|
||||
// if yes, then throw bad data exception.
|
||||
/*
|
||||
* check if this new state and the previous state are same.
|
||||
* if yes, then throw bad data exception.
|
||||
*/
|
||||
|
||||
if (stateBeforeThis && stateBeforeThis.monitorStatusId && monitorStatusId) {
|
||||
if (
|
||||
@@ -144,8 +146,10 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
createBy.data.endsAt = stateAfterThis.startsAt;
|
||||
}
|
||||
|
||||
// check if this new state and the previous state are same.
|
||||
// if yes, then throw bad data exception.
|
||||
/*
|
||||
* check if this new state and the previous state are same.
|
||||
* if yes, then throw bad data exception.
|
||||
*/
|
||||
|
||||
if (stateAfterThis && stateAfterThis.monitorStatusId && monitorStatusId) {
|
||||
if (
|
||||
@@ -194,14 +198,18 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
logger.debug("Created Item");
|
||||
logger.debug(createdItem);
|
||||
|
||||
// now there are three cases.
|
||||
// 1. This is the first status OR there's no status after this.
|
||||
/*
|
||||
* now there are three cases.
|
||||
* 1. This is the first status OR there's no status after this.
|
||||
*/
|
||||
if (!onCreate.carryForward.statusTimelineBeforeThisStatus) {
|
||||
// This is the first status, no need to update previous status.
|
||||
logger.debug("This is the first status.");
|
||||
} else if (!onCreate.carryForward.statusTimelineAfterThisStatus) {
|
||||
// 2. This is the last status.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 2. This is the last status.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -213,8 +221,10 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
});
|
||||
logger.debug("This is the last status.");
|
||||
} else {
|
||||
// 3. This is in the middle.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 3. This is in the middle.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -358,10 +368,12 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
);
|
||||
}
|
||||
|
||||
// There are three cases.
|
||||
// 1. This is the first status.
|
||||
// 2. This is the last status.
|
||||
// 3. This is in the middle.
|
||||
/*
|
||||
* There are three cases.
|
||||
* 1. This is the first status.
|
||||
* 2. This is the last status.
|
||||
* 3. This is in the middle.
|
||||
*/
|
||||
|
||||
const stateBeforeThis: MonitorStatusTimeline | null =
|
||||
await this.findOneBy({
|
||||
@@ -410,8 +422,10 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
// This is the first status, no need to update previous status.
|
||||
logger.debug("This is the first status.");
|
||||
} else if (!stateAfterThis) {
|
||||
// This is the last status.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* This is the last status.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
@@ -423,8 +437,10 @@ export class Service extends DatabaseService<MonitorStatusTimeline> {
|
||||
});
|
||||
logger.debug("This is the last status.");
|
||||
} else {
|
||||
// This status is in the middle.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* This status is in the middle.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
|
||||
@@ -181,8 +181,10 @@ export class Service extends DatabaseService<OnCallDutyPolicySchedule> {
|
||||
|
||||
const { previousInformation, newInformation } = data;
|
||||
|
||||
// if there's a change, witht he current user, send notification to the new current user.
|
||||
// Send notificiation to the new current user.
|
||||
/*
|
||||
* if there's a change, witht he current user, send notification to the new current user.
|
||||
* Send notificiation to the new current user.
|
||||
*/
|
||||
if (
|
||||
previousInformation.currentUserIdOnRoster?.toString() !==
|
||||
newInformation.currentUserIdOnRoster?.toString() ||
|
||||
|
||||
@@ -139,10 +139,12 @@ export class ProjectService extends DatabaseService<Model> {
|
||||
data.data.planName = this.getPlanType(data.data.paymentProviderPlanId);
|
||||
|
||||
if (data.data.paymentProviderPromoCode) {
|
||||
// check if it exists in promcode table. Not all promocodes are in the table, only reseller ones are.
|
||||
// If they are not in the table, allow projetc creation to proceed.
|
||||
// If they are in the project table, then see if anyn restrictions on reseller plan apply and if it does,
|
||||
// apply those restictions to the project.
|
||||
/*
|
||||
* check if it exists in promcode table. Not all promocodes are in the table, only reseller ones are.
|
||||
* If they are not in the table, allow projetc creation to proceed.
|
||||
* If they are in the project table, then see if anyn restrictions on reseller plan apply and if it does,
|
||||
* apply those restictions to the project.
|
||||
*/
|
||||
|
||||
const promoCode: PromoCode | null = await PromoCodeService.findOneBy({
|
||||
query: {
|
||||
|
||||
@@ -326,14 +326,18 @@ export class Service extends DatabaseService<ScheduledMaintenanceStateTimeline>
|
||||
logger.debug("Created Item");
|
||||
logger.debug(createdItem);
|
||||
|
||||
// now there are three cases.
|
||||
// 1. This is the first status OR there's no status after this.
|
||||
/*
|
||||
* now there are three cases.
|
||||
* 1. This is the first status OR there's no status after this.
|
||||
*/
|
||||
if (!onCreate.carryForward.statusTimelineBeforeThisStatus) {
|
||||
// This is the first status, no need to update previous status.
|
||||
logger.debug("This is the first status.");
|
||||
} else if (!onCreate.carryForward.statusTimelineAfterThisStatus) {
|
||||
// 2. This is the last status.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 2. This is the last status.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -345,8 +349,10 @@ export class Service extends DatabaseService<ScheduledMaintenanceStateTimeline>
|
||||
});
|
||||
logger.debug("This is the last status.");
|
||||
} else {
|
||||
// 3. This is in the middle.
|
||||
// Update the previous status to end at the start of this status.
|
||||
/*
|
||||
* 3. This is in the middle.
|
||||
* Update the previous status to end at the start of this status.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: onCreate.carryForward.statusTimelineBeforeThisStatus.id!,
|
||||
data: {
|
||||
@@ -718,10 +724,12 @@ export class Service extends DatabaseService<ScheduledMaintenanceStateTimeline>
|
||||
);
|
||||
}
|
||||
|
||||
// There are three cases.
|
||||
// 1. This is the first state.
|
||||
// 2. This is the last state.
|
||||
// 3. This is in the middle.
|
||||
/*
|
||||
* There are three cases.
|
||||
* 1. This is the first state.
|
||||
* 2. This is the last state.
|
||||
* 3. This is in the middle.
|
||||
*/
|
||||
|
||||
const stateBeforeThis: ScheduledMaintenanceStateTimeline | null =
|
||||
await this.findOneBy({
|
||||
@@ -770,8 +778,10 @@ export class Service extends DatabaseService<ScheduledMaintenanceStateTimeline>
|
||||
// This is the first state, no need to update previous state.
|
||||
logger.debug("This is the first state.");
|
||||
} else if (!stateAfterThis) {
|
||||
// This is the last state.
|
||||
// Update the previous state to end at the end of this state.
|
||||
/*
|
||||
* This is the last state.
|
||||
* Update the previous state to end at the end of this state.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
@@ -783,8 +793,10 @@ export class Service extends DatabaseService<ScheduledMaintenanceStateTimeline>
|
||||
});
|
||||
logger.debug("This is the last state.");
|
||||
} else {
|
||||
// This state is in the middle.
|
||||
// Update the previous state to end at the start of the next state.
|
||||
/*
|
||||
* This state is in the middle.
|
||||
* Update the previous state to end at the start of the next state.
|
||||
*/
|
||||
await this.updateOneById({
|
||||
id: stateBeforeThis.id!,
|
||||
data: {
|
||||
|
||||
@@ -168,8 +168,10 @@ export class Service extends DatabaseService<StatusPage> {
|
||||
createBy.data.defaultBarColor = Green;
|
||||
}
|
||||
|
||||
// For new status pages, set enableCustomSubscriberEmailNotificationFooterText to false by default
|
||||
// and provide a default custom footer text only if not provided
|
||||
/*
|
||||
* For new status pages, set enableCustomSubscriberEmailNotificationFooterText to false by default
|
||||
* and provide a default custom footer text only if not provided
|
||||
*/
|
||||
if (
|
||||
createBy.data.enableCustomSubscriberEmailNotificationFooterText ===
|
||||
undefined
|
||||
|
||||
@@ -252,8 +252,10 @@ export default class ModelPermission {
|
||||
DatabaseRequestType.Read,
|
||||
);
|
||||
|
||||
// We will check for this permission in recursive function.
|
||||
// check query permissions.
|
||||
/*
|
||||
* We will check for this permission in recursive function.
|
||||
* check query permissions.
|
||||
*/
|
||||
this.checkQueryPermission(modelType, query, props);
|
||||
|
||||
if (select) {
|
||||
@@ -393,9 +395,11 @@ export default class ModelPermission {
|
||||
!props.tenantId &&
|
||||
props.userGlobalAccessPermission
|
||||
) {
|
||||
// for each of these projectIds,
|
||||
// check if they have valid permissions for these projects
|
||||
// and if they do, include them in the query.
|
||||
/*
|
||||
* for each of these projectIds,
|
||||
* check if they have valid permissions for these projects
|
||||
* and if they do, include them in the query.
|
||||
*/
|
||||
|
||||
const queries: Array<Query<TBaseModel>> = [];
|
||||
|
||||
|
||||
@@ -66,8 +66,10 @@ export default class BasePermission {
|
||||
// check model level permissions.
|
||||
TablePermission.checkTableLevelPermissions(modelType, props, type);
|
||||
|
||||
// We will check for this permission in recursive function.
|
||||
// check query permissions.
|
||||
/*
|
||||
* We will check for this permission in recursive function.
|
||||
* check query permissions.
|
||||
*/
|
||||
QueryPermission.checkQueryPermission(modelType, query, props);
|
||||
|
||||
query = await AccessControlPermission.addAccessControlIdsToQuery(
|
||||
|
||||
@@ -44,9 +44,11 @@ export default class TenantPermission {
|
||||
!props.tenantId &&
|
||||
props.userGlobalAccessPermission
|
||||
) {
|
||||
// for each of these projectIds,
|
||||
// check if they have valid permissions for these projects
|
||||
// and if they do, include them in the query.
|
||||
/*
|
||||
* for each of these projectIds,
|
||||
* check if they have valid permissions for these projects
|
||||
* and if they do, include them in the query.
|
||||
*/
|
||||
|
||||
const queries: Array<Query<TBaseModel>> = [];
|
||||
|
||||
|
||||
@@ -463,8 +463,10 @@ export default class QueryHelper {
|
||||
}
|
||||
|
||||
return Raw((alias: string) => {
|
||||
// alias is table name + column name like tableName.columnName
|
||||
// we need to convert this to "tableName"."columnName"
|
||||
/*
|
||||
* alias is table name + column name like tableName.columnName
|
||||
* we need to convert this to "tableName"."columnName"
|
||||
*/
|
||||
|
||||
alias = alias
|
||||
.split(".")
|
||||
|
||||
@@ -198,10 +198,12 @@ export default class Markdown {
|
||||
return `<figure class="my-8"><img src="${href}" alt="${text}" class="rounded-xl shadow-sm border border-gray-200" loading="lazy"/><figcaption class="mt-2 text-center text-sm text-gray-500">${text || ""}</figcaption></figure>`;
|
||||
};
|
||||
|
||||
// Links
|
||||
// We explicitly add underline + color classes because Tailwind Typography (prose-*)
|
||||
// styles may get overridden by surrounding utility classes or global resets.
|
||||
// External links open in a new tab with proper rel attributes; internal links stay in-page.
|
||||
/*
|
||||
* Links
|
||||
* We explicitly add underline + color classes because Tailwind Typography (prose-*)
|
||||
* styles may get overridden by surrounding utility classes or global resets.
|
||||
* External links open in a new tab with proper rel attributes; internal links stay in-page.
|
||||
*/
|
||||
renderer.link = function (href, title, text) {
|
||||
// Guard: if no href, just return the text.
|
||||
if (!href) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// this class is the base class that all the component can implement
|
||||
//
|
||||
/*
|
||||
* this class is the base class that all the component can implement
|
||||
*
|
||||
*/
|
||||
import BadDataException from "../../../Types/Exception/BadDataException";
|
||||
import Exception from "../../../Types/Exception/Exception";
|
||||
import { JSONArray, JSONObject, JSONValue } from "../../../Types/JSON";
|
||||
|
||||
@@ -55,9 +55,11 @@ export default class IfElse extends ComponentCode {
|
||||
}
|
||||
|
||||
try {
|
||||
// Set timeout
|
||||
// Inject args
|
||||
// Inject dependencies
|
||||
/*
|
||||
* Set timeout
|
||||
* Inject args
|
||||
* Inject dependencies
|
||||
*/
|
||||
|
||||
for (const key in args) {
|
||||
if (key === "operator") {
|
||||
|
||||
@@ -51,9 +51,11 @@ export default class JavaScriptCode extends ComponentCode {
|
||||
}
|
||||
|
||||
try {
|
||||
// Set timeout
|
||||
// Inject args
|
||||
// Inject dependencies
|
||||
/*
|
||||
* Set timeout
|
||||
* Inject args
|
||||
* Inject dependencies
|
||||
*/
|
||||
|
||||
let scriptArgs: JSONObject | string =
|
||||
(args["arguments"] as JSONObject | string) || {};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// this class is the base class that all the component can implement
|
||||
//
|
||||
/*
|
||||
* this class is the base class that all the component can implement
|
||||
*
|
||||
*/
|
||||
import { ExpressRouter } from "../../Utils/Express";
|
||||
import ComponentCode, { RunOptions, RunReturnType } from "./ComponentCode";
|
||||
import BadDataException from "../../../Types/Exception/BadDataException";
|
||||
|
||||
@@ -159,8 +159,10 @@ export class Statement implements BaseQueryParams {
|
||||
private static toColumnType(
|
||||
statementParam: StatementParameter | string,
|
||||
): string {
|
||||
// ensure we have a mapping for all types (a missing mapping will
|
||||
// be a compile error)
|
||||
/*
|
||||
* ensure we have a mapping for all types (a missing mapping will
|
||||
* be a compile error)
|
||||
*/
|
||||
const columnTypes: Dictionary<string> = {
|
||||
[TableColumnType.Text]: "String",
|
||||
[TableColumnType.ObjectID]: "String",
|
||||
|
||||
@@ -131,8 +131,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
||||
records.push(record);
|
||||
}
|
||||
|
||||
// we need async insert to be enabled for clickhouse to work.
|
||||
// otherwise too many parts will be created.
|
||||
/*
|
||||
* we need async insert to be enabled for clickhouse to work.
|
||||
* otherwise too many parts will be created.
|
||||
*/
|
||||
|
||||
const statement: string = `INSERT INTO ${
|
||||
this.database.getDatasourceOptions().database
|
||||
@@ -263,9 +265,11 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
||||
setStatement.append(SQL`, `);
|
||||
}
|
||||
|
||||
// special case - ClickHouse does not support using query
|
||||
// parameters for column names in the SET statement so we
|
||||
// have to trust the column names here.
|
||||
/*
|
||||
* special case - ClickHouse does not support using query
|
||||
* parameters for column names in the SET statement so we
|
||||
* have to trust the column names here.
|
||||
*/
|
||||
const keyStatement: string = column.key;
|
||||
|
||||
setStatement.append(keyStatement).append(
|
||||
@@ -505,8 +509,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
||||
statement: Statement;
|
||||
columns: Array<string>;
|
||||
} {
|
||||
// EXAMPLE:
|
||||
// SELECT sum(Metric.value) as avg_value, date_trunc('hour', toStartOfInterval(createdAt, INTERVAL 1 hour)) as createdAt
|
||||
/*
|
||||
* EXAMPLE:
|
||||
* SELECT sum(Metric.value) as avg_value, date_trunc('hour', toStartOfInterval(createdAt, INTERVAL 1 hour)) as createdAt
|
||||
*/
|
||||
|
||||
const selectStatement: Statement = new Statement();
|
||||
|
||||
@@ -578,8 +584,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
||||
columns.append(SQL`, `);
|
||||
}
|
||||
|
||||
// special case - ClickHouse does not support using an a query parameter
|
||||
// to specify the column name when creating the table
|
||||
/*
|
||||
* special case - ClickHouse does not support using an a query parameter
|
||||
* to specify the column name when creating the table
|
||||
*/
|
||||
const keyStatement: string = column.key;
|
||||
|
||||
columns
|
||||
@@ -683,8 +691,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
||||
this.model.tableColumns,
|
||||
);
|
||||
|
||||
// special case - ClickHouse does not support using a query parameter
|
||||
// to specify the table engine
|
||||
/*
|
||||
* special case - ClickHouse does not support using a query parameter
|
||||
* to specify the table engine
|
||||
*/
|
||||
const tableEngineStatement: string = this.model.tableEngine;
|
||||
|
||||
const partitionKey: string = this.model.partitionKey;
|
||||
|
||||
@@ -78,10 +78,12 @@ export default class BrowserUtil {
|
||||
page = await browser.newPage();
|
||||
}
|
||||
|
||||
// if (data.browserType === BrowserType.Webkit) {
|
||||
// browser = await webkit.launch();
|
||||
// page = await browser.newPage();
|
||||
// }
|
||||
/*
|
||||
* if (data.browserType === BrowserType.Webkit) {
|
||||
* browser = await webkit.launch();
|
||||
* page = await browser.newPage();
|
||||
* }
|
||||
*/
|
||||
|
||||
await page?.setViewportSize({
|
||||
width: viewport.width,
|
||||
|
||||
@@ -141,8 +141,10 @@ export default class GitHubUtil extends HostedCodeRepository {
|
||||
page: page,
|
||||
});
|
||||
|
||||
// Fetch all pull requests by paginating through the results
|
||||
// 100 pull requests per page is the limit of the GitHub API
|
||||
/*
|
||||
* Fetch all pull requests by paginating through the results
|
||||
* 100 pull requests per page is the limit of the GitHub API
|
||||
*/
|
||||
while (pullRequests.length === page * 100 || page === 1) {
|
||||
pullRequests = await this.getPullRequestsByPage({
|
||||
organizationName: data.organizationName,
|
||||
|
||||
@@ -572,8 +572,10 @@ export default class MonitorResourceUtil {
|
||||
lastMonitorStatusTimeline.monitorStatusId.toString() ===
|
||||
monitorSteps.data.defaultMonitorStatusId.toString()
|
||||
) {
|
||||
// status is same as last status. do not create new status timeline.
|
||||
// do nothing! status is same as last status.
|
||||
/*
|
||||
* status is same as last status. do not create new status timeline.
|
||||
* do nothing! status is same as last status.
|
||||
*/
|
||||
} else {
|
||||
// if no criteria is met then update monitor to default state.
|
||||
const monitorStatusTimeline: MonitorStatusTimeline =
|
||||
@@ -634,9 +636,11 @@ export default class MonitorResourceUtil {
|
||||
|
||||
const itemsToSave: Array<Metric> = [];
|
||||
|
||||
// Metric name to serviceId map
|
||||
// example: "cpu.usage" -> [serviceId1, serviceId2]
|
||||
// since these are monitor metrics. They dont belong to any service so we can keep the array empty.
|
||||
/*
|
||||
* Metric name to serviceId map
|
||||
* example: "cpu.usage" -> [serviceId1, serviceId2]
|
||||
* since these are monitor metrics. They dont belong to any service so we can keep the array empty.
|
||||
*/
|
||||
const metricNameServiceNameMap: Dictionary<MetricType> = {};
|
||||
|
||||
if (
|
||||
@@ -1147,8 +1151,10 @@ export default class MonitorResourceUtil {
|
||||
probeApiIngestResponse: ProbeApiIngestResponse;
|
||||
criteriaInstance: MonitorCriteriaInstance;
|
||||
}): Promise<string | null> {
|
||||
// returns root cause if any. Otherwise criteria is not met.
|
||||
// process monitor criteria instance here.
|
||||
/*
|
||||
* returns root cause if any. Otherwise criteria is not met.
|
||||
* process monitor criteria instance here.
|
||||
*/
|
||||
|
||||
const rootCause: string | null =
|
||||
await MonitorResourceUtil.isMonitorInstanceCriteriaFiltersMet({
|
||||
@@ -1227,8 +1233,10 @@ export default class MonitorResourceUtil {
|
||||
criteriaInstance: MonitorCriteriaInstance;
|
||||
criteriaFilter: CriteriaFilter;
|
||||
}): Promise<string | null> {
|
||||
// returns root cause if any. Otherwise criteria is not met.
|
||||
// process monitor criteria filter here.
|
||||
/*
|
||||
* returns root cause if any. Otherwise criteria is not met.
|
||||
* process monitor criteria filter here.
|
||||
*/
|
||||
|
||||
if (input.criteriaFilter.checkOn === CheckOn.JavaScriptExpression) {
|
||||
let storageMap: JSONObject = {};
|
||||
|
||||
@@ -92,8 +92,10 @@ export default abstract class Realtime {
|
||||
await this.init();
|
||||
}
|
||||
|
||||
// before joining room check the user token and check if the user has access to this tenant
|
||||
// and to this model and to this event type
|
||||
/*
|
||||
* before joining room check the user token and check if the user has access to this tenant
|
||||
* and to this model and to this event type
|
||||
*/
|
||||
|
||||
logger.debug("Extracting user access token from socket");
|
||||
const userAccessToken: string | undefined =
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import OpenTelemetryAPI, {
|
||||
// diag,
|
||||
// DiagConsoleLogger,
|
||||
// DiagLogLevel,
|
||||
/*
|
||||
* diag,
|
||||
* DiagConsoleLogger,
|
||||
* DiagLogLevel,
|
||||
*/
|
||||
Meter,
|
||||
} from "@opentelemetry/api";
|
||||
import { Logger, logs } from "@opentelemetry/api-logs";
|
||||
@@ -33,8 +35,10 @@ import Dictionary from "../../Types/Dictionary";
|
||||
import { DisableTelemetry } from "../EnvironmentConfig";
|
||||
import logger from "./Logger";
|
||||
|
||||
// Enable this line to see debug logs
|
||||
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
||||
/*
|
||||
* Enable this line to see debug logs
|
||||
* diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
||||
*/
|
||||
|
||||
export type Span = opentelemetry.api.Span;
|
||||
export type SpanStatus = opentelemetry.api.SpanStatus;
|
||||
@@ -203,10 +207,12 @@ export default class Telemetry {
|
||||
nodeSdkConfiguration.traceExporter = traceExporter;
|
||||
}
|
||||
|
||||
// We will skip this becasue we're attachng this metric reader to the meter provider later.
|
||||
// if (this.metricReader) {
|
||||
// nodeSdkConfiguration.metricReader = this.metricReader;
|
||||
// }
|
||||
/*
|
||||
* We will skip this becasue we're attachng this metric reader to the meter provider later.
|
||||
* if (this.metricReader) {
|
||||
* nodeSdkConfiguration.metricReader = this.metricReader;
|
||||
* }
|
||||
*/
|
||||
|
||||
if (logRecordProcessor) {
|
||||
nodeSdkConfiguration.logRecordProcessor = logRecordProcessor;
|
||||
|
||||
@@ -194,8 +194,10 @@ export default class MicrosoftTeamsAuthAction {
|
||||
teamsUserId: string;
|
||||
projectId: ObjectID;
|
||||
}): Promise<ObjectID> {
|
||||
// Find a OneUptime user associated with this Teams user ID using WorkspaceUserAuthToken table
|
||||
// This table is populated when users authenticate with Microsoft Teams through the OAuth flow
|
||||
/*
|
||||
* Find a OneUptime user associated with this Teams user ID using WorkspaceUserAuthToken table
|
||||
* This table is populated when users authenticate with Microsoft Teams through the OAuth flow
|
||||
*/
|
||||
|
||||
try {
|
||||
// Look up the user in the WorkspaceUserAuthToken table
|
||||
|
||||
@@ -97,8 +97,10 @@ export default class MicrosoftTeamsIncidentActions {
|
||||
return await this.showNewIncidentCard(data);
|
||||
|
||||
case MicrosoftTeamsIncidentActionType.SubmitNewIncident:
|
||||
// This is handled by handleBotIncidentAction through bot framework
|
||||
// Don't process it here to avoid duplicate messages
|
||||
/*
|
||||
* This is handled by handleBotIncidentAction through bot framework
|
||||
* Don't process it here to avoid duplicate messages
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -902,8 +904,10 @@ export default class MicrosoftTeamsIncidentActions {
|
||||
teamsRequest.projectId,
|
||||
);
|
||||
|
||||
// Send card as a message (note: in real Teams bot, this would be sent via TurnContext)
|
||||
// For now, we'll just log it. The actual sending will be done through the bot framework
|
||||
/*
|
||||
* Send card as a message (note: in real Teams bot, this would be sent via TurnContext)
|
||||
* For now, we'll just log it. The actual sending will be done through the bot framework
|
||||
*/
|
||||
logger.debug("New incident card built:");
|
||||
logger.debug(JSON.stringify(card, null, 2));
|
||||
}
|
||||
|
||||
@@ -78,8 +78,10 @@ export default class MicrosoftTeamsScheduledMaintenanceActions {
|
||||
return await this.showNewScheduledMaintenanceCard(data);
|
||||
|
||||
case MicrosoftTeamsScheduledMaintenanceActionType.SubmitNewScheduledMaintenance:
|
||||
// This is handled by handleBotScheduledMaintenanceAction through bot framework
|
||||
// Don't process it here to avoid duplicate messages
|
||||
/*
|
||||
* This is handled by handleBotScheduledMaintenanceAction through bot framework
|
||||
* Don't process it here to avoid duplicate messages
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -603,8 +605,10 @@ export default class MicrosoftTeamsScheduledMaintenanceActions {
|
||||
teamsRequest.projectId,
|
||||
);
|
||||
|
||||
// Send card as a message (note: in real Teams bot, this would be sent via TurnContext)
|
||||
// For now, we'll just log it. The actual sending will be done through the bot framework
|
||||
/*
|
||||
* Send card as a message (note: in real Teams bot, this would be sent via TurnContext)
|
||||
* For now, we'll just log it. The actual sending will be done through the bot framework
|
||||
*/
|
||||
logger.debug("New scheduled maintenance card built:");
|
||||
logger.debug(JSON.stringify(card, null, 2));
|
||||
}
|
||||
|
||||
@@ -32,13 +32,15 @@ export default class MicrosoftTeamsAlertMessages {
|
||||
|
||||
blockMicrosoftTeams.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge alert
|
||||
// Resolve data.
|
||||
// Change Alert State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge alert
|
||||
* Resolve data.
|
||||
* Change Alert State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -32,13 +32,15 @@ export default class MicrosoftTeamsIncidentMessages {
|
||||
|
||||
blockMicrosoftTeams.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge incident
|
||||
// Resolve data.
|
||||
// Change Incident State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge incident
|
||||
* Resolve data.
|
||||
* Change Incident State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -32,13 +32,15 @@ export default class MicrosoftTeamsScheduledMaintenanceMessages {
|
||||
|
||||
blockMicrosoftTeams.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge scheduledMaintenance
|
||||
// Resolve data.
|
||||
// Change ScheduledMaintenance State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge scheduledMaintenance
|
||||
* Resolve data.
|
||||
* Change ScheduledMaintenance State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -342,10 +342,12 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
||||
actionType: MicrosoftTeamsActionType;
|
||||
actionValue: string;
|
||||
} {
|
||||
// Support multiple shapes that Teams may send for Adaptive Card submits
|
||||
// 1) { action: "ack-incident", actionValue: "<id>" }
|
||||
// 2) { data: { action: "ack-incident", actionValue: "<id>" } }
|
||||
// 3) { action: { type: "Action.Submit", data: { action: "ack-incident", actionValue: "<id>" } } }
|
||||
/*
|
||||
* Support multiple shapes that Teams may send for Adaptive Card submits
|
||||
* 1) { action: "ack-incident", actionValue: "<id>" }
|
||||
* 2) { data: { action: "ack-incident", actionValue: "<id>" } }
|
||||
* 3) { action: { type: "Action.Submit", data: { action: "ack-incident", actionValue: "<id>" } } }
|
||||
*/
|
||||
let actionType: string = (value["action"] as string) || "";
|
||||
let actionValue: string = (value["actionValue"] as string) || "";
|
||||
|
||||
@@ -376,8 +378,10 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
||||
}
|
||||
|
||||
private static buildMessageCardFromMarkdown(markdown: string): JSONObject {
|
||||
// Teams MessageCard has limited markdown support. Headings like '##' are not supported
|
||||
// and single newlines can collapse. Convert common patterns to a structured card.
|
||||
/*
|
||||
* Teams MessageCard has limited markdown support. Headings like '##' are not supported
|
||||
* and single newlines can collapse. Convert common patterns to a structured card.
|
||||
*/
|
||||
const lines: Array<string> = markdown
|
||||
.split("\n")
|
||||
.map((l: string) => {
|
||||
|
||||
@@ -757,8 +757,10 @@ export default class SlackAlertActions {
|
||||
}
|
||||
|
||||
if (actionType === SlackActionType.ViewAlert) {
|
||||
// do nothing. This is just a view alert action.
|
||||
// clear response.
|
||||
/*
|
||||
* do nothing. This is just a view alert action.
|
||||
* clear response.
|
||||
*/
|
||||
return Response.sendJsonObjectResponse(data.req, data.res, {
|
||||
response_action: "clear",
|
||||
});
|
||||
|
||||
@@ -42,8 +42,10 @@ export interface SlackRequest {
|
||||
|
||||
const slackActionTypesThatDoNotRequireUserSlackAccountToBeConnectedToOneUptime: Array<SlackActionType> =
|
||||
[
|
||||
// anyone in the company can create incident.
|
||||
// regardless of whether they are connected to OneUptime or not.
|
||||
/*
|
||||
* anyone in the company can create incident.
|
||||
* regardless of whether they are connected to OneUptime or not.
|
||||
*/
|
||||
SlackActionType.NewIncident,
|
||||
SlackActionType.SubmitNewIncident,
|
||||
SlackActionType.ViewIncident,
|
||||
|
||||
@@ -258,14 +258,16 @@ export default class SlackIncidentActions {
|
||||
// send response to clear the action.
|
||||
Response.sendTextResponse(data.req, data.res, "");
|
||||
|
||||
// show new incident modal.
|
||||
// new incident modal is :
|
||||
// Incident Title (this can be prefilled with actionValue)
|
||||
// Incident Description
|
||||
// Incident Severity (dropdown) (single select)
|
||||
// Monitors (dropdown) (miltiselect)
|
||||
// Change Monitor Status to (dropdown) (single select)
|
||||
// Labels (dropdown) (multiselect)
|
||||
/*
|
||||
* show new incident modal.
|
||||
* new incident modal is :
|
||||
* Incident Title (this can be prefilled with actionValue)
|
||||
* Incident Description
|
||||
* Incident Severity (dropdown) (single select)
|
||||
* Monitors (dropdown) (miltiselect)
|
||||
* Change Monitor Status to (dropdown) (single select)
|
||||
* Labels (dropdown) (multiselect)
|
||||
*/
|
||||
|
||||
const incidentTitle: WorkspaceTextBoxBlock = {
|
||||
_type: "WorkspaceTextBoxBlock",
|
||||
@@ -1267,8 +1269,10 @@ export default class SlackIncidentActions {
|
||||
}
|
||||
|
||||
if (actionType === SlackActionType.ViewIncident) {
|
||||
// do nothing. This is just a view incident action.
|
||||
// clear response.
|
||||
/*
|
||||
* do nothing. This is just a view incident action.
|
||||
* clear response.
|
||||
*/
|
||||
return Response.sendJsonObjectResponse(data.req, data.res, {
|
||||
response_action: "clear",
|
||||
});
|
||||
|
||||
@@ -31,8 +31,10 @@ export default class SlackMonitorActions {
|
||||
const actionType: SlackActionType | undefined = data.action.actionType;
|
||||
|
||||
if (actionType === SlackActionType.ViewMonitor) {
|
||||
// do nothing. This is just a view Monitor action.
|
||||
// clear response.
|
||||
/*
|
||||
* do nothing. This is just a view Monitor action.
|
||||
* clear response.
|
||||
*/
|
||||
return Response.sendJsonObjectResponse(data.req, data.res, {
|
||||
response_action: "clear",
|
||||
});
|
||||
|
||||
@@ -31,8 +31,10 @@ export default class SlackOnCallDutyActions {
|
||||
const actionType: SlackActionType | undefined = data.action.actionType;
|
||||
|
||||
if (actionType === SlackActionType.ViewOnCallPolicy) {
|
||||
// do nothing. This is just a view alert action.
|
||||
// clear response.
|
||||
/*
|
||||
* do nothing. This is just a view alert action.
|
||||
* clear response.
|
||||
*/
|
||||
return Response.sendJsonObjectResponse(data.req, data.res, {
|
||||
response_action: "clear",
|
||||
});
|
||||
|
||||
@@ -313,14 +313,16 @@ export default class SlackScheduledMaintenanceActions {
|
||||
// send response to clear the action.
|
||||
Response.sendTextResponse(data.req, data.res, "");
|
||||
|
||||
// show new scheduledMaintenance modal.
|
||||
// new scheduledMaintenance modal is :
|
||||
// ScheduledMaintenance Title (this can be prefilled with actionValue)
|
||||
// ScheduledMaintenance Description
|
||||
// Start Date and Time (date picker)
|
||||
// End Date and Time (date picker)
|
||||
// Monitors (dropdown) (miltiselect)
|
||||
// Change Monitor Status to (dropdown) (single select)
|
||||
/*
|
||||
* show new scheduledMaintenance modal.
|
||||
* new scheduledMaintenance modal is :
|
||||
* ScheduledMaintenance Title (this can be prefilled with actionValue)
|
||||
* ScheduledMaintenance Description
|
||||
* Start Date and Time (date picker)
|
||||
* End Date and Time (date picker)
|
||||
* Monitors (dropdown) (miltiselect)
|
||||
* Change Monitor Status to (dropdown) (single select)
|
||||
*/
|
||||
|
||||
// Labels (dropdown) (multiselect)
|
||||
|
||||
@@ -1092,8 +1094,10 @@ export default class SlackScheduledMaintenanceActions {
|
||||
}
|
||||
|
||||
if (actionType === SlackActionType.ViewScheduledMaintenance) {
|
||||
// do nothing. This is just a view scheduledMaintenance action.
|
||||
// clear response.
|
||||
/*
|
||||
* do nothing. This is just a view scheduledMaintenance action.
|
||||
* clear response.
|
||||
*/
|
||||
return Response.sendJsonObjectResponse(data.req, data.res, {
|
||||
response_action: "clear",
|
||||
});
|
||||
|
||||
@@ -32,13 +32,15 @@ export default class SlackAlertMessages {
|
||||
|
||||
blockSlack.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge alert
|
||||
// Resolve data.
|
||||
// Change Alert State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge alert
|
||||
* Resolve data.
|
||||
* Change Alert State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -32,13 +32,15 @@ export default class SlackIncidentMessages {
|
||||
|
||||
blockSlack.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge incident
|
||||
// Resolve data.
|
||||
// Change Incident State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge incident
|
||||
* Resolve data.
|
||||
* Change Incident State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -31,13 +31,15 @@ export default class SlackMonitorMessages {
|
||||
|
||||
blockSlack.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge Monitor
|
||||
// Resolve data.
|
||||
// Change Monitor State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge Monitor
|
||||
* Resolve data.
|
||||
* Change Monitor State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -32,13 +32,15 @@ export default class SlackScheduledMaintenanceMessages {
|
||||
|
||||
blockSlack.push(dividerBlock);
|
||||
|
||||
// now add buttons.
|
||||
// View data.
|
||||
// Execute On Call
|
||||
// Acknowledge scheduledMaintenance
|
||||
// Resolve data.
|
||||
// Change ScheduledMaintenance State.
|
||||
// Add Note.
|
||||
/*
|
||||
* now add buttons.
|
||||
* View data.
|
||||
* Execute On Call
|
||||
* Acknowledge scheduledMaintenance
|
||||
* Resolve data.
|
||||
* Change ScheduledMaintenance State.
|
||||
* Add Note.
|
||||
*/
|
||||
|
||||
const buttons: Array<WorkspaceMessagePayloadButton> = [];
|
||||
|
||||
|
||||
@@ -740,58 +740,70 @@ describe("BaseAPI", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// describe('createItem', () => {
|
||||
// let createRequest: OneUptimeRequest;
|
||||
// let createResponse: ExpressResponse;
|
||||
// let savedItem: BaseModel;
|
||||
/*
|
||||
* describe('createItem', () => {
|
||||
* let createRequest: OneUptimeRequest;
|
||||
* let createResponse: ExpressResponse;
|
||||
* let savedItem: BaseModel;
|
||||
*/
|
||||
|
||||
// beforeEach(() => {
|
||||
// createRequest = {
|
||||
// body: {
|
||||
// data: { version: '1' },
|
||||
// miscDataProps: { additional: 'info' },
|
||||
// },
|
||||
// headers: {},
|
||||
// } as unknown as OneUptimeRequest;
|
||||
/*
|
||||
* beforeEach(() => {
|
||||
* createRequest = {
|
||||
* body: {
|
||||
* data: { version: '1' },
|
||||
* miscDataProps: { additional: 'info' },
|
||||
* },
|
||||
* headers: {},
|
||||
* } as unknown as OneUptimeRequest;
|
||||
*/
|
||||
|
||||
// createResponse = {
|
||||
// status: jest.fn().mockReturnThis(),
|
||||
// json: jest.fn().mockReturnThis(),
|
||||
// send: jest.fn().mockReturnThis(),
|
||||
// } as unknown as ExpressResponse;
|
||||
/*
|
||||
* createResponse = {
|
||||
* status: jest.fn().mockReturnThis(),
|
||||
* json: jest.fn().mockReturnThis(),
|
||||
* send: jest.fn().mockReturnThis(),
|
||||
* } as unknown as ExpressResponse;
|
||||
*/
|
||||
|
||||
// savedItem = new BaseModel();
|
||||
// });
|
||||
/*
|
||||
* savedItem = new BaseModel();
|
||||
* });
|
||||
*/
|
||||
|
||||
// it('should call onBeforeCreate lifecycle method', async () => {
|
||||
// const onBeforeCreateSpy: jest.SpyInstance = jest.spyOn(
|
||||
// baseApiInstance as any,
|
||||
// 'onBeforeCreate'
|
||||
// );
|
||||
// await baseApiInstance.createItem(createRequest, createResponse);
|
||||
// expect(onBeforeCreateSpy).toHaveBeenCalledWith(
|
||||
// createRequest,
|
||||
// createResponse
|
||||
// );
|
||||
// });
|
||||
/*
|
||||
* it('should call onBeforeCreate lifecycle method', async () => {
|
||||
* const onBeforeCreateSpy: jest.SpyInstance = jest.spyOn(
|
||||
* baseApiInstance as any,
|
||||
* 'onBeforeCreate'
|
||||
* );
|
||||
* await baseApiInstance.createItem(createRequest, createResponse);
|
||||
* expect(onBeforeCreateSpy).toHaveBeenCalledWith(
|
||||
* createRequest,
|
||||
* createResponse
|
||||
* );
|
||||
* });
|
||||
*/
|
||||
|
||||
// it('should return EntityResponse with the saved item', async () => {
|
||||
// jest.spyOn(baseApiInstance.service, 'create').mockResolvedValue(
|
||||
// savedItem
|
||||
// );
|
||||
// await baseApiInstance.createItem(createRequest, createResponse);
|
||||
// const sendEntityResponseSpy: jest.SpyInstance = jest.spyOn(
|
||||
// Response as any,
|
||||
// 'sendEntityResponse'
|
||||
// );
|
||||
// expect(sendEntityResponseSpy).toHaveBeenCalledWith(
|
||||
// createRequest,
|
||||
// createResponse,
|
||||
// savedItem,
|
||||
// BaseModel
|
||||
// );
|
||||
// });
|
||||
// });
|
||||
/*
|
||||
* it('should return EntityResponse with the saved item', async () => {
|
||||
* jest.spyOn(baseApiInstance.service, 'create').mockResolvedValue(
|
||||
* savedItem
|
||||
* );
|
||||
* await baseApiInstance.createItem(createRequest, createResponse);
|
||||
* const sendEntityResponseSpy: jest.SpyInstance = jest.spyOn(
|
||||
* Response as any,
|
||||
* 'sendEntityResponse'
|
||||
* );
|
||||
* expect(sendEntityResponseSpy).toHaveBeenCalledWith(
|
||||
* createRequest,
|
||||
* createResponse,
|
||||
* savedItem,
|
||||
* BaseModel
|
||||
* );
|
||||
* });
|
||||
* });
|
||||
*/
|
||||
|
||||
describe("getRouter", () => {
|
||||
it("should return an ExpressRouter instance", () => {
|
||||
|
||||
@@ -343,10 +343,12 @@ describe("TeamMemberService", () => {
|
||||
"refreshTokens",
|
||||
);
|
||||
|
||||
// const updateSeatsSpy: jest.SpyInstance = jest.spyOn(
|
||||
// TeamMemberService,
|
||||
// "updateSubscriptionSeatsByUniqueTeamMembersInProject",
|
||||
// );
|
||||
/*
|
||||
* const updateSeatsSpy: jest.SpyInstance = jest.spyOn(
|
||||
* TeamMemberService,
|
||||
* "updateSubscriptionSeatsByUniqueTeamMembersInProject",
|
||||
* );
|
||||
*/
|
||||
|
||||
const user: User = await UserService.create({
|
||||
data: UserServiceHelper.generateRandomUser(),
|
||||
@@ -741,8 +743,10 @@ describe("TeamMemberService", () => {
|
||||
|
||||
describe("getUniqueTeamMemberCountInProject", () => {
|
||||
it("should return the count of unique team members in a project", async () => {
|
||||
// make findBy to return 4 team members: 1 normal, 2 with the same id and 1 without a user ID
|
||||
// total should be 2 unique team members
|
||||
/*
|
||||
* make findBy to return 4 team members: 1 normal, 2 with the same id and 1 without a user ID
|
||||
* total should be 2 unique team members
|
||||
*/
|
||||
|
||||
const user: User = await UserServiceHelper.genrateAndSaveRandomUser(
|
||||
null,
|
||||
@@ -839,9 +843,11 @@ describe("TeamMemberService", () => {
|
||||
|
||||
describe("getUsersInTeam(s)", () => {
|
||||
it("should return users in specified team", async () => {
|
||||
// team A members: user1 & user2
|
||||
// team B members: user2 & user3
|
||||
// team C members: user 3
|
||||
/*
|
||||
* team A members: user1 & user2
|
||||
* team B members: user2 & user3
|
||||
* team C members: user 3
|
||||
*/
|
||||
|
||||
const user: User = await UserServiceHelper.genrateAndSaveRandomUser(
|
||||
null,
|
||||
@@ -966,9 +972,11 @@ describe("TeamMemberService", () => {
|
||||
});
|
||||
|
||||
it("should return users in multiple teams", async () => {
|
||||
// team A members: user1 & user2
|
||||
// team B members: user2 & user3
|
||||
// team C members: user 3
|
||||
/*
|
||||
* team A members: user1 & user2
|
||||
* team B members: user2 & user3
|
||||
* team C members: user 3
|
||||
*/
|
||||
|
||||
const user: User = await UserServiceHelper.genrateAndSaveRandomUser(
|
||||
null,
|
||||
|
||||
@@ -220,8 +220,10 @@ describe("LayerUtil getEvents - Daily Restrictions", () => {
|
||||
calendarEndDate: calendarEnd,
|
||||
});
|
||||
|
||||
// Expect two events: 23:00 -> 23:59:59 (approx) and 00:00 -> 11:00 next day (depending on trimming logic)
|
||||
// We simplify by checking presence of one starting at 23:00 and one ending at 11:00.
|
||||
/*
|
||||
* Expect two events: 23:00 -> 23:59:59 (approx) and 00:00 -> 11:00 next day (depending on trimming logic)
|
||||
* We simplify by checking presence of one starting at 23:00 and one ending at 11:00.
|
||||
*/
|
||||
expect(events.length).toBeGreaterThanOrEqual(2); // Expect at least two distinct segments across midnight.
|
||||
const has23Window: boolean = events.some((e: CalendarEvent) => {
|
||||
return OneUptimeDate.getLocalHourAndMinuteFromDate(e.start) === "23:00";
|
||||
@@ -436,8 +438,10 @@ describe("LayerUtil getEvents - Rotation Handoff", () => {
|
||||
return e.title;
|
||||
});
|
||||
|
||||
// Titles are user ids (strings we passed) according to implementation.
|
||||
// Check that at least first three rotate u1 -> u2 -> u3
|
||||
/*
|
||||
* Titles are user ids (strings we passed) according to implementation.
|
||||
* Check that at least first three rotate u1 -> u2 -> u3
|
||||
*/
|
||||
expect(userSequence.slice(0, 3)).toEqual(["u1", "u2", "u3"]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// Libraries
|
||||
// Custom components
|
||||
/*
|
||||
* Libraries
|
||||
* Custom components
|
||||
*/
|
||||
import DictionaryOfStrings, {
|
||||
ComponentProps,
|
||||
} from "../../../UI/Components/Dictionary/DictionaryOfStrings";
|
||||
|
||||
@@ -32,10 +32,12 @@ jest.mock("axios", () => {
|
||||
return Object.assign(jest.fn(), jest.requireActual("axios"));
|
||||
});
|
||||
|
||||
// Mock axios(config) top level function
|
||||
// Ignore type error
|
||||
// Property 'lastCall' is optional in type MockFunctionState but required in type MockContext
|
||||
// @ts-ignore
|
||||
/*
|
||||
* Mock axios(config) top level function
|
||||
* Ignore type error
|
||||
* Property 'lastCall' is optional in type MockFunctionState but required in type MockContext
|
||||
* @ts-ignore
|
||||
*/
|
||||
const mockedAxios: jest.MockedFunctionDeep<typeof axios> =
|
||||
jest.mocked<AxiosStatic>(axios);
|
||||
|
||||
@@ -342,8 +344,10 @@ interface HTTPMethodType {
|
||||
method: HTTPMethod;
|
||||
}
|
||||
|
||||
// Set up table-driven tests for
|
||||
// .get(), .post(), .put(), .delete(), get(), post(), put(), delete()
|
||||
/*
|
||||
* Set up table-driven tests for
|
||||
* .get(), .post(), .put(), .delete(), get(), post(), put(), delete()
|
||||
*/
|
||||
const httpMethodTests: Array<HTTPMethodType> = [
|
||||
{
|
||||
name: "get",
|
||||
|
||||
@@ -11,9 +11,11 @@ export default class DatabaseCommonInteractionPropsUtil {
|
||||
props: DatabaseCommonInteractionProps,
|
||||
permissionType: PermissionType,
|
||||
): Array<UserPermission> {
|
||||
// Check first if the user has Global Permissions.
|
||||
// Global permissions includes all the tenantId user has access to.
|
||||
// and it includes all the global permissions that applies to all the tenant, like PUBLIC.
|
||||
/*
|
||||
* Check first if the user has Global Permissions.
|
||||
* Global permissions includes all the tenantId user has access to.
|
||||
* and it includes all the global permissions that applies to all the tenant, like PUBLIC.
|
||||
*/
|
||||
if (!props.userGlobalAccessPermission) {
|
||||
props.userGlobalAccessPermission = {
|
||||
globalPermissions: [Permission.Public],
|
||||
|
||||
@@ -18,9 +18,11 @@ export default class HTML {
|
||||
public static isHtml(text: string): boolean {
|
||||
// Check if the text is HTML
|
||||
|
||||
// Example usage const htmlString = '<div>Hello, World!</div>'; const notHtmlString = 'Just a regular string'
|
||||
// console.log(HTML.isHtml(htmlString)); // true
|
||||
// console.log(HTML.isHtml(notHtmlString)); // false
|
||||
/*
|
||||
* Example usage const htmlString = '<div>Hello, World!</div>'; const notHtmlString = 'Just a regular string'
|
||||
* console.log(HTML.isHtml(htmlString)); // true
|
||||
* console.log(HTML.isHtml(notHtmlString)); // false
|
||||
*/
|
||||
|
||||
const htmlPattern: RegExp = /<\/?[a-z][\s\S]*>/i;
|
||||
return htmlPattern.test(text);
|
||||
|
||||
@@ -27,11 +27,11 @@ export default class JSONFunctions {
|
||||
// obj could be in this format:
|
||||
|
||||
/**
|
||||
* {
|
||||
"http.url.protocol": "http",
|
||||
"http.url.hostname": "localhost",
|
||||
"http.host": "localhost",
|
||||
*/
|
||||
* {
|
||||
*"http.url.protocol": "http",
|
||||
*"http.url.hostname": "localhost",
|
||||
*"http.host": "localhost",
|
||||
*/
|
||||
|
||||
// we want to convert it to this format:
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@ export default interface MetricsQuery {
|
||||
aggegationType: MetricsAggregationType;
|
||||
aggregateBy: Dictionary<boolean>;
|
||||
|
||||
// This is used for example for probes.
|
||||
// To display US probe and EU probe in chart for example.
|
||||
// In this case groupByAttribute is "probeId"
|
||||
// and attributeValueToLegendMap is { "xx-xx-xx-xx": "US Probe", "yy-yyy-yyy-yy-yy": "EU Probe" }
|
||||
/*
|
||||
* This is used for example for probes.
|
||||
* To display US probe and EU probe in chart for example.
|
||||
* In this case groupByAttribute is "probeId"
|
||||
* and attributeValueToLegendMap is { "xx-xx-xx-xx": "US Probe", "yy-yyy-yyy-yy-yy": "EU Probe" }
|
||||
*/
|
||||
|
||||
groupByAttribute?: string | undefined;
|
||||
attributeValueToLegendMap?: Dictionary<string>;
|
||||
|
||||
@@ -69,12 +69,14 @@ export class MonitorTypeHelper {
|
||||
description:
|
||||
"This monitor type does the basic ping test of an endpoint.",
|
||||
},
|
||||
// {
|
||||
// monitorType: MonitorType.Kubernetes,
|
||||
// title: 'Kubernetes',
|
||||
// description:
|
||||
// 'This monitor types lets you monitor Kubernetes clusters.',
|
||||
// },
|
||||
/*
|
||||
* {
|
||||
* monitorType: MonitorType.Kubernetes,
|
||||
* title: 'Kubernetes',
|
||||
* description:
|
||||
* 'This monitor types lets you monitor Kubernetes clusters.',
|
||||
* },
|
||||
*/
|
||||
{
|
||||
monitorType: MonitorType.IP,
|
||||
title: "IP",
|
||||
|
||||
@@ -663,9 +663,11 @@ export default class LayerUtil {
|
||||
// if start time is after end time, we need to add one week to the end time
|
||||
|
||||
if (OneUptimeDate.isAfter(startTime, endTime)) {
|
||||
// in this case the restriction is towards the ends of the week and not in the middle so we need to add two objects to the array.
|
||||
// One for start of the week
|
||||
// and the other for end of the week .
|
||||
/*
|
||||
* in this case the restriction is towards the ends of the week and not in the middle so we need to add two objects to the array.
|
||||
* One for start of the week
|
||||
* and the other for end of the week .
|
||||
*/
|
||||
|
||||
const startOfWeek: Date = data.eventStartTime;
|
||||
// add 7 days to the end time to get the end of the week
|
||||
@@ -718,11 +720,13 @@ export default class LayerUtil {
|
||||
let restrictionStartTime: Date = dayRestrictionTimes.startTime;
|
||||
let restrictionEndTime: Date = dayRestrictionTimes.endTime;
|
||||
|
||||
// Special Case: Overnight (wrap-around) window where end time is logically on the next day.
|
||||
// Example: 23:00 -> 11:00 (next day). Existing algorithm assumed end >= start within same day
|
||||
// and returned no events. We explicitly expand such windows into two segments per day:
|
||||
// 1) start -> endOfDay(start)
|
||||
// 2) startOfNextDay -> end (moved to next day)
|
||||
/*
|
||||
* Special Case: Overnight (wrap-around) window where end time is logically on the next day.
|
||||
* Example: 23:00 -> 11:00 (next day). Existing algorithm assumed end >= start within same day
|
||||
* and returned no events. We explicitly expand such windows into two segments per day:
|
||||
* 1) start -> endOfDay(start)
|
||||
* 2) startOfNextDay -> end (moved to next day)
|
||||
*/
|
||||
if (OneUptimeDate.isBefore(restrictionEndTime, restrictionStartTime)) {
|
||||
const results: Array<StartAndEndTime> = [];
|
||||
|
||||
@@ -1012,9 +1016,11 @@ export default class LayerUtil {
|
||||
public removeOverlappingEvents(
|
||||
events: PriorityCalendarEvents[],
|
||||
): CalendarEvent[] {
|
||||
// now remove overlapping events by priority and trim them by priority. Lower priority number will be kept and higher priority number will be trimmed.
|
||||
// so if there are two events with the same start and end time, we will keep the one with the lower priority number and remove the one with the higher priority number.
|
||||
// if there are overlapping events, we will trim the one with the higher priority number.
|
||||
/*
|
||||
* now remove overlapping events by priority and trim them by priority. Lower priority number will be kept and higher priority number will be trimmed.
|
||||
* so if there are two events with the same start and end time, we will keep the one with the lower priority number and remove the one with the higher priority number.
|
||||
* if there are overlapping events, we will trim the one with the higher priority number.
|
||||
*/
|
||||
|
||||
// sort the events by priority
|
||||
|
||||
@@ -1078,14 +1084,18 @@ export default class LayerUtil {
|
||||
) {
|
||||
// if the current event has a higher priority than the final event, we need to trim the final event
|
||||
if (event.priority < finalEvent.priority) {
|
||||
// trim the final event based on the current event
|
||||
// end time of the final event will be the start time of the current event - 1 second
|
||||
/*
|
||||
* trim the final event based on the current event
|
||||
* end time of the final event will be the start time of the current event - 1 second
|
||||
*/
|
||||
const tempFinalEventEnd: Date = finalEvent.end;
|
||||
|
||||
finalEvent.end = OneUptimeDate.addRemoveSeconds(event.start, -1);
|
||||
|
||||
// check if the final event end time is before the start time of the current event
|
||||
// if it is, we need to remove the final event from the final events array
|
||||
/*
|
||||
* check if the final event end time is before the start time of the current event
|
||||
* if it is, we need to remove the final event from the final events array
|
||||
*/
|
||||
if (OneUptimeDate.isBefore(finalEvent.end, finalEvent.start)) {
|
||||
finalEvents.splice(i, 1);
|
||||
i--; // Adjust index after removal
|
||||
@@ -1115,8 +1125,10 @@ export default class LayerUtil {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// trim the current event based on the final event
|
||||
// start time of the current event will be the end time of the final event + 1 second
|
||||
/*
|
||||
* trim the current event based on the final event
|
||||
* start time of the current event will be the end time of the final event + 1 second
|
||||
*/
|
||||
event.start = OneUptimeDate.addRemoveSeconds(finalEvent.end, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,11 @@ export default class Phone extends DatabaseProperty {
|
||||
primaryPhoneNumberToPickFrom: Phone | string;
|
||||
seocndaryPhoneNumbersToPickFrom: Phone[] | string[];
|
||||
}): Phone {
|
||||
// convert all to string, so that we can compare them
|
||||
// if the country code matches in secondary phone numbers, then pick that number
|
||||
// if no country code matches, then pick the primary phone number and return it.
|
||||
/*
|
||||
* convert all to string, so that we can compare them
|
||||
* if the country code matches in secondary phone numbers, then pick that number
|
||||
* if no country code matches, then pick the primary phone number and return it.
|
||||
*/
|
||||
|
||||
const to: string =
|
||||
typeof data.to === "string" ? data.to : data.to.toString();
|
||||
|
||||
@@ -13,7 +13,9 @@ export default interface CreateChannelNotificationRule
|
||||
shouldInviteOwnersToNewChannel: boolean;
|
||||
newChannelTemplateName: string;
|
||||
|
||||
// if selected this would archive channel when incident, alert, scheduled maintenance reaches the last state (is resolved)
|
||||
// This would only archive the channel which was created.
|
||||
/*
|
||||
* if selected this would archive channel when incident, alert, scheduled maintenance reaches the last state (is resolved)
|
||||
* This would only archive the channel which was created.
|
||||
*/
|
||||
archiveChannelAutomatically: boolean;
|
||||
}
|
||||
|
||||
@@ -114,8 +114,10 @@ export default interface Field<TEntity> {
|
||||
|
||||
hideOptionalLabel?: boolean | undefined;
|
||||
|
||||
// Spell check configuration (primarily for Markdown and text fields)
|
||||
// Default: false (spell check enabled). Set to true to disable spell check.
|
||||
/*
|
||||
* Spell check configuration (primarily for Markdown and text fields)
|
||||
* Default: false (spell check enabled). Set to true to disable spell check.
|
||||
*/
|
||||
disableSpellCheck?: boolean | undefined;
|
||||
|
||||
getSummaryElement?: (item: FormValues<TEntity>) => ReactElement | undefined;
|
||||
|
||||
@@ -46,8 +46,10 @@ const JSONTable: FunctionComponent<JSONTableProps> = (
|
||||
JSONFunctions.nestJson(json),
|
||||
) as { [key: string]: any };
|
||||
|
||||
// Post-process flattened keys to group primitive arrays: prefix.0, prefix.1 => prefix: [v0, v1]
|
||||
// We ONLY group if all matching keys are simple (no deeper nesting like prefix.0.field)
|
||||
/*
|
||||
* Post-process flattened keys to group primitive arrays: prefix.0, prefix.1 => prefix: [v0, v1]
|
||||
* We ONLY group if all matching keys are simple (no deeper nesting like prefix.0.field)
|
||||
*/
|
||||
type GroupEntry = { index: number; value: unknown };
|
||||
type GroupMap = { [prefix: string]: Array<GroupEntry> };
|
||||
const groupMap: GroupMap = {};
|
||||
|
||||
@@ -224,9 +224,11 @@ export interface BaseTableProps<
|
||||
|
||||
formSummary?: FormSummaryConfig | undefined;
|
||||
|
||||
// this key is used to save table user preferences in local storage.
|
||||
// If you provide this key, the table will save the user preferences in local storage.
|
||||
// If you do not provide this key, the table will not save the user preferences in local storage.
|
||||
/*
|
||||
* this key is used to save table user preferences in local storage.
|
||||
* If you provide this key, the table will save the user preferences in local storage.
|
||||
* If you do not provide this key, the table will not save the user preferences in local storage.
|
||||
*/
|
||||
userPreferencesKey: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +132,10 @@ const SideMenu: FunctionComponent<ComponentProps> = (props: ComponentProps) => {
|
||||
|
||||
// Re-run active item detection when location changes
|
||||
useEffect(() => {
|
||||
// This will trigger a re-render when navigation changes
|
||||
// The activeItem will be recalculated
|
||||
/*
|
||||
* This will trigger a re-render when navigation changes
|
||||
* The activeItem will be recalculated
|
||||
*/
|
||||
}, [Navigation.getCurrentPath().toString()]);
|
||||
|
||||
// Render function for the menu content
|
||||
|
||||
@@ -35,32 +35,44 @@ const SideMenuItem: FunctionComponent<ComponentProps> = (
|
||||
subItemLinkClassName = `bg-gray-100 text-indigo-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
}
|
||||
|
||||
// if(props.badge && props.badge > 0){
|
||||
// if(props.badgeType === BadgeType.DANGER){
|
||||
// linkClassName = `text-red-400 hover:text-red-600 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
/*
|
||||
* if(props.badge && props.badge > 0){
|
||||
* if(props.badgeType === BadgeType.DANGER){
|
||||
* linkClassName = `text-red-400 hover:text-red-600 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
*/
|
||||
|
||||
// if(Navigation.isOnThisPage(props.link.to)){
|
||||
// linkClassName = `bg-gray-100 text-red-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
// }
|
||||
/*
|
||||
* if(Navigation.isOnThisPage(props.link.to)){
|
||||
* linkClassName = `bg-gray-100 text-red-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
* }
|
||||
*/
|
||||
|
||||
// }
|
||||
|
||||
// if(props.badgeType === BadgeType.WARNING){
|
||||
// linkClassName = `text-yellow-400 hover:text-yellow-600 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
/*
|
||||
* if(props.badgeType === BadgeType.WARNING){
|
||||
* linkClassName = `text-yellow-400 hover:text-yellow-600 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
*/
|
||||
|
||||
// if(Navigation.isOnThisPage(props.link.to)){
|
||||
// linkClassName = `bg-gray-100 text-yellow-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
// }
|
||||
// }
|
||||
/*
|
||||
* if(Navigation.isOnThisPage(props.link.to)){
|
||||
* linkClassName = `bg-gray-100 text-yellow-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
// if(props.badgeType === BadgeType.SUCCESS){
|
||||
// linkClassName = `text-emerald-400 hover:text-emerald-600 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
/*
|
||||
* if(props.badgeType === BadgeType.SUCCESS){
|
||||
* linkClassName = `text-emerald-400 hover:text-emerald-600 hover:bg-gray-100 group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
*/
|
||||
|
||||
// if(Navigation.isOnThisPage(props.link.to)){
|
||||
// linkClassName = `bg-gray-100 text-emerald-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
/*
|
||||
* if(Navigation.isOnThisPage(props.link.to)){
|
||||
* linkClassName = `bg-gray-100 text-emerald-600 hover:bg-white group rounded-md px-3 py-2 flex items-center text-sm font-medium`;
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
let iconClassName: string =
|
||||
"text-gray-400 group-hover:text-gray-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6";
|
||||
@@ -76,32 +88,44 @@ const SideMenuItem: FunctionComponent<ComponentProps> = (
|
||||
subItemIconClassName = "text-indigo-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6";
|
||||
}
|
||||
|
||||
// if(props.badge && props.badge > 0){
|
||||
// if(props.badgeType === BadgeType.DANGER){
|
||||
// iconClassName = `text-red-400 group-hover:text-red-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
/*
|
||||
* if(props.badge && props.badge > 0){
|
||||
* if(props.badgeType === BadgeType.DANGER){
|
||||
* iconClassName = `text-red-400 group-hover:text-red-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
*/
|
||||
|
||||
// if(Navigation.isOnThisPage(props.link.to)){
|
||||
// iconClassName = `text-red-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
// }
|
||||
/*
|
||||
* if(Navigation.isOnThisPage(props.link.to)){
|
||||
* iconClassName = `text-red-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
* }
|
||||
*/
|
||||
|
||||
// }
|
||||
|
||||
// if(props.badgeType === BadgeType.WARNING){
|
||||
// iconClassName = `text-yellow-400 group-hover:text-yellow-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
/*
|
||||
* if(props.badgeType === BadgeType.WARNING){
|
||||
* iconClassName = `text-yellow-400 group-hover:text-yellow-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
*/
|
||||
|
||||
// if(Navigation.isOnThisPage(props.link.to)){
|
||||
// iconClassName = `text-yellow-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
// }
|
||||
// }
|
||||
/*
|
||||
* if(Navigation.isOnThisPage(props.link.to)){
|
||||
* iconClassName = `text-yellow-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
// if(props.badgeType === BadgeType.SUCCESS){
|
||||
// iconClassName = `text-emerald-400 group-hover:text-emerald-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
/*
|
||||
* if(props.badgeType === BadgeType.SUCCESS){
|
||||
* iconClassName = `text-emerald-400 group-hover:text-emerald-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
*/
|
||||
|
||||
// if(Navigation.isOnThisPage(props.link.to)){
|
||||
// iconClassName = `text-emerald-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
/*
|
||||
* if(Navigation.isOnThisPage(props.link.to)){
|
||||
* iconClassName = `text-emerald-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6`;
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -98,9 +98,11 @@ class BaseAPI extends API {
|
||||
public static override handleError(
|
||||
error: HTTPErrorResponse | APIException,
|
||||
): HTTPErrorResponse | APIException {
|
||||
// 405 Status - Tenant not found. If Project was deleted.
|
||||
// 401 Status - User is not logged in.
|
||||
// 403 Status - Forbidden. If the IP address is not whitelisted (for example).
|
||||
/*
|
||||
* 405 Status - Tenant not found. If Project was deleted.
|
||||
* 401 Status - User is not logged in.
|
||||
* 403 Status - Forbidden. If the IP address is not whitelisted (for example).
|
||||
*/
|
||||
if (
|
||||
error instanceof HTTPErrorResponse &&
|
||||
(error.statusCode === 401 || error.statusCode === 405)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// ISO 3166-1 alpha-2 country codes and names.
|
||||
// Limited to widely recognized sovereign states and territories supported by Stripe.
|
||||
// If needed, expand or adjust for specific business logic.
|
||||
/*
|
||||
* ISO 3166-1 alpha-2 country codes and names.
|
||||
* Limited to widely recognized sovereign states and territories supported by Stripe.
|
||||
* If needed, expand or adjust for specific business logic.
|
||||
*/
|
||||
export interface CountryOption {
|
||||
value: string;
|
||||
label: string;
|
||||
|
||||
@@ -1157,8 +1157,10 @@ export class ModelSchema extends BaseSchema {
|
||||
data.disableOpenApiSchema || false,
|
||||
);
|
||||
|
||||
// Check if the column is required and make it optional if not
|
||||
// Also make columns with default values optional in create schemas
|
||||
/*
|
||||
* Check if the column is required and make it optional if not
|
||||
* Also make columns with default values optional in create schemas
|
||||
*/
|
||||
if (column.isDefaultValueColumn) {
|
||||
// should be optional
|
||||
zodType = zodType.optional();
|
||||
|
||||
@@ -339,8 +339,10 @@ export default class AddSpans extends CopilotActionBase {
|
||||
_data: CopilotProcess,
|
||||
inputCode: string,
|
||||
): Promise<CopilotActionPrompt> {
|
||||
// const fileLanguage: TechStack = data.input.files[data.input.currentFilePath]
|
||||
// ?.fileLanguage as TechStack;
|
||||
/*
|
||||
* const fileLanguage: TechStack = data.input.files[data.input.currentFilePath]
|
||||
* ?.fileLanguage as TechStack;
|
||||
*/
|
||||
|
||||
const fileLanguage: TechStack = TechStack.TypeScript;
|
||||
|
||||
@@ -383,11 +385,13 @@ export default class AddSpans extends CopilotActionBase {
|
||||
inputCode: string;
|
||||
outputCode: string;
|
||||
}): Promise<string> {
|
||||
// this code contains text as well. The code is in betwen ```<type> and ```. Please extract the code and return it.
|
||||
// for example code can be in the format of
|
||||
// ```python
|
||||
// print("Hello World")
|
||||
// ```
|
||||
/*
|
||||
* this code contains text as well. The code is in betwen ```<type> and ```. Please extract the code and return it.
|
||||
* for example code can be in the format of
|
||||
* ```python
|
||||
* print("Hello World")
|
||||
* ```
|
||||
*/
|
||||
|
||||
// so the code to be extracted is print("Hello World")
|
||||
|
||||
|
||||
@@ -168,8 +168,10 @@ If you have any feedback or suggestions, please let us know. We would love to h
|
||||
|
||||
while (!isActionComplete) {
|
||||
if (!(await this.validateExecutionStep(processData))) {
|
||||
// execution step not valid
|
||||
// return data as it is
|
||||
/*
|
||||
* execution step not valid
|
||||
* return data as it is
|
||||
*/
|
||||
|
||||
return processData;
|
||||
}
|
||||
|
||||
@@ -358,8 +358,10 @@ export default class ImproveComments extends CopilotActionBase {
|
||||
_data: CopilotProcess,
|
||||
inputCode: string,
|
||||
): Promise<CopilotActionPrompt> {
|
||||
// const fileLanguage: TechStack = data.input.files[data.input.currentFilePath]
|
||||
// ?.fileLanguage as TechStack;
|
||||
/*
|
||||
* const fileLanguage: TechStack = data.input.files[data.input.currentFilePath]
|
||||
* ?.fileLanguage as TechStack;
|
||||
*/
|
||||
|
||||
const fileLanguage: TechStack = TechStack.TypeScript;
|
||||
|
||||
@@ -402,11 +404,13 @@ export default class ImproveComments extends CopilotActionBase {
|
||||
inputCode: string;
|
||||
outputCode: string;
|
||||
}): Promise<string> {
|
||||
// this code contains text as well. The code is in betwen ```<type> and ```. Please extract the code and return it.
|
||||
// for example code can be in the format of
|
||||
// ```python
|
||||
// print("Hello World")
|
||||
// ```
|
||||
/*
|
||||
* this code contains text as well. The code is in betwen ```<type> and ```. Please extract the code and return it.
|
||||
* for example code can be in the format of
|
||||
* ```python
|
||||
* print("Hello World")
|
||||
* ```
|
||||
*/
|
||||
|
||||
// so the code to be extracted is print("Hello World")
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@ const ComponentSettingsSideOver: FunctionComponent<ComponentProps> = (
|
||||
},
|
||||
) as DashboardBaseComponent;
|
||||
|
||||
// const [hasFormValidationErrors, setHasFormValidationErrors] = useState<
|
||||
// Dictionary<boolean>
|
||||
// >({});
|
||||
/*
|
||||
* const [hasFormValidationErrors, setHasFormValidationErrors] = useState<
|
||||
* Dictionary<boolean>
|
||||
* >({});
|
||||
*/
|
||||
|
||||
const [showDeleteConfirmation, setShowDeleteConfirmation] =
|
||||
useState<boolean>(false);
|
||||
@@ -84,9 +86,11 @@ const ComponentSettingsSideOver: FunctionComponent<ComponentProps> = (
|
||||
|
||||
<ArgumentsForm
|
||||
component={component}
|
||||
// onHasFormValidationErrors={(values: Dictionary<boolean>) => {
|
||||
// setHasFormValidationErrors(values);
|
||||
// }}
|
||||
/*
|
||||
* onHasFormValidationErrors={(values: Dictionary<boolean>) => {
|
||||
* setHasFormValidationErrors(values);
|
||||
* }}
|
||||
*/
|
||||
onFormChange={(component: DashboardBaseComponent) => {
|
||||
props.onComponentUpdate(component);
|
||||
}}
|
||||
|
||||
@@ -42,15 +42,17 @@ const MonitorCriteriaAlertsForm: FunctionComponent<ComponentProps> = (
|
||||
alertSeverityDropdownOptions={props.alertSeverityDropdownOptions}
|
||||
onCallPolicyDropdownOptions={props.onCallPolicyDropdownOptions}
|
||||
initialValue={i}
|
||||
// onDelete={() => {
|
||||
// // remove the criteria filter
|
||||
// const index: number = alerts.indexOf(i);
|
||||
// const newAlerts: Array<CriteriaAlert> = [
|
||||
// ...alerts,
|
||||
// ];
|
||||
// newAlerts.splice(index, 1);
|
||||
// setAlerts(newAlerts);
|
||||
// }}
|
||||
/*
|
||||
* onDelete={() => {
|
||||
* // remove the criteria filter
|
||||
* const index: number = alerts.indexOf(i);
|
||||
* const newAlerts: Array<CriteriaAlert> = [
|
||||
* ...alerts,
|
||||
* ];
|
||||
* newAlerts.splice(index, 1);
|
||||
* setAlerts(newAlerts);
|
||||
* }}
|
||||
*/
|
||||
onChange={(value: CriteriaAlert) => {
|
||||
const index: number = alerts.indexOf(i);
|
||||
const newAlerts: Array<CriteriaAlert> = [...alerts];
|
||||
|
||||
@@ -42,15 +42,17 @@ const MonitorCriteriaIncidentsForm: FunctionComponent<ComponentProps> = (
|
||||
}
|
||||
onCallPolicyDropdownOptions={props.onCallPolicyDropdownOptions}
|
||||
initialValue={i}
|
||||
// onDelete={() => {
|
||||
// // remove the criteria filter
|
||||
// const index: number = incidents.indexOf(i);
|
||||
// const newIncidents: Array<CriteriaIncident> = [
|
||||
// ...incidents,
|
||||
// ];
|
||||
// newIncidents.splice(index, 1);
|
||||
// setIncidents(newIncidents);
|
||||
// }}
|
||||
/*
|
||||
* onDelete={() => {
|
||||
* // remove the criteria filter
|
||||
* const index: number = incidents.indexOf(i);
|
||||
* const newIncidents: Array<CriteriaIncident> = [
|
||||
* ...incidents,
|
||||
* ];
|
||||
* newIncidents.splice(index, 1);
|
||||
* setIncidents(newIncidents);
|
||||
* }}
|
||||
*/
|
||||
onChange={(value: CriteriaIncident) => {
|
||||
const index: number = incidents.indexOf(i);
|
||||
const newIncidents: Array<CriteriaIncident> = [...incidents];
|
||||
|
||||
@@ -236,31 +236,35 @@ const MonitorStepsElement: FunctionComponent<ComponentProps> = (
|
||||
onCallPolicyDropdownOptions={onCallPolicyDropdownOptions}
|
||||
value={i}
|
||||
probes={probes}
|
||||
// onDelete={() => {
|
||||
// // remove the criteria filter
|
||||
// const index: number | undefined =
|
||||
// monitorSteps.data?.monitorStepsInstanceArray.findIndex((item: MonitorStep) => {
|
||||
// return item.data?.id === value.data?.id;
|
||||
// })
|
||||
/*
|
||||
* onDelete={() => {
|
||||
* // remove the criteria filter
|
||||
* const index: number | undefined =
|
||||
* monitorSteps.data?.monitorStepsInstanceArray.findIndex((item: MonitorStep) => {
|
||||
* return item.data?.id === value.data?.id;
|
||||
* })
|
||||
*/
|
||||
|
||||
// if (index === undefined) {
|
||||
// return;
|
||||
// }
|
||||
// const newMonitorSteps: Array<MonitorStep> = [
|
||||
// ...(monitorSteps.data
|
||||
// ?.monitorStepsInstanceArray || []),
|
||||
// ];
|
||||
// newMonitorSteps.splice(index, 1);
|
||||
// setMonitorSteps(
|
||||
// new MonitorSteps().fromJSON({
|
||||
// _type: 'MonitorSteps',
|
||||
// value: {
|
||||
// monitorStepsInstanceArray:
|
||||
// newMonitorSteps,
|
||||
// },
|
||||
// })
|
||||
// );
|
||||
// }}
|
||||
/*
|
||||
* if (index === undefined) {
|
||||
* return;
|
||||
* }
|
||||
* const newMonitorSteps: Array<MonitorStep> = [
|
||||
* ...(monitorSteps.data
|
||||
* ?.monitorStepsInstanceArray || []),
|
||||
* ];
|
||||
* newMonitorSteps.splice(index, 1);
|
||||
* setMonitorSteps(
|
||||
* new MonitorSteps().fromJSON({
|
||||
* _type: 'MonitorSteps',
|
||||
* value: {
|
||||
* monitorStepsInstanceArray:
|
||||
* newMonitorSteps,
|
||||
* },
|
||||
* })
|
||||
* );
|
||||
* }}
|
||||
*/
|
||||
onChange={(value: MonitorStep) => {
|
||||
const index: number | undefined =
|
||||
monitorSteps.data?.monitorStepsInstanceArray.findIndex(
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import PageMap from "../../Utils/PageMap";
|
||||
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
|
||||
// import SearchBox from './SearchBox';
|
||||
// import Notifications from './Notifications';
|
||||
/*
|
||||
* import SearchBox from './SearchBox';
|
||||
* import Notifications from './Notifications';
|
||||
*/
|
||||
import Help from "./Help";
|
||||
import Logo from "./Logo";
|
||||
import ProjectPicker from "./ProjectPicker";
|
||||
|
||||
@@ -151,16 +151,20 @@ const OnCallPolicyLogTable: FunctionComponent<ComponentProps> = (
|
||||
let startDate: Date = log.startsAt!;
|
||||
let endDate: Date = log.endsAt || OneUptimeDate.getCurrentDate();
|
||||
|
||||
// if end date is mroe than the end date selected in the range, then
|
||||
// set the end date to the end date selected in the range
|
||||
/*
|
||||
* if end date is mroe than the end date selected in the range, then
|
||||
* set the end date to the end date selected in the range
|
||||
*/
|
||||
if (
|
||||
OneUptimeDate.isAfter(endDate, pickedStartAndEndDate.endValue)
|
||||
) {
|
||||
endDate = pickedStartAndEndDate.endValue;
|
||||
}
|
||||
|
||||
// if start date is less than the start date selected in the range, then
|
||||
// set the start date to the start date selected in the range
|
||||
/*
|
||||
* if start date is less than the start date selected in the range, then
|
||||
* set the start date to the start date selected in the range
|
||||
*/
|
||||
|
||||
if (
|
||||
OneUptimeDate.isBefore(
|
||||
|
||||
@@ -388,8 +388,10 @@ const TraceExplorer: FunctionComponent<ComponentProps> = (
|
||||
});
|
||||
}, []);
|
||||
|
||||
// Derived values for summary / filtering
|
||||
// Services involved in this trace only
|
||||
/*
|
||||
* Derived values for summary / filtering
|
||||
* Services involved in this trace only
|
||||
*/
|
||||
const servicesInTrace: TelemetryService[] = React.useMemo(() => {
|
||||
if (spans.length === 0) {
|
||||
return [];
|
||||
@@ -552,9 +554,11 @@ const TraceExplorer: FunctionComponent<ComponentProps> = (
|
||||
const numberOfDigitsInIntervalTemp: number = intervalTemp.toString().length;
|
||||
const interval: number = Math.pow(10, numberOfDigitsInIntervalTemp);
|
||||
|
||||
// Improved root span detection:
|
||||
// 1. Root if parentSpanId is null/undefined/empty string.
|
||||
// 2. Root if parentSpanId does not exist among spanIds (orphan) – common when trace is truncated.
|
||||
/*
|
||||
* Improved root span detection:
|
||||
* 1. Root if parentSpanId is null/undefined/empty string.
|
||||
* 2. Root if parentSpanId does not exist among spanIds (orphan) – common when trace is truncated.
|
||||
*/
|
||||
const allSpanIds: Set<string> = new Set(
|
||||
displaySpans
|
||||
.map((s: Span) => {
|
||||
@@ -591,9 +595,11 @@ const TraceExplorer: FunctionComponent<ComponentProps> = (
|
||||
},
|
||||
);
|
||||
|
||||
// Fallback: If after building hierarchy we only have 1 row but many spans, the
|
||||
// hierarchy likely failed (e.g., every span references a missing parent in a chain)
|
||||
// or produced an unhelpful single path. Display a flat list so user can still see all.
|
||||
/*
|
||||
* Fallback: If after building hierarchy we only have 1 row but many spans, the
|
||||
* hierarchy likely failed (e.g., every span references a missing parent in a chain)
|
||||
* or produced an unhelpful single path. Display a flat list so user can still see all.
|
||||
*/
|
||||
if (allRows.length === 1 && displaySpans.length > 10) {
|
||||
allRows = displaySpans.map((span: Span) => {
|
||||
const telemetryService: TelemetryService | undefined =
|
||||
|
||||
@@ -60,8 +60,10 @@ const CopilotDocuementationPage: FunctionComponent<
|
||||
return;
|
||||
}
|
||||
|
||||
// Send api request to get documentation
|
||||
// http://localhost/docs/copilot/introduction
|
||||
/*
|
||||
* Send api request to get documentation
|
||||
* http://localhost/docs/copilot/introduction
|
||||
*/
|
||||
|
||||
const documentation: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
||||
(await API.get({
|
||||
|
||||
@@ -24,13 +24,17 @@ const CheckoutForm: FunctionComponent<ComponentProps> = (
|
||||
event: Event,
|
||||
): Promise<void> => {
|
||||
event.preventDefault();
|
||||
// We don't want to let default form submission happen here,
|
||||
// which would refresh the page.
|
||||
/*
|
||||
* We don't want to let default form submission happen here,
|
||||
* which would refresh the page.
|
||||
*/
|
||||
event.preventDefault();
|
||||
|
||||
if (!stripe || !elements) {
|
||||
// Stripe.js has not yet loaded.
|
||||
// Make sure to disable form submission until Stripe.js has loaded.
|
||||
/*
|
||||
* Stripe.js has not yet loaded.
|
||||
* Make sure to disable form submission until Stripe.js has loaded.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,18 +47,22 @@ const CheckoutForm: FunctionComponent<ComponentProps> = (
|
||||
});
|
||||
|
||||
if (error) {
|
||||
// This point will only be reached if there is an immediate error when
|
||||
// confirming the payment. Show error to your customer (for example, payment
|
||||
// details incomplete)
|
||||
/*
|
||||
* This point will only be reached if there is an immediate error when
|
||||
* confirming the payment. Show error to your customer (for example, payment
|
||||
* details incomplete)
|
||||
*/
|
||||
|
||||
props.onError(
|
||||
error.message?.toString() ||
|
||||
"Unknown error with your payemnt provider.",
|
||||
);
|
||||
} else {
|
||||
// Your customer will be redirected to your `return_url`. For some payment
|
||||
// methods like iDEAL, your customer will be redirected to an indeterminate
|
||||
// site first to authorize the payment, then redirected to the `return_url`.
|
||||
/*
|
||||
* Your customer will be redirected to your `return_url`. For some payment
|
||||
* methods like iDEAL, your customer will be redirected to an indeterminate
|
||||
* site first to authorize the payment, then redirected to the `return_url`.
|
||||
*/
|
||||
props.onSuccess();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -28,8 +28,10 @@ type GetTemplateFormFieldsFunction = (data: {
|
||||
export const getTemplateFormFields: GetTemplateFormFieldsFunction = (data: {
|
||||
isViewPage: boolean;
|
||||
}): ModelField<ScheduledMaintenanceTemplate>[] => {
|
||||
// if its the view page then ignore the owner fields
|
||||
// because they are already on the table in the view page.
|
||||
/*
|
||||
* if its the view page then ignore the owner fields
|
||||
* because they are already on the table in the view page.
|
||||
*/
|
||||
|
||||
let fields: ModelField<ScheduledMaintenanceTemplate>[] = [
|
||||
{
|
||||
@@ -345,8 +347,10 @@ type GetFormStepsFunction = (data: {
|
||||
export const getFormSteps: GetFormStepsFunction = (data: {
|
||||
isViewPage: boolean;
|
||||
}): Array<FormStep<ScheduledMaintenanceTemplate>> => {
|
||||
// if its the view page then ignore the owner fields
|
||||
// because they are already on the table in the view page.
|
||||
/*
|
||||
* if its the view page then ignore the owner fields
|
||||
* because they are already on the table in the view page.
|
||||
*/
|
||||
|
||||
const steps: Array<FormStep<ScheduledMaintenanceTemplate>> = [
|
||||
{
|
||||
|
||||
@@ -54,32 +54,38 @@ export default defineConfig({
|
||||
use: { ...devices["Desktop Firefox"] },
|
||||
},
|
||||
/* Test against mobile viewports. */
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
// use: { ...devices['iPhone 12'] },
|
||||
// },
|
||||
/*
|
||||
* {
|
||||
* name: 'Mobile Chrome',
|
||||
* use: { ...devices['Pixel 5'] },
|
||||
* },
|
||||
* {
|
||||
* name: 'Mobile Safari',
|
||||
* use: { ...devices['iPhone 12'] },
|
||||
* },
|
||||
*/
|
||||
|
||||
/* Test against branded browsers. */
|
||||
// {
|
||||
// name: 'Microsoft Edge',
|
||||
// use: { channel: 'msedge' },
|
||||
// },
|
||||
// {
|
||||
// name: 'Google Chrome',
|
||||
// use: { channel: 'chrome' },
|
||||
// },
|
||||
/*
|
||||
* {
|
||||
* name: 'Microsoft Edge',
|
||||
* use: { channel: 'msedge' },
|
||||
* },
|
||||
* {
|
||||
* name: 'Google Chrome',
|
||||
* use: { channel: 'chrome' },
|
||||
* },
|
||||
*/
|
||||
],
|
||||
|
||||
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
|
||||
// outputDir: 'test-results/',
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
// webServer: {
|
||||
// command: 'npm run start',
|
||||
// port: 3000,
|
||||
// },
|
||||
/*
|
||||
* webServer: {
|
||||
* command: 'npm run start',
|
||||
* port: 3000,
|
||||
* },
|
||||
*/
|
||||
});
|
||||
|
||||
@@ -67,8 +67,10 @@ app.get(
|
||||
app.get(
|
||||
"/blog/post/:postName/:fileName",
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
// return static files for blog post images
|
||||
// the static files are stored in the /usr/src/blog/post/:file/:imageName
|
||||
/*
|
||||
* return static files for blog post images
|
||||
* the static files are stored in the /usr/src/blog/post/:file/:imageName
|
||||
*/
|
||||
|
||||
try {
|
||||
const fileName: string = req.params["fileName"] as string;
|
||||
|
||||
@@ -32,8 +32,10 @@ const HomeFeatureSet: FeatureSet = {
|
||||
init: async (): Promise<void> => {
|
||||
const app: ExpressApplication = Express.getExpressApp();
|
||||
|
||||
//Routes
|
||||
// Middleware to inject baseUrl for templates (used for canonical links)
|
||||
/*
|
||||
* Routes
|
||||
* Middleware to inject baseUrl for templates (used for canonical links)
|
||||
*/
|
||||
app.use(
|
||||
async (_req: ExpressRequest, res: ExpressResponse, next: () => void) => {
|
||||
if (!res.locals["homeUrl"]) {
|
||||
@@ -1406,8 +1408,10 @@ const HomeFeatureSet: FeatureSet = {
|
||||
"# Disallowed because host is not oneuptime.com",
|
||||
].join("\n");
|
||||
} else {
|
||||
// Allow all and point to sitemap
|
||||
// res.locals.homeUrl is set earlier middleware; fallback to canonical domain.
|
||||
/*
|
||||
* Allow all and point to sitemap
|
||||
* res.locals.homeUrl is set earlier middleware; fallback to canonical domain.
|
||||
*/
|
||||
const homeUrl: string = (
|
||||
res.locals["homeUrl"] || "https://oneuptime.com"
|
||||
).replace(/\/$/, "");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user