app-ui

created pr with 46.1 on 2025-02-06T15:20:57Z · by c8ef7d19
cmds
checkout latest patchset:
ssh pr.pico.sh print 46 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 46.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 46

Patchset 46.1 on 2025-02-06T15:20:57Z · commit 7fa43cf

Install react-use-websocket
Eric Abruzzese 2025-01-15T14:28:15Z
Update the diagnostics create form to navigate to the details page with query parameters instead of POSTing to the external service
Eric Abruzzese 2025-01-15T14:29:34Z
Collect events on the diagnostic details page and construct a dashboard state
Eric Abruzzese 2025-01-15T14:30:03Z
Formatting and cleanup
Eric Abruzzese 2025-01-15T14:34:02Z
Show dashboard messages, resources, operations, and plots
Michael Peterson 2025-01-28T20:23:45Z
Support async plot annotations
Eric Abruzzese 2025-01-31T17:53:30Z
Fix an issue that would cause a page crash if datasets weren't perfectly aligned
Eric Abruzzese 2025-02-03T20:19:05Z
Add VITE_APTIBLE_AI_URL to .env.example
Eric Abruzzese 2025-02-04T16:30:13Z
Update VITE_APTIBLE_AI_URL references to point to Hotshot
Eric Abruzzese 2025-02-05T17:50:02Z
Update the analysis using PlotAnnotated events
Eric Abruzzese 2025-02-05T17:51:11Z
Install react-use-websocket
Eric Abruzzese 2025-01-15T14:28:15Z
Update the diagnostics create form to navigate to the details page with query parameters instead of POSTing to the external service
Eric Abruzzese 2025-01-15T14:29:34Z
Collect events on the diagnostic details page and construct a dashboard state
Eric Abruzzese 2025-01-15T14:30:03Z
Formatting and cleanup
Eric Abruzzese 2025-01-15T14:34:02Z
Show dashboard messages, resources, operations, and plots
Michael Peterson 2025-01-28T20:23:45Z
Support async plot annotations
Eric Abruzzese 2025-01-31T17:53:30Z
Fix an issue that would cause a page crash if datasets weren't perfectly aligned
Eric Abruzzese 2025-02-03T20:19:05Z
Add VITE_APTIBLE_AI_URL to .env.example
Eric Abruzzese 2025-02-04T16:30:13Z
Update VITE_APTIBLE_AI_URL references to point to Hotshot
Eric Abruzzese 2025-02-05T17:50:02Z
Update the analysis using PlotAnnotated events
Eric Abruzzese 2025-02-05T17:51:11Z
Refactor charts
Michael Peterson 2025-02-05T18:25:59Z
Refactor OperationsTimeline, chart hover state
Michael Peterson 2025-02-05T18:42:20Z
Extract types into aptible-ai/index, useDashboard hook
Michael Peterson 2025-02-05T19:21:56Z
Fix a linter error
Eric Abruzzese 2025-02-05T19:40:48Z
Fix linter errors
Eric Abruzzese 2025-02-05T19:50:07Z
+2 -2 src/routes/index.ts #
......@@ -408,8 +408,8 @@ export const DIAGNOSTICS_URL = "/diagnostics";
408408 export const diagnosticsUrl = () => DIAGNOSTICS_URL;
409409 export const DIAGNOSTICS_CREATE_URL = "/diagnostics/create";
410410 export const diagnosticsCreateUrl = () => DIAGNOSTICS_CREATE_URL;
411-export const DIAGNOSTICS_DETAIL_URL = "/diagnostics/:id";
412-export const diagnosticsDetailUrl = (id: string) => `/diagnostics/${id}`;
411+export const DIAGNOSTICS_DETAIL_URL = "/diagnostics/detail";
412+export const diagnosticsDetailUrl = (appId: string, symptoms: string, start: Date, end: Date) => `/diagnostics/detail?app_id=${appId}&symptom_description=${symptoms}&start_time=${start.toISOString()}&end_time=${end.toISOString()}`;
413413
414414 export const SOURCES_PATH = "/sources";
415415 export const sourcesUrl = () => SOURCES_PATH;
+15 -27 src/ui/pages/diagnostics-create.tsx #
......@@ -6,7 +6,6 @@ import {
66 import { DateTime } from "luxon";
77 import { useEffect, useMemo, useState } from "react";
88 import DatePicker from "react-datepicker";
9-import { useDispatch, useLoader, useSelector } from "starfx/react";
109 import { AppSidebarLayout } from "../layouts";
1110 import {
1211 Banner,
......@@ -21,13 +20,9 @@ import {
2120 import { AppSelect } from "../shared/select-apps";
2221
2322 import "react-datepicker/dist/react-datepicker.css";
24-import { createDashboard } from "@app/aptible-ai";
25-import { type WebState, schema } from "@app/schema";
2623 import { useNavigate } from "react-router-dom";
2724
2825 export const DiagnosticsCreateForm = ({ appId }: { appId: string }) => {
29- const dispatch = useDispatch();
30-
3126 const symptomOptions = [
3227 { label: "App is slow", value: "App is slow" },
3328 { label: "App is unavailable", value: "App is unavailable" },
......@@ -43,7 +38,7 @@ export const DiagnosticsCreateForm = ({ appId }: { appId: string }) => {
4338 // invalid.
4439 const now = useMemo(
4540 () => DateTime.now().minus({ minutes: DateTime.local().offset }),
46- [],
41+ []
4742 );
4843
4944 const timePresets = [
......@@ -60,7 +55,7 @@ export const DiagnosticsCreateForm = ({ appId }: { appId: string }) => {
6055 const [timePreset, setTimePreset] = useState(timePresets[2].value);
6156
6257 const [startDate, setStartDate] = useState<DateTime>(
63- DateTime.fromISO(timePreset),
58+ DateTime.fromISO(timePreset)
6459 );
6560 const onSelectStartDate = (date: Date) => {
6661 const dateTime = DateTime.fromJSDate(date);
......@@ -100,33 +95,26 @@ export const DiagnosticsCreateForm = ({ appId }: { appId: string }) => {
10095 startDate !== null &&
10196 endDate !== null &&
10297 startDate < endDate,
103- [symptoms, appId, startDate, endDate],
98+ [symptoms, appId, startDate, endDate]
10499 );
105100
106101 // Submit the form.
107- const submitAction = createDashboard({
108- symptoms: symptoms,
109- appId,
110- start: startDate.toUTC(0, { keepLocalTime: true }).toJSDate(),
111- end: endDate.toUTC(0, { keepLocalTime: true }).toJSDate(),
112- });
113- const dashboardData = useSelector((s: WebState) =>
114- schema.cache.selectById(s, { id: submitAction.payload.key }),
115- );
116- const { isLoading } = useLoader(submitAction);
102+ const [isLoading, setIsLoading] = useState(false);
103+ const navigate = useNavigate();
117104 const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
118105 e.preventDefault();
119- dispatch(submitAction);
106+ setIsLoading(true);
107+ navigate(
108+ diagnosticsDetailUrl(
109+ appId,
110+ symptoms,
111+ startDate.toUTC(0, { keepLocalTime: true }).toJSDate(),
112+ endDate.toUTC(0, { keepLocalTime: true }).toJSDate()
113+ )
114+ );
115+ setIsLoading(false);
120116 };
121117
122- // Navigate to the dashboard when it is created.
123- const navigate = useNavigate();
124- useEffect(() => {
125- if (dashboardData?.id) {
126- navigate(diagnosticsDetailUrl(dashboardData.id));
127- }
128- }, [dashboardData]);
129-
130118 return (
131119 <>
132120 <form onSubmit={handleSubmit}>
Back to top