Skip to content

Commit d197bf2

Browse files
committed
feat(ui): add environment badge to header for non-production deployments
1 parent 9bfed6d commit d197bf2

6 files changed

Lines changed: 11 additions & 1 deletion

File tree

client/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ VITE_KEYCLOAK_URL=http://localhost:8080
33
VITE_KEYCLOAK_REALM=master
44
VITE_KEYCLOAK_CLIENT_ID=request-client
55
VITE_ADMIN_ROLE=admin
6+
VITE_ENVIRONMENT=development
67

78
# API Configuration
89
VITE_API_BASE_URL=http://localhost:3000/api

client/src/components/layout/Header.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
PopoverTrigger,
99
} from "@/components/ui/popover";
1010
import { Separator } from "@/components/ui/separator";
11-
import { APP_NAME } from "@/config/app";
11+
import { APP_ENVIRONMENT, APP_NAME } from "@/config/app";
1212
import { useAuth } from "@/hooks/useAuth";
1313

1414
export function Header() {
@@ -21,6 +21,11 @@ export function Header() {
2121
<Link to="/" className="flex items-center gap-2">
2222
<img src={AETLogo} alt="AET Logo" className="h-8" />
2323
<span className="font-semibold">{APP_NAME}</span>
24+
{APP_ENVIRONMENT !== "production" && (
25+
<span className="rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-800 dark:bg-amber-900/30 dark:text-amber-400">
26+
{APP_ENVIRONMENT}
27+
</span>
28+
)}
2429
</Link>
2530

2631
{/* Auth Section */}

client/src/config/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export const APP_VERSION = __APP_VERSION__;
44
export const APP_NAME = "AET Request";
55
export const APP_DESCRIPTION =
66
"Request virtual machines, access permissions, and other resources at the Applied Education Technologies research group.";
7+
export const APP_ENVIRONMENT = import.meta.env.VITE_ENVIRONMENT ?? "production";

client/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type ImportMetaEnv = {
99
VITE_KEYCLOAK_REALM: string
1010
VITE_KEYCLOAK_CLIENT_ID: string
1111
VITE_ADMIN_ROLE: string
12+
VITE_ENVIRONMENT: string
1213
VITE_OTEL_COLLECTOR_URL: string
1314
VITE_OTEL_SERVICE_NAME: string
1415
VITE_OTEL_ENVIRONMENT: string

deploy/helm/aet-request/templates/client-configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ data:
1111
VITE_KEYCLOAK_REALM: {{ .Values.client.config.VITE_KEYCLOAK_REALM | quote }}
1212
VITE_KEYCLOAK_CLIENT_ID: {{ .Values.client.config.VITE_KEYCLOAK_CLIENT_ID | quote }}
1313
VITE_ADMIN_ROLE: {{ .Values.client.config.VITE_ADMIN_ROLE | quote }}
14+
VITE_ENVIRONMENT: {{ .Values.client.config.VITE_ENVIRONMENT | quote }}

deploy/helm/aet-request/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ client:
3434
VITE_KEYCLOAK_REALM: ""
3535
VITE_KEYCLOAK_CLIENT_ID: ""
3636
VITE_ADMIN_ROLE: admin
37+
VITE_ENVIRONMENT: production
3738

3839
server:
3940
replicaCount: 2

0 commit comments

Comments
 (0)