Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cloud panel): new refresh button #1174

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 33 additions & 12 deletions src/renderer/routes/test_sequencer_panel/components/CloudPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) => (
Expand All @@ -360,6 +356,20 @@ export function CloudPanel() {
{option.label}
</SelectItem>
))}
<Separator />
<Button
className="h-8 w-full gap-2 text-center text-xs text-muted-foreground"
onClick={() => projectsQuery.refetch()}
variant={"link"}
disabled={projectsQuery.isFetching}
>
<RefreshCcw size={10} />
{projectsQuery.isFetching ? (
<p> Loading... </p>
) : (
<p> Refresh </p>
)}
</Button>
</SelectContent>
</Select>

Expand All @@ -375,13 +385,10 @@ 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{" "}
</p>
<p>No station found for the selected test profile.</p>
)}
</div>
)}
Expand All @@ -390,6 +397,20 @@ export function CloudPanel() {
{option.label}
</SelectItem>
))}
<Separator />
<Button
className="h-8 w-full gap-2 text-center text-xs text-muted-foreground"
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">
Expand Down
Loading