From d2e4a25f6054ac1b99c531652351b7076bfd89ce Mon Sep 17 00:00:00 2001 From: Guillaume Thibault <guillaume.thibault.98@gmail.com> Date: Wed, 24 Apr 2024 14:32:30 -0400 Subject: [PATCH 1/2] feat(cloud panel): new refresh button --- .../components/CloudPanel.tsx | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx b/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx index 0d6f154d0..dc22e7dbf 100644 --- a/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx +++ b/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx @@ -39,6 +39,8 @@ import { getGlobalStatus } from "./DesignBar"; import { useSequencerStore } from "@/renderer/stores/sequencer"; import { Autocomplete } from "@/renderer/components/ui/autocomplete"; import { useLoadTestProfile } from "@/renderer/hooks/useTestSequencerProject"; +import { RefreshCcw } from "lucide-react"; +import { Separator } from "@/renderer/components/ui/separator"; export function CloudPanel() { const queryClient = useQueryClient(); @@ -346,12 +348,6 @@ export function CloudPanel() { {projectsQuery.data.length === 0 && ( <div className="flex flex-col items-center justify-center gap-2 p-2 text-sm"> <strong>No Test Profile found</strong> - <Button - onClick={() => projectsQuery.refetch()} - variant={"ghost"} - > - Refresh - </Button> </div> )} {projectsQuery.data.map((option) => ( @@ -360,6 +356,20 @@ export function CloudPanel() { {option.label} </SelectItem> ))} + <Separator /> + <Button + className="text-center w-full gap-2 text-xs text-muted-foreground h-8" + onClick={() => projectsQuery.refetch()} + variant={"link"} + disabled={projectsQuery.isFetching} + > + <RefreshCcw size={10} /> + {projectsQuery.isFetching ? ( + <p> Loading... </p> + ) : ( + <p> Refresh </p> + )} + </Button> </SelectContent> </Select> @@ -375,12 +385,13 @@ export function CloudPanel() { {stationsQuery.data.length === 0 && ( <div className="flex flex-col items-center justify-center gap-2 p-2 text-sm"> <strong>No station found</strong> - {stationsQuery.isFetching ? ( - <p> Loading... </p> + {projectsQuery.data.length === 0 ? ( + <p> + Select a test profile to load the available stations. + </p> ) : ( <p> - {" "} - Select a test profile to load the available stations{" "} + No station found for the selected test profile. </p> )} </div> @@ -390,6 +401,20 @@ export function CloudPanel() { {option.label} </SelectItem> ))} + <Separator /> + <Button + className="text-center w-full gap-2 text-xs text-muted-foreground h-8" + onClick={() => stationsQuery.refetch()} + variant={"link"} + disabled={stationsQuery.isFetching} + > + <RefreshCcw size={10} /> + {stationsQuery.isFetching ? ( + <p> Loading... </p> + ) : ( + <p> Refresh </p> + )} + </Button> </SelectContent> </Select> <div className="mt-2 grid grid-flow-row grid-cols-2 gap-1 text-xs text-muted-foreground"> From 9928f98d0a97cdf1406d84f8ed37aee1a3a8c79b Mon Sep 17 00:00:00 2001 From: Guillaume <g.thibault@polymtl.ca> Date: Thu, 25 Apr 2024 11:48:21 -0400 Subject: [PATCH 2/2] chore(cloud panel): formatting --- .../test_sequencer_panel/components/CloudPanel.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx b/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx index dc22e7dbf..aedffc24e 100644 --- a/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx +++ b/src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx @@ -358,7 +358,7 @@ export function CloudPanel() { ))} <Separator /> <Button - className="text-center w-full gap-2 text-xs text-muted-foreground h-8" + className="h-8 w-full gap-2 text-center text-xs text-muted-foreground" onClick={() => projectsQuery.refetch()} variant={"link"} disabled={projectsQuery.isFetching} @@ -386,13 +386,9 @@ export function CloudPanel() { <div className="flex flex-col items-center justify-center gap-2 p-2 text-sm"> <strong>No station found</strong> {projectsQuery.data.length === 0 ? ( - <p> - Select a test profile to load the available stations. - </p> + <p>Select a test profile to load the available stations.</p> ) : ( - <p> - No station found for the selected test profile. - </p> + <p>No station found for the selected test profile.</p> )} </div> )} @@ -403,7 +399,7 @@ export function CloudPanel() { ))} <Separator /> <Button - className="text-center w-full gap-2 text-xs text-muted-foreground h-8" + className="h-8 w-full gap-2 text-center text-xs text-muted-foreground" onClick={() => stationsQuery.refetch()} variant={"link"} disabled={stationsQuery.isFetching}