refactor: Remove /ui path prefix
Removed the /ui basePath from Next.js configuration to serve the app at root path: - Removed basePath: "/ui" from next.config.ts - Updated all API route calls from /ui/api/* to /api/* - App now accessible at root path instead of /ui subdirectory 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,7 @@ export default function JobsPage() {
|
|||||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||||
queryKey: ["projects"],
|
queryKey: ["projects"],
|
||||||
queryFn: async (): Promise<ListProjects> => {
|
queryFn: async (): Promise<ListProjects> => {
|
||||||
const res = await fetch("/ui/api/scrapyd/projects");
|
const res = await fetch("/api/scrapyd/projects");
|
||||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -63,7 +63,7 @@ export default function JobsPage() {
|
|||||||
const { data: jobs, isLoading: isJobsLoading } = useQuery({
|
const { data: jobs, isLoading: isJobsLoading } = useQuery({
|
||||||
queryKey: ["jobs", selectedProject],
|
queryKey: ["jobs", selectedProject],
|
||||||
queryFn: async (): Promise<ListJobs> => {
|
queryFn: async (): Promise<ListJobs> => {
|
||||||
const res = await fetch(`/ui/api/scrapyd/jobs?project=${selectedProject}`);
|
const res = await fetch(`/api/scrapyd/jobs?project=${selectedProject}`);
|
||||||
if (!res.ok) throw new Error("Failed to fetch jobs");
|
if (!res.ok) throw new Error("Failed to fetch jobs");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -74,7 +74,7 @@ export default function JobsPage() {
|
|||||||
// Cancel job mutation
|
// Cancel job mutation
|
||||||
const cancelJobMutation = useMutation({
|
const cancelJobMutation = useMutation({
|
||||||
mutationFn: async (data: { project: string; job: string }) => {
|
mutationFn: async (data: { project: string; job: string }) => {
|
||||||
const res = await fetch("/ui/api/scrapyd/jobs", {
|
const res = await fetch("/api/scrapyd/jobs", {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function DashboardPage() {
|
|||||||
const { data: daemonStatus, isLoading: isDaemonLoading } = useQuery({
|
const { data: daemonStatus, isLoading: isDaemonLoading } = useQuery({
|
||||||
queryKey: ["daemon-status"],
|
queryKey: ["daemon-status"],
|
||||||
queryFn: async (): Promise<DaemonStatus> => {
|
queryFn: async (): Promise<DaemonStatus> => {
|
||||||
const res = await fetch("/ui/api/scrapyd/daemon");
|
const res = await fetch("/api/scrapyd/daemon");
|
||||||
if (!res.ok) throw new Error("Failed to fetch daemon status");
|
if (!res.ok) throw new Error("Failed to fetch daemon status");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -27,7 +27,7 @@ export default function DashboardPage() {
|
|||||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||||
queryKey: ["projects"],
|
queryKey: ["projects"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const res = await fetch("/ui/api/scrapyd/projects");
|
const res = await fetch("/api/scrapyd/projects");
|
||||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function ProjectsPage() {
|
|||||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||||
queryKey: ["projects"],
|
queryKey: ["projects"],
|
||||||
queryFn: async (): Promise<ListProjects> => {
|
queryFn: async (): Promise<ListProjects> => {
|
||||||
const res = await fetch("/ui/api/scrapyd/projects");
|
const res = await fetch("/api/scrapyd/projects");
|
||||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -56,7 +56,7 @@ export default function ProjectsPage() {
|
|||||||
queryKey: ["versions", selectedProject],
|
queryKey: ["versions", selectedProject],
|
||||||
queryFn: async (): Promise<ListVersions> => {
|
queryFn: async (): Promise<ListVersions> => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`/ui/api/scrapyd/versions?project=${selectedProject}`
|
`/api/scrapyd/versions?project=${selectedProject}`
|
||||||
);
|
);
|
||||||
if (!res.ok) throw new Error("Failed to fetch versions");
|
if (!res.ok) throw new Error("Failed to fetch versions");
|
||||||
return res.json();
|
return res.json();
|
||||||
@@ -67,7 +67,7 @@ export default function ProjectsPage() {
|
|||||||
// Delete project mutation
|
// Delete project mutation
|
||||||
const deleteProjectMutation = useMutation({
|
const deleteProjectMutation = useMutation({
|
||||||
mutationFn: async (project: string) => {
|
mutationFn: async (project: string) => {
|
||||||
const res = await fetch("/ui/api/scrapyd/projects", {
|
const res = await fetch("/api/scrapyd/projects", {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ project }),
|
body: JSON.stringify({ project }),
|
||||||
@@ -85,7 +85,7 @@ export default function ProjectsPage() {
|
|||||||
// Upload version mutation
|
// Upload version mutation
|
||||||
const uploadVersionMutation = useMutation({
|
const uploadVersionMutation = useMutation({
|
||||||
mutationFn: async (formData: FormData) => {
|
mutationFn: async (formData: FormData) => {
|
||||||
const res = await fetch("/ui/api/scrapyd/versions", {
|
const res = await fetch("/api/scrapyd/versions", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default function SpidersPage() {
|
|||||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||||
queryKey: ["projects"],
|
queryKey: ["projects"],
|
||||||
queryFn: async (): Promise<ListProjects> => {
|
queryFn: async (): Promise<ListProjects> => {
|
||||||
const res = await fetch("/ui/api/scrapyd/projects");
|
const res = await fetch("/api/scrapyd/projects");
|
||||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -58,7 +58,7 @@ export default function SpidersPage() {
|
|||||||
queryKey: ["spiders", selectedProject],
|
queryKey: ["spiders", selectedProject],
|
||||||
queryFn: async (): Promise<ListSpiders> => {
|
queryFn: async (): Promise<ListSpiders> => {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`/ui/api/scrapyd/spiders?project=${selectedProject}`
|
`/api/scrapyd/spiders?project=${selectedProject}`
|
||||||
);
|
);
|
||||||
if (!res.ok) throw new Error("Failed to fetch spiders");
|
if (!res.ok) throw new Error("Failed to fetch spiders");
|
||||||
return res.json();
|
return res.json();
|
||||||
@@ -73,7 +73,7 @@ export default function SpidersPage() {
|
|||||||
spider: string;
|
spider: string;
|
||||||
args?: Record<string, string>;
|
args?: Record<string, string>;
|
||||||
}) => {
|
}) => {
|
||||||
const res = await fetch("/ui/api/scrapyd/jobs", {
|
const res = await fetch("/api/scrapyd/jobs", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function SystemPage() {
|
|||||||
const { data: daemonStatus, isLoading: isDaemonLoading } = useQuery({
|
const { data: daemonStatus, isLoading: isDaemonLoading } = useQuery({
|
||||||
queryKey: ["daemon-status"],
|
queryKey: ["daemon-status"],
|
||||||
queryFn: async (): Promise<DaemonStatus> => {
|
queryFn: async (): Promise<DaemonStatus> => {
|
||||||
const res = await fetch("/ui/api/scrapyd/daemon");
|
const res = await fetch("/api/scrapyd/daemon");
|
||||||
if (!res.ok) throw new Error("Failed to fetch daemon status");
|
if (!res.ok) throw new Error("Failed to fetch daemon status");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -31,7 +31,7 @@ export default function SystemPage() {
|
|||||||
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
const { data: projects, isLoading: isProjectsLoading } = useQuery({
|
||||||
queryKey: ["projects"],
|
queryKey: ["projects"],
|
||||||
queryFn: async (): Promise<ListProjects> => {
|
queryFn: async (): Promise<ListProjects> => {
|
||||||
const res = await fetch("/ui/api/scrapyd/projects");
|
const res = await fetch("/api/scrapyd/projects");
|
||||||
if (!res.ok) throw new Error("Failed to fetch projects");
|
if (!res.ok) throw new Error("Failed to fetch projects");
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { cn } from "@/lib/utils";
|
|||||||
import {
|
import {
|
||||||
LayoutDashboard,
|
LayoutDashboard,
|
||||||
FolderKanban,
|
FolderKanban,
|
||||||
Bug,
|
Webhook,
|
||||||
BriefcaseBusiness,
|
BriefcaseBusiness,
|
||||||
Activity,
|
Activity,
|
||||||
Menu,
|
Menu,
|
||||||
@@ -35,7 +35,7 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Spiders",
|
label: "Spiders",
|
||||||
icon: Bug,
|
icon: Webhook,
|
||||||
href: "/spiders",
|
href: "/spiders",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
basePath: "/ui",
|
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
experimental: {
|
experimental: {
|
||||||
optimizePackageImports: ["lucide-react"],
|
optimizePackageImports: ["lucide-react"],
|
||||||
|
|||||||
Reference in New Issue
Block a user