Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion backend/app/routers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TokenAnalytics(BaseModel):
never_used_tokens: int
recent_active_tokens: int

router = APIRouter(prefix="/admin", tags=["admin"])
router = APIRouter(prefix="/api/admin", tags=["admin"])


@router.get("/auth/github")
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Set the API base URL as a build argument
ARG NEXT_PUBLIC_API_BASE=http://localhost:8000
ARG NEXT_PUBLIC_API_BASE=http://localhost:8000/api
ENV NEXT_PUBLIC_API_BASE=$NEXT_PUBLIC_API_BASE

# Build the application
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/admin/components/AdminUsersManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function AdminUsersManager() {
});
const { toast } = useToast();

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

useEffect(() => {
fetchUsers();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/admin/components/BinariesManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function BinariesManager() {
const [isDialogOpen, setIsDialogOpen] = useState(false);
const { toast } = useToast();

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

const [formData, setFormData] = useState({
id: '',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/admin/components/EnvironmentsManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function EnvironmentsManager() {
const [isDialogOpen, setIsDialogOpen] = useState(false);
const { toast } = useToast();

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

const [formData, setFormData] = useState({
id: '',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/admin/components/RunsManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function RunsManager() {
});
const { toast } = useToast();

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

const [filters, setFilters] = useState({
commit_sha: '',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function AdminPage() {
const [authenticating, setAuthenticating] = useState(false);
const { toast } = useToast();

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

useEffect(() => {
checkAuth();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/auth/callback/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function AuthCallbackContent() {
);
const [errorMessage, setErrorMessage] = useState('');

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

useEffect(() => {
const handleCallback = async () => {
Expand Down
34 changes: 17 additions & 17 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
TokenAnalytics,
} from './types';

const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000';
const API_BASE = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:8000/api';

class ApiError extends Error {
constructor(
Expand Down Expand Up @@ -98,12 +98,12 @@ async function fetchApi<T>(
export const api = {
// Commit endpoints
getCommits: (skip: number = 0, limit: number = 100) =>
fetchApi<Commit[]>(`/api/commits?skip=${skip}&limit=${limit}`),
getCommit: (sha: string) => fetchApi<Commit>(`/api/commits/${sha}`),
fetchApi<Commit[]>(`/commits?skip=${skip}&limit=${limit}`),
getCommit: (sha: string) => fetchApi<Commit>(`/commits/${sha}`),

// Binary endpoints
getBinaries: () => fetchApi<Binary[]>(`/api/binaries?_t=${Date.now()}`),
getBinary: (id: string) => fetchApi<Binary>(`/api/binaries/${id}`),
getBinaries: () => fetchApi<Binary[]>(`/binaries?_t=${Date.now()}`),
getBinary: (id: string) => fetchApi<Binary>(`/binaries/${id}`),
getEnvironmentsForBinary: (binaryId: string) =>
fetchApi<
Array<{
Expand All @@ -113,7 +113,7 @@ export const api = {
run_count: number;
commit_count: number;
}>
>(`/api/binaries/${binaryId}/environments`),
>(`/binaries/${binaryId}/environments`),
getCommitsForBinaryAndEnvironment: (
binaryId: string,
environmentId: string
Expand All @@ -127,19 +127,19 @@ export const api = {
python_version: { major: number; minor: number; patch: number };
run_timestamp: string;
}>
>(`/api/binaries/${binaryId}/environments/${environmentId}/commits`),
>(`/binaries/${binaryId}/environments/${environmentId}/commits`),

// Environment endpoints
getEnvironments: () => fetchApi<Environment[]>('/api/environments'),
getEnvironments: () => fetchApi<Environment[]>('/environments'),
getEnvironment: (id: string) =>
fetchApi<Environment>(`/api/environments/${id}`),
fetchApi<Environment>(`/environments/${id}`),

// Python version endpoints
getPythonVersions: () =>
fetchApi<PythonVersionFilterOption[]>('/api/python-versions'),
fetchApi<PythonVersionFilterOption[]>('/python-versions'),

// Benchmark endpoints
getAllBenchmarks: () => fetchApi<string[]>('/api/benchmarks'),
getAllBenchmarks: () => fetchApi<string[]>('/benchmarks'),
getBenchmarkNames: (params: {
environment_id: string;
binary_id: string;
Expand All @@ -152,7 +152,7 @@ export const api = {
queryParams.append('python_major', params.python_major.toString());
queryParams.append('python_minor', params.python_minor.toString());

return fetchApi<string[]>(`/api/benchmark-names?${queryParams.toString()}`);
return fetchApi<string[]>(`/benchmark-names?${queryParams.toString()}`);
},

// Diff endpoint
Expand All @@ -168,7 +168,7 @@ export const api = {
queryParams.append('environment_id', params.environment_id);
queryParams.append('metric_key', params.metric_key);

return fetchApi<DiffTableRow[]>(`/api/diff?${queryParams.toString()}`);
return fetchApi<DiffTableRow[]>(`/diff?${queryParams.toString()}`);
},

// Upload endpoint
Expand All @@ -183,7 +183,7 @@ export const api = {
};
benchmark_results: BenchmarkResultJson[];
}) =>
fetchApi<{ success: boolean }>('/api/upload', {
fetchApi<{ success: boolean }>('/upload', {
method: 'POST',
body: JSON.stringify(data),
}),
Expand All @@ -209,7 +209,7 @@ export const api = {
high_watermark_bytes: number;
total_allocated_bytes: number;
}>
>(`/api/trends?${queryParams.toString()}`);
>(`/trends?${queryParams.toString()}`);
},

// Batch trends endpoint
Expand All @@ -232,7 +232,7 @@ export const api = {
total_allocated_bytes: number;
}>
>;
}>('/api/trends-batch', {
}>('/trends-batch', {
method: 'POST',
body: JSON.stringify({
trend_queries: trendQueries.map((query) => ({
Expand All @@ -247,7 +247,7 @@ export const api = {

// Flamegraph endpoint
getFlamegraph: (id: string) =>
fetchApi<{ flamegraph_html: string }>(`/api/flamegraph/${id}`),
fetchApi<{ flamegraph_html: string }>(`/flamegraph/${id}`),

// Token management endpoints
getTokens: () =>
Expand Down