-
- {summaryPercent}%
-
+
+
+
+
+ {summaryPercent}%
+
+
+
+
+
+ {props.showCurrent && info && (
+
+ )}
+
+
+ {
+ const status = parseHealthStatusByPercent(
+ item.upRate,
+ item.totalCount
+ );
+
+ return {
+ status,
+ title: `${item.day} | (${item.upCount}/${item.totalCount}) ${item.upRate}%`,
+ };
+ })}
+ />
+
-
-
- {props.showCurrent && info && (
-
- )}
-
-
- {
- const status = parseHealthStatusByPercent(
- item.upRate,
- item.totalCount
- );
-
- return {
- status,
- title: `${item.day} | (${item.upCount}/${item.totalCount}) ${item.upRate}%`,
- };
- })}
- />
-
+
);
});
@@ -199,3 +207,16 @@ const MonitorLatestResponse: React.FC<{
);
});
MonitorLatestResponse.displayName = 'MonitorLatestResponse';
+
+export const MonitorRecentChart: React.FC<{
+ workspaceId: string;
+ monitorId: string;
+}> = React.memo((props) => {
+ return (
+
+ );
+});
+MonitorRecentChart.displayName = 'MonitorRecentChart';
diff --git a/src/client/tailwind.config.ts b/src/client/tailwind.config.ts
index aeea1e3..64c177a 100644
--- a/src/client/tailwind.config.ts
+++ b/src/client/tailwind.config.ts
@@ -13,6 +13,7 @@ module.exports = {
'./components/**/*.{js,jsx,ts,tsx}',
'./pages/**/*.{js,jsx,ts,tsx}',
'./routes/**/*.{js,jsx,ts,tsx}',
+ './utils/health.ts',
],
},
theme: {
diff --git a/src/server/model/_schema/monitor.ts b/src/server/model/_schema/monitor.ts
index 03780aa..712695a 100644
--- a/src/server/model/_schema/monitor.ts
+++ b/src/server/model/_schema/monitor.ts
@@ -9,4 +9,5 @@ export const monitorPublicInfoSchema = MonitorModelSchema.pick({
id: true,
name: true,
type: true,
+ trendingMode: true,
});
diff --git a/src/server/trpc/routers/monitor.ts b/src/server/trpc/routers/monitor.ts
index fab6bdf..c869436 100644
--- a/src/server/trpc/routers/monitor.ts
+++ b/src/server/trpc/routers/monitor.ts
@@ -361,6 +361,38 @@ export const monitorRouter = router({
return summary;
}),
+ publicData: publicProcedure
+ .meta(
+ buildMonitorOpenapi({
+ method: 'GET',
+ protect: false,
+ path: '/{monitorId}/publicData',
+ })
+ )
+ .input(
+ z.object({
+ workspaceId: z.string().cuid2(),
+ monitorId: z.string().cuid2(),
+ })
+ )
+ .output(
+ z.array(
+ z.object({
+ value: z.number(),
+ createdAt: z.date(),
+ })
+ )
+ )
+ .query(async ({ input }) => {
+ const { workspaceId, monitorId } = input;
+
+ return getMonitorData(
+ workspaceId,
+ monitorId,
+ dayjs().subtract(1, 'days').toDate(),
+ dayjs().toDate()
+ );
+ }),
dataMetrics: workspaceProcedure
.meta(
buildMonitorOpenapi({