Skip to content

Commit fa3bc0e

Browse files
PenguinzTechclaude
andcommitted
Fix frontend API URL and add IceFlows navigation
- Fix client API URL to use relative paths in production - Add IceFlows section to sidebar navigation (Workflows, My Approvals, Promotions) - Update Dockerfile defaults to use empty API_URL for production - Update Dockerfile.static with correct production defaults - Remove unnecessary build args from deploy-beta.sh (hardcoded in Dockerfile) This fixes the "localhost:5001" error and adds missing IceFlows menu items. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent ec16039 commit fa3bc0e

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

scripts/deploy-beta.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,8 @@ with open('$orig_package', 'w') as f:
374374
local docker_file_tmp="$PROJECT_ROOT/services/webui/Dockerfile.static.tmp"
375375
sed 's/npm ci/npm install/g' "$PROJECT_ROOT/services/webui/Dockerfile.static" > "$docker_file_tmp"
376376

377+
# Build web image (defaults in Dockerfile.static are production-ready)
377378
if ! docker build \
378-
--build-arg VITE_API_URL= \
379-
--build-arg VITE_API_BASE_PATH=/api/v1 \
380-
--build-arg VITE_WS_URL= \
381379
-t "$IMAGE_REGISTRY/icecharts-web:$IMAGE_TAG" \
382380
-t "$IMAGE_REGISTRY/icecharts-web:beta" \
383381
-f "$docker_file_tmp" \

services/webui/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RUN npm run test -- --run --coverage
3535
# Stage 4: Build
3636
FROM dependencies AS builder
3737

38-
# Build arguments for Vite
38+
# Build arguments for Vite (production defaults)
3939
ARG VITE_API_URL=""
4040
ARG VITE_API_BASE_PATH="/api/v1"
4141

@@ -45,7 +45,8 @@ WORKDIR /app
4545
COPY . .
4646

4747
# Build application with environment variables
48-
RUN VITE_API_URL=${VITE_API_URL} VITE_API_BASE_PATH=${VITE_API_BASE_PATH} npm run build
48+
# Production uses empty API_URL (relative paths) and /api/v1 base path
49+
RUN VITE_API_URL="" VITE_API_BASE_PATH="/api/v1" npm run build
4950

5051
# Stage 5: Production
5152
FROM nginx:1.25 AS production

services/webui/Dockerfile.static

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ FROM node:20-slim AS builder
33

44
WORKDIR /app
55

6-
# Set build-time environment variables for Vite
7-
ARG VITE_API_URL=http://localhost:5002
8-
ARG VITE_API_BASE_PATH=/api/v1
9-
ARG VITE_WS_URL=http://localhost:5002
6+
# Set build-time environment variables for Vite (production defaults)
7+
# Empty API_URL means use relative paths (works through nginx proxy)
8+
ARG VITE_API_URL=""
9+
ARG VITE_API_BASE_PATH="/api/v1"
10+
ARG VITE_WS_URL=""
1011
ENV VITE_API_URL=$VITE_API_URL
1112
ENV VITE_API_BASE_PATH=$VITE_API_BASE_PATH
1213
ENV VITE_WS_URL=$VITE_WS_URL

services/webui/src/client/lib/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios, { AxiosError, InternalAxiosRequestConfig } from 'axios';
22

33
// Build API URL - combine API host with base path
4-
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:5001';
4+
const apiUrl = import.meta.env.VITE_API_URL || (import.meta.env.PROD ? '' : 'http://localhost:5001');
55
const basePath = import.meta.env.VITE_API_BASE_PATH || '/api/v1';
66
const API_BASE_URL = `${apiUrl}${basePath}`;
77

services/webui/src/components/layout/Sidebar.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ const streamsItems = [
2121
{ path: '/playbooks/templates', label: 'Templates', icon: 'M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2' },
2222
];
2323

24+
// Flows section (IceFlows - approval workflows)
25+
const flowsItems = [
26+
{ path: '/iceflows', label: 'Workflows', icon: 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4' },
27+
{ path: '/iceflows/my-approvals', label: 'My Approvals', icon: 'M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z' },
28+
{ path: '/iceflows/promotions', label: 'Promotions', icon: 'M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12' },
29+
];
30+
2431
// Runs section (IceRuns - serverless functions)
2532
const runsItems = [
2633
{ path: '/iceruns', label: 'Functions', icon: 'M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4' },
@@ -126,6 +133,31 @@ export const Sidebar: React.FC = () => {
126133
</NavLink>
127134
))}
128135

136+
{/* Flows section */}
137+
<div className="pt-4 pb-2">
138+
<p className="px-4 text-xs font-semibold text-ice-navy-400 uppercase tracking-wider">
139+
Flows
140+
</p>
141+
</div>
142+
{flowsItems.map((item) => (
143+
<NavLink
144+
key={item.path}
145+
to={item.path}
146+
className={({ isActive }) =>
147+
`flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors ${
148+
isActive
149+
? 'bg-ice-gold-500/20 text-ice-gold-400'
150+
: 'text-ice-navy-200 hover:bg-ice-navy-700 hover:text-white'
151+
}`
152+
}
153+
>
154+
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
155+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d={item.icon} />
156+
</svg>
157+
{item.label}
158+
</NavLink>
159+
))}
160+
129161
{/* Runs section */}
130162
<div className="pt-4 pb-2">
131163
<p className="px-4 text-xs font-semibold text-ice-navy-400 uppercase tracking-wider">

0 commit comments

Comments
 (0)