@oneuptime/common 8.0.5129 → 8.0.5139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Server/Services/ScheduledMaintenanceService.ts +6 -5
- package/Server/Services/StatusPageService.ts +1 -1
- package/Tests/UI/Components/MarkdownEditor.test.tsx +87 -2
- package/Types/Date.ts +77 -3
- package/UI/Components/Date/RangeStartAndEndDateView.tsx +2 -2
- package/UI/Components/Detail/Detail.tsx +2 -2
- package/UI/Components/EventHistoryList/EventHistoryDayList.tsx +4 -1
- package/UI/Components/EventItem/EventItem.tsx +2 -2
- package/UI/Components/Feed/FeedItem.tsx +1 -1
- package/UI/Components/Filters/FilterViewer.tsx +5 -5
- package/UI/Components/Forms/Fields/FormField.tsx +2 -2
- package/UI/Components/Forms/Types/Field.ts +1 -0
- package/UI/Components/Graphs/DayUptimeGraph.tsx +2 -2
- package/UI/Components/LogsViewer/LogItem.tsx +2 -1
- package/UI/Components/Markdown.tsx/MarkdownEditor.tsx +652 -13
- package/UI/Components/Table/TableRow.tsx +4 -4
- package/UI/Utils/Markdown.tsx +1 -11
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +6 -5
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +1 -1
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Tests/UI/Components/MarkdownEditor.test.js +48 -2
- package/build/dist/Tests/UI/Components/MarkdownEditor.test.js.map +1 -1
- package/build/dist/Types/Date.js +44 -4
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js +2 -2
- package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js.map +1 -1
- package/build/dist/UI/Components/Detail/Detail.js +2 -2
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/EventHistoryList/EventHistoryDayList.js +1 -1
- package/build/dist/UI/Components/EventHistoryList/EventHistoryDayList.js.map +1 -1
- package/build/dist/UI/Components/EventItem/EventItem.js +2 -2
- package/build/dist/UI/Components/EventItem/EventItem.js.map +1 -1
- package/build/dist/UI/Components/Feed/FeedItem.js +1 -1
- package/build/dist/UI/Components/Feed/FeedItem.js.map +1 -1
- package/build/dist/UI/Components/Filters/FilterViewer.js +5 -5
- package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js +2 -1
- package/build/dist/UI/Components/Forms/Fields/FormField.js.map +1 -1
- package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +2 -2
- package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogItem.js +3 -2
- package/build/dist/UI/Components/LogsViewer/LogItem.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js +337 -3
- package/build/dist/UI/Components/Markdown.tsx/MarkdownEditor.js.map +1 -1
- package/build/dist/UI/Components/Table/TableRow.js +2 -2
- package/build/dist/UI/Components/Table/TableRow.js.map +1 -1
- package/build/dist/UI/Utils/Markdown.js +1 -8
- package/build/dist/UI/Utils/Markdown.js.map +1 -1
- package/package.json +1 -1
|
@@ -261,7 +261,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
261
261
|
if (subscriber.slackIncomingWebhookUrl) {
|
|
262
262
|
const slackMessage: string = `## 🔧 Scheduled Maintenance - ${event.title || ""}
|
|
263
263
|
|
|
264
|
-
**Scheduled Date:** ${OneUptimeDate.
|
|
264
|
+
**Scheduled Date:** ${OneUptimeDate.getDateAsUserFriendlyFormattedString(event.startsAt!)}
|
|
265
265
|
|
|
266
266
|
${resourcesAffected ? `**Resources Affected:** ${resourcesAffected}` : ""}
|
|
267
267
|
|
|
@@ -305,6 +305,7 @@ ${resourcesAffected ? `**Resources Affected:** ${resourcesAffected}` : ""}
|
|
|
305
305
|
OneUptimeDate.getDateAsFormattedHTMLInMultipleTimezones({
|
|
306
306
|
date: event.startsAt!,
|
|
307
307
|
timezones: statuspage.subscriberTimezones || [],
|
|
308
|
+
use12HourFormat: true,
|
|
308
309
|
}),
|
|
309
310
|
eventTitle: event.title || "",
|
|
310
311
|
eventDescription: await Markdown.convertToHTML(
|
|
@@ -769,11 +770,11 @@ ${scheduledMaintenance.description || "No description provided."}
|
|
|
769
770
|
|
|
770
771
|
// add starts at and ends at.
|
|
771
772
|
if (scheduledMaintenance.startsAt) {
|
|
772
|
-
feedInfoInMarkdown += `**Starts At**: ${OneUptimeDate.
|
|
773
|
+
feedInfoInMarkdown += `**Starts At**: ${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(scheduledMaintenance.startsAt)} \n\n`;
|
|
773
774
|
}
|
|
774
775
|
|
|
775
776
|
if (scheduledMaintenance.endsAt) {
|
|
776
|
-
feedInfoInMarkdown += `**Ends At**: ${OneUptimeDate.
|
|
777
|
+
feedInfoInMarkdown += `**Ends At**: ${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(scheduledMaintenance.endsAt)} \n\n`;
|
|
777
778
|
}
|
|
778
779
|
|
|
779
780
|
if (scheduledMaintenance.currentScheduledMaintenanceState?.name) {
|
|
@@ -1064,7 +1065,7 @@ ${onUpdate.updateBy.data.title || "No title provided."}
|
|
|
1064
1065
|
// add scheduledMaintenance feed.
|
|
1065
1066
|
|
|
1066
1067
|
feedInfoInMarkdown += `\n\n**Starts At**:
|
|
1067
|
-
${OneUptimeDate.
|
|
1068
|
+
${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(onUpdate.updateBy.data.startsAt as Date) || "No title provided."}
|
|
1068
1069
|
`;
|
|
1069
1070
|
shouldAddScheduledMaintenanceFeed = true;
|
|
1070
1071
|
}
|
|
@@ -1073,7 +1074,7 @@ ${OneUptimeDate.getDateAsLocalFormattedString(onUpdate.updateBy.data.startsAt as
|
|
|
1073
1074
|
// add scheduledMaintenance feed.
|
|
1074
1075
|
|
|
1075
1076
|
feedInfoInMarkdown += `\n\n**Ends At**:
|
|
1076
|
-
${OneUptimeDate.
|
|
1077
|
+
${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(onUpdate.updateBy.data.endsAt as Date) || "No title provided."}
|
|
1077
1078
|
`;
|
|
1078
1079
|
shouldAddScheduledMaintenanceFeed = true;
|
|
1079
1080
|
}
|
|
@@ -877,7 +877,7 @@ export class Service extends DatabaseService<StatusPage> {
|
|
|
877
877
|
|
|
878
878
|
const endDate: Date = OneUptimeDate.getCurrentDate();
|
|
879
879
|
const startDate: Date = OneUptimeDate.getSomeDaysAgo(numberOfDays);
|
|
880
|
-
const startAndEndDate: string = `${numberOfDays} days (${OneUptimeDate.
|
|
880
|
+
const startAndEndDate: string = `${numberOfDays} days (${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(startDate, true)} - ${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(endDate, true)})`;
|
|
881
881
|
|
|
882
882
|
if (statusPageResources.length === 0) {
|
|
883
883
|
return {
|
|
@@ -1,9 +1,55 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import MarkdownEditor from "../../../UI/Components/Markdown.tsx/MarkdownEditor";
|
|
3
|
-
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { render, screen, fireEvent } from "@testing-library/react";
|
|
4
4
|
import { describe, expect, test } from "@jest/globals";
|
|
5
5
|
|
|
6
|
-
describe("MarkdownEditor
|
|
6
|
+
describe("MarkdownEditor", () => {
|
|
7
|
+
test("should render with toolbar buttons", () => {
|
|
8
|
+
render(
|
|
9
|
+
<MarkdownEditor
|
|
10
|
+
initialValue="This is a test"
|
|
11
|
+
placeholder="Enter markdown here..."
|
|
12
|
+
/>,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
// Check for toolbar buttons
|
|
16
|
+
expect(screen.getByTitle("Bold (Ctrl+B)")).toBeInTheDocument();
|
|
17
|
+
expect(screen.getByTitle("Italic (Ctrl+I)")).toBeInTheDocument();
|
|
18
|
+
expect(screen.getByTitle("Underline")).toBeInTheDocument();
|
|
19
|
+
expect(screen.getByTitle("Strikethrough")).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByTitle("Heading 1")).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByTitle("Heading 2")).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByTitle("Heading 3")).toBeInTheDocument();
|
|
23
|
+
expect(screen.getByTitle("Bullet List")).toBeInTheDocument();
|
|
24
|
+
expect(screen.getByTitle("Numbered List")).toBeInTheDocument();
|
|
25
|
+
expect(screen.getByTitle("Task List")).toBeInTheDocument();
|
|
26
|
+
expect(screen.getByTitle("Link")).toBeInTheDocument();
|
|
27
|
+
expect(screen.getByTitle("Image")).toBeInTheDocument();
|
|
28
|
+
expect(screen.getByTitle("Table")).toBeInTheDocument();
|
|
29
|
+
expect(screen.getByTitle("Code")).toBeInTheDocument();
|
|
30
|
+
expect(screen.getByTitle("Quote")).toBeInTheDocument();
|
|
31
|
+
expect(screen.getByTitle("Horizontal Rule")).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("should toggle preview mode", () => {
|
|
35
|
+
render(
|
|
36
|
+
<MarkdownEditor
|
|
37
|
+
initialValue="**bold text**"
|
|
38
|
+
placeholder="Enter markdown here..."
|
|
39
|
+
/>,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const previewButton: HTMLElement = screen.getByText("Preview");
|
|
43
|
+
fireEvent.click(previewButton);
|
|
44
|
+
|
|
45
|
+
// Should show preview
|
|
46
|
+
expect(screen.getByText("Write")).toBeInTheDocument();
|
|
47
|
+
|
|
48
|
+
// Click to go back to write mode
|
|
49
|
+
fireEvent.click(screen.getByText("Write"));
|
|
50
|
+
expect(screen.getByText("Preview")).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
|
|
7
53
|
test("should enable spell check by default", () => {
|
|
8
54
|
render(
|
|
9
55
|
<MarkdownEditor
|
|
@@ -18,6 +64,21 @@ describe("MarkdownEditor with SpellCheck", () => {
|
|
|
18
64
|
expect(textarea.spellcheck).toBe(true);
|
|
19
65
|
});
|
|
20
66
|
|
|
67
|
+
test("should enable spell check when disableSpellCheck is undefined", () => {
|
|
68
|
+
render(
|
|
69
|
+
<MarkdownEditor
|
|
70
|
+
initialValue="This is a test with spelling errors"
|
|
71
|
+
placeholder="Enter markdown here..."
|
|
72
|
+
disableSpellCheck={undefined}
|
|
73
|
+
/>,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const textarea: HTMLTextAreaElement = screen.getByRole(
|
|
77
|
+
"textbox",
|
|
78
|
+
) as HTMLTextAreaElement;
|
|
79
|
+
expect(textarea.spellcheck).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
|
|
21
82
|
test("should disable spell check when disableSpellCheck is true", () => {
|
|
22
83
|
render(
|
|
23
84
|
<MarkdownEditor
|
|
@@ -58,4 +119,28 @@ describe("MarkdownEditor with SpellCheck", () => {
|
|
|
58
119
|
textarea = screen.getByRole("textbox") as HTMLTextAreaElement;
|
|
59
120
|
expect(textarea.spellcheck).toBe(false);
|
|
60
121
|
});
|
|
122
|
+
|
|
123
|
+
test("should show help text", () => {
|
|
124
|
+
render(
|
|
125
|
+
<MarkdownEditor initialValue="" placeholder="Enter markdown here..." />,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
expect(screen.getByText("Markdown help")).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test("should handle onChange callback", () => {
|
|
132
|
+
const mockOnChange: jest.Mock = jest.fn();
|
|
133
|
+
render(
|
|
134
|
+
<MarkdownEditor
|
|
135
|
+
initialValue=""
|
|
136
|
+
placeholder="Enter markdown here..."
|
|
137
|
+
onChange={mockOnChange}
|
|
138
|
+
/>,
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const textarea: HTMLElement = screen.getByRole("textbox");
|
|
142
|
+
fireEvent.change(textarea, { target: { value: "new text" } });
|
|
143
|
+
|
|
144
|
+
expect(mockOnChange).toHaveBeenCalledWith("new text");
|
|
145
|
+
});
|
|
61
146
|
});
|
package/Types/Date.ts
CHANGED
|
@@ -201,12 +201,19 @@ export default class OneUptimeDate {
|
|
|
201
201
|
return this.secondsToFormattedFriendlyTimeString(seconds);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
public static toTimeString(
|
|
204
|
+
public static toTimeString(
|
|
205
|
+
date: Date | string,
|
|
206
|
+
use12HourFormat?: boolean,
|
|
207
|
+
): string {
|
|
205
208
|
if (typeof date === "string") {
|
|
206
209
|
date = this.fromString(date);
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
|
|
212
|
+
const format: "hh:mm A" | "HH:mm" =
|
|
213
|
+
use12HourFormat || this.getUserPrefers12HourFormat()
|
|
214
|
+
? "hh:mm A"
|
|
215
|
+
: "HH:mm";
|
|
216
|
+
return moment(date).format(format);
|
|
210
217
|
}
|
|
211
218
|
|
|
212
219
|
public static isSame(date1: Date, date2: Date): boolean {
|
|
@@ -879,23 +886,72 @@ export default class OneUptimeDate {
|
|
|
879
886
|
public static getCurrentDateAsFormattedString(options?: {
|
|
880
887
|
onlyShowDate?: boolean;
|
|
881
888
|
showSeconds?: boolean;
|
|
889
|
+
use12HourFormat?: boolean;
|
|
882
890
|
}): string {
|
|
883
891
|
return this.getDateAsFormattedString(new Date(), options);
|
|
884
892
|
}
|
|
885
893
|
|
|
894
|
+
public static getUserPrefers12HourFormat(): boolean {
|
|
895
|
+
if (typeof window === "undefined") {
|
|
896
|
+
// Server-side: default to 12-hour format for user-friendly display
|
|
897
|
+
return true;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// Client-side: detect user's preferred time format from browser locale
|
|
901
|
+
const testDate: Date = new Date();
|
|
902
|
+
const timeString: string = testDate.toLocaleTimeString();
|
|
903
|
+
return (
|
|
904
|
+
timeString.toLowerCase().includes("am") ||
|
|
905
|
+
timeString.toLowerCase().includes("pm")
|
|
906
|
+
);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
public static getDateAsUserFriendlyFormattedString(
|
|
910
|
+
date: string | Date,
|
|
911
|
+
options?: {
|
|
912
|
+
onlyShowDate?: boolean;
|
|
913
|
+
showSeconds?: boolean;
|
|
914
|
+
},
|
|
915
|
+
): string {
|
|
916
|
+
return this.getDateAsFormattedString(date, {
|
|
917
|
+
...options,
|
|
918
|
+
use12HourFormat: this.getUserPrefers12HourFormat(),
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
public static getDateAsUserFriendlyLocalFormattedString(
|
|
923
|
+
date: string | Date,
|
|
924
|
+
onlyShowDate?: boolean,
|
|
925
|
+
): string {
|
|
926
|
+
return this.getDateAsLocalFormattedString(
|
|
927
|
+
date,
|
|
928
|
+
onlyShowDate,
|
|
929
|
+
this.getUserPrefers12HourFormat(),
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
|
|
886
933
|
public static getDateAsFormattedString(
|
|
887
934
|
date: string | Date,
|
|
888
935
|
options?: {
|
|
889
936
|
onlyShowDate?: boolean;
|
|
890
937
|
showSeconds?: boolean;
|
|
938
|
+
use12HourFormat?: boolean;
|
|
891
939
|
},
|
|
892
940
|
): string {
|
|
893
941
|
date = this.fromString(date);
|
|
894
942
|
|
|
895
943
|
let formatstring: string = "MMM DD YYYY, HH:mm";
|
|
896
944
|
|
|
945
|
+
if (options?.use12HourFormat) {
|
|
946
|
+
formatstring = "MMM DD YYYY, hh:mm A";
|
|
947
|
+
}
|
|
948
|
+
|
|
897
949
|
if (options?.showSeconds) {
|
|
898
|
-
|
|
950
|
+
if (options?.use12HourFormat) {
|
|
951
|
+
formatstring = "MMM DD YYYY, hh:mm:ss A";
|
|
952
|
+
} else {
|
|
953
|
+
formatstring = "MMM DD YYYY, HH:mm:ss";
|
|
954
|
+
}
|
|
899
955
|
}
|
|
900
956
|
|
|
901
957
|
if (options?.onlyShowDate) {
|
|
@@ -1061,15 +1117,22 @@ export default class OneUptimeDate {
|
|
|
1061
1117
|
date: string | Date;
|
|
1062
1118
|
onlyShowDate?: boolean | undefined;
|
|
1063
1119
|
timezones?: Array<Timezone> | undefined;
|
|
1120
|
+
use12HourFormat?: boolean | undefined;
|
|
1064
1121
|
}): Array<string> {
|
|
1065
1122
|
let date: string | Date = data.date;
|
|
1066
1123
|
const onlyShowDate: boolean | undefined = data.onlyShowDate;
|
|
1067
1124
|
let timezones: Array<Timezone> | undefined = data.timezones;
|
|
1125
|
+
const use12HourFormat: boolean =
|
|
1126
|
+
data.use12HourFormat ?? this.getUserPrefers12HourFormat();
|
|
1068
1127
|
|
|
1069
1128
|
date = this.fromString(date);
|
|
1070
1129
|
|
|
1071
1130
|
let formatstring: string = "MMM DD YYYY, HH:mm";
|
|
1072
1131
|
|
|
1132
|
+
if (use12HourFormat) {
|
|
1133
|
+
formatstring = "MMM DD YYYY, hh:mm A";
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1073
1136
|
if (onlyShowDate) {
|
|
1074
1137
|
formatstring = "MMM DD, YYYY";
|
|
1075
1138
|
}
|
|
@@ -1106,15 +1169,18 @@ export default class OneUptimeDate {
|
|
|
1106
1169
|
date: string | Date;
|
|
1107
1170
|
onlyShowDate?: boolean;
|
|
1108
1171
|
timezones?: Array<Timezone> | undefined; // if this is skipped, then it will show the default timezones in the order of UTC, EST, PST, IST, ACT
|
|
1172
|
+
use12HourFormat?: boolean | undefined;
|
|
1109
1173
|
}): string {
|
|
1110
1174
|
const date: string | Date = data.date;
|
|
1111
1175
|
const onlyShowDate: boolean | undefined = data.onlyShowDate;
|
|
1112
1176
|
const timezones: Array<Timezone> | undefined = data.timezones;
|
|
1177
|
+
const use12HourFormat: boolean | undefined = data.use12HourFormat;
|
|
1113
1178
|
|
|
1114
1179
|
return this.getDateAsFormattedArrayInMultipleTimezones({
|
|
1115
1180
|
date,
|
|
1116
1181
|
onlyShowDate,
|
|
1117
1182
|
timezones,
|
|
1183
|
+
use12HourFormat,
|
|
1118
1184
|
}).join("<br/>");
|
|
1119
1185
|
}
|
|
1120
1186
|
|
|
@@ -1122,26 +1188,34 @@ export default class OneUptimeDate {
|
|
|
1122
1188
|
date: string | Date;
|
|
1123
1189
|
onlyShowDate?: boolean | undefined;
|
|
1124
1190
|
timezones?: Array<Timezone> | undefined; // if this is skipped, then it will show the default timezones in the order of UTC, EST, PST, IST, ACT
|
|
1191
|
+
use12HourFormat?: boolean | undefined;
|
|
1125
1192
|
}): string {
|
|
1126
1193
|
const date: string | Date = data.date;
|
|
1127
1194
|
const onlyShowDate: boolean | undefined = data.onlyShowDate;
|
|
1128
1195
|
const timezones: Array<Timezone> | undefined = data.timezones;
|
|
1196
|
+
const use12HourFormat: boolean | undefined = data.use12HourFormat;
|
|
1129
1197
|
|
|
1130
1198
|
return this.getDateAsFormattedArrayInMultipleTimezones({
|
|
1131
1199
|
date,
|
|
1132
1200
|
onlyShowDate,
|
|
1133
1201
|
timezones,
|
|
1202
|
+
use12HourFormat,
|
|
1134
1203
|
}).join("\n");
|
|
1135
1204
|
}
|
|
1136
1205
|
|
|
1137
1206
|
public static getDateAsLocalFormattedString(
|
|
1138
1207
|
date: string | Date,
|
|
1139
1208
|
onlyShowDate?: boolean,
|
|
1209
|
+
use12HourFormat?: boolean,
|
|
1140
1210
|
): string {
|
|
1141
1211
|
date = this.fromString(date);
|
|
1142
1212
|
|
|
1143
1213
|
let formatstring: string = "MMM DD YYYY, HH:mm";
|
|
1144
1214
|
|
|
1215
|
+
if (use12HourFormat) {
|
|
1216
|
+
formatstring = "MMM DD YYYY, hh:mm A";
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1145
1219
|
if (onlyShowDate) {
|
|
1146
1220
|
formatstring = "MMM DD, YYYY";
|
|
1147
1221
|
}
|
|
@@ -29,10 +29,10 @@ const DashboardStartAndEndDateView: FunctionComponent<ComponentProps> = (
|
|
|
29
29
|
|
|
30
30
|
const getContent: GetReactElementFunction = (): ReactElement => {
|
|
31
31
|
const title: string = isCustomRange
|
|
32
|
-
? `${OneUptimeDate.
|
|
32
|
+
? `${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
33
33
|
props.dashboardStartAndEndDate.startAndEndDate?.startValue ||
|
|
34
34
|
OneUptimeDate.getCurrentDate(),
|
|
35
|
-
)} - ${OneUptimeDate.
|
|
35
|
+
)} - ${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
36
36
|
props.dashboardStartAndEndDate.startAndEndDate?.endValue ||
|
|
37
37
|
OneUptimeDate.getCurrentDate(),
|
|
38
38
|
)}`
|
|
@@ -178,7 +178,7 @@ const Detail: DetailFunction = <T extends GenericObject>(
|
|
|
178
178
|
|
|
179
179
|
if (field.fieldType === FieldType.Date) {
|
|
180
180
|
if (data) {
|
|
181
|
-
data = OneUptimeDate.
|
|
181
|
+
data = OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
182
182
|
data as string,
|
|
183
183
|
true,
|
|
184
184
|
);
|
|
@@ -197,7 +197,7 @@ const Detail: DetailFunction = <T extends GenericObject>(
|
|
|
197
197
|
|
|
198
198
|
if (field.fieldType === FieldType.DateTime) {
|
|
199
199
|
if (data) {
|
|
200
|
-
data = OneUptimeDate.
|
|
200
|
+
data = OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
201
201
|
data as string,
|
|
202
202
|
false,
|
|
203
203
|
);
|
|
@@ -55,7 +55,10 @@ const EventHistoryDayList: FunctionComponent<ComponentProps> = (
|
|
|
55
55
|
width: isMobile ? "100%" : "15%",
|
|
56
56
|
}}
|
|
57
57
|
>
|
|
58
|
-
{OneUptimeDate.
|
|
58
|
+
{OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
59
|
+
props.date,
|
|
60
|
+
true,
|
|
61
|
+
)}
|
|
59
62
|
</div>
|
|
60
63
|
<div
|
|
61
64
|
style={{
|
|
@@ -224,7 +224,7 @@ const EventItem: FunctionComponent<ComponentProps> = (
|
|
|
224
224
|
</div>
|
|
225
225
|
<div>
|
|
226
226
|
<span className="text-sm leading-8 text-gray-500 whitespace-nowrap">
|
|
227
|
-
{OneUptimeDate.
|
|
227
|
+
{OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
228
228
|
item.date,
|
|
229
229
|
)}
|
|
230
230
|
</span>
|
|
@@ -269,7 +269,7 @@ const EventItem: FunctionComponent<ComponentProps> = (
|
|
|
269
269
|
</div>
|
|
270
270
|
<p className="mt-0.5 text-sm text-gray-500">
|
|
271
271
|
posted on{" "}
|
|
272
|
-
{OneUptimeDate.
|
|
272
|
+
{OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
273
273
|
item.date,
|
|
274
274
|
)}
|
|
275
275
|
</p>
|
|
@@ -117,7 +117,7 @@ const FeedItem: FunctionComponent<ComponentProps> = (
|
|
|
117
117
|
)}
|
|
118
118
|
<div className="mt-0.5 text-sm text-gray-500 w-fit">
|
|
119
119
|
<Tooltip
|
|
120
|
-
text={OneUptimeDate.
|
|
120
|
+
text={OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
121
121
|
props.itemDateTime,
|
|
122
122
|
)}
|
|
123
123
|
>
|
|
@@ -208,11 +208,11 @@ const FilterComponent: FilterComponentFunction = <T extends GenericObject>(
|
|
|
208
208
|
const shouldOnlyShowDate: boolean = data.filter.type === FieldType.Date;
|
|
209
209
|
|
|
210
210
|
if (
|
|
211
|
-
OneUptimeDate.
|
|
211
|
+
OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
212
212
|
startAndEndDates.startValue as Date,
|
|
213
213
|
shouldOnlyShowDate,
|
|
214
214
|
) ===
|
|
215
|
-
OneUptimeDate.
|
|
215
|
+
OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
216
216
|
startAndEndDates.endValue as Date,
|
|
217
217
|
shouldOnlyShowDate,
|
|
218
218
|
)
|
|
@@ -222,7 +222,7 @@ const FilterComponent: FilterComponentFunction = <T extends GenericObject>(
|
|
|
222
222
|
{" "}
|
|
223
223
|
<span className="font-medium">{data.filter.title}</span> at{" "}
|
|
224
224
|
<span className="font-medium">
|
|
225
|
-
{OneUptimeDate.
|
|
225
|
+
{OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
226
226
|
startAndEndDates.startValue as Date,
|
|
227
227
|
data.filter.type === FieldType.Date,
|
|
228
228
|
)}
|
|
@@ -235,14 +235,14 @@ const FilterComponent: FilterComponentFunction = <T extends GenericObject>(
|
|
|
235
235
|
{" "}
|
|
236
236
|
<span className="font-medium">{data.filter.title}</span> is in between{" "}
|
|
237
237
|
<span className="font-medium">
|
|
238
|
-
{OneUptimeDate.
|
|
238
|
+
{OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
239
239
|
startAndEndDates.startValue as Date,
|
|
240
240
|
shouldOnlyShowDate,
|
|
241
241
|
)}
|
|
242
242
|
</span>{" "}
|
|
243
243
|
and{" "}
|
|
244
244
|
<span className="font-medium">
|
|
245
|
-
{OneUptimeDate.
|
|
245
|
+
{OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
246
246
|
startAndEndDates.endValue as Date,
|
|
247
247
|
shouldOnlyShowDate,
|
|
248
248
|
)}
|
|
@@ -34,6 +34,7 @@ import React, { ReactElement, useEffect } from "react";
|
|
|
34
34
|
import Radio, { RadioValue } from "../../Radio/Radio";
|
|
35
35
|
import { BasicRadioButtonOption } from "../../RadioButtons/BasicRadioButtons";
|
|
36
36
|
import HorizontalRule from "../../HorizontalRule/HorizontalRule";
|
|
37
|
+
import MarkdownEditor from "../../Markdown.tsx/MarkdownEditor";
|
|
37
38
|
|
|
38
39
|
export interface ComponentProps<T extends GenericObject> {
|
|
39
40
|
field: Field<T>;
|
|
@@ -473,11 +474,10 @@ const FormField: <T extends GenericObject>(
|
|
|
473
474
|
)}
|
|
474
475
|
|
|
475
476
|
{props.field.fieldType === FormFieldSchemaType.Markdown && (
|
|
476
|
-
<
|
|
477
|
+
<MarkdownEditor
|
|
477
478
|
error={props.touched && props.error ? props.error : undefined}
|
|
478
479
|
dataTestId={props.field.dataTestId}
|
|
479
480
|
tabIndex={index}
|
|
480
|
-
type={CodeType.Markdown}
|
|
481
481
|
disableSpellCheck={props.field.disableSpellCheck}
|
|
482
482
|
onChange={async (value: string) => {
|
|
483
483
|
onChange(value);
|
|
@@ -115,6 +115,7 @@ export default interface Field<TEntity> {
|
|
|
115
115
|
hideOptionalLabel?: boolean | undefined;
|
|
116
116
|
|
|
117
117
|
// Spell check configuration (primarily for Markdown and text fields)
|
|
118
|
+
// Default: false (spell check enabled). Set to true to disable spell check.
|
|
118
119
|
disableSpellCheck?: boolean | undefined;
|
|
119
120
|
|
|
120
121
|
getSummaryElement?: (item: FormValues<TEntity>) => ReactElement | undefined;
|
|
@@ -55,7 +55,7 @@ const DayUptimeGraph: FunctionComponent<ComponentProps> = (
|
|
|
55
55
|
dayNumber,
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
-
let toolTipText: string = `${OneUptimeDate.
|
|
58
|
+
let toolTipText: string = `${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
59
59
|
todaysDay,
|
|
60
60
|
true,
|
|
61
61
|
)}`;
|
|
@@ -189,7 +189,7 @@ const DayUptimeGraph: FunctionComponent<ComponentProps> = (
|
|
|
189
189
|
|
|
190
190
|
if (todaysEvents.length === 1) {
|
|
191
191
|
hasEvents = true;
|
|
192
|
-
toolTipText = `${OneUptimeDate.
|
|
192
|
+
toolTipText = `${OneUptimeDate.getDateAsUserFriendlyLocalFormattedString(
|
|
193
193
|
todaysDay,
|
|
194
194
|
true,
|
|
195
195
|
)} - 100% ${todaysEvents[0]?.label || "Operational"}.`;
|
|
@@ -144,7 +144,8 @@ const LogItem: FunctionComponent<ComponentProps> = (
|
|
|
144
144
|
DATE TIME:
|
|
145
145
|
</div>
|
|
146
146
|
<div className="text-slate-500 courier-prime">
|
|
147
|
-
{OneUptimeDate.
|
|
147
|
+
{OneUptimeDate.getDateAsUserFriendlyFormattedString(props.log.time)}{" "}
|
|
148
|
+
{" "}
|
|
148
149
|
</div>
|
|
149
150
|
</div>
|
|
150
151
|
)}
|