diff --git a/.gitignore b/.gitignore index 691f3db59..5c5f64566 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,6 @@ pnpm-debug.log* .react-router .wrangler next-env.d.ts + +# Local review screenshots and generated previews (not product assets) +/artifacts/ diff --git a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/BuildSettings.tsx b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/BuildSettings.tsx index 5cd3d24ee..f3014f53a 100644 --- a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/BuildSettings.tsx +++ b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/BuildSettings.tsx @@ -1,29 +1,16 @@ +"use client"; + import { Icon as UiIcon, type IconName } from "@repo/ui/icons"; import React, { useState } from "react"; -import { useRouter } from "next/navigation"; -import { getRuntimeVersionPolicy, isServicesFramework, normalizeRepoPath } from "@repo/core"; -import { useProjectSettings } from "@/context/ProjectSettingsContext"; -import { workloadOf } from "@/context/deployment/types"; -import { useI18n } from "@/components/i18n-provider"; -import { encodeLocalSlug, encodeRepoSlug } from "@/utils/repoSlug"; -import { EnvVarsEditor } from "./EnvVarsEditor"; -import { StorageSettings } from "./StorageSettings"; -import { BuildCacheMigration } from "@/components/project-settings/DeploymentAutomation"; -import { ResourceSettings } from "./ResourceSettings"; -import { CommandEnvironmentNotice } from "@/components/import-project/CommandEnvironmentNotice"; -import { RuntimeSourceUpdate } from "@/components/updates/RuntimeSourceUpdate"; import Link from "next/link"; +import { isServicesFramework } from "@repo/core"; +import { useProjectSettings } from "@/context/ProjectSettingsContext"; +import { useI18n } from "@/components/i18n-provider"; +import { BuildCacheMigration } from "@/components/project-settings/DeploymentAutomation"; +import { RuntimeSourceUpdate } from "@/components/updates/RuntimeSourceUpdate"; import { projectApplication } from "@/lib/project-application"; - -/** - * Configuration cards within project Settings. Build settings link to the deploy wizard; project - * environment, resources and storage use their existing focused editors. - * Shared project environment remains available for every workload type. - * - * Visual shell (SectionCard + ICON_TONES) mirrors the sibling settings tabs - * (GitSettings / BackupSettings / DomainSettings) so the tab fills the same - * column width and reads as part of the same design system. - */ +import { EnvVarsEditor } from "./EnvVarsEditor"; +import { ResourceSettings } from "./ResourceSettings"; const ICON_TONES = { primary: "bg-primary/10 text-primary", @@ -71,84 +58,29 @@ function SectionCard({ ); } -function Row({ label, value, mono }: { label: string; value?: React.ReactNode; mono?: boolean }) { - const empty = value === undefined || value === null || value === ""; - return ( -
- {label} - - {empty ? — : value} - -
- ); -} - -export const BuildSettings = ({ scope = "project" }: { scope?: "project" | "application" }) => { - const { buildData, projectData, servicesData, id, updateBuild, refreshEnvironment } = - useProjectSettings(); +/** Project-owned settings stay here regardless of the number of workloads. */ +export const BuildSettings = () => { + const { buildData, projectData, servicesData, id } = useProjectSettings(); const { t } = useI18n(); - const router = useRouter(); + const application = projectApplication(projectData, servicesData.services); + const hasRepo = Boolean(projectData.gitOwner && projectData.gitRepo); + const composeSource = + Boolean(projectData.composePath) || isServicesFramework(projectData.framework); - const isWebmail = projectData?.framework === "webmail"; - const services = servicesData.services; - const application = projectApplication(projectData, services); - // SERVICE-FIRST = the project itself is a set of services (a compose-stack - // project) or a monorepo of sub-apps — its config genuinely lives per-service. - // A single/static APP that merely had a sidecar service ADDED is NOT - // service-first: it keeps its own primary-app Configuration below. Keyed on - // the project's framework, never on "a service row exists" (which conflates - // the two — the whole point of this fix). - const isServiceFirst = - (application?.mode !== "project" && services.some((service) => service.kind === "monorepo")) || - isServicesFramework(projectData?.framework); - - // Edit = the deploy wizard, rehydrated from this project. The single place - // config is editable; this tab never mutates it. - const hasRepo = Boolean(projectData?.gitOwner && projectData?.gitRepo); - const editSlug = hasRepo - ? encodeRepoSlug(projectData!.gitOwner!, projectData!.gitRepo!) - : projectData?.localPath - ? encodeLocalSlug(projectData.localPath) - : null; - const openWizard = () => { - // mode=config → the wizard SAVES config (no deploy); see Sidebar handleSave. - if (editSlug) router.push(`/deploy/${editSlug}?projectId=${id}&mode=config`); - }; - - const EditButton = () => - editSlug ? ( - - ) : null; - - // ── Webmail: fully managed, nothing to show or edit. ────────────────── - if (isWebmail) { + if (projectData.framework === "webmail") { return ( -
- -
+ ); } - // ── Service-first project: config lives per-service in the Services tab. - // (A single/static app with an added sidecar service falls through to the - // single-app config below — it is NOT service-first.) ── - if (scope === "project" && application) { - return ( -
+ return ( +
+ {application && ( } /> - - - {services.some((service) => !service.applicationMode) && } -
- ); - } - if (isServiceFirst && scope === "project") { - return ( -
- {hasRepo && ( - - )} - - - -
- ); - } - - // ── Single-app: read-only configuration summary. ────────────────────── - // A static site has no runtime process to isolate — the edge serves its files - // from the shared static volume. Its `runtimeMode` is still "docker" because it - // BUILT in a Docker sandbox, so reporting "Sandboxed (container)" here mislabels a - // build detail as a runtime one and contradicts the Start command row's "Static - // (no server)". Say plainly there is no runtime instead. - // A worker shares hasServer=false with a static site but DOES run a process - // (sandboxed like a web app), so classify via the resolved workload — only a - // static site has "no runtime" (#538). - const workload = workloadOf(buildData); - const runtimeModeLabel = - workload === "static" - ? projectData?.deployTarget === "cloud" - ? t.projectSettings.cloudStaticHosting[projectData.cloudStaticHosting ?? "pages"] - : t.projectSettings.build.runtime.modeStatic - : projectData?.runtimeMode === "docker" - ? t.projectSettings.build.runtime.modeSandboxed - : projectData?.runtimeMode === "bare" - ? t.projectSettings.build.runtime.modeDirect - : t.projectSettings.build.runtime.modeDefault; - - return ( -
- { - updateBuild(commands); - await refreshEnvironment(); - }} - /> - - {hasRepo && - (projectData?.buildKind === "dockerfile" || projectData?.framework === "docker") && ( - - )} - -
- } - > -
- - - - {/* Resources moved to the editable ResourceSettings card below — one - source, and it covers self-hosted (where limits are now a real - choice) instead of being cloud-only and read-only. */} - - - - {getRuntimeVersionPolicy(projectData?.framework) && ( - - )} - {projectData?.runtimeImage && ( - - )} - - - {/* Only when pinned — a blank row would be noise for the vast majority - of projects, whose compose file (if any) sits at the root. */} - {buildData.composePath && ( - - )} - -
- - - {scope === "project" && } - {scope === "project" && } - - {/* Project-wide limits also apply to companion services on a static site. */} - {(workload !== "static" || services.length > 0) && - (scope === "project" || !services.some((service) => !service.applicationMode)) && ( - - )} - - {/* Storage — persistent paths + object storage. Editable in place (see the - component's own note on why it doesn't route through the wizard). Only - meaningful for a project with a running container. */} - {scope === "project" && workload !== "static" && } + )} + {hasRepo && composeSource && ( + + )} + + +
); }; -/** Shared project inputs remain editable for single apps, Compose and monorepos. */ +/** One shared editor, accessible here and through workload shortcuts. */ export function ProjectEnvironmentSettings() { - const { id, projectData, servicesData } = useProjectSettings(); + const { id } = useProjectSettings(); const { t } = useI18n(); const [envOpen, setEnvOpen] = useState(false); - const application = projectApplication(projectData, servicesData.services); - const shared = servicesData.services.some((service) => !service.applicationMode); - if (application && !shared) { - return ( + return ( + <> - {t.projectSettings.build.env.edit} - - - } - /> - ); - } - return ( - <> - {/* The same project environment panel also opens from Apps & Services. */} - } /> - setEnvOpen(false)} /> ); diff --git a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/DomainSettings.tsx b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/DomainSettings.tsx index df5460400..43691ed49 100644 --- a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/DomainSettings.tsx +++ b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/DomainSettings.tsx @@ -338,12 +338,14 @@ function resolveDomainSsl(hostname: string, domain: any, baseDomain: string, t: } interface DomainSettingsProps { + /** Primary app routes only, including before it has a backing service row. */ + applicationScope?: boolean; /** Keep domain management inside a service, with an optional port selected. */ serviceScope?: { serviceId: string; port?: number; add?: boolean }; onRoutesChanged?: () => void | Promise; } -export const DomainSettings = ({ serviceScope, onRoutesChanged }: DomainSettingsProps = {}) => { +export const DomainSettings = ({ applicationScope = false, serviceScope, onRoutesChanged }: DomainSettingsProps = {}) => { const { domainsData, updateDomains, @@ -673,7 +675,7 @@ export const DomainSettings = ({ serviceScope, onRoutesChanged }: DomainSettings const projectHasServices = Number(projectData.serviceCount ?? 0) > 0 || services.length > 0; const hasProjectLevelRouting = - !serviceScope && ((Array.isArray(projectData.publicEndpoints) && projectData.publicEndpoints.length > 0) || + !serviceScope && (applicationScope || (Array.isArray(projectData.publicEndpoints) && projectData.publicEndpoints.length > 0) || !projectHasServices); const draftPublicEndpoints = useMemo( () => @@ -717,6 +719,7 @@ export const DomainSettings = ({ serviceScope, onRoutesChanged }: DomainSettings (typeof endpoint?.id === "string" ? domainById.get(endpoint.id) : undefined) || domainByHostname.get(hostname) || null; + if (applicationScope && !serviceScope && domain?.serviceId) return null; const mappedPort = endpoint?.port !== undefined && endpoint?.port !== null ? String(endpoint.port) : projectRuntimePort; @@ -754,6 +757,8 @@ export const DomainSettings = ({ serviceScope, onRoutesChanged }: DomainSettings }) .filter((domain): domain is DomainSummaryItem => domain !== null); }, [ + applicationScope, + serviceScope?.serviceId, projectData.publicEndpoints, projectData.activeDeploymentId, projectData.awaitingDecision, @@ -1856,9 +1861,9 @@ export const DomainSettings = ({ serviceScope, onRoutesChanged }: DomainSettings /** Cards actually rendered — gates "Set as primary", which needs a choice. */ const totalRouteCards = serviceRouteCards.length + orphanDomainCards.length; - const inServiceScope = (summary: DomainSummaryItem) => !serviceScope || ( - summary.serviceId === serviceScope.serviceId && (!portFilter || summary.mappedPort === portFilter) - ); + const inServiceScope = (summary: DomainSummaryItem) => serviceScope + ? summary.serviceId === serviceScope.serviceId && (!portFilter || summary.mappedPort === portFilter) + : !applicationScope || !summary.serviceId; const visibleServiceRoutes = serviceRouteCards.filter(({ summary }) => inServiceScope(summary)); const visibleOrphanRoutes = orphanDomainCards.filter(inServiceScope); @@ -2718,7 +2723,7 @@ export const DomainSettings = ({ serviceScope, onRoutesChanged }: DomainSettings {/* Routing (rewrites/redirects/headers) — advanced, sits AFTER the domain/route cards so the primary domain list leads the page. */} - {!serviceScope && } + {!serviceScope && !applicationScope && !isCloudProject && } {editingRouteService && editingRouteTarget && routeDraft && (
({ @@ -18,6 +19,7 @@ const api = vi.hoisted(() => ({ inspectCaches: vi.fn(), push: vi.fn(), connections: vi.fn(), + setOptions: vi.fn(), })); vi.mock("@/lib/api", () => ({ projectsApi: { getEnv: api.getEnv, mergeEnv: api.mergeEnv, getCommitStatus: async () => ({ data: { supported: false } }) }, @@ -31,13 +33,14 @@ vi.mock("@/lib/api/client", () => ({ getApiRequestScopeVersion: () => 0, getApiErrorMessage: (_error: unknown, fallback: string) => fallback, })); -vi.mock("@/lib/api/projects", () => ({ projectsApi: { getEnv: api.getEnv } })); +vi.mock("@/lib/api/projects", () => ({ projectsApi: { getEnv: api.getEnv, setOptions: api.setOptions } })); vi.mock("@/lib/api/connections", () => ({ connectionsApi: { list: api.connections } })); vi.mock("@/components/services/RuntimeRoles", () => ({ RuntimeRolesCard: () => null })); vi.mock("@/components/services/RuntimeRoleConfiguration", () => ({ RuntimeRoleConfigurationControl: () => null })); vi.mock("@/hooks/useProjectEndpoints", () => ({ useProjectInfo: () => ({ isLoading: false }), invalidateProjectCachesFor: vi.fn(), + invalidateProjectCaches: vi.fn(), PROJECT_INFO_NOT_FOUND: "missing", })); vi.mock("next/navigation", () => ({ useRouter: () => ({ push: api.push, replace: vi.fn() }) })); @@ -76,6 +79,7 @@ beforeEach(() => { }, ], }); + api.setOptions.mockReset(); api.mergeEnv.mockResolvedValue({ upserted: 1, deleted: 0 }); api.trigger.mockReset().mockResolvedValue({ data: { deployment: { id: "next-deployment" } } }); host = document.createElement("div"); @@ -100,14 +104,6 @@ function TabsProbe() { ); } -function RoutedSettings({ children }: { children: ReactNode }) { - const [environment, setEnvironment] = useState(false); - return
{ - if ((event.target as HTMLElement).closest('a[href$="/application/env"]')) { - event.preventDefault(); setEnvironment(true); - } - }}>{environment ? : children}
; -} async function mountProject( framework: string, children: ReactNode = , @@ -130,7 +126,7 @@ async function mountProject( }} > - {children} + {children} , ), ); @@ -173,8 +169,7 @@ describe("project environment access (GH-881)", () => { }); it("keeps Apply available after revisiting the app Environment tab without another save", async () => { - await mountProject("node", , { runtimeMode: "bare" }); - await act(async () => button("Edit").click()); + await mountProject("node", , { runtimeMode: "bare" }); await editInput([...document.querySelectorAll("input")].find(input => input.value === "old")!, "new"); await act(async () => button("Save").click()); await act(async () => button("Overview").click()); @@ -336,7 +331,7 @@ describe("project environment access (GH-881)", () => { async (framework) => { await mountProject(framework); expect(host.querySelector('nav a[href$="/advanced"]')).not.toBeNull(); - expect(host.textContent).toContain(framework === "docker-compose" ? "Project environment" : "Environment"); + expect(host.textContent).toContain("Project environment"); await act(async () => button("Edit").click()); expect(api.getEnv).toHaveBeenCalledWith("project"); const value = [...document.querySelectorAll("input")].find((input) => input.value === "old")!; @@ -363,7 +358,7 @@ describe("project environment access (GH-881)", () => { it("keeps the shared editor for monorepos", async () => { api.services.mockResolvedValue({ success: true, services: [{ id: "sub", name: "api", kind: "monorepo" }] }); await mountProject("node"); - expect(host.textContent).toContain("Shared project environment"); + expect(host.textContent).toContain("Project environment"); expect(host.querySelector('nav a[href$="/advanced"]')).not.toBeNull(); expect(host.querySelectorAll('section[aria-label="Machine power"]')).toHaveLength(1); }); @@ -393,7 +388,71 @@ describe("project environment access (GH-881)", () => { ? [{ id: "cache", name: "redis", kind: "compose" }] : [] }); await mountProject("static", , { options: { hasServer: false, workloadType: "static" } }); - expect(host.querySelectorAll('section[aria-label="Machine power"]')).toHaveLength(hasCompanion ? 1 : 0); - expect(host.textContent).toContain(hasCompanion ? "Shared project environment" : "Environment"); + expect(host.querySelectorAll('section[aria-label="Machine power"]')).toHaveLength(1); + expect(host.textContent).toContain("Project environment"); + }); +}); + + +describe("permanent configuration ownership", () => { + const options = { workloadType: "web" as const, hasServer: true, hasBuild: true, + buildCommand: "bun run build", startCommand: "bun run start", productionPort: "3000" }; + const saved = { id: "project", name: "Test", slug: "test", description: "", framework: "nextjs", + runtimeMode: "bare", ...options, port: 3000 }; + + it.each([false, true])("keeps project limits and the shared editor in Settings with companions=%s", async (companions) => { + if (companions) api.services.mockResolvedValue({ success: true, services: [{ id: "db", name: "postgres", kind: "compose" }] }); + await mountProject("nextjs", , { options }); + expect(host.querySelectorAll('section[aria-label="Machine power"]')).toHaveLength(1); + expect(host.textContent).toContain("Project environment"); + expect(host.querySelector('a[href$="/application/env"]')).toBeNull(); + expect(host.querySelector('a[href$="/application/settings"]')).not.toBeNull(); + await act(async () => button("Edit").click()); + expect(document.querySelector('[data-modal-surface] input[value="BUILD_VALUE"]')).not.toBeNull(); + }); + + it("saves only edited app configuration inline without touching environment or deploying", async () => { + api.setOptions.mockResolvedValue({ success: true, data: { ...saved, buildCommand: "bun run build:production" } }); + await mountProject("nextjs", , { options, runtimeMode: "bare" }); + expect(host.querySelector('section[aria-label="Machine power"]')).toBeNull(); + expect(host.querySelector('a[href^="/deploy/"]')).toBeNull(); + await editInput(host.querySelector('input[value="bun run build"]')!, "bun run build:production"); + await act(async () => host.querySelector("form")!.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }))); + expect(api.setOptions).toHaveBeenCalledExactlyOnceWith("project", { buildCommand: "bun run build:production" }); + expect(host.querySelector('input[value="bun run build:production"]')).not.toBeNull(); + expect(api.trigger).not.toHaveBeenCalled(); + expect(api.mergeEnv).not.toHaveBeenCalled(); + expect(api.push).not.toHaveBeenCalled(); + expect(button("Save").disabled).toBe(true); + }); + + it("preserves a failed configuration draft for retry and ignores a double submit", async () => { + let reject!: (error: Error) => void; + api.setOptions.mockReturnValueOnce(new Promise((_, fail) => { reject = fail; })); + await mountProject("nextjs", , { options, runtimeMode: "bare" }); + await editInput(host.querySelector('input[value="bun run build"]')!, "bun run build:changed"); + await act(async () => { + const submit = () => host.querySelector("form")!.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true })); + submit(); submit(); + }); + expect(api.setOptions).toHaveBeenCalledOnce(); + expect(host.querySelector("fieldset")!.disabled).toBe(true); + await act(async () => reject(new Error("unavailable"))); + expect(host.querySelector('input[value="bun run build:changed"]')).not.toBeNull(); + expect(host.querySelector('[role="alert"]')).not.toBeNull(); + api.setOptions.mockResolvedValueOnce({ success: true, data: { ...saved, buildCommand: "bun run build:changed" } }); + await act(async () => host.querySelector("form")!.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }))); + expect(api.setOptions).toHaveBeenCalledTimes(2); + expect(button("Save").disabled).toBe(true); + }); + + it("retains an unsaved app configuration when switching local tabs", async () => { + await mountProject("nextjs", , { options, runtimeMode: "bare" }); + await act(async () => host.querySelector('a[href$="/application/settings"]')!.click()); + await editInput(host.querySelector('input[value="bun run build"]')!, "bun run build:draft"); + await act(async () => button("Overview").click()); + await act(async () => host.querySelector('a[href$="/application/settings"]')!.click()); + expect(host.querySelector('input[value="bun run build:draft"]')).not.toBeNull(); + expect(api.setOptions).not.toHaveBeenCalled(); }); }); diff --git a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/ProjectApplicationPanel.tsx b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/ProjectApplicationPanel.tsx index fa3c208d9..302f39297 100644 --- a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/ProjectApplicationPanel.tsx +++ b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/ProjectApplicationPanel.tsx @@ -9,13 +9,13 @@ import { Button } from "@/components/ui/button"; import { useI18n } from "@/components/i18n-provider"; import { useProjectSettings } from "@/context/ProjectSettingsContext"; import { ProjectEnvironmentPanel } from "@/components/project-settings/ProjectEnvironmentPanel"; +import { ApplicationSettingsForm } from "@/components/project-settings/ApplicationSettingsForm"; import { ProjectStatusBadge } from "@/components/shared/ProjectStatusBadge"; import { RuntimeRoleConfigurationControl } from "@/components/services/RuntimeRoleConfiguration"; import { RuntimeRolesCard } from "@/components/services/RuntimeRoles"; import { canConfigureRuntimeRoles } from "@/lib/runtime-roles"; import { applicationServiceRoute, projectApplication } from "@/lib/project-application"; import { invalidateProjectCaches } from "@/hooks/useProjectEndpoints"; -import { BuildSettings } from "../BuildSettings"; import { LogsSettings } from "../LogsSettings"; import { DomainSettings } from "../DomainSettings"; import { StorageSettings } from "../StorageSettings"; @@ -50,7 +50,10 @@ export function ProjectApplicationPanel({ supported.includes(requested) ? requested : "overview", ); const [envVisited, setEnvVisited] = useState(requested === "env"); - const [busy, setBusy] = useState(false); + const [settingsVisited, setSettingsVisited] = useState(requested === "settings"); + const [envBusy, setEnvBusy] = useState(false); + const [settingsBusy, setSettingsBusy] = useState(false); + const busy = envBusy || settingsBusy; const [refreshing, setRefreshing] = useState(false); useEffect(() => { setActiveTab(supported.includes(requested) ? requested : "overview"); @@ -59,6 +62,7 @@ export function ProjectApplicationPanel({ }, [requested, workload]); useEffect(() => { if (activeTab === "env") setEnvVisited(true); + if (activeTab === "settings") setSettingsVisited(true); }, [activeTab]); const changeTab = (tab: WorkloadTab) => { if (busy) return; @@ -171,17 +175,22 @@ export function ProjectApplicationPanel({ )} {(envVisited || activeTab === "env") && ( )} {activeTab === "logs" && } {activeTab === "domains" && ( )} {activeTab === "volumes" && } - {activeTab === "settings" && } + {(settingsVisited || activeTab === "settings") && ( + + )}
); } diff --git a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/service-domains.test.tsx b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/service-domains.test.tsx index 4503c97a4..28825b05d 100644 --- a/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/service-domains.test.tsx +++ b/apps/dashboard/src/app/(dashboard)/projects/[id]/components/services/service-domains.test.tsx @@ -24,8 +24,8 @@ vi.mock("@/hooks/useSystemPrepareModal", () => ({ useEdgeModal: () => mocks.edge vi.mock("@/hooks/useProjectEndpoints", () => ({ invalidateProjectCaches: mocks.invalidate })); vi.mock("@/hooks/useLocalhostForward", () => ({ useLocalhostForward: () => ({ canForward: false }) })); vi.mock("../RoutingUnsyncedCallout", () => ({ RoutingUnsyncedCallout: () => null })); -vi.mock("../RoutingConfigCard", () => ({ RoutingConfigCard: () => null })); -vi.mock("../RouteRules", () => ({ RouteRules: () => null })); +vi.mock("../RoutingConfigCard", () => ({ RoutingConfigCard: () =>
})); +vi.mock("../RouteRules", () => ({ RouteRules: () =>
})); vi.mock("@/components/ingress/DomainIngressSettings", () => ({ DomainIngressMenu: () => null, IngressDestinationNotice: () => null })); vi.mock("@/lib/api", async (original) => { const actual = await original(); @@ -100,9 +100,9 @@ afterEach(async () => { vi.unstubAllGlobals(); vi.restoreAllMocks(); }); -async function render(scope: { serviceId: string; port?: number; add?: boolean } | null = { serviceId: service.id }) { +async function render(scope: { serviceId: string; port?: number; add?: boolean } | null = { serviceId: service.id }, applicationScope = false) { await act(async () => root.render( - + )); } function button(label: string) { @@ -483,3 +483,28 @@ it("edits an existing service domain into a redirect without changing its siblin primary, { ...secondary, redirectTo: primary.customDomain, redirectStatus: 301 }, ]); }); + + +describe("application domain ownership", () => { + it.each([false, true])("keeps project routing policy outside the app with backing service=%s", async (backing) => { + context.projectData.framework = "nextjs"; + context.projectData.deployTarget = "server"; + context.projectData.publicEndpoints = [primary]; + context.servicesData.services = backing ? [service, other] : [other]; + if (!backing) context.domainsData.domains = context.domainsData.domains.map(row => row.serviceId === service.id ? { ...row, serviceId: undefined } : row); + await render(backing ? { serviceId: service.id } : null, true); + expect(host.textContent).toContain("app.example.com"); + expect(host.textContent).not.toContain("other.example.com"); + expect(host.querySelector('[aria-label="Project routing policy"]')).toBeNull(); + expect(host.querySelector('[aria-label="Project route rules"]')).toBeNull(); + }); + + it("keeps project routing policy and route rules in project Domains", async () => { + context.projectData.deployTarget = "server"; + await render(null); + expect(host.querySelectorAll('[aria-label="Project routing policy"]')).toHaveLength(1); + expect(host.querySelectorAll('[aria-label="Project route rules"]')).toHaveLength(1); + expect(host.textContent).toContain("other.example.com"); + expect(host.textContent).toContain("app.example.com"); + }); +}); diff --git a/apps/dashboard/src/components/import-project/BuildSettings.domains.test.tsx b/apps/dashboard/src/components/import-project/BuildSettings.domains.test.tsx index 9236e6240..c0fead4e2 100644 --- a/apps/dashboard/src/components/import-project/BuildSettings.domains.test.tsx +++ b/apps/dashboard/src/components/import-project/BuildSettings.domains.test.tsx @@ -82,3 +82,29 @@ it.each([false, true])( ).toHaveLength(2); }, ); + +it("reuses controlled fields in saved settings without exposing or changing route targets", async () => { + const updateOptions = vi.fn(); + const updateConfig = vi.fn(); + const config = { + framework: "nextjs", runtimeMode: "bare", + publicEndpoints: [ + createPublicEndpoint({ domainType: "custom", customDomain: "app.example.com", port: "3000" }), + createPublicEndpoint({ domainType: "custom", customDomain: "metrics.example.com", port: "9000" }), + ], + options: { hasBuild: true, hasServer: true, workloadType: "web", productionPort: "3000" }, + }; + mocks.config = { framework: "static", options: { hasServer: false } }; + await act(async () => root.render()); + expect(container.textContent).not.toContain("metrics.example.com"); + const port = container.querySelector('input[type="number"]')!; + expect(port.value).toBe("3000"); + await act(async () => { + Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(port, "8080"); + port.dispatchEvent(new Event("input", { bubbles: true })); + }); + expect(updateOptions).toHaveBeenCalledExactlyOnceWith({ productionPort: "8080" }); + expect(updateConfig).not.toHaveBeenCalled(); + expect(mocks.updateConfig).not.toHaveBeenCalled(); +}); diff --git a/apps/dashboard/src/components/import-project/BuildSettings.tsx b/apps/dashboard/src/components/import-project/BuildSettings.tsx index 99891180b..f250ea08b 100644 --- a/apps/dashboard/src/components/import-project/BuildSettings.tsx +++ b/apps/dashboard/src/components/import-project/BuildSettings.tsx @@ -30,6 +30,8 @@ interface InputField { } interface BuildSettingsProps { + /** Saved app settings use the same fields without draft environment or route editors. */ + surface?: "deploy" | "settings"; allowWorker?: boolean; variant?: "deploy" | "import"; mode?: "simple" | "advanced"; @@ -38,21 +40,24 @@ interface BuildSettingsProps { loading?: { [key: string]: boolean }; buildConfig?: any; updateOptions?: (options: any) => void; + updateConfig?: (config: any) => void; } const BuildSettings: React.FC = ({ + surface = "deploy", mode = "simple", allowWorker = true, buildData: externalBuildData, onSave, loading = {}, buildConfig, - updateOptions: externalUpdateOptions + updateOptions: externalUpdateOptions, + updateConfig: externalUpdateConfig, }) => { const deploymentContext = useOptionalDeployment(); - const fallbackContext = { config: buildConfig || {}, updateOptions: externalUpdateOptions || (() => {}), updateConfig: () => {} }; + const fallbackContext = { config: buildConfig || {}, updateOptions: externalUpdateOptions || (() => {}), updateConfig: externalUpdateConfig || (() => {}) }; const resolvedContext = mode === 'simple' - ? (deploymentContext ?? fallbackContext) + ? (buildConfig ? fallbackContext : deploymentContext ?? fallbackContext) : fallbackContext; const { config, updateOptions, updateConfig } = resolvedContext; const { baseDomain } = usePlatform(); @@ -98,7 +103,7 @@ const BuildSettings: React.FC = ({ packageManager: config?.packageManager || "npm", buildImage: config?.buildImage || "", }); - const primaryPortLabel = primaryEndpointHost + const primaryPortLabel = surface === "settings" ? bs.productionPort : primaryEndpointHost ? ( <> {bs.portForPrefix} {primaryEndpointHost} @@ -242,7 +247,7 @@ const BuildSettings: React.FC = ({ const handleChange = (field: InputField, value: string) => { if (mode === 'simple' && updateOptions) { - if (field.key === 'productionPort' && config?.options?.hasServer && updateConfig) { + if (surface === "deploy" && field.key === 'productionPort' && config?.options?.hasServer && updateConfig) { const primaryEndpoint = servingEndpoints[0]; updateConfig({ productionPortTouched: true, @@ -519,7 +524,7 @@ const BuildSettings: React.FC = ({ }; const renderEndpointTargetInputs = () => { - if (mode !== 'simple') { + if (mode !== 'simple' || surface === "settings") { return null; } @@ -584,14 +589,14 @@ const BuildSettings: React.FC = ({ if (mode === 'simple') { return (
- { + {surface === "deploy" && { const existing = config.envVars ?? []; for (const [key, value] of Object.entries(variables)) { const row = existing.find((item: { key: string }) => item.key === key); if (row && row.value !== value) throw new Error(`Environment already has a different or masked value for ${key}. Resolve it before migrating.`); } updateConfig({ options: { ...config.options, ...commands }, envVars: [...existing, ...Object.entries(variables).filter(([key]) => !existing.some((row: { key: string }) => row.key === key)).map(([key, value]) => ({ key, value, isSecret: true }))] }); - }} /> + }} />}
-

{bs.deployConfig}

+

{surface === "settings" ? t.projectSettings.build.runtime.title : bs.deployConfig}

- {config?.framework + {surface === "settings" ? t.projectSettings.build.runtime.description : config?.framework ? interpolate(bs.defaultsApplied, { framework: config.framework }) : bs.configureOptions}

diff --git a/apps/dashboard/src/components/project-settings/ApplicationSettingsForm.tsx b/apps/dashboard/src/components/project-settings/ApplicationSettingsForm.tsx new file mode 100644 index 000000000..7114c979d --- /dev/null +++ b/apps/dashboard/src/components/project-settings/ApplicationSettingsForm.tsx @@ -0,0 +1,233 @@ +"use client"; + +import { useEffect, useMemo, useRef, useState } from "react"; +import Link from "next/link"; +import { Icon } from "@repo/ui/icons"; +import { normalizeRepoPath, resolveWorkload } from "@repo/core"; +import { RuntimeSourceUpdate } from "@/components/updates/RuntimeSourceUpdate"; +import BuildSettingsFields from "@/components/import-project/BuildSettings"; +import { CommandEnvironmentNotice } from "@/components/import-project/CommandEnvironmentNotice"; +import { Button } from "@/components/ui/button"; +import { useI18n } from "@/components/i18n-provider"; +import { useProjectSettings } from "@/context/ProjectSettingsContext"; +import { useToast } from "@/context/ToastContext"; +import { projectsApi, type ProjectOptionsBody } from "@/lib/api/projects"; +import { getApiErrorMessage } from "@/lib/api/client"; +import { invalidateProjectCaches } from "@/hooks/useProjectEndpoints"; + +type Config = ReturnType["projectData"]; + +/** Only fields owned by the shared build form. Environment, routes and source identity + * have their own owners and must never be serialized by a configuration save. */ +function optionsOf(config: Config): ProjectOptionsBody { + const options = config.options ?? {}; + return { + installCommand: options.installCommand ?? "", + buildCommand: options.buildCommand ?? "", + startCommand: options.startCommand ?? "", + outputDirectory: options.outputDirectory ?? "", + productionPaths: options.productionPaths ?? "", + rootDirectory: options.rootDirectory ?? "", + productionPort: options.productionPort ? Number(options.productionPort) : undefined, + hasBuild: options.hasBuild, + hasServer: options.hasServer, + workloadType: options.workloadType, + buildImage: config.buildImage ?? "", + runtimeVersion: config.runtimeVersion ?? null, + runtimeImage: config.runtimeImage ?? null, + }; +} + +export function ApplicationSettingsForm({ + onBusyChange, +}: { + onBusyChange?: (busy: boolean) => void; +}) { + const { id, projectData, buildData, updateProjectData, updateBuild, refreshEnvironment } = + useProjectSettings(); + const { t } = useI18n(); + const copy = t.projectSettings.build.runtime; + const { showToast } = useToast(); + const persisted = useMemo( + () => ({ ...projectData, options: { ...projectData.options, ...buildData } }), + [projectData, buildData], + ); + const [baseline, setBaseline] = useState(persisted); + const [draft, setDraft] = useState(persisted); + const [saving, setSaving] = useState(false); + const [error, setError] = useState(null); + const mutation = useRef(false); + const alive = useRef(true); + const before = optionsOf(baseline); + const after = optionsOf(draft); + const patch = Object.fromEntries( + Object.entries(after).filter( + ([key, value]) => value !== before[key as keyof ProjectOptionsBody], + ), + ) as ProjectOptionsBody; + const dirty = Object.keys(patch).length > 0; + + useEffect(() => { + alive.current = true; + return () => { + alive.current = false; + }; + }, []); + useEffect(() => { + onBusyChange?.(saving); + }, [saving, onBusyChange]); + useEffect(() => { + // A status refresh or an added companion must not erase an unsaved app draft. + if (!dirty && !mutation.current) { + setBaseline(persisted); + setDraft(persisted); + } + }, [persisted, dirty]); + useEffect(() => { + if (!dirty) return; + const prevent = (event: BeforeUnloadEvent) => { + event.preventDefault(); + event.returnValue = ""; + }; + window.addEventListener("beforeunload", prevent); + return () => window.removeEventListener("beforeunload", prevent); + }, [dirty]); + + const save = async () => { + if (mutation.current || !dirty || buildData.isLoading || buildData.error) return; + if ( + Object.hasOwn(patch, "productionPort") && + (!Number.isInteger(patch.productionPort) || + patch.productionPort! < 1 || + patch.productionPort! > 65535) + ) { + setError(copy.invalidPort); + return; + } + mutation.current = true; + setSaving(true); + setError(null); + try { + const result = await projectsApi.setOptions(id, patch); + if (result.success === false) throw new Error(copy.saveFailed); + if (!alive.current) return; + // setOptions returns the flat Project contract; the page uses the nested + // ProjectDetails projection. Map only this form's options, retaining the + // server's normalized workload, images and commands. + const saved = result.data as Config; + if (!saved || saved.id !== id) throw new Error(copy.saveFailed); + const workload = resolveWorkload(saved.workloadType, saved.hasServer); + const options = Object.fromEntries( + Object.entries(after) + .filter(([key]) => !["buildImage", "runtimeVersion", "runtimeImage"].includes(key)) + .map(([key, fallback]) => [ + key, + key === "productionPort" + ? workload === "web" + ? String(saved.port ?? 3000) + : "" + : key === "workloadType" + ? workload + : Object.hasOwn(saved, key) + ? (saved[key] ?? (typeof fallback === "string" ? "" : fallback)) + : fallback, + ]), + ); + const normalized = { ...draft, ...saved, options: { ...draft.options, ...options } }; + updateProjectData(normalized); + setBaseline(normalized); + setDraft(normalized); + invalidateProjectCaches(id); + showToast(copy.saved, "success"); + } catch (cause) { + if (alive.current) setError(getApiErrorMessage(cause, copy.saveFailed)); + } finally { + mutation.current = false; + if (alive.current) setSaving(false); + } + }; + + return ( +
+ {projectData.gitOwner && + projectData.gitRepo && + (projectData.buildKind === "dockerfile" || projectData.framework === "docker") && ( + + )} + {!dirty && ( + { + updateBuild(commands); + await refreshEnvironment(); + }} + /> + )} +
{ + event.preventDefault(); + void save(); + }} + > +
+ setDraft((previous) => ({ ...previous, ...updates }))} + updateOptions={(updates) => + setDraft((previous) => ({ + ...previous, + options: { ...previous.options, ...updates }, + })) + } + /> + {(error || buildData.error) && ( +

+ {error || buildData.error} +

+ )} +
+ + +
+
+
+

+ {copy.projectSettingsHint}{" "} + + {t.projects.sidebar.tabs.settings} + +

+
+ ); +} diff --git a/apps/dashboard/src/i18n/locales/ar/projectSettings.json b/apps/dashboard/src/i18n/locales/ar/projectSettings.json index 0cdab3a8e..dd0d5dcab 100644 --- a/apps/dashboard/src/i18n/locales/ar/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/ar/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "إعداد وقت التشغيل", - "description": "للقراءة فقط. عدّل عبر معالج النشر بحيث يُشحن كل تغيير كإصدار جديد.", + "description": "احفظ الإعدادات هنا. تسري التغييرات عند النشر التالي.", "framework": "الإطار", "packageManager": "مدير الحزم", "runtimeIsolation": "عزل وقت التشغيل", @@ -498,7 +498,11 @@ "modeSandboxed": "معزول (حاوية)", "modeDirect": "مباشر (عملية على المضيف)", "modeDefault": "افتراضي (يُحدَّد عند النشر)", - "modeStatic": "لا شيء — يُقدَّم كملفات ثابتة" + "modeStatic": "لا شيء — يُقدَّم كملفات ثابتة", + "saved": "تم حفظ الإعدادات. انشر لتطبيق التغييرات.", + "saveFailed": "تعذر حفظ الإعدادات. لا تزال تغييراتك محفوظة في النموذج.", + "projectSettingsHint": "تُدار البيئة المشتركة وحدود الموارد من إعدادات المشروع.", + "invalidPort": "أدخل منفذًا بين 1 و65535." }, "storage": { "title": "تخزين دائم", @@ -540,7 +544,7 @@ "env": { "title": "بيئة المشروع", "sharedTitle": "بيئة المشروع المشتركة", - "description": "تُستخدم أثناء البناء والتشغيل. تبقى الأسرار مخفية.", + "description": "قيم افتراضية مشتركة للبناء والتشغيل. قيم الخدمة لها الأولوية. تبقى الأسرار مخفية.", "edit": "تعديل" } }, diff --git a/apps/dashboard/src/i18n/locales/de/projectSettings.json b/apps/dashboard/src/i18n/locales/de/projectSettings.json index 174f88f40..e6dc03dc4 100644 --- a/apps/dashboard/src/i18n/locales/de/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/de/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "Laufzeitkonfiguration", - "description": "Schreibgeschützt. Bearbeiten Sie über den Deploy-Assistenten, damit jede Änderung als neue Version ausgeliefert wird.", + "description": "Konfiguration hier speichern. Änderungen werden bei der nächsten Bereitstellung wirksam.", "framework": "Framework", "packageManager": "Paketmanager", "runtimeIsolation": "Laufzeit-Isolation", @@ -498,7 +498,11 @@ "modeSandboxed": "Sandbox (Container)", "modeDirect": "Direkt (Host-Prozess)", "modeDefault": "Standard (beim Deploy aufgelöst)", - "modeStatic": "Keine – als statische Dateien ausgeliefert" + "modeStatic": "Keine – als statische Dateien ausgeliefert", + "saved": "Konfiguration gespeichert. Stelle die App bereit, um die Änderungen anzuwenden.", + "saveFailed": "Die Konfiguration konnte nicht gespeichert werden. Deine Änderungen bleiben im Formular erhalten.", + "projectSettingsHint": "Die gemeinsame Umgebung und Ressourcenlimits werden in den Projekteinstellungen verwaltet.", + "invalidPort": "Gib einen Port zwischen 1 und 65535 ein." }, "storage": { "title": "Dauerhafter Speicher", @@ -540,7 +544,7 @@ "env": { "title": "Projektumgebung", "sharedTitle": "Gemeinsame Projektumgebung", - "description": "Wird beim Build und zur Laufzeit verwendet. Geheimnisse bleiben maskiert.", + "description": "Gemeinsame Standardwerte für Image-Builds und Laufzeit. Dienstwerte haben Vorrang. Geheimnisse bleiben verborgen.", "edit": "Bearbeiten" } }, diff --git a/apps/dashboard/src/i18n/locales/en/projectSettings.json b/apps/dashboard/src/i18n/locales/en/projectSettings.json index e5975d43f..53ff643c7 100644 --- a/apps/dashboard/src/i18n/locales/en/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/en/projectSettings.json @@ -532,7 +532,7 @@ }, "runtime": { "title": "Runtime configuration", - "description": "Read-only. Edit through the deploy wizard so each change ships as a new version.", + "description": "Save configuration here. Changes take effect on the next deployment.", "framework": "Framework", "packageManager": "Package manager", "runtimeIsolation": "Runtime isolation", @@ -548,7 +548,11 @@ "modeSandboxed": "Sandboxed (container)", "modeDirect": "Direct (host process)", "modeDefault": "Default (resolved at deploy)", - "modeStatic": "None — served as static files" + "modeStatic": "None — served as static files", + "saved": "Configuration saved. Deploy to apply your changes.", + "saveFailed": "Could not save configuration. Your changes are still here.", + "projectSettingsHint": "Shared environment and resource limits are managed in project Settings.", + "invalidPort": "Enter a port between 1 and 65535." }, "storage": { "title": "Persistent storage", @@ -590,7 +594,7 @@ "env": { "title": "Project environment", "sharedTitle": "Shared project environment", - "description": "Used during builds and at runtime. Secrets stay masked.", + "description": "Shared defaults for image builds and runtime. Service values take precedence. Secrets stay masked.", "edit": "Edit" } }, diff --git a/apps/dashboard/src/i18n/locales/es/projectSettings.json b/apps/dashboard/src/i18n/locales/es/projectSettings.json index 3633c6b45..b556bc26b 100644 --- a/apps/dashboard/src/i18n/locales/es/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/es/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "Configuración de tiempo de ejecución", - "description": "Solo lectura. Edítalo mediante el asistente de despliegue para que cada cambio se publique como una nueva versión.", + "description": "Guarda la configuración aquí. Los cambios se aplicarán en el próximo despliegue.", "framework": "Framework", "packageManager": "Gestor de paquetes", "runtimeIsolation": "Aislamiento del tiempo de ejecución", @@ -498,7 +498,11 @@ "modeSandboxed": "En sandbox (contenedor)", "modeDirect": "Directo (proceso del host)", "modeDefault": "Predeterminado (resuelto en el despliegue)", - "modeStatic": "Ninguno: se sirve como archivos estáticos" + "modeStatic": "Ninguno: se sirve como archivos estáticos", + "saved": "Configuración guardada. Despliega para aplicar los cambios.", + "saveFailed": "No se pudo guardar la configuración. Tus cambios siguen en el formulario.", + "projectSettingsHint": "El entorno compartido y los límites de recursos se gestionan en los ajustes del proyecto.", + "invalidPort": "Introduce un puerto entre 1 y 65535." }, "storage": { "title": "Almacenamiento persistente", @@ -540,7 +544,7 @@ "env": { "title": "Entorno del proyecto", "sharedTitle": "Entorno compartido del proyecto", - "description": "Se usa durante la compilación y la ejecución. Los secretos permanecen ocultos.", + "description": "Valores predeterminados compartidos para compilar imágenes y ejecutar servicios. Los valores del servicio tienen prioridad. Los secretos permanecen ocultos.", "edit": "Editar" } }, diff --git a/apps/dashboard/src/i18n/locales/fr/projectSettings.json b/apps/dashboard/src/i18n/locales/fr/projectSettings.json index 5eaed55f8..6ac3bb6d6 100644 --- a/apps/dashboard/src/i18n/locales/fr/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/fr/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "Configuration d'exécution", - "description": "Lecture seule. Modifiez via l'assistant de déploiement afin que chaque changement soit livré comme une nouvelle version.", + "description": "Enregistrez la configuration ici. Les modifications prendront effet au prochain déploiement.", "framework": "Framework", "packageManager": "Gestionnaire de paquets", "runtimeIsolation": "Isolation d'exécution", @@ -498,7 +498,11 @@ "modeSandboxed": "En bac à sable (conteneur)", "modeDirect": "Direct (processus hôte)", "modeDefault": "Par défaut (résolu au déploiement)", - "modeStatic": "Aucun — servi en fichiers statiques" + "modeStatic": "Aucun — servi en fichiers statiques", + "saved": "Configuration enregistrée. Déployez pour appliquer vos modifications.", + "saveFailed": "Impossible d’enregistrer la configuration. Vos modifications sont conservées dans le formulaire.", + "projectSettingsHint": "L’environnement partagé et les limites de ressources se gèrent dans les paramètres du projet.", + "invalidPort": "Saisissez un port compris entre 1 et 65535." }, "storage": { "title": "Stockage persistant", @@ -540,7 +544,7 @@ "env": { "title": "Environnement du projet", "sharedTitle": "Environnement partagé du projet", - "description": "Utilisé lors de la compilation et de l’exécution. Les secrets restent masqués.", + "description": "Valeurs par défaut partagées pour la création des images et l’exécution. Les valeurs du service sont prioritaires. Les secrets restent masqués.", "edit": "Modifier" } }, diff --git a/apps/dashboard/src/i18n/locales/ja/projectSettings.json b/apps/dashboard/src/i18n/locales/ja/projectSettings.json index 0200d06b8..8f450bbf0 100644 --- a/apps/dashboard/src/i18n/locales/ja/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/ja/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "ランタイム設定", - "description": "読み取り専用。各変更を新しいバージョンとして反映するため、デプロイウィザードから編集してください。", + "description": "ここで設定を保存します。変更は次回のデプロイ時に反映されます。", "framework": "フレームワーク", "packageManager": "パッケージマネージャー", "runtimeIsolation": "ランタイム分離", @@ -498,7 +498,11 @@ "modeSandboxed": "サンドボックス化(コンテナ)", "modeDirect": "ダイレクト(ホストプロセス)", "modeDefault": "デフォルト(デプロイ時に解決)", - "modeStatic": "なし(静的ファイルとして配信)" + "modeStatic": "なし(静的ファイルとして配信)", + "saved": "設定を保存しました。変更を適用するにはデプロイしてください。", + "saveFailed": "設定を保存できませんでした。変更内容はフォームに保持されています。", + "projectSettingsHint": "共有環境とリソース制限はプロジェクト設定で管理します。", + "invalidPort": "1〜65535のポート番号を入力してください。" }, "storage": { "title": "永続ストレージ", @@ -540,7 +544,7 @@ "env": { "title": "プロジェクトの環境変数", "sharedTitle": "プロジェクト共通の環境変数", - "description": "ビルド時と実行時に使用します。シークレットは非表示のままです。", + "description": "イメージのビルドと実行時に使用する共通のデフォルト値です。サービスの値が優先されます。シークレットはマスクされたままです。", "edit": "編集" } }, diff --git a/apps/dashboard/src/i18n/locales/pt/projectSettings.json b/apps/dashboard/src/i18n/locales/pt/projectSettings.json index aabb2ac19..014d5b274 100644 --- a/apps/dashboard/src/i18n/locales/pt/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/pt/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "Configuração de runtime", - "description": "Apenas leitura. Edite através do assistente de implementação para que cada alteração seja publicada como uma nova versão.", + "description": "Salve a configuração aqui. As alterações entram em vigor na próxima implantação.", "framework": "Framework", "packageManager": "Gestor de pacotes", "runtimeIsolation": "Isolamento de runtime", @@ -498,7 +498,11 @@ "modeSandboxed": "Isolado (contentor)", "modeDirect": "Direto (processo do anfitrião)", "modeDefault": "Predefinido (resolvido na implementação)", - "modeStatic": "Nenhum — servido como ficheiros estáticos" + "modeStatic": "Nenhum — servido como ficheiros estáticos", + "saved": "Configuração salva. Implante para aplicar as alterações.", + "saveFailed": "Não foi possível salvar a configuração. Suas alterações continuam no formulário.", + "projectSettingsHint": "O ambiente compartilhado e os limites de recursos são gerenciados nas configurações do projeto.", + "invalidPort": "Informe uma porta entre 1 e 65535." }, "storage": { "title": "Armazenamento persistente", @@ -540,7 +544,7 @@ "env": { "title": "Ambiente do projeto", "sharedTitle": "Ambiente compartilhado do projeto", - "description": "Usado durante a compilação e a execução. Os segredos permanecem ocultos.", + "description": "Valores padrão compartilhados para criar imagens e executar serviços. Os valores do serviço têm prioridade. Os segredos permanecem ocultos.", "edit": "Editar" } }, diff --git a/apps/dashboard/src/i18n/locales/ru/projectSettings.json b/apps/dashboard/src/i18n/locales/ru/projectSettings.json index c5474717c..8f5e396a0 100644 --- a/apps/dashboard/src/i18n/locales/ru/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/ru/projectSettings.json @@ -532,7 +532,7 @@ }, "runtime": { "title": "Конфигурация среды выполнения", - "description": "Только чтение. Редактируйте через мастер деплоя, чтобы каждое изменение поставлялось как новая версия.", + "description": "Сохраните настройки здесь. Изменения вступят в силу при следующем развёртывании.", "framework": "Фреймворк", "packageManager": "Менеджер пакетов", "runtimeIsolation": "Изоляция среды", @@ -548,7 +548,11 @@ "modeSandboxed": "В песочнице (контейнер)", "modeDirect": "Прямой (процесс хоста)", "modeDefault": "По умолчанию (определяется при деплое)", - "modeStatic": "Нет — отдается как статические файлы" + "modeStatic": "Нет — отдается как статические файлы", + "saved": "Настройки сохранены. Выполните развёртывание, чтобы применить изменения.", + "saveFailed": "Не удалось сохранить настройки. Ваши изменения остались в форме.", + "projectSettingsHint": "Общая среда и ограничения ресурсов управляются в настройках проекта.", + "invalidPort": "Введите номер порта от 1 до 65535." }, "storage": { "title": "Постоянное хранилище", @@ -590,7 +594,7 @@ "env": { "title": "Окружение проекта", "sharedTitle": "Общее окружение проекта", - "description": "Используется при сборке и выполнении. Секреты остаются скрытыми.", + "description": "Общие значения по умолчанию для сборки образов и выполнения. Значения сервиса имеют приоритет. Секреты остаются скрытыми.", "edit": "Редактировать" } }, diff --git a/apps/dashboard/src/i18n/locales/tr/projectSettings.json b/apps/dashboard/src/i18n/locales/tr/projectSettings.json index b5ae9bad2..3f9e5f391 100644 --- a/apps/dashboard/src/i18n/locales/tr/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/tr/projectSettings.json @@ -532,7 +532,7 @@ }, "runtime": { "title": "Çalışma zamanı yapılandırması", - "description": "Salt okunur. Dağıtım sihirbazı aracılığıyla düzenleyin, böylece her değişiklik yeni bir sürüm olarak yayınlansın.", + "description": "Yapılandırmayı buradan kaydedin. Değişiklikler bir sonraki dağıtımda uygulanır.", "framework": "Framework", "packageManager": "Paket yöneticisi", "runtimeIsolation": "Çalışma zamanı izolasyonu", @@ -548,7 +548,11 @@ "modeSandboxed": "Korumalı Alan (konteyner)", "modeDirect": "Doğrudan (ana makine süreci)", "modeDefault": "Varsayılan (dağıtımda çözümlenir)", - "modeStatic": "Yok — statik dosya olarak sunulur" + "modeStatic": "Yok — statik dosya olarak sunulur", + "saved": "Yapılandırma kaydedildi. Değişiklikleri uygulamak için dağıtım yapın.", + "saveFailed": "Yapılandırma kaydedilemedi. Değişiklikleriniz formda korunuyor.", + "projectSettingsHint": "Paylaşılan ortam ve kaynak sınırları proje ayarlarından yönetilir.", + "invalidPort": "1 ile 65535 arasında bir bağlantı noktası girin." }, "storage": { "title": "Kalıcı depolama", @@ -590,7 +594,7 @@ "env": { "title": "Proje ortamı", "sharedTitle": "Paylaşılan proje ortamı", - "description": "Derleme ve çalışma sırasında kullanılır. Gizli değerler maskeli kalır.", + "description": "İmaj derlemeleri ve çalışma zamanı için paylaşılan varsayılan değerler. Hizmet değerleri önceliklidir. Gizli değerler maskelenir.", "edit": "Düzenle" } }, diff --git a/apps/dashboard/src/i18n/locales/zh/projectSettings.json b/apps/dashboard/src/i18n/locales/zh/projectSettings.json index ad661b324..24b0cc21f 100644 --- a/apps/dashboard/src/i18n/locales/zh/projectSettings.json +++ b/apps/dashboard/src/i18n/locales/zh/projectSettings.json @@ -482,7 +482,7 @@ }, "runtime": { "title": "运行时配置", - "description": "只读。请通过部署向导进行编辑,使每次更改都作为新版本发布。", + "description": "在此保存配置。更改将在下次部署时生效。", "framework": "框架", "packageManager": "包管理器", "runtimeIsolation": "运行时隔离", @@ -498,7 +498,11 @@ "modeSandboxed": "沙盒化(容器)", "modeDirect": "直接(主机进程)", "modeDefault": "默认(部署时解析)", - "modeStatic": "无 — 以静态文件形式提供" + "modeStatic": "无 — 以静态文件形式提供", + "saved": "配置已保存。请部署以应用更改。", + "saveFailed": "无法保存配置。您的更改仍保留在表单中。", + "projectSettingsHint": "共享环境和资源限制在项目设置中管理。", + "invalidPort": "请输入 1 到 65535 之间的端口号。" }, "storage": { "title": "持久化存储", @@ -540,7 +544,7 @@ "env": { "title": "项目环境变量", "sharedTitle": "项目共享环境变量", - "description": "在构建和运行时使用。密钥保持隐藏。", + "description": "用于镜像构建和运行时的共享默认值。服务中的值优先,密钥保持隐藏。", "edit": "编辑" } }, diff --git a/apps/web/public/icons/translate language-115-1663582874.png b/apps/web/public/icons/translate language-115-1663582874.png new file mode 100644 index 000000000..32bfa08cf Binary files /dev/null and b/apps/web/public/icons/translate language-115-1663582874.png differ diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css index e7dd91842..1555e1c12 100644 --- a/apps/web/src/app/globals.css +++ b/apps/web/src/app/globals.css @@ -23,10 +23,22 @@ html[lang="ar"] :where(h1, h2, h3, h4, p, span, a, button, li, dt, dd, strong, l html[lang="ar"] :where(h1, h2, h3, h4) { line-height: 1.4; } +html[lang="ar"] .landing-hero { + padding-block: 112px 56px; +} +html[lang="ar"] .hero-content { + max-width: 1000px; +} html[lang="ar"] .hero-title > span { - font-size: clamp(2.25rem, 5vw, 3.5rem); + font-size: clamp(2rem, 4.5vw, 3.75rem); line-height: 1.4; font-weight: 400; + text-wrap: balance; +} +html[lang="ar"] .landing-hero .hero-description { + max-width: 680px; + font-size: clamp(1rem, 1.2vw, 1.125rem); + line-height: 1.9; } html[lang="ar"] .cmp-cell { line-height: 1.8; diff --git a/apps/web/src/components/landing/hero.tsx b/apps/web/src/components/landing/hero.tsx index 188187fa5..0160177a2 100644 --- a/apps/web/src/components/landing/hero.tsx +++ b/apps/web/src/components/landing/hero.tsx @@ -29,7 +29,7 @@ export async function Hero() { const cloudHref = cloudPlanHref(); return ( -
+
{/* ═══════════════ Background layers ═══════════════ */}