AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(web): reorganise platform administration into fewer, clearer pages (#15563)
Ahmad Tash56a3bd64d158
diff --git a/brain/knowledge/decisions/000035-platform-admin-is-fifteen-pages-derived-from-one-registry.md b/brain/knowledge/decisions/000035-platform-admin-is-fifteen-pages-derived-from-one-registry.mdnew file mode 100644index 00000000000..1bc5ab820d3--- /dev/null+++ b/brain/knowledge/decisions/000035-platform-admin-is-fifteen-pages-derived-from-one-registry.md@@ -0,0 +1,431 @@+---+status: accepted+---++# Platform admin is fifteen pages derived from one registry++## Decision++The platform admin nav collapses from **22 items in 5 labelled groups to 15 items in 3 unlabelled blocks**,+and every page, route and gate derives from **one declarative registry** rather than the three unconnected+places that held them. Six of the fifteen pages have sections: Users & access, Connections, Security,+AI Center & MCP, Pieces, and Billing & usage.++**A section parent is a page, not an alias for its first child.** Users & access, Connections, AI Center &+MCP, Security, Billing & usage and Infrastructure each own an overview at their bare path: a card per child+carrying that child's live count and plan tier, then the few sections that only make sense across the whole+section (sign-in policy, connection health, AI credits, a security checklist, infrastructure status).+Children therefore all address an explicit `?tab=`, where the first one used to sit on the bare path. The+overview is what makes a parent worth clicking; without it the parent row was a lie, navigating somewhere+its label did not name. This also retires the rule below that a page with its own tabs never becomes a tab:+`Workers`, `Health`, `Triggers` and `Configurations` are now tabs of `Infrastructure`, which is what let the+group labels come back over a nav short enough to read.++**Three knobs decide whether a row appears, and they are not interchangeable.** `isLocked` keeps the row+visible and crowned and the page reachable, because the point is to advertise what a plan would buy.+`isHidden` removes the row and the route together, for something an edition does not have at all rather+than has not bought: the AI `capabilities` tab is `isHidden` on Community, matching what+`setup/ai/index.tsx` did before the registry. `hideInNav` keeps the route and drops only the nav entry, for+a tab its parent row already stands for. Picking `isHidden` where `isLocked` belongs silently deletes a+feature from the product tour; picking `isLocked` where `isHidden` belongs advertises something the+edition can never enable.++**`Pieces` takes the other way out: the parent row IS the first tab.** It has tabs and no overview, and+rather than invent a landing page over two children, its `pieces` tab carries `hideInNav: true`. The tab+stays routable and still owns the bare path, but the sidebar does not draw it as a sub-item, so the nav+reads `Pieces` with one child `Piece Sets`, and clicking the parent opens the pieces table. This satisfies+the rule above rather than breaking it: the parent row goes where its label says. Reach for it whenever a+section's first tab is the obvious thing the parent name already promises, and reach for an overview when+the parent name covers several children equally.++**Those sections live in the sidebar, not in the page.** Each one is an indented sub-item under its parent,+with a connector line. The counts in this decision's title and first paragraphs were the plan; the registry+is the truth and has moved since, currently eleven nav parents and twenty children. An in-page tab row was built+first and rejected: it left the sidebar reading as fifteen flat items with nothing under them, while the+structure that mattered was hidden inside whichever page you had opened. Sub-items address the same+`?tab=` the tabs used, so the first section stays on the bare path and every redirect kept working.++**A page that already has its own tabs does not become a tab** was the rule that decided most of the+shape, and it is now fully retired. It went first for Infrastructure, which absorbed `Workers`, `Health`,+`Triggers` and `Configurations`, and then for `Pieces`, whose own two tabs became the registry tabs+`Pieces` and `Piece Sets` while its `:id` child route stayed where it was. What survives of the rule is+its opposite: an in-page tab row is a **candidate** for promotion, because the sidebar is where sections+belong. `Templates` and `Embedding` stay separate for their own reasons, so the embed wizard keeps a page+of its own. `MCP Server` folds into `AI Center & MCP` as a third tab, because its own two tabs are a light+pill control that reads as a different level rather than a second tab row.++**Promoting an in-page tab row costs no URL change**, which is what makes it cheap. Both conventions are+the same one: first tab on the bare path, the rest on `?tab=<id>`. `Pieces` was already hand-rolling+exactly that, deleting a `useSearchParams` handler and a `TabsList` per page promoted.++**Ask the registry which tab is active; never recompute it in the sidebar.** `adminPagesUtils.activeTabId`+resolves the `?tab=` param, or `null` when the page has an overview, or the first tab otherwise, and the+nav highlights the parent whenever no visible sub-item owns that answer. That one rule replaced three+hand-written special cases (`tabs.length === 0`, `hasOverview && tab === null`, `index === 0`), which had+all silently assumed every routable tab was also a visible sub-item. `hideInNav` broke that assumption, and+anything else that makes the routable set differ from the nav set will break it again.++**Sample mode mounts the real page, so its plan-gated queries must be `enabled`-guarded.** `FeatureSample` renders the+locked page ghosted underneath the upgrade card, which means every `useQuery` inside it fires for platforms that lack+the feature; an endpoint behind `platformMustHaveFeatureEnabled` then answers 402 on every visit (seen 2026-09-14 on+`/platform/security/embed`: `GET /v1/signing-keys` → 402 until `useSigningKeys` got `enabled: platform.plan.embeddingEnabled`).+`LockedFeatureGuard` used to hide this by not mounting the page at all. A 31-page smoke run also surfaced three+pre-existing console warnings the ghosted rows now expose on every plan: a bare `<TooltipTrigger>` around a `<Checkbox>`+(nested buttons, on projects / templates / project roles), `<DialogTrigger asChild>` wrapping a `<>` fragment in+`edit-global-connection-dialog.tsx` ("Invalid prop `type` supplied to React.Fragment"), and DataTable filters whose+`accessorKey` names no column (`pieceName`/`projectIds`/`ownerIds` on connections, `name` on pieces). None are regressions.+The populated states were verified separately against a 0.90.4 EE backend with seeded data (two pending platform+invitations, six connections with one in `ERROR`): "Pending invitations" lists the emails, "Needs attention" lists the+failing connection, "Most used pieces" ranks by count. One nit surfaced there: both connection overview sections label rows+with the raw package name (`@activepieces/piece-apollo`) instead of the piece display name. Seeding notes: the invitation+endpoint enforces the seat quota (402 `QUOTA_EXCEEDED`) so `platform_plan.usersLimit` has to be lifted first; a personal+project refuses project invitations ("Project must be a team project"); connections cannot be inserted by hand because the+list endpoint decrypts every `value` (`ERR_CRYPTO_INVALID_IV` → 500), and a dev backend with `AP_PIECES_SOURCE` on files+returns `piece_metadata_not_found` for anything not in `AP_DEV_PIECES`, so seed through `POST /v1/app-connections` with+`type: NO_AUTH` (skips engine validation) against a backend that knows the piece.++**An overview is gated like any other page, an unknown tab redirects, and a failed query says so.** The overview+branch of the route resolver wraps in the same `FeatureSample` as component pages, so a locked section (Billing on+Community, declared with `sample: true` and a teaser in the registry) shows the upgrade card instead of empty values.+A `?tab=` that is hidden or unknown redirects to the page's bare path rather than silently rendering the first tab,+and overview cards derive their tab links from `visibleTabs`, never a hardcoded list. `OverviewCard` and+`OverviewSection` take `isError`/`error` and `isLoading`: a failed fetch renders `DataFetchErrorState`, a pending one a+skeleton, and only real data can claim "healthy" or "none". The connections overview counts project-scoped+connections only, so global ones are not counted twice, while "Needs attention" still lists failing global ones.+Greptile caught all four on the first review of #15526 (2026-09-14).++**Groups never collapse.** Every page with sub-items draws them all the time; there is no chevron and no+collapse state. A per-page `collapsed` boolean was tried first and left `/platform/users?tab=members` with+nothing lit up whenever the group had been closed earlier; a per-navigation version fixed that but bought+little for its state, so it was dropped for always-expanded on 2026-09-13.++**`General` keeps its name and keeps branding inside it.** It holds the platform name, the five plan-gated+branding assets, the auto-create-personal-projects default, and the Cloud owner's danger zone, as one form+with one Save. A `Branding` page was split out first and has been folded back: the split was there so each+of the two pages was wholly gated or not gated at all, but it cost a second nav item and a second form for+five inputs, and the page it left behind was three fields.++The gated half is marked in place instead, with a `FeatureBanner` above the branding inputs carrying the+upgrade link while the platform name stays editable. That is the same treatment `Pieces` already uses for a+partly gated page. `General` therefore wears no crown and is the one admin page where part of the body is+gated and part is not.++**A paid feature is gated at the action, not at the door.** The page opens, the data loads, the forms+fill in, and the crown sits on the primary action: on `New Project`, again on `Create Project` inside the+dialog, and only that final click is refused, with an upgrade dialog explaining the feature. An admin+evaluating Activepieces can therefore see what a feature is before being asked to pay for it, which the+earlier full-page teaser made impossible.++**Which click refuses depends on whether the input can still change the answer.** `New Project` defers to+the final `Create Project` on purpose: the dialog is worth opening because seeing the form is part of+seeing the feature. `Invite` is the opposite case, because `isOutOfSeats` means zero seats remain, so+every invitation the admin could type is already going to fail; it refuses on the click and never opens+the form. Getting this wrong is a half-gate, marker on one control and check on another, which reads as a+gate and behaves as wasted typing. Ask whether any input reaches a different outcome. If not, refuse where+the crown is.++**The crown replaces the action's own icon, it does not join it.** A plus and a crown side by side read as+two separate affordances. `useFeatureGate` returns `crown` as an element when locked and `null` when not,+so a plain button is `{gate.crown ?? <Plus className="size-4" />}` and only ever shows one icon. The+exception is `AnimatedIconButton`, whose icon is a prop rather than a child because it animates on hover:+a crown has no animation to drive, so the locked case renders a plain `Button` instead.++`gate.crown` carries `text-primary-foreground/90`, which is white, so it only reads on the purple primary+button it was written for and disappears on an `outline` one. `Customize Selector` is outline and renders+its own `<Crown className="size-3.5 shrink-0 text-primary" />` instead, matching the sidebar crowns, while+still taking `open` and `dialog` from the hook. Take the behaviour from the gate and the colour from the+button until the helper learns to inherit `currentColor`.++**A refused submit swaps its dialog's content, it does not trade one dialog for another.** Closing the form+and opening a second dialog was tried and rejected: each Radix `Dialog` owns an overlay, so the first+animates out while the second animates in, the backdrop undims between them and the screen visibly+flashes. Stacking is worse still, leaving a dead form dimmed behind an upsell of a different width. So the+gate hands over *content* and the host dialog renders it in place of its form, and the overlay element+never unmounts. Two things to get right: reset the swap flag through the same handler that sets `open`,+since a footer button calling `setOpen(false)` skips `onOpenChange` and the next open would show the upsell+instead of the form; and check any two-dialog interaction in the browser, because that is where Radix+orphans `pointer-events: none` on `<body>` and the page behind stops taking clicks.++**A feature you cannot act on renders as the real page, and the gate moves to the write.**+`Audit logs` is a table, so there is no action to crown, and opening it freely would show an empty table+with nothing to explain why. So the page renders at full opacity with nothing over it: real header, real+toolbar, real rows filled with the sample fixtures. Reads all work against those fixtures, meaning search,+filters, sorting, pagination and opening a row for its payload. A write, meaning Save, New, Delete, Export+or a config switch, opens an upgrade popover anchored to the control that was pressed. There is no overlay+and no scrim anywhere in the flow.++Three non-blocking marks say whose data this is: a `Sample data` pill beside the page title carrying the+tier, the table header tinted `#f6f3fe` over the data region only, and a rail pinned to the bottom of the+page holding the one-line pitch and the link out to what the plan adds. On a form page that rail merges+with the form's own action row, so Discard and Save sit inside it.++Designed in Paper, not yet built: the branch still ships the centred sign-in card described below.++**The presentation was iterated seven times, and the rejected six are the useful record**, because each+failed for a reason worth not rediscovering. The seventh, the centred **sign-in card** over a quarter+opacity page, is the one this supersedes: it keeps the whole page visible where a fade shows only its top+third, but it still puts a wall between the person and the thing they came to look at. **Blur** hides the+very rows the treatment exists to show. A **strip** above the content said the right words but left the+page reading as ordinary. A **framed container** read as locked but dominated the page it was previewing. **Chrome merged into the page's own+header** was too quiet, and needed a React context plus edits to both shared headers and `DataTable` to+deliver. A **full-bleed banner** announced the paywall before the page had shown anything. A **gradient+fade** read as one surface but revealed only the top of a page and cut a form mid-field. A Mobbin survey+found products split between crisp-and-labelled and fade-an-empty-shell, and none sampling a form, so+there is no direct precedent to defer to here.++**The sample content is live, not inert.** The earlier call here was the opposite: `pointer-events: none`+on the region, filters and pagination disabled, one live CTA, on the grounds that wiring the controls to+the fixtures means a second implementation of every filter for customers who have not paid. That is+reversed. The fixtures already live in the browser, so client-side filtering and sorting of eight rows is+the cheap half, and a disabled toolbar teaches nobody what the feature does. The cost accepted is that a+locked write control looks completely ordinary until it is pressed: a person will occasionally press Save+expecting it to save. A visibly disabled Save was the alternative and it cannot show what the plan buys.++Sample data is **generated in the browser and never crosses the API**. A locked page skips its plan-gated+query outright rather than letting it answer 402, and the endpoints keep refusing. Serving fabricated rows+from a gated endpoint was rejected outright: an audit trail that returns fiction is a support and+compliance hazard, and every API key and script would see it too.++So the rule is: crown the action where there is one, and fill the surface with sample data where there is+not.++The nav still marks a page when **every** section on it is gated, and marks a gated **section** directly,+so `Security` stays uncrowned while its API keys section works and its three paid sections each carry a+crown.++**The route resolves `?tab=`; every section keeps its own header.** The registry entry names the sections,+the route element picks the active one and renders that component directly, so no page hand-rolls the+searchParams dance again. But the header stays with the page: a unified `AdminPage` shell was built first+and rejected, because it stretched the heading across the full page width instead of the content column,+and it stacked the parent above the section as "AI Center & MCP · Capabilities", which is a breadcrumb the+sidebar already draws. Each page renders the `DashboardPageHeader` or `CenteredPage` header it had before,+and the sections that never had one got the same treatment as their neighbours. The parent name lives only+in the sidebar. `AI Center & MCP` lost the vertical rail it used to ship with, since the sidebar now does+that job for every page. Community sees the same structure as everyone else, but a gated tab there gets a+short "available in Enterprise" note with a docs link rather than benefit bullets and a sales button.++It lands as four PRs: the registry and shell with **no visible change** at all, then the cheap merges,+then gating, then the collapse with its redirects and docs. `/platform` keeps redirecting to Projects: the+section overviews cover the "where am I" job, so a whole-platform landing page is still deferred.++## Context++22 nav items, 18,588 LOC across 103 files, and 13 items wearing a lock icon that is decorative: the click+navigates regardless and the destination page is the real gate. What that page does is inconsistent by+accident, not design. Twelve pages replace their whole body with `LockedFeatureGuard`, Pieces stays usable+under a banner, the branding fields just set `disabled` with no explanation and no upgrade path at all,+and AI Center gates on platform role rather than a plan flag.++The nav is a literal inside `PlatformSidebar`, the routes are a flat hand-written array, and each page's+gate is hardcoded in its own file. Nothing ties the three together, which is why `Embedding` sits under+Setup while routing to `/platform/security/`, and `Event Streaming` sits under Observability while routing+to `/platform/infrastructure/`.++The consolidation itself is not new here. AI Center already folded two nav items into one tabbed page with+a validated `?tab=`, MCP Server was built tab-first, and `setup/general` composes two sections on one page.+Four pages now hand-roll the same searchParams dance, three with an unsafe cast.++## Why++- **Fifteen, not the eleven the mockup drew.** The line counts and the existing tab rows decide it. `usage` is 47 lines and already sits beside billing on+ the same gate and the same endpoint, `mcp` is 117, and sso plus api-keys plus project-roles are 401 and+ already the same `Item` list shape. Against that, Pieces and AI Center are ~3,000 LOC each with their own+ tabs, so folding them in buys a smaller nav by making two real pages harder to use.+- **One registry over three sources.** Adding an admin page becomes one entry instead of three edits, the+ group and URL can no longer disagree, and the nav crown becomes a derived value rather than a maintained+ boolean. The cost accepted is one file that every admin change touches.+- **A shell that owns tabs, not the headers.** Eight pages are about to need the tab dance that four pages+ already copy and three get subtly wrong, so the routing layer absorbs it. Absorbing the headers too was+ the overreach: the twenty-odd pages already agree on two header shapes, and centralising them traded a+ layout every page had right for one the shell got wrong everywhere at once.+- **Three treatments, chosen by what the surface offers.** Once pages carry tabs, a full-page takeover is+ wrong by construction: it blanks a page whose other tabs work. So a page with a primary action gets a+ crown on it, a page you only read gets its own UI blurred, and a page that is partly gated keeps working+ under a `FeatureBanner`. One rule for all three would either hide working controls behind an upsell or+ leave an empty greyed table reading as broken.+- **Crown only when the whole page is gated.** A crown on `Users & access` when only SCIM is paid would be a+ lie, because Members works. Bundling gated tabs beside free ones is what drops thirteen markers to three.+ `Projects` and `Pieces` shipped breaking this and were corrected on 2026-09-14: both pages load and read+ fine unpaid, and only one control on each is gated, so the page-level `isLocked` came off and the crown+ moved onto `New Project` and `Customize Selector`. The test is whether a person who cannot pay still has+ a reason to open the page. If yes, the sidebar stays clean and the control carries the mark.+- **Four PRs, each reviewing one idea.** PR #14330 reverted the last big navigation rework, but that revert+ touched **zero** platform-admin files: 106 files across global search, the builder canvas and the dashboard+ sidebar. Its real lesson is that it bundled a navigation model change with unrelated surfaces, so nothing+ could be reverted alone. Scoping this to platform admin and splitting by concern keeps each piece+ revertable. Rendering the platform nav's item chrome locally rather than editing the shared+ `ap-sidebar-item` keeps the shared-file count at zero, at the cost of having to re-implement everything+ that component quietly did. The sidebar icons are the bill: each one in `components/icons/` is a+ `forwardRef` exposing `startAnimation` / `stopAnimation`, and `ApSidebarItem` drives them from row hover+ through a ref. `PlatformNavItem` rendered the same components with no ref, so the icons went inert and+ nothing failed. `pointer-events-none` on the icon is why the self-animating fallback does not cover it+ either: the icon's own `onMouseEnter` never fires, and the component only marks itself externally+ controlled once a ref is attached. Restored 2026-09-15. Before copying a shared component's markup,+ diff it for refs, effects and handlers, not just classes.+- **A quieter Community.** This is the open-source product, and upsell density there is a brand question and+ not only a conversion one. The structure stays honest, the pitch does not follow self-hosters around.+- **No landing page yet.** It is purely additive, blocks nothing, needs five or six separate queries with no+ aggregate endpoint, and is far easier to design once the twelve-page IA exists.++## Consequences++**A tier label has to name a plan somebody can buy.** The gating UI carries its own two-value vocabulary,+`FeatureTier = 'team' | 'enterprise'`, entirely separate from `PlanName` in shared. It shipped as+`'team' | 'ultimate'`, and there is no Ultimate plan: billing sells Free, Plus, Team and Enterprise. So a+locked page told a Plus admin to "Upgrade to Ultimate", and the Explore plans dialog it opened offered no+such thing. Renamed to `enterprise` on 2026-09-14. The tier is decorative, meaning nothing maps it to a+plan id or preselects a plan at checkout, which is exactly why the drift went unnoticed; keep the two+vocabularies spelled the same so the next drift is visible. `FeatureTier` and `TIER_LABELS` are still+declared in four places (`lib/feature-tier.ts`, `feature-teaser.tsx`, `use-feature-gate.tsx`, and a fourth+label map inline in `overview-shell.tsx`), so any future rename has to touch all four.++**The registry trades drift bugs for derivation bugs, and the escape hatches are how you tell whether it+is still worth it.** Three sources describing the same pages had already disagreed in production, which is+why this exists, and that class is now impossible: the URL and the nav entry are one object. What replaced+it is smaller but real, and the first week produced two of them. The registry claimed `?tab=` and silently+broke the two pages that kept their own inner tabs there, and `isCrowned` miscomputed a page whose lock+lived on the page rather than its tabs. A hand-maintained boolean can be stale; it cannot be computed+wrong. Expect that shape of bug from anything derived here.++The signal to watch is the **escape-hatch count**. `AdminPage` carries `isHidden`, `hideInNav`, `overview`+versus `component` versus `tabs`: four places where the uniform model did not hold, one of which+(`hideInNav`) was added days after the registry landed because Pieces wanted a routable tab that the nav+should not draw. Each new one is the model being bent rather than used. If the list keeps growing, the+answer is not a fifth: it is a thinner registry carrying path, title, nav and gate only, with routes+composed normally, which keeps most of the benefit because the drift was always between *those* four+things and never between the JSX blocks.++**An overview's card row fits three, and the fourth wraps.** The cards sit in a+`repeat(auto-fit, minmax(15rem, 1fr))` grid inside a column capped at 1024px, so three tracks plus gaps+are all that fit and Security and Infrastructure render three cards plus an orphan. Narrowing the track+until four fit truncates the longer titles (`Secret mana...`, `Event strea...`), which is worse than the+wrap, so the wrap stands. Treat four as the point where a section has outgrown a single card row rather+than something to squeeze. Use `auto-fit`, never `auto-fill`: `auto-fill` keeps the empty tracks alive, so+a two-card overview renders both at a fifth of the width with dead space beside them.++**A gated query with no `enabled:` puts an error state behind the blur.** The overlay works only because+the query underneath already carries `enabled: platform.plan.<flag>`, the repo rule for any endpoint behind+`platformMustHaveFeatureEnabled`. Without it the request fires, answers 402, and `DataFetchErrorState`+renders "Trouble loading …" under the glass, which reads as broken rather than unpurchased. Check that+guard before giving any surface an overlay.++**PR 0 describes today's 22-item IA on purpose.** The registry and shell ship deriving the nav and routes+that already exist, so the diff is reviewable as pure refactor with identical screenshots, and the+derivation is proven against the IA everyone knows before the data changes under it.++**The quiet Community treatment retires `RequestTrial` from platform admin**, which is currently the only+in-product path from a self-hosted install to sales, feeding `activepieces.com/sales` from 26 feature keys.+That is a growth decision as much as a design one and was taken with that understood.++Old deep links must redirect. 22 items becoming 15 means eleven redirects on top of the five+that exist, and `docs/docs.json` mirrors this IA across about twenty `admin-guide` pages, so a rename lands+in the same PR as the route change.++`SidebarProvider open={true}` means the admin sidebar never collapses, so the collapsed-state branches in+the shared item component stay unreachable from here.++PR #15028 tuned the admin nav's widths and spacing to line up with the primary rail by hand, and the rail+imports none of the sidebar primitives. Any change to admin nav metrics needs re-checking against the rail,+and nothing will fail if it drifts.++**Folding Branding back into `General` reopens the per-field `brandingLocked` gotcha**, where five inputs+grey out beside a sixth that works. The banner above them is what keeps it from being the silent version+the brain records: it names the feature and carries the upgrade link, so the disabled inputs are explained+rather than merely dead. Whether that is enough on Community, which now sees an uncrowned `General` with a+banner inside it instead of a crowned `Branding` item, has not been reviewed yet. Revisit before the gating+PR ships.++Two dead things went with the split: the three file inputs were bound to `logoUrl` / `iconUrl` /+`faviconUrl` form fields whose values nothing ever read, since the inputs are ref-driven and render+`platform.fullLogoUrl` directly, and `sampleData.branding` was their only consumer so it never rendered+either. Both are gone.++**A tab promoted to a section inherits nothing from its old page wrapper.** The AI Center page supplied+`max-w-6xl px-8 py-6` and the scroll container for its tabs, so `providers-tab` and `capabilities-tab`+carried no padding of their own; once the route rendered them directly they sat flush against the edge.+Each section now supplies its own padding, and the layout's `#dashboard-content-container` already+scrolls, so none of them needs `overflow-auto`. Check the old wrapper before promoting the next tab.++The same bite has a second shape: whatever the old wrapper rendered **above** the tab row now renders on+no tab at all. The Pieces page held one `DashboardPageHeader` and one `FeatureBanner` for both tabs, so+promoting them meant giving each tab its own header and extracting the banner into `PiecesLockedBanner`+for both to call. A banner is the easy one to miss, because losing it leaves the locked tab silently empty+rather than visibly broken.++**The third shape is the dangerous one: `?tab=` is a single namespace, and a promoted page that keeps its+own inner tab row in the URL collides with the registry.** `infra/health` reads+`searchParams.get('tab')` for its `system | runs | queue` row and `infra/workers` for its+`health | worker-groups` row. Once Infrastructure became a tabbed registry page the router started writing+`?tab=health`, the page read that same param, matched none of its own panels, and rendered a tab row with+nothing under it. Worse, clicking an inner tab writes `?tab=runs`, which is not an Infrastructure tab id,+so the route's unknown-tab guard redirects to the bare path and ejects you to the overview. Triggers and+Configurations survived only because they have no inner tabs.++Grep the page for `searchParams.get('tab')` before promoting it. **The registry owns `?tab=`; a promoted+page's own row moves to `?view=`**, exported as `VIEW_QUERY_PARAM` from `admin-pages.ts` so the contract+sits beside the thing that claims the other half. Promoting the inner tabs instead was the alternative and+was rejected: it puts six children under one parent, which is what the collapse existed to avoid. Fixed for+Health and Workers on 2026-09-14; old inner-tab deep links like `?tab=runs` now land on the parent overview+rather than a blank page.++Both pages had reached for the param with `searchParams.get('tab') as TabValue`, and that cast is what let+`'health'` through as a legal value of a `system | runs | queue` union. A `parseTabValue` guard that falls+back to the default is what makes an unknown param render the first panel instead of nothing, which is the+difference between a wrong link looking wrong and looking broken. The repo bans `as` casts for exactly this.++**A parent crown is the AND of its tabs**, since `isCrowned` returns true only when every visible tab is+locked. A page whose tabs share one plan flag therefore has to repeat that flag on each tab to keep the+crown it had as a single item: `Pieces` carries `managePiecesEnabled` on both of its.++**Do not give a section a page header when it already opens with a `SectionHeader`.** Providers and+Capabilities each led with one, so adding a header above it printed the title twice.++**Sampling every locked page costs two working controls on Single sign on.** `ssoEnabled` gates only+SAML: `platform.service.ts` checks the plan solely when the payload carries `federatedAuthProviders.saml`,+and `googleAuthEnabled` is enforced with no plan check at all, so the Google and Allowed Email Login+toggles genuinely work on a plan without SSO. Sampling the section wholesale, rather than only its SAML+row, therefore takes two live controls away from EE and Cloud admins who have them today. Taken knowingly,+for one consistent treatment across all nine locked pages. Community is unaffected, because its+sign-in enforcement returns early on that edition anyway.++**Sample data does not mean inventing fixtures for audit events.** `buildMockEvent` in+`@activepieces/shared` already builds realistic `ApplicationEvent` values across forty event names, and the+web app already calls it for the test-destination flow. Reuse it there; only the other locked surfaces need+fixtures written by hand.++**Community keeps its quiet copy inside the loud treatment.** It sees the same sample content, but the+strip names the feature as Enterprise with a docs link in place of the upgrade button, so the open-source+product still avoids a sales button on a dozen pages.++**Nothing renders the full-page teaser once all nine are sampled.** `LockedFeatureGuard` and the page-level+`FeatureTeaser` lose their last callers in platform admin, and `overlay: true` in the registry is replaced+by the sample opt-in. `FeatureTeaserContent` survives inside the upgrade dialog.++**One form, not two.** `appearance-section.tsx` is a single react-hook-form whose submit handler+deliberately skips the branding fields when locked, and both halves post to the same+`platformApi.updateWithFormData`. Splitting it was tried and undone; keeping it whole is what gives the page+one Save.++`Configurations`, added to the nav on 2026-09-07 after the proposal was drawn, becomes Infrastructure's+fourth tab and carries its Cloud exclusion into its registry entry. It already routed under+`/platform/infrastructure/`, so nothing moves. The credits meter the admin sidebar lacks is deferred with+the overview page: additive, and `SidebarUsageLimits` already exists and already returns nothing on+Community.++The four PRs are scoped in `packages/web`, but the largest single chunk is not there. PR 3 carries roughly+fourteen route redirects plus the `admin-guide` restructure in `docs/docs.json`, about twenty pages that+PR #15153 had just expanded.++## Tracking++Grilled 2026-09-07 against the `maybe-chat.activepieces.ai/docs/admin-nav` concept and Langdock's settings+IA as references.++The sample-data treatment was checked against Mobbin afterwards, and the survey supports dropping the+blur: every product found picks one side or the other, never both. Later and Churnkey show crisp,+realistic figures under a labelled band ("just a glimpse", "ANALYTICS PREVIEW"), while Juicebox, Asana+Admin and Hex fade an essentially empty shell behind a card and teach the reader nothing about the+feature. Churnkey's one-word "preview" also reads better than a sentence explaining that the data is not+real. No product in the survey samples a *form*, so our Single sign on, General and Embedding treatment+has no precedent to lean on, which is worth remembering given it is the same part that costs two working+controls.diff --git a/brain/knowledge/engineering/index.md b/brain/knowledge/engineering/index.mdindex eeb77e2d8a1..82eac033dbf 100644--- a/brain/knowledge/engineering/index.md+++ b/brain/knowledge/engineering/index.md@@ -31,6 +31,7 @@ The **Activepieces engineering brain**: how the system works, and *why* it was b- **API & Endpoints** — route conventions and the security contract- **Server Module Anatomy** — the six files of a server module (entity → migration → repo → service → controller → module), and the manual registration steps nothing auto-discovers- **Web Feature Anatomy** — the frontend feature folder, its barrel, route guards, and how a failed primary query reports itself in place+- **Web Navigation Shell** — the rail, the three sidebars and the layouts that choose between them, which primitives are shared, and why platform admin renders without the rail- **Cloud Deployment Paths** — canary → prod, the `cloud-hotfix` override, and the breaking-migration gate that blocks both- **Helm Chart** — the Kubernetes install we ship to self-hosters, its two competing paths for an `AP_*` variable, and the secrets it never creates- **CI PR Review Hygiene** — draft-first Greptile review, the per-area PR size gate, and the workflow conventions reviewers keep re-litigatingdiff --git a/brain/knowledge/engineering/web-navigation-shell.md b/brain/knowledge/engineering/web-navigation-shell.mdnew file mode 100644index 00000000000..b1c7f47c70c--- /dev/null+++ b/brain/knowledge/engineering/web-navigation-shell.md@@ -0,0 +1,77 @@+---+icon: 🧱+---++# Web Navigation Shell++The frame the web app renders every route inside. Four components, and knowing which is shared matters+more than knowing what each looks like.++**Primary rail** (`components/primary-rail`) is the chat-first left rail that replaced the project+sidebar in PR #15005. Chat, Agents, Explore, Impact, plus the projects list and the credits meter.++**Dashboard sidebar** (`components/sidebar/dashboard`) is the older per-project nav the rail replaced+on most surfaces.++**Platform sidebar** (`components/sidebar/platform`) is the platform-admin nav, and it is the only one+of the three that understands paid gating. Its groups and items are a literal built inline on every+render, not a config.++**Layouts** (`components/platform-layout.tsx`, `components/project-layout`) pick which of the above a+route gets. `PlatformLayout` is 44 lines and mounts the platform sidebar with no rail beside it.++`ap-sidebar-item` and `ap-sidebar-group` are the shared primitives, used by the dashboard and platform+sidebars only. The rail imports neither.++## Gotchas++- **`workspace-shell/` does not exist, and anything still referring to it is stale.** PR #14330 reverted+ the four merges that introduced it (#14298, #14303, #14304, #14306) five days after they landed,+ deleting the folder along with `stage-context.tsx`, `stage-breadcrumb.tsx` and `chat-dock-context.tsx`,+ and restoring `sidebar/dashboard`. That revert was 106 files and touched **zero** platform-admin files,+ so it is not a precedent for admin-nav work; what it does show is why it was unrevertable in pieces,+ since it bundled a navigation model change together with global search and the builder canvas. Keep a+ navigation change scoped to one surface and it stays revertable on its own.+- **The rail and the platform admin nav are aligned by hand, not by shared code.** `primary-rail` imports+ none of the sidebar primitives, so the two columns only look like one system because PR #15028 tuned+ their widths and spacing to match. Any change to admin nav metrics needs re-checking against the rail,+ and no type error or test will tell you it drifted.+- **Platform admin deliberately renders without the rail.** `PlatformLayout` mounts the platform sidebar+ straight under `SidebarProvider`, because the rail beside it meant two left columns and a narrower admin+ nav, and the admin nav already carries its own way back out. This is a documented departure from the+ `design/workspace-redesign` direction, which did show the rail there. Entry in is the rail's platform+ admin button; the way out is the "Back to app" link in the platform sidebar header, which resolves+ through `determineDefaultRoute`.+- **A role check inside a platform admin page is dead code.** `PlatformLayout` calls `useIsPlatformAdmin()`+ and redirects away when it fails, so every component below it already knows the viewer is a platform+ admin. AI Center nonetheless wrapped itself in a guard keyed on `platformRole !== PlatformRole.ADMIN`,+ which can never be true where it sits, and that guard was the only thing standing in for a plan gate on+ that page: reading it, the page looks gated when nothing gates it. Same shape as the `isCommunity` checks+ under `BillingPageShell`. Before adding a guard to an admin page, check whether the layout above already+ decided it.++- **`locked` is a platform-only concept living in a shared primitive.** `ap-sidebar-item` renders the lock+ icon, but the dashboard sidebar passes `locked` zero times and the platform sidebar passes it fifteen.+ So a change to lock or badge rendering edits a file two callers share to alter a path one caller uses.+ Worth rendering platform-specific item chrome in the platform sidebar instead, rather than growing the+ shared primitive for one consumer.+- **`/platform` redirects without `replace`, so Back lands you right back on it.** Every other admin+ redirect (`/platform/setup`, `/platform/security`, `/platform/infrastructure`, `/platform/setup/branding`,+ `/platform/setup/ai-capabilities`) passes `replace` to `<Navigate>`, but the one on `/platform` does not,+ so it pushes a history entry and the browser Back button re-enters the redirect instead of leaving the+ admin. Anyone who opens platform admin from a link to `/platform` rather than a specific page is stuck+ going forward. Preserved deliberately while the routes were being derived from a registry, so fixing it+ is a one-word change wherever that redirect is declared.++- **Four platform admin pages already carry their own tabs, so they cannot become tabs of something else without nesting two deep.** `setup/pieces` (Pieces, Piece sets, plus a `piece-sets/:id` child route), `infra/workers` (Health, Worker groups), `infra/health` (System, Runs, Queue) and `setup/mcp` (Connection, Tools). Any plan that groups admin pages under a parent has to answer this for each of them, and the answer decides the item count more than the grouping does: leaving all four as their own nav items lands around seventeen, folding them in lands around thirteen but puts a second tab row inside a tab. Count `TabsTrigger` occurrences per page before promising a number, because the mockups that drive this work are drawn from the nav and cannot see the second level.++- **The active item is a bare prefix match with no query-string awareness.** `pathname.startsWith(item.to)`,+ plus an optional `isActive` override that the platform sidebar never passes. Any nav that needs to+ distinguish tabs of one page has to pass that override, because `?tab=` is invisible to the default.++## Key files++- `packages/web/src/app/components/primary-rail`: the chat-first rail+- `packages/web/src/app/components/sidebar`: `ap-sidebar-item` / `ap-sidebar-group` primitives, plus the `dashboard`, `platform` and `project` navs+- `packages/web/src/app/components/platform-layout.tsx`: `PlatformLayout`, the admin frame and its admin-role check+- `packages/web/src/lib/route-utils.ts`: `determineDefaultRoute`, where "Back to app" goesdiff --git a/packages/web/src/app/components/billing-page-shell.tsx b/packages/web/src/app/components/billing-page-shell.tsxindex f9778a289e0..674cc9d9f11 100644--- a/packages/web/src/app/components/billing-page-shell.tsx+++ b/packages/web/src/app/components/billing-page-shell.tsx@@ -27,13 +27,13 @@ export function BillingPageShell({return (<LockedFeatureGuardfeatureKey="BILLING"+ showContactSales={false}locked={edition === ApEdition.COMMUNITY}lockTitle={lockTitle}lockDescription={t('Switch to the Enterprise edition to access billing and usage management.',)}lockDocumentationUrl={LOCK_DOCUMENTATION_URL}- showContactSales={false}><BillingPageContent errorMessage={errorMessage}>{children}diff --git a/packages/web/src/app/components/centered-page.tsx b/packages/web/src/app/components/centered-page.tsxindex 9f4feb557f4..7df71a9609a 100644--- a/packages/web/src/app/components/centered-page.tsx+++ b/packages/web/src/app/components/centered-page.tsx@@ -12,27 +12,30 @@ export const CenteredPage = ({children,widthClassName = 'max-w-[40rem]',}: {- title: string;+ title?: string;description?: React.ReactNode;actions?: React.ReactNode;footer?: React.ReactNode;children: React.ReactNode;widthClassName?: string;}) => {- const header = (- <>- <div className="flex items-start justify-between gap-4">- <div className="flex flex-col gap-1">- <h1 className="text-xl font-medium">{title}</h1>- {description && (- <div className="text-sm text-muted-foreground">{description}</div>- )}+ const header =+ title === undefined && !description && !actions ? null : (+ <>+ <div className="flex items-start justify-between gap-4">+ <div className="flex flex-col gap-1">+ {title !== undefined && (+ <h1 className="text-xl font-medium">{title}</h1>+ )}+ {description && (+ <div className="text-sm text-muted-foreground">{description}</div>+ )}+ </div>+ {actions && <div className="shrink-0">{actions}</div>}</div>- {actions && <div className="shrink-0">{actions}</div>}- </div>- <Separator className="my-4" />- </>- );+ <Separator className="my-4" />+ </>+ );if (!footer) {return (diff --git a/packages/web/src/app/components/feature-banner.tsx b/packages/web/src/app/components/feature-banner.tsxnew file mode 100644index 00000000000..1d378fd980c--- /dev/null+++ b/packages/web/src/app/components/feature-banner.tsx@@ -0,0 +1,54 @@+import { ApEdition, ApFlagId } from '@activepieces/shared';+import { t } from 'i18next';+import { ExternalLink } from 'lucide-react';++import { Alert, AlertDescription } from '@/components/ui/alert';+import { useManagePlanDialogStore } from '@/features/billing';+import { flagsHooks } from '@/hooks/flags-hooks';++export function FeatureBanner({+ message,+ documentationUrl,+ className,+}: FeatureBannerProps) {+ const { openDialog: openManagePlanDialog } = useManagePlanDialogStore();+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);+ const isCommunity = edition === ApEdition.COMMUNITY;+ const docsUrl = documentationUrl ?? ENTERPRISE_DOCUMENTATION_URL;++ return (+ <Alert variant="primary" className={className}>+ <AlertDescription className="flex flex-wrap items-center gap-x-2 gap-y-1">+ <span>{message}</span>+ {isCommunity ? (+ <a+ href={docsUrl}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center gap-1 font-medium text-primary hover:underline"+ >+ {t('Read the docs')}+ <ExternalLink className="size-3.5" />+ </a>+ ) : (+ <button+ type="button"+ onClick={() => openManagePlanDialog()}+ className="font-medium text-primary hover:underline"+ >+ {t('Upgrade plan')}+ </button>+ )}+ </AlertDescription>+ </Alert>+ );+}++const ENTERPRISE_DOCUMENTATION_URL =+ 'https://www.activepieces.com/docs/install/configuration/overview#enterprise-edition-optional';++export type FeatureBannerProps = {+ message: string;+ documentationUrl?: string;+ className?: string;+};diff --git a/packages/web/src/app/components/sidebar/platform/index.tsx b/packages/web/src/app/components/sidebar/platform/index.tsxindex 29662ae666d..4d96b291867 100644--- a/packages/web/src/app/components/sidebar/platform/index.tsx+++ b/packages/web/src/app/components/sidebar/platform/index.tsx@@ -1,31 +1,13 @@import { ApEdition, ApFlagId } from '@activepieces/shared';import { t } from 'i18next';-import { ComponentType, useRef } from 'react';-import { Link } from 'react-router-dom';+import { Fragment, useRef } from 'react';+import { Link, useLocation, useSearchParams } from 'react-router-dom';-import { McpSvg } from '@/assets/img/custom/mcp';-import { ChartLineIcon } from '@/components/icons/chart-line';+import { adminPagesUtils } from '@/app/routes/platform/admin-pages';import {ChevronLeftIcon,ChevronLeftIconHandle,} from '@/components/icons/chevron-left';-import { FileHeartIcon } from '@/components/icons/file-heart';-import { FileJson2Icon } from '@/components/icons/file-json2';-import { FrameIcon } from '@/components/icons/frame';-import { KeyRoundIcon } from '@/components/icons/key-round';-import { LayoutGridIcon } from '@/components/icons/layout-grid';-import { LogInIcon } from '@/components/icons/log-in';-import { MousePointerClickIcon } from '@/components/icons/mouse-pointer-click';-import { PuzzleIcon } from '@/components/icons/puzzle';-import { ReceiptIcon } from '@/components/icons/receipt';-import { ServerIcon } from '@/components/icons/server';-import { SettingsIcon } from '@/components/icons/settings';-import { Settings2Icon } from '@/components/icons/settings2';-import { SparklesIcon } from '@/components/icons/sparkles';-import { SquareDashedBottomCodeIcon } from '@/components/icons/square-dashed-bottom-code';-import { UnplugIcon } from '@/components/icons/unplug';-import { UsersIcon } from '@/components/icons/users';-import { WebhookIcon } from '@/components/icons/webhook';import { buttonVariants } from '@/components/ui/button';import {Sidebar,@@ -35,8 +17,6 @@ import {SidebarHeader,SidebarGroup,SidebarGroupContent,- SidebarGroupLabel,- SidebarSeparator,} from '@/components/ui/sidebar-shadcn';import { useAuthorization } from '@/hooks/authorization-hooks';import { flagsHooks } from '@/hooks/flags-hooks';@@ -44,9 +24,10 @@ import { platformHooks } from '@/hooks/platform-hooks';import { determineDefaultRoute } from '@/lib/route-utils';import { cn } from '@/lib/utils';-import { ApSidebarItem } from '../ap-sidebar-item';import { SidebarUser } from '../sidebar-user';+import { PlatformNavItem, PlatformNavSubItem } from './platform-nav-item';+export function PlatformSidebar() {const { platform } = platformHooks.useCurrentPlatform();const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);@@ -57,170 +38,12 @@ export function PlatformSidebar() {});const chevronRef = useRef<ChevronLeftIconHandle>(null);- const setupItems = [- {- to: '/platform/setup/general',- label: t('General'),- icon: SettingsIcon,- },- {- to: '/platform/setup/ai',- label: t('AI Center'),- icon: SparklesIcon,- },- {- to: '/platform/setup/mcp',- label: t('MCP Server'),- icon: McpSvg,- },- {- to: '/platform/setup/connections',- label: t('Global Connections'),- icon: UnplugIcon,- locked: !platform.plan.globalConnectionsEnabled,- },- {- to: '/platform/setup/pieces',- label: t('Pieces'),- icon: PuzzleIcon,- locked: !platform.plan.managePiecesEnabled,- },- {- to: '/platform/setup/templates',- label: t('Templates'),- icon: LayoutGridIcon,- locked: !platform.plan.manageTemplatesEnabled,- },- {- to: '/platform/setup/billing',- label: t('Billing & subscription'),- icon: ReceiptIcon,- locked: edition === ApEdition.COMMUNITY,- },- {- to: '/platform/setup/usage',- label: t('Usage'),- icon: ChartLineIcon,- locked: edition === ApEdition.COMMUNITY,- },- {- to: '/platform/security/embed',- label: t('Embedding'),- icon: FrameIcon,- locked: !platform.plan.embeddingEnabled,- },- ];-- const groups: {- label: string;- items: {- to: string;- label: string;- icon?: ComponentType<{ className?: string }>;- locked?: boolean;- }[];- }[] = [- {- label: t('General'),- items: [- {- to: '/platform/projects',- label: t('Projects'),- icon: LayoutGridIcon,- locked: platform.plan.billedTeamProjectsLimit === 0,- },- {- to: '/platform/users',- label: t('Users'),- icon: UsersIcon,- },- {- to: '/platform/connections',- label: t('Connections'),- icon: UnplugIcon,- },- ],- },- {- label: t('Setup'),- items: setupItems,- },- {- label: t('Security'),- items: [- {- to: '/platform/security/sso',- label: t('Single Sign On'),- icon: LogInIcon,- locked: !platform.plan.ssoEnabled,- },- {- to: '/platform/security/project-roles',- label: t('Project Roles'),- icon: Settings2Icon,- locked: !platform.plan.projectRolesEnabled,- },- {- to: '/platform/security/api-keys',- label: t('API Keys'),- icon: FileJson2Icon,- locked: !platform.plan.apiKeysEnabled,- },- {- to: '/platform/security/secret-managers',- label: t('Secret Managers'),- icon: KeyRoundIcon,- locked: !platform.plan.secretManagersEnabled,- },- ],- },- {- label: t('Observability'),- items: [- {- to: '/platform/security/audit-logs',- label: t('Audit Logs'),- icon: SquareDashedBottomCodeIcon,- locked: !platform.plan.auditLogEnabled,- },- {- to: '/platform/infrastructure/event-destinations',- label: t('Event Streaming'),- icon: WebhookIcon,- locked: !platform.plan.eventStreamingEnabled,- },- ],- },- {- label: t('Infrastructure'),- items: [- {- to: '/platform/infrastructure/workers',- label: t('Workers'),- icon: ServerIcon,- },- {- to: '/platform/infrastructure/health',- label: t('Health'),- icon: FileHeartIcon,- },- {- to: '/platform/infrastructure/triggers',- label: t('Triggers'),- icon: MousePointerClickIcon,- },- ...(edition === ApEdition.CLOUD- ? []- : [- {- to: '/platform/infrastructure/configurations',- label: t('Configurations'),- icon: Settings2Icon,- },- ]),- ],- },- ];+ const location = useLocation();+ const context = { plan: platform.plan, edition };+ const pages = adminPagesUtils.visibleNavPages(context);+ const activeId = adminPagesUtils.activePageId(location.pathname);+ const [searchParams] = useSearchParams();+ const requestedTabId = searchParams.get('tab');return (<Sidebar className="border-r-0!">@@ -240,26 +63,44 @@ export function PlatformSidebar() {</SidebarHeader><div className="flex-1 overflow-y-auto"><SidebarContent className="gap-0">- {groups.map((group, idx) => (- <SidebarGroup key={group.label} className="cursor-default shrink-0">- {idx > 0 && <SidebarSeparator className="mb-3" />}- <SidebarGroupLabel>{group.label}</SidebarGroupLabel>- <SidebarGroupContent>- <SidebarMenu>- {group.items.map((item) => (- <ApSidebarItem- type="link"- key={item.label}- to={item.to}- label={item.label}- icon={item.icon}- locked={item.locked}- />- ))}- </SidebarMenu>- </SidebarGroupContent>- </SidebarGroup>- ))}+ <SidebarGroup className="cursor-default shrink-0">+ <SidebarGroupContent>+ <SidebarMenu>+ {pages.map((page) => {+ const tabs = adminPagesUtils.navTabs({ page, context });+ const isActivePage = page.id === activeId;+ const activeTabId = adminPagesUtils.activeTabId({+ page,+ context,+ requested: requestedTabId,+ });+ return (+ <Fragment key={page.id}>+ <PlatformNavItem+ to={page.path}+ label={t(page.nav.label)}+ icon={page.nav.icon}+ active={+ isActivePage &&+ !tabs.some((tab) => tab.id === activeTabId)+ }+ crowned={adminPagesUtils.isCrowned({ page, context })}+ />+ {tabs.map((tab) => (+ <PlatformNavSubItem+ key={tab.id}+ to={`${page.path}?tab=${tab.id}`}+ label={t(tab.label)}+ active={isActivePage && activeTabId === tab.id}+ crowned={tab.isLocked?.(context) === true}+ />+ ))}+ </Fragment>+ );+ })}+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup></SidebarContent></div>diff --git a/packages/web/src/app/components/sidebar/platform/platform-nav-item.tsx b/packages/web/src/app/components/sidebar/platform/platform-nav-item.tsxnew file mode 100644index 00000000000..3956605081f--- /dev/null+++ b/packages/web/src/app/components/sidebar/platform/platform-nav-item.tsx@@ -0,0 +1,113 @@+import { Crown } from 'lucide-react';+import React, { ComponentType, useEffect, useRef, useState } from 'react';+import { useNavigate } from 'react-router-dom';++import {+ SidebarMenuButton,+ SidebarMenuItem,+} from '@/components/ui/sidebar-shadcn';+import { cn } from '@/lib/utils';++export function PlatformNavItem({+ to,+ label,+ icon,+ active,+ crowned,+}: PlatformNavItemProps) {+ const navigate = useNavigate();+ const iconRef = useRef<AnimatedIconHandle | null>(null);+ const [isHovered, setIsHovered] = useState(false);++ useEffect(() => {+ if (isHovered) {+ iconRef.current?.startAnimation();+ } else {+ iconRef.current?.stopAnimation();+ }+ }, [isHovered]);++ return (+ <SidebarMenuItem>+ <SidebarMenuButton+ className={cn('pr-1', {+ 'bg-sidebar-accent hover:bg-sidebar-accent!': active,+ })}+ onClick={() => navigate(to)}+ onMouseEnter={() => setIsHovered(true)}+ onMouseLeave={() => setIsHovered(false)}+ >+ {icon !== undefined &&+ React.createElement(icon, {+ className: 'size-4 pointer-events-none',+ ref: iconRef,+ })}+ <span+ className={cn('flex-1 truncate text-sm', {+ 'font-semibold': active,+ })}+ >+ {label}+ </span>+ {crowned && <Crown className="size-3.5! shrink-0 text-primary" />}+ </SidebarMenuButton>+ </SidebarMenuItem>+ );+}++export function PlatformNavSubItem({+ to,+ label,+ active,+ crowned,+}: PlatformNavSubItemProps) {+ const navigate = useNavigate();++ return (+ <SidebarMenuItem>+ <div className="flex items-stretch">+ <div className="ml-4 mr-1 w-px shrink-0 bg-sidebar-border" />+ <SidebarMenuButton+ className={cn('h-7 flex-1', {+ 'bg-sidebar-accent hover:bg-sidebar-accent!': active,+ })}+ onClick={() => navigate(to)}+ >+ <span+ className={cn('text-sm text-muted-foreground', {+ 'font-medium text-foreground': active,+ })}+ >+ {label}+ </span>+ {crowned && <Crown className="size-3! ml-auto text-primary" />}+ </SidebarMenuButton>+ </div>+ </SidebarMenuItem>+ );+}++export type AnimatedIconHandle = {+ startAnimation: () => void;+ stopAnimation: () => void;+};++export type AnimatedIconComponent = ComponentType<{+ className?: string;+ ref?: React.Ref<AnimatedIconHandle>;+}>;++export type PlatformNavItemProps = {+ to: string;+ label: string;+ icon?: AnimatedIconComponent;+ active: boolean;+ crowned: boolean;+};++export type PlatformNavSubItemProps = {+ to: string;+ label: string;+ active: boolean;+ crowned: boolean;+};diff --git a/packages/web/src/app/routes/mcp-server/page-band.tsx b/packages/web/src/app/routes/mcp-server/page-band.tsxindex 2cc71e41b6a..948042a1e8f 100644--- a/packages/web/src/app/routes/mcp-server/page-band.tsx+++ b/packages/web/src/app/routes/mcp-server/page-band.tsx@@ -11,7 +11,7 @@ export function PageBand({}) {return (<div- className={cn('mx-auto w-full max-w-[1198px] px-6 lg:px-12', className)}+ className={cn('mx-auto w-full max-w-page-band px-6 lg:px-12', className)}>{children}</div>diff --git a/packages/web/src/app/routes/platform-routes.tsx b/packages/web/src/app/routes/platform-routes.tsxindex 8be572f6fd1..0cc07183c05 100644--- a/packages/web/src/app/routes/platform-routes.tsx+++ b/packages/web/src/app/routes/platform-routes.tsx@@ -1,431 +1,90 @@+import { ApEdition, ApFlagId } from '@activepieces/shared';import React, { Suspense } from 'react';-import { Navigate } from 'react-router-dom';+import { Navigate, useSearchParams } from 'react-router-dom';import { PageTitle } from '@/app/components/page-title';import { RouteLoadingBar } from '@/components/custom/route-loading-bar';-import { Error, Success } from '@/features/billing';+import { flagsHooks } from '@/hooks/flags-hooks';+import { platformHooks } from '@/hooks/platform-hooks';import { PlatformLayout } from '../components/platform-layout';-const SettingsBilling = React.lazy(() => import('./platform/billing'));-const SettingsUsage = React.lazy(() => import('./platform/usage'));-const EventDestinationsPage = React.lazy(- () => import('./platform/infra/event-destinations'),-);-const SettingsHealthPage = React.lazy(() => import('./platform/infra/health'));-const PlatformConfigurationsPage = React.lazy(() =>- import('./platform/infra/configurations').then((m) => ({- default: m.ConfigurationsPage,- })),-);-const TriggerHealthPage = React.lazy(() => import('./platform/infra/triggers'));-const SettingsWorkersPage = React.lazy(- () => import('./platform/infra/workers'),-);-const ProjectsPage = React.lazy(() => import('./platform/projects'));-const ApiKeysPage = React.lazy(() =>- import('./platform/security/api-keys').then((m) => ({- default: m.ApiKeysPage,- })),-);-const AuditLogsPage = React.lazy(- () => import('./platform/security/audit-logs'),-);-const ProjectRolePage = React.lazy(() =>- import('./platform/security/project-role').then((m) => ({- default: m.ProjectRolePage,- })),-);-const SecretManagersPage = React.lazy(- () => import('./platform/security/secret-managers'),-);-const EmbedPage = React.lazy(() =>- import('./platform/security/embed').then((m) => ({- default: m.EmbedPage,- })),-);-const SSOPage = React.lazy(() =>- import('./platform/security/sso').then((m) => ({ default: m.SSOPage })),-);-const AIProvidersPage = React.lazy(() => import('./platform/setup/ai'));-const PlatformMcpPage = React.lazy(() => import('./platform/setup/mcp'));-const GeneralPage = React.lazy(() =>- import('./platform/setup/general').then((m) => ({- default: m.GeneralPage,- })),-);-const GlobalConnectionsTable = React.lazy(() =>- import('./platform/setup/connections').then((m) => ({- default: m.GlobalConnectionsTable,- })),-);-const PlatformPiecesPage = React.lazy(() =>- import('./platform/setup/pieces').then((m) => ({- default: m.PlatformPiecesPage,- })),-);-const PieceSetDetailsPage = React.lazy(() =>- import('./platform/setup/pieces/piece-sets/piece-set-details-page').then(- (m) => ({ default: m.PieceSetDetailsPage }),- ),-);-const PlatformTemplatesPage = React.lazy(() =>- import('./platform/setup/templates').then((m) => ({- default: m.PlatformTemplatesPage,- })),-);-const UsersPage = React.lazy(() => import('./platform/users'));-const PlatformConnectionsPage = React.lazy(- () => import('./platform/connections'),-);+import {+ ADMIN_PAGES,+ ADMIN_REDIRECTS,+ AdminPage as AdminPageSpec,+ adminPagesUtils,+} from './platform/admin-pages';function SuspenseWrapper({ children }: { children: React.ReactNode }) {return <Suspense fallback={<RouteLoadingBar />}>{children}</Suspense>;}+function AdminRoute({ page }: { page: AdminPageSpec }) {+ const { platform } = platformHooks.useCurrentPlatform();+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);+ const [searchParams] = useSearchParams();+ const context = { plan: platform.plan, edition };++ const Page = page.component;+ if (Page !== undefined) {+ return (+ <SuspenseWrapper>+ <Page />+ </SuspenseWrapper>+ );+ }++ const tabs = adminPagesUtils.visibleTabs({ page, context });+ const requested = searchParams.get('tab');+ const Overview = page.overview;+ if (Overview !== undefined && requested === null) {+ return (+ <SuspenseWrapper>+ <Overview />+ </SuspenseWrapper>+ );+ }++ const requestedTab = tabs.find((tab) => tab.id === requested);+ if (requested !== null && requestedTab === undefined) {+ return <Navigate to={page.path} replace />;+ }+ const activeTab = requestedTab ?? tabs[0];+ if (activeTab === undefined) {+ return null;+ }++ const TabContent = activeTab.component;+ return (+ <SuspenseWrapper>+ <TabContent />+ </SuspenseWrapper>+ );+}+export const platformRoutes = [- {- path: '/platform',- element: (- <PlatformLayout>- <PageTitle title="Platform">- <Navigate to="/platform/projects" />- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/projects',- element: (- <PlatformLayout>- <PageTitle title="Projects">- <SuspenseWrapper>- <ProjectsPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/users',- element: (- <PlatformLayout>- <PageTitle title="Users">- <SuspenseWrapper>- <UsersPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/connections',- element: (- <PlatformLayout>- <PageTitle title="Connections">- <SuspenseWrapper>- <PlatformConnectionsPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup',- element: (- <PlatformLayout>- <PageTitle title="Platform Setup">- <Navigate to="/platform/setup/ai" replace />- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/ai',- element: (- <PlatformLayout>- <PageTitle title="AI Center">- <SuspenseWrapper>- <AIProvidersPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/ai-capabilities',- element: <Navigate to="/platform/setup/ai?tab=capabilities" replace />,- },- {- path: '/platform/setup/mcp',- element: (- <PlatformLayout>- <PageTitle title="MCP Server">- <SuspenseWrapper>- <PlatformMcpPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/pieces',- element: (- <PlatformLayout>- <PageTitle title="Pieces">- <SuspenseWrapper>- <PlatformPiecesPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/pieces/piece-sets/:id',- element: (- <PlatformLayout>- <PageTitle title="Piece Set">- <SuspenseWrapper>- <PieceSetDetailsPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/connections',- element: (- <PlatformLayout>- <PageTitle title="Connections">- <SuspenseWrapper>- <GlobalConnectionsTable />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/templates',- element: (- <PlatformLayout>- <PageTitle title="Templates">- <SuspenseWrapper>- <PlatformTemplatesPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/general',- element: (- <PlatformLayout>- <PageTitle title="General">- <SuspenseWrapper>- <GeneralPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/branding',- element: <Navigate to="/platform/setup/general" replace />,- },- {- path: '/platform/setup/billing',- element: (- <PlatformLayout>- <PageTitle title="Billing">- <SuspenseWrapper>- <SettingsBilling />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/usage',- element: (- <PlatformLayout>- <PageTitle title="Usage">- <SuspenseWrapper>- <SettingsUsage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/billing/success',- element: (- <PlatformLayout>- <PageTitle title="Billing">- <Success />- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/setup/billing/error',- element: (- <PlatformLayout>- <PageTitle title="Billing">- <Error />- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security',- element: (- <PlatformLayout>- <PageTitle title="Platform Security">- <Navigate to="/platform/security/audit-logs" replace />- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security/api-keys',- element: (- <PlatformLayout>- <PageTitle title="API Keys">- <SuspenseWrapper>- <ApiKeysPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security/secret-managers',- element: (- <PlatformLayout>- <PageTitle title="Secret managers">- <SuspenseWrapper>- <SecretManagersPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security/audit-logs',- element: (- <PlatformLayout>- <PageTitle title="Audit Logs">- <SuspenseWrapper>- <AuditLogsPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security/embed',- element: (- <PlatformLayout>- <PageTitle title="Embedding">- <SuspenseWrapper>- <EmbedPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security/sso',- element: (- <PlatformLayout>- <PageTitle title="SSO">- <SuspenseWrapper>- <SSOPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/security/project-roles',- element: (- <PlatformLayout>- <PageTitle title="Project Roles">- <SuspenseWrapper>- <ProjectRolePage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/infrastructure',- element: (- <PlatformLayout>- <PageTitle title="Platform Infrastructure">- <Navigate to="/platform/infrastructure/workers" replace />- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/infrastructure/workers',+ ...ADMIN_PAGES.map((page) => ({+ path: page.path,element: (<PlatformLayout>- <PageTitle title="Workers">- <SuspenseWrapper>- <SettingsWorkersPage />- </SuspenseWrapper>+ <PageTitle title={page.title}>+ <AdminRoute page={page} /></PageTitle></PlatformLayout>),- },- {- path: '/platform/infrastructure/health',- element: (- <PlatformLayout>- <PageTitle title="Health">- <SuspenseWrapper>- <SettingsHealthPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/infrastructure/configurations',- element: (- <PlatformLayout>- <PageTitle title="Configurations">- <SuspenseWrapper>- <PlatformConfigurationsPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/infrastructure/triggers',- element: (- <PlatformLayout>- <PageTitle title="Trigger Health">- <SuspenseWrapper>- <TriggerHealthPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },- {- path: '/platform/infrastructure/event-destinations',- element: (- <PlatformLayout>- <PageTitle title="Event Streaming">- <SuspenseWrapper>- <EventDestinationsPage />- </SuspenseWrapper>- </PageTitle>- </PlatformLayout>- ),- },+ })),+ ...ADMIN_REDIRECTS.map(({ from, to, title, replace = true }) => ({+ path: from,+ element:+ title === undefined ? (+ <Navigate to={to} replace={replace} />+ ) : (+ <PlatformLayout>+ <PageTitle title={title}>+ <Navigate to={to} replace={replace} />+ </PageTitle>+ </PlatformLayout>+ ),+ })),];diff --git a/packages/web/src/app/routes/platform/admin-pages.ts b/packages/web/src/app/routes/platform/admin-pages.tsnew file mode 100644index 00000000000..1898fb7f4f4--- /dev/null+++ b/packages/web/src/app/routes/platform/admin-pages.ts@@ -0,0 +1,520 @@+import { ApEdition, PlatformWithoutSensitiveData } from '@activepieces/shared';+import React, { ComponentType } from 'react';++import { FeatureTeaserProps } from '@/app/components/feature-teaser';+import { FrameIcon } from '@/components/icons/frame';+import { LayoutGridIcon } from '@/components/icons/layout-grid';+import { PuzzleIcon } from '@/components/icons/puzzle';+import { ReceiptIcon } from '@/components/icons/receipt';+import { ServerIcon } from '@/components/icons/server';+import { SettingsIcon } from '@/components/icons/settings';+import { ShieldIcon } from '@/components/icons/shield';+import { SparklesIcon } from '@/components/icons/sparkles';+import { UnplugIcon } from '@/components/icons/unplug';+import { UsersIcon } from '@/components/icons/users';+import { Error as BillingError, Success } from '@/features/billing';++const UsersOverview = React.lazy(() =>+ import('./overview/users-overview').then((m) => ({+ default: m.UsersOverview,+ })),+);+const ConnectionsOverview = React.lazy(() =>+ import('./overview/connections-overview').then((m) => ({+ default: m.ConnectionsOverview,+ })),+);+const AiOverview = React.lazy(() =>+ import('./overview/ai-overview').then((m) => ({ default: m.AiOverview })),+);+const SecurityOverview = React.lazy(() =>+ import('./overview/security-overview').then((m) => ({+ default: m.SecurityOverview,+ })),+);+const BillingOverview = React.lazy(() =>+ import('./overview/billing-overview').then((m) => ({+ default: m.BillingOverview,+ })),+);+const InfrastructureOverview = React.lazy(() =>+ import('./overview/infrastructure-overview').then((m) => ({+ default: m.InfrastructureOverview,+ })),+);+const ProjectsPage = React.lazy(() => import('./projects'));+const UsersPage = React.lazy(() => import('./users'));+const PlatformConnectionsPage = React.lazy(() => import('./connections'));+const GeneralPage = React.lazy(() =>+ import('./setup/general').then((m) => ({ default: m.GeneralPage })),+);+const ProvidersTab = React.lazy(() =>+ import('./setup/ai/providers-tab').then((m) => ({ default: m.ProvidersTab })),+);+const CapabilitiesTab = React.lazy(() =>+ import('./setup/ai/capabilities-tab').then((m) => ({+ default: m.CapabilitiesTab,+ })),+);+const PlatformMcpPage = React.lazy(() => import('./setup/mcp'));+const GlobalConnectionsTable = React.lazy(() =>+ import('./setup/connections').then((m) => ({+ default: m.GlobalConnectionsTable,+ })),+);+const PiecesListTab = React.lazy(() =>+ import('./setup/pieces').then((m) => ({ default: m.PiecesListTab })),+);+const PieceSetsTab = React.lazy(() =>+ import('./setup/pieces/piece-sets/piece-sets-tab').then((m) => ({+ default: m.PieceSetsTab,+ })),+);+const PieceSetDetailsPage = React.lazy(() =>+ import('./setup/pieces/piece-sets/piece-set-details-page').then((m) => ({+ default: m.PieceSetDetailsPage,+ })),+);+const PlatformTemplatesPage = React.lazy(() =>+ import('./setup/templates').then((m) => ({+ default: m.PlatformTemplatesPage,+ })),+);+const BillingPlanTab = React.lazy(() =>+ import('./billing').then((m) => ({ default: m.BillingPlanTab })),+);+const BillingUsageTab = React.lazy(() =>+ import('./billing').then((m) => ({ default: m.BillingUsageTab })),+);+const SSOPage = React.lazy(() =>+ import('./security/sso').then((m) => ({ default: m.SSOPage })),+);+const ProjectRolePage = React.lazy(() =>+ import('./security/project-role').then((m) => ({+ default: m.ProjectRolePage,+ })),+);+const ApiKeysPage = React.lazy(() =>+ import('./security/api-keys').then((m) => ({ default: m.ApiKeysPage })),+);+const SecretManagersPage = React.lazy(+ () => import('./security/secret-managers'),+);+const AuditLogsPage = React.lazy(() => import('./security/audit-logs'));+const EmbedPage = React.lazy(() =>+ import('./security/embed').then((m) => ({ default: m.EmbedPage })),+);+const SettingsWorkersPage = React.lazy(() => import('./infra/workers'));+const SettingsHealthPage = React.lazy(() => import('./infra/health'));+const ConfigurationsPage = React.lazy(() =>+ import('./infra/configurations').then((m) => ({+ default: m.ConfigurationsPage,+ })),+);+const TriggerHealthPage = React.lazy(() => import('./infra/triggers'));+const EventDestinationsPage = React.lazy(+ () => import('./infra/event-destinations'),+);++function isCommunity({ edition }: AdminPageContext) {+ return edition === ApEdition.COMMUNITY;+}++function hasNav(page: AdminPage): page is AdminNavPage {+ return page.nav !== undefined;+}++function visibleNavPages(context: AdminPageContext) {+ return ADMIN_PAGES.filter(hasNav).filter(+ (page) => page.nav.isHidden?.(context) !== true,+ );+}++function visibleTabs({ page, context }: PageInContext) {+ return (page.tabs ?? []).filter((tab) => tab.isHidden?.(context) !== true);+}++function navTabs({ page, context }: PageInContext) {+ return visibleTabs({ page, context }).filter((tab) => tab.hideInNav !== true);+}++function activeTabId({+ page,+ context,+ requested,+}: PageInContext & { requested: string | null }) {+ if (requested !== null) {+ return requested;+ }+ if (page.overview !== undefined) {+ return null;+ }+ return visibleTabs({ page, context })[0]?.id ?? null;+}++function isCrowned({+ page,+ context,+}: {+ page: AdminNavPage;+ context: AdminPageContext;+}) {+ if (page.nav.isLocked?.(context) === true) {+ return true;+ }+ const tabs = visibleTabs({ page, context });+ return (+ tabs.length > 0 && tabs.every((tab) => tab.isLocked?.(context) === true)+ );+}++function activePageId(pathname: string) {+ const matches = ADMIN_PAGES.filter(+ (page) => pathname === page.path || pathname.startsWith(page.path + '/'),+ );+ const best = matches.reduce<AdminPage | undefined>(+ (longest, page) =>+ longest === undefined || page.path.length > longest.path.length+ ? page+ : longest,+ undefined,+ );+ return best?.id;+}++export const adminPagesUtils = {+ visibleNavPages,+ visibleTabs,+ navTabs,+ activeTabId,+ isCrowned,+ activePageId,+};++export const ADMIN_PAGES: AdminPage[] = [+ {+ id: 'general',+ path: '/platform/setup/general',+ title: 'General',+ component: GeneralPage,+ nav: { label: 'General', icon: SettingsIcon },+ },+ {+ id: 'projects',+ path: '/platform/projects',+ title: 'Projects',+ component: ProjectsPage,+ nav: {+ label: 'Projects',+ icon: LayoutGridIcon,+ },+ },+ {+ id: 'users',+ path: '/platform/users',+ title: 'Users & access',+ overview: UsersOverview,+ nav: { label: 'Users & access', icon: UsersIcon },+ tabs: [+ { id: 'members', label: 'Members', component: UsersPage },+ {+ id: 'sso',+ label: 'Single sign on',+ component: SSOPage,+ isLocked: ({ plan }) => !plan.ssoEnabled,+ },+ {+ id: 'roles',+ label: 'Project roles',+ component: ProjectRolePage,+ isLocked: ({ plan }) => !plan.projectRolesEnabled,+ },+ ],+ },+ {+ id: 'connections',+ path: '/platform/connections',+ title: 'Connections',+ overview: ConnectionsOverview,+ nav: { label: 'Connections', icon: UnplugIcon },+ tabs: [+ {+ id: 'project',+ label: 'Project connections',+ component: PlatformConnectionsPage,+ },+ {+ id: 'global',+ label: 'Global connections',+ component: GlobalConnectionsTable,+ isLocked: ({ plan }) => !plan.globalConnectionsEnabled,+ },+ ],+ },+ {+ id: 'ai',+ path: '/platform/setup/ai',+ title: 'AI Center & MCP',+ overview: AiOverview,+ nav: { label: 'AI Center & MCP', icon: SparklesIcon },+ tabs: [+ { id: 'providers', label: 'Providers', component: ProvidersTab },+ {+ id: 'capabilities',+ label: 'Capabilities',+ component: CapabilitiesTab,+ isHidden: ({ edition }) => edition === ApEdition.COMMUNITY,+ },+ {+ id: 'mcp',+ label: 'MCP Server',+ component: PlatformMcpPage,+ },+ ],+ },+ {+ id: 'pieces',+ path: '/platform/setup/pieces',+ title: 'Pieces',+ nav: {+ label: 'Pieces',+ icon: PuzzleIcon,+ },+ tabs: [+ {+ id: 'pieces',+ label: 'Pieces',+ component: PiecesListTab,+ hideInNav: true,+ },+ {+ id: 'piece-sets',+ label: 'Piece Sets',+ component: PieceSetsTab,+ isLocked: ({ plan }) => !plan.managePiecesEnabled,+ },+ ],+ },+ {+ id: 'templates',+ path: '/platform/setup/templates',+ title: 'Templates',+ component: PlatformTemplatesPage,+ nav: {+ label: 'Templates',+ icon: LayoutGridIcon,+ isLocked: ({ plan }) => !plan.manageTemplatesEnabled,+ },+ },+ {+ id: 'embed',+ path: '/platform/security/embed',+ title: 'Embedding',+ component: EmbedPage,+ nav: {+ label: 'Embedding',+ icon: FrameIcon,+ isLocked: ({ plan }) => !plan.embeddingEnabled,+ },+ },+ {+ id: 'security',+ path: '/platform/security',+ title: 'Security',+ overview: SecurityOverview,+ nav: {+ label: 'Security',+ icon: ShieldIcon,+ },+ tabs: [+ {+ id: 'api-keys',+ label: 'API keys',+ component: ApiKeysPage,+ isLocked: ({ plan }) => !plan.apiKeysEnabled,+ },+ {+ id: 'secrets',+ label: 'Secret managers',+ component: SecretManagersPage,+ isLocked: ({ plan }) => !plan.secretManagersEnabled,+ },+ {+ id: 'audit',+ label: 'Audit logs',+ component: AuditLogsPage,+ isLocked: ({ plan }) => !plan.auditLogEnabled,+ },+ {+ id: 'events',+ label: 'Event streaming',+ component: EventDestinationsPage,+ isLocked: ({ plan }) => !plan.eventStreamingEnabled,+ },+ ],+ },+ {+ id: 'billing',+ path: '/platform/setup/billing',+ title: 'Billing & usage',+ overview: BillingOverview,+ nav: {+ label: 'Billing & usage',+ icon: ReceiptIcon,+ isLocked: isCommunity,+ },+ tabs: [+ { id: 'plan', label: 'Plan', component: BillingPlanTab },+ { id: 'usage', label: 'Usage', component: BillingUsageTab },+ ],+ },+ {+ id: 'infrastructure',+ path: '/platform/infrastructure',+ title: 'Infrastructure',+ overview: InfrastructureOverview,+ nav: { label: 'Infrastructure', icon: ServerIcon },+ tabs: [+ { id: 'health', label: 'Health', component: SettingsHealthPage },+ { id: 'workers', label: 'Workers', component: SettingsWorkersPage },+ { id: 'triggers', label: 'Triggers', component: TriggerHealthPage },+ {+ id: 'configurations',+ label: 'Configurations',+ component: ConfigurationsPage,+ isHidden: ({ edition }) => edition === ApEdition.CLOUD,+ },+ ],+ },+ {+ id: 'piece-set-details',+ path: '/platform/setup/pieces/piece-sets/:id',+ title: 'Piece Set',+ component: PieceSetDetailsPage,+ },+ {+ id: 'billing-success',+ path: '/platform/setup/billing/success',+ title: 'Billing',+ component: Success,+ },+ {+ id: 'billing-error',+ path: '/platform/setup/billing/error',+ title: 'Billing',+ component: BillingError,+ },+];++export const ADMIN_REDIRECTS: AdminRedirect[] = [+ {+ from: '/platform',+ to: '/platform/projects',+ title: 'Platform',+ replace: false,+ },+ {+ from: '/platform/setup',+ to: '/platform/setup/ai',+ title: 'Platform Setup',+ },+ {+ from: '/platform/setup/ai-capabilities',+ to: '/platform/setup/ai?tab=capabilities',+ },+ {+ from: '/platform/setup/usage',+ to: '/platform/setup/billing?tab=usage',+ },+ {+ from: '/platform/setup/branding',+ to: '/platform/setup/general',+ },+ { from: '/platform/setup/mcp', to: '/platform/setup/ai?tab=mcp' },+ {+ from: '/platform/security/api-keys',+ to: '/platform/security?tab=api-keys',+ },+ { from: '/platform/security/sso', to: '/platform/users?tab=sso' },+ { from: '/platform/security/project-roles', to: '/platform/users?tab=roles' },+ {+ from: '/platform/setup/connections',+ to: '/platform/connections?tab=global',+ },+ {+ from: '/platform/security/secret-managers',+ to: '/platform/security?tab=secrets',+ },+ { from: '/platform/security/audit-logs', to: '/platform/security?tab=audit' },+ {+ from: '/platform/infrastructure/event-destinations',+ to: '/platform/security?tab=events',+ },+ {+ from: '/platform/infrastructure/workers',+ to: '/platform/infrastructure?tab=workers',+ },+ {+ from: '/platform/infrastructure/health',+ to: '/platform/infrastructure?tab=health',+ },+ {+ from: '/platform/infrastructure/triggers',+ to: '/platform/infrastructure?tab=triggers',+ },+ {+ from: '/platform/infrastructure/configurations',+ to: '/platform/infrastructure?tab=configurations',+ },+];++type PageInContext = {+ page: AdminPage;+ context: AdminPageContext;+};++export type AdminPageContext = {+ plan: PlatformWithoutSensitiveData['plan'];+ edition: ApEdition | null;+};++export type AdminPageNav = {+ label: string;+ icon?: ComponentType<{ className?: string }>;+ isLocked?: (context: AdminPageContext) => boolean;+ isHidden?: (context: AdminPageContext) => boolean;+};++export type AdminPageTabSpec = {+ id: string;+ label: string;+ component: ComponentType;+ isLocked?: (context: AdminPageContext) => boolean;+ isHidden?: (context: AdminPageContext) => boolean;+ hideInNav?: boolean;+ teaser?: FeatureTeaserProps;+ sample?: boolean;+};++export type AdminPage = {+ id: string;+ path: string;+ title: string;+ component?: ComponentType;+ overview?: ComponentType;+ tabs?: AdminPageTabSpec[];+ nav?: AdminPageNav;+ sample?: boolean;+ teaser?: FeatureTeaserProps;+};++export const VIEW_QUERY_PARAM = 'view';++export type AdminNavPage = AdminPage & { nav: AdminPageNav };++export type AdminRedirect = {+ from: string;+ to: string;+ title?: string;+ replace?: boolean;+};diff --git a/packages/web/src/app/routes/platform/billing/index.tsx b/packages/web/src/app/routes/platform/billing/index.tsxindex f2f86dc7c42..5ffd50d3f17 100644--- a/packages/web/src/app/routes/platform/billing/index.tsx+++ b/packages/web/src/app/routes/platform/billing/index.tsx@@ -33,20 +33,71 @@ import {import { flagsHooks } from '@/hooks/flags-hooks';import { platformHooks } from '@/hooks/platform-hooks';-export default function Billing() {+import { UsageTab } from './usage-tab';++export function BillingPlanTab() {return (<BillingPageShell- lockTitle={t('Unlock Billing Page')}+ lockTitle={t('Unlock Billing & Usage')}errorMessage={t('Failed to load billing information')}>{({ platform, info }) => (- <BillingPageDetails platform={platform} info={info} />+ <div className="flex w-full flex-col gap-4 p-6">+ <div className="flex items-start justify-between gap-4">+ <div className="flex flex-col gap-1">+ <h1 className="text-xl font-medium">+ {t('Billing & subscription')}+ </h1>+ <div className="text-sm text-muted-foreground">+ {t(+ 'For questions about billing contact us at [email protected]',+ )}+ </div>+ </div>+ <BillingRefreshButton />+ </div>+ <Separator />+ <PlanTab platform={platform} info={info} />+ </div>)}</BillingPageShell>);}-function BillingPageDetails({ platform, info }: BillingPageDetailsProps) {+export function BillingUsageTab() {+ return (+ <BillingPageShell+ lockTitle={t('Unlock Billing & Usage')}+ errorMessage={t('Failed to load billing information')}+ >+ {({ platform, info }) => <UsageTab platform={platform} info={info} />}+ </BillingPageShell>+ );+}++function BillingRefreshButton() {+ const { mutate: refreshBilling, isPending: isRefreshing } =+ billingMutations.useRefreshSubscription();++ return (+ <Button+ variant="outline"+ size="sm"+ className="shrink-0"+ loading={isRefreshing}+ onClick={() =>+ refreshBilling(undefined, {+ onSuccess: () => toast.success(t('Billing information refreshed')),+ })+ }+ >+ <RefreshCw className="size-4 mr-2" />+ {t('Refresh')}+ </Button>+ );+}++function PlanTab({ platform, info }: PlanTabProps) {const { openDialog } = useManagePlanDialogStore();const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);const isCommunity = edition === ApEdition.COMMUNITY;@@ -56,8 +107,6 @@ function BillingPageDetails({ platform, info }: BillingPageDetailsProps) {const [isCancelOpen, setIsCancelOpen] = useState(false);const { cancelWithSeatCheck, deactivateUsersDialog } =useCancelSubscriptionGuard();- const { mutate: refreshBilling, isPending: isRefreshing } =- billingMutations.useRefreshSubscription();const isCloud = edition === ApEdition.CLOUD;@@ -86,34 +135,6 @@ function BillingPageDetails({ platform, info }: BillingPageDetailsProps) {return (<div className="flex w-full flex-col gap-4 p-6">- <div className="flex items-start justify-between gap-4">- <div className="flex flex-col gap-1">- <h1 className="text-xl font-medium">{t('Billing & subscription')}</h1>- <div className="text-sm text-muted-foreground">- {t(- 'For questions about billing contact us at [email protected]',- )}- </div>- </div>- {!isCommunity && (- <Button- variant="outline"- size="sm"- className="shrink-0"- loading={isRefreshing}- onClick={() =>- refreshBilling(undefined, {- onSuccess: () =>- toast.success(t('Billing information refreshed')),- })- }- >- <RefreshCw className="size-4 mr-2" />- {t('Refresh')}- </Button>- )}- </div>- <Separator />{info.billingUnavailable && (<Alert variant="warning"><AlertDescription>@@ -354,7 +375,7 @@ const LinkButton = ({</button>);-type BillingPageDetailsProps = {+type PlanTabProps = {platform: ReturnType<typeof platformHooks.useCurrentPlatform>['platform'];info: PlatformBillingInformation;};diff --git a/packages/web/src/app/routes/platform/billing/usage-tab.tsx b/packages/web/src/app/routes/platform/billing/usage-tab.tsxnew file mode 100644index 00000000000..cdee3ae5e82--- /dev/null+++ b/packages/web/src/app/routes/platform/billing/usage-tab.tsx@@ -0,0 +1,46 @@+import { PlatformBillingInformation } from '@activepieces/shared';+import { t } from 'i18next';+import { Info } from 'lucide-react';++import { Separator } from '@/components/ui/separator';+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from '@/components/ui/tooltip';+import { FeatureUsageCards, ProjectsUsageTable } from '@/features/billing';+import { platformHooks } from '@/hooks/platform-hooks';++export function UsageTab({ platform, info }: UsageTabProps) {+ return (+ <div className="flex w-full flex-col gap-4 p-6">+ <div className="flex flex-col gap-1">+ <div className="flex items-center gap-1.5">+ <h1 className="text-xl font-medium">{t('Usage')}</h1>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info className="size-3.5 text-muted-foreground cursor-help" />+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-60">+ <p className="text-sm">+ {t('Usage figures may be a few minutes out of date.')}+ </p>+ </TooltipContent>+ </Tooltip>+ </div>+ <div className="text-sm text-muted-foreground">+ {t('Track your workspace usage across your plan limits.')}+ </div>+ </div>+ <Separator />+ <FeatureUsageCards platformSubscription={info} />+ <Separator />+ <ProjectsUsageTable platformId={platform.id} />+ </div>+ );+}++type UsageTabProps = {+ platform: ReturnType<typeof platformHooks.useCurrentPlatform>['platform'];+ info: PlatformBillingInformation;+};diff --git a/packages/web/src/app/routes/platform/infra/health/index.tsx b/packages/web/src/app/routes/platform/infra/health/index.tsxindex 1c4b116d7fb..a43965bbfd9 100644--- a/packages/web/src/app/routes/platform/infra/health/index.tsx+++ b/packages/web/src/app/routes/platform/infra/health/index.tsx@@ -5,6 +5,7 @@ import React from 'react';import { useSearchParams } from 'react-router-dom';import { DashboardPageHeader } from '@/app/components/dashboard-page-header';+import { VIEW_QUERY_PARAM } from '@/app/routes/platform/admin-pages';import {Select,SelectContent,@@ -19,8 +20,6 @@ import { RunsTab } from './components/runs-tab';import { SystemHealthTab } from './components/system-health-tab';import { healthMetricsQueries } from './lib/health-metrics-hooks';-type TabValue = 'system' | 'runs' | 'queue';-type MonthOption = { value: string; label: string };function buildMonthOptions(): MonthOption[] {@@ -37,7 +36,7 @@ function buildMonthOptions(): MonthOption[] {export default function SettingsHealthPage() {const monthOptions = React.useMemo(buildMonthOptions, []);const [searchParams, setSearchParams] = useSearchParams();- const activeTab = (searchParams.get('tab') as TabValue) || 'system';+ const activeTab = parseTabValue(searchParams.get(VIEW_QUERY_PARAM));const selectedMonth = searchParams.get('month') || monthOptions[0].value;const range = React.useMemo(() => {@@ -60,9 +59,9 @@ export default function SettingsHealthPage() {const setTab = (tab: TabValue) => {const newParams = new URLSearchParams(searchParams);if (tab === 'system') {- newParams.delete('tab');+ newParams.delete(VIEW_QUERY_PARAM);} else {- newParams.set('tab', tab);+ newParams.set(VIEW_QUERY_PARAM, tab);}setSearchParams(newParams, { replace: true });};@@ -136,3 +135,9 @@ export default function SettingsHealthPage() {</div>);}++function parseTabValue(value: string | null): TabValue {+ return value === 'runs' || value === 'queue' ? value : 'system';+}++type TabValue = 'system' | 'runs' | 'queue';diff --git a/packages/web/src/app/routes/platform/infra/workers/index.tsx b/packages/web/src/app/routes/platform/infra/workers/index.tsxindex 2a6b8ec4a66..5a02a786f5a 100644--- a/packages/web/src/app/routes/platform/infra/workers/index.tsx+++ b/packages/web/src/app/routes/platform/infra/workers/index.tsx@@ -23,6 +23,7 @@ import { useSearchParams } from 'react-router-dom';import { DashboardPageHeader } from '@/app/components/dashboard-page-header';import LockedFeatureGuard from '@/app/components/locked-feature-guard';+import { VIEW_QUERY_PARAM } from '@/app/routes/platform/admin-pages';import {Alert,AlertAction,@@ -53,8 +54,6 @@ import { SandboxesPopover } from './sandboxes-popover';import { WorkerAssignmentsTab } from './worker-assignments-tab';import { WorkerConfigsPopover } from './worker-configs-popover';-type TabValue = 'health' | 'worker-groups';-export default function WorkersPage() {const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);const { platform } = platformHooks.useCurrentPlatform();@@ -62,14 +61,14 @@ export default function WorkersPage() {const { data: workersData, isLoading } = workersQueries.useWorkerMachines();const [searchParams, setSearchParams] = useSearchParams();- const activeTab = (searchParams.get('tab') as TabValue) || 'health';+ const activeTab = parseTabValue(searchParams.get(VIEW_QUERY_PARAM));const setTab = (tab: TabValue) => {const newParams = new URLSearchParams(searchParams);if (tab === 'health') {- newParams.delete('tab');+ newParams.delete(VIEW_QUERY_PARAM);} else {- newParams.set('tab', tab);+ newParams.set(VIEW_QUERY_PARAM, tab);}setSearchParams(newParams, { replace: true });};@@ -378,3 +377,9 @@ type WorkerCardProps = {worker: WorkerMachineWithStatus;index: number;};++function parseTabValue(value: string | null): TabValue {+ return value === 'worker-groups' ? value : 'health';+}++type TabValue = 'health' | 'worker-groups';diff --git a/packages/web/src/app/routes/platform/overview/ai-overview.tsx b/packages/web/src/app/routes/platform/overview/ai-overview.tsxnew file mode 100644index 00000000000..f5ec310172a--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/ai-overview.tsx@@ -0,0 +1,177 @@+import { AIProviderName } from '@activepieces/core-utils';+import { ApEdition, ApFlagId } from '@activepieces/shared';+import { t } from 'i18next';+import { Link } from 'react-router-dom';++import { Button } from '@/components/ui/button';+import { SUPPORTED_AI_PROVIDERS } from '@/features/agents';+import { billingQueries } from '@/features/billing';+import {+ aiProviderQueries,+ aiToolConfigQueries,+} from '@/features/platform-admin';+import { flagsHooks } from '@/hooks/flags-hooks';+import { platformHooks } from '@/hooks/platform-hooks';++import { AI_TOOL_CATALOG } from '../setup/ai-capabilities/catalog';++import {+ AdminOverview,+ OverviewCard,+ OverviewCards,+ OverviewRow,+ OverviewRows,+ OverviewSection,+} from './overview-shell';++export function AiOverview() {+ const { platform } = platformHooks.useCurrentPlatform();+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);+ const isCommunity = edition === ApEdition.COMMUNITY;+ const {+ data: providers,+ isLoading: isLoadingProviders,+ isError: isProvidersError,+ refetch: refetchProviders,+ } = aiProviderQueries.useAiProviderConfigs();+ const {+ data: toolConfigs,+ isLoading: isLoadingTools,+ isError: isToolsError,+ } = aiToolConfigQueries.useAiToolConfigs();+ const {+ data: subscription,+ isError: isSubscriptionError,+ refetch: refetchSubscription,+ } = billingQueries.usePlatformSubscription(platform.id, !isCommunity);++ const configured = (providers ?? []).filter(+ (provider) => provider.provider !== AIProviderName.ACTIVEPIECES,+ );+ const chatProvider = (providers ?? []).find(+ (provider) => provider.enabledForChat,+ );+ const connectedTools = (toolConfigs ?? []).filter((config) => config.enabled);+ const chatProviderName =+ SUPPORTED_AI_PROVIDERS.find(+ (info) => info.provider === chatProvider?.provider,+ )?.name ?? chatProvider?.provider;++ const credits = subscription?.usage.creditsUsed ?? 0;+ const creditsIncluded = subscription?.plan.includedCredits ?? 0;+ const creditsPercent =+ creditsIncluded === 0+ ? 0+ : Math.min(100, Math.round((credits / creditsIncluded) * 100));++ return (+ <AdminOverview+ title={t('AI Center & MCP')}+ description={t(+ 'Models, assistant capabilities and the MCP server your flows and chat rely on.',+ )}+ >+ <OverviewCards>+ <OverviewCard+ to="/platform/setup/ai?tab=providers"+ title={t('Providers')}+ value={configured.length}+ isLoading={isLoadingProviders}+ isError={isProvidersError}+ errorEntity={t('AI providers')}+ description={+ chatProvider === undefined+ ? t('No provider powers chat yet')+ : t('{provider} powers chat', { provider: chatProviderName })+ }+ />+ {!isCommunity && (+ <OverviewCard+ to="/platform/setup/ai?tab=capabilities"+ title={t('Capabilities')}+ value={t('{connected} of {total}', {+ connected: connectedTools.length,+ total: AI_TOOL_CATALOG.length,+ })}+ isLoading={isLoadingTools}+ isError={isToolsError}+ errorEntity={t('capabilities')}+ description={t(+ 'Web search, scraping and image generation for the assistant',+ )}+ />+ )}+ <OverviewCard+ to="/platform/setup/ai?tab=mcp"+ title={t('MCP Server')}+ value={t('Ready')}+ description={t('Expose platform tools to external MCP clients')}+ />+ </OverviewCards>++ {!isCommunity && (+ <OverviewSection+ title={t('AI credits this month')}+ description={t(+ 'Credits spent on AI steps and chat, out of your plan total.',+ )}+ error={+ isSubscriptionError+ ? { entity: t('credits'), onRetry: refetchSubscription }+ : undefined+ }+ >+ <div className="flex flex-col gap-2 rounded-lg border p-4">+ <div className="flex items-baseline justify-between gap-3">+ <span className="text-sm">+ <span className="text-lg font-semibold">+ {credits.toLocaleString()}+ </span>{' '}+ {t('used')}+ </span>+ <span className="text-sm text-muted-foreground">+ {t('{included} included', {+ included: creditsIncluded.toLocaleString(),+ })}+ </span>+ </div>+ <div className="h-1.5 overflow-hidden rounded-full bg-muted">+ <div+ className="h-full rounded-full bg-primary"+ style={{ width: `${creditsPercent}%` }}+ />+ </div>+ </div>+ </OverviewSection>+ )}++ <OverviewSection+ title={t('Default model')}+ description={t(+ 'Used by AI steps and the assistant when a flow does not pick a model explicitly.',+ )}+ isLoading={isLoadingProviders}+ error={+ isProvidersError+ ? { entity: t('AI providers'), onRetry: refetchProviders }+ : undefined+ }+ >+ <OverviewRows>+ <OverviewRow+ tone={chatProvider === undefined ? 'off' : 'ok'}+ label={+ chatProvider === undefined+ ? t('No provider enabled for chat')+ : chatProviderName+ }+ >+ <Button variant="outline" size="sm" asChild>+ <Link to="/platform/setup/ai?tab=providers">{t('Change')}</Link>+ </Button>+ </OverviewRow>+ </OverviewRows>+ </OverviewSection>+ </AdminOverview>+ );+}diff --git a/packages/web/src/app/routes/platform/overview/billing-overview.tsx b/packages/web/src/app/routes/platform/overview/billing-overview.tsxnew file mode 100644index 00000000000..5dbf02b69bb--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/billing-overview.tsx@@ -0,0 +1,59 @@+import { ApEdition, ApFlagId } from '@activepieces/shared';+import { t } from 'i18next';++import { billingQueries } from '@/features/billing';+import { flagsHooks } from '@/hooks/flags-hooks';+import { platformHooks } from '@/hooks/platform-hooks';++import { AdminOverview, OverviewCard, OverviewCards } from './overview-shell';++export function BillingOverview() {+ const { platform } = platformHooks.useCurrentPlatform();+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);+ const isCommunity = edition === ApEdition.COMMUNITY;+ const {+ data: subscription,+ isLoading,+ isError,+ } = billingQueries.usePlatformSubscription(platform.id, !isCommunity);++ const creditsUsed = subscription?.usage.creditsUsed ?? 0;+ const creditsLimit = subscription?.plan.includedCredits ?? 0;+ const usedPercent =+ creditsLimit === 0+ ? 0+ : Math.min(100, Math.round((creditsUsed / creditsLimit) * 100));++ return (+ <AdminOverview+ title={t('Billing & usage')}+ description={t('Your plan, credits and how projects consume them.')}+ >+ <OverviewCards>+ <OverviewCard+ to="/platform/setup/billing?tab=plan"+ title={t('Plan')}+ value={subscription?.autumnPlanName ?? subscription?.plan.plan ?? '—'}+ isLoading={isLoading}+ isError={isError}+ errorEntity={t('billing')}+ description={t('{credits} credits included', {+ credits: creditsLimit.toLocaleString(),+ })}+ />+ <OverviewCard+ to="/platform/setup/billing?tab=usage"+ title={t('Usage')}+ value={`${usedPercent}%`}+ isLoading={isLoading}+ isError={isError}+ errorEntity={t('billing')}+ description={t('{used} of {total} credits used this period', {+ used: creditsUsed.toLocaleString(),+ total: creditsLimit.toLocaleString(),+ })}+ />+ </OverviewCards>+ </AdminOverview>+ );+}diff --git a/packages/web/src/app/routes/platform/overview/connections-overview.tsx b/packages/web/src/app/routes/platform/overview/connections-overview.tsxnew file mode 100644index 00000000000..38be7e5f05e--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/connections-overview.tsx@@ -0,0 +1,165 @@+import { AppConnectionScope, AppConnectionStatus } from '@activepieces/shared';+import { useQuery } from '@tanstack/react-query';+import { t } from 'i18next';++import { globalConnectionsQueries } from '@/features/connections';+import { platformAppConnectionsApi } from '@/features/platform-admin/api/platform-app-connections-api';+import { projectCollectionUtils } from '@/features/projects';+import { platformHooks } from '@/hooks/platform-hooks';++import {+ AdminOverview,+ OverviewCard,+ OverviewCards,+ OverviewEmpty,+ OverviewRow,+ OverviewRows,+ OverviewSection,+} from './overview-shell';++export function ConnectionsOverview() {+ const { platform } = platformHooks.useCurrentPlatform();+ const {+ data: connections,+ isLoading,+ isError,+ refetch,+ } = useQuery({+ queryKey: ['platform-app-connections', 'overview'],+ queryFn: () =>+ platformAppConnectionsApi.list({+ limit: 1000,+ scope: AppConnectionScope.PROJECT,+ }),+ });+ const {+ data: globalConnections,+ isLoading: isLoadingGlobal,+ isError: isGlobalError,+ refetch: refetchGlobal,+ } = globalConnectionsQueries.useGlobalConnections({+ request: { limit: 1000 },+ extraKeys: ['overview'],+ });+ const { data: projects } = projectCollectionUtils.useAllPlatformProjects();++ const rows = connections?.data ?? [];+ const globalRows = platform.plan.globalConnectionsEnabled+ ? globalConnections?.data ?? []+ : [];+ const unhealthy = [...rows, ...globalRows].filter(+ (connection) => connection.status === AppConnectionStatus.ERROR,+ );+ const hasGlobalError =+ platform.plan.globalConnectionsEnabled && isGlobalError;+ const isLoadingHealth =+ isLoading || (platform.plan.globalConnectionsEnabled && isLoadingGlobal);+ const healthError =+ isError || hasGlobalError+ ? {+ entity: t('connections'),+ onRetry: () =>+ Promise.all([+ ...(isError ? [refetch()] : []),+ ...(hasGlobalError ? [refetchGlobal()] : []),+ ]),+ }+ : undefined;+ const usageError = isError+ ? { entity: t('connections'), onRetry: refetch }+ : undefined;+ const byPiece = rows.reduce<Record<string, number>>(+ (counts, connection) => ({+ ...counts,+ [connection.pieceName]: (counts[connection.pieceName] ?? 0) + 1,+ }),+ {},+ );+ const topPieces: [string, number][] = Object.entries(byPiece)+ .sort((left, right) => right[1] - left[1])+ .slice(0, 5);++ return (+ <AdminOverview+ title={t('Connections')}+ description={t(+ 'Every app credential in use across the platform, whether owned by a project or shared globally.',+ )}+ >+ <OverviewCards>+ <OverviewCard+ to="/platform/connections?tab=project"+ title={t('Project connections')}+ value={rows.length}+ isLoading={isLoading}+ isError={isError}+ errorEntity={t('connections')}+ description={t(+ 'Across {count, plural, =1 {# project} other {# projects}}',+ { count: projects?.length ?? 0 },+ )}+ />+ <OverviewCard+ to="/platform/connections?tab=global"+ title={t('Global connections')}+ tier="team"+ value={+ platform.plan.globalConnectionsEnabled+ ? globalConnections?.data.length ?? 0+ : t('Locked')+ }+ isLoading={isLoadingGlobal}+ isError={hasGlobalError}+ errorEntity={t('connections')}+ description={t('Shared credentials available to multiple projects')}+ />+ </OverviewCards>++ <OverviewSection+ title={t('Needs attention')}+ description={t(+ 'Connections across every project that are expired, revoked or failing.',+ )}+ isLoading={isLoadingHealth}+ error={healthError}+ >+ {unhealthy.length === 0 ? (+ <OverviewEmpty>{t('All connections are healthy')}</OverviewEmpty>+ ) : (+ <OverviewRows>+ {unhealthy.map((connection) => (+ <OverviewRow+ key={connection.id}+ tone="error"+ label={connection.displayName}+ >+ {connection.pieceName}+ </OverviewRow>+ ))}+ </OverviewRows>+ )}+ </OverviewSection>++ <OverviewSection+ title={t('Most used pieces')}+ description={t('Which apps your projects connect to most.')}+ isLoading={isLoading}+ error={usageError}+ >+ {topPieces.length === 0 ? (+ <OverviewEmpty>{t('No connections yet')}</OverviewEmpty>+ ) : (+ <OverviewRows>+ {topPieces.map(([pieceName, count]) => (+ <OverviewRow key={pieceName} tone="ok" label={pieceName}>+ {t('{count, plural, =1 {# connection} other {# connections}}', {+ count,+ })}+ </OverviewRow>+ ))}+ </OverviewRows>+ )}+ </OverviewSection>+ </AdminOverview>+ );+}diff --git a/packages/web/src/app/routes/platform/overview/infrastructure-overview.tsx b/packages/web/src/app/routes/platform/overview/infrastructure-overview.tsxnew file mode 100644index 00000000000..6a8354ac3c9--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/infrastructure-overview.tsx@@ -0,0 +1,198 @@+import { isNil } from '@activepieces/core-utils';+import { ApEdition, ApFlagId } from '@activepieces/shared';+import { t } from 'i18next';+import semver from 'semver';++import { healthQueries, workersQueries } from '@/features/platform-admin';+import { flagsHooks } from '@/hooks/flags-hooks';+import { platformHooks } from '@/hooks/platform-hooks';++import { ADMIN_PAGES, adminPagesUtils } from '../admin-pages';++import {+ AdminOverview,+ OverviewCard,+ OverviewCards,+ OverviewRow,+ OverviewRows,+ OverviewSection,+} from './overview-shell';++export function InfrastructureOverview() {+ const { platform } = platformHooks.useCurrentPlatform();+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);+ const {+ data: health,+ isLoading: isLoadingHealth,+ isError: isHealthError,+ refetch: refetchHealth,+ } = healthQueries.useSystemHealth();+ const {+ data: workers,+ isLoading: isLoadingWorkers,+ isError: isWorkersError,+ refetch: refetchWorkers,+ } = workersQueries.useWorkerMachines();+ const infrastructurePage = ADMIN_PAGES.find(+ (page) => page.id === 'infrastructure',+ );+ const showConfigurations =+ infrastructurePage !== undefined &&+ adminPagesUtils+ .visibleTabs({+ page: infrastructurePage,+ context: { plan: platform.plan, edition },+ })+ .some((tab) => tab.id === 'configurations');+ const statusError =+ isHealthError || isWorkersError+ ? {+ entity: t('infrastructure status'),+ onRetry: () => Promise.all([refetchHealth(), refetchWorkers()]),+ }+ : undefined;++ const currentVersion = health?.release?.current;+ const latestVersion = health?.latestVersion;+ const isUpToDate =+ currentVersion !== undefined &&+ latestVersion !== undefined &&+ semver.gte(currentVersion, latestVersion);+ const appChecksPassed =+ health?.disk === true && health?.appRam === true && health?.appCpu === true;+ const workerCount = workers?.length ?? 0;+ const mismatched = health?.release?.workers.versionMismatched ?? 0;++ const workerChecksReported =+ !isNil(health?.workerRam) && !isNil(health?.workerCpu);+ const workerChecksPassed =+ health?.workerRam === true && health?.workerCpu === true;+ const needsAttention =+ !isUpToDate ||+ !appChecksPassed ||+ mismatched > 0 ||+ (workerChecksReported && !workerChecksPassed);++ return (+ <AdminOverview+ title={t('Infrastructure')}+ description={t(+ 'Health of the app, workers, queues and triggers running your automations.',+ )}+ >+ <OverviewCards>+ <OverviewCard+ to="/platform/infrastructure?tab=health"+ title={t('Health')}+ value={needsAttention ? t('Attention') : t('Healthy')}+ isLoading={isLoadingHealth}+ isError={isHealthError}+ errorEntity={t('health checks')}+ description={+ health === undefined+ ? ''+ : !needsAttention+ ? t('All checks passed')+ : !isUpToDate+ ? t('Version behind latest; see release notes')+ : t('Some checks are failing')+ }+ />+ <OverviewCard+ to="/platform/infrastructure?tab=workers"+ title={t('Workers')}+ value={workerCount}+ isLoading={isLoadingWorkers}+ isError={isWorkersError}+ errorEntity={t('workers')}+ description={+ workerCount === 0+ ? t('No workers connected')+ : t(+ '{count, plural, =1 {# machine} other {# machines}} connected',+ {+ count: workerCount,+ },+ )+ }+ />+ <OverviewCard+ to="/platform/infrastructure?tab=triggers"+ title={t('Triggers')}+ value="—"+ description={t('Trigger health across the last 14 days')}+ />+ {showConfigurations && (+ <OverviewCard+ to="/platform/infrastructure?tab=configurations"+ title={t('Configurations')}+ value={t('Runtime')}+ description={t('Runtime settings for this instance')}+ />+ )}+ </OverviewCards>++ <OverviewSection+ title={t('Status')}+ isLoading={isLoadingHealth || isLoadingWorkers}+ error={statusError}+ >+ <OverviewRows>+ <OverviewRow+ tone={isUpToDate ? 'ok' : 'error'}+ label={+ currentVersion === undefined+ ? t('Version unknown')+ : t('Version {current} · latest is {latest}', {+ current: currentVersion,+ latest: latestVersion ?? t('unknown'),+ })+ }+ >+ <a+ href="https://github.com/activepieces/activepieces/releases"+ target="_blank"+ rel="noopener noreferrer"+ className="text-sm font-medium text-primary hover:underline"+ >+ {t('Release notes')}+ </a>+ </OverviewRow>+ <OverviewRow+ tone={appChecksPassed ? 'ok' : 'warn'}+ label={+ appChecksPassed+ ? t('App: disk, RAM and CPU checks passed')+ : t('App: one or more hardware checks failed')+ }+ />+ <OverviewRow+ tone={workerCount === 0 ? 'off' : mismatched > 0 ? 'warn' : 'ok'}+ label={+ workerCount === 0+ ? t('No workers connected')+ : mismatched > 0+ ? t(+ '{count, plural, =1 {# worker is} other {# workers are}} on an incompatible version',+ { count: mismatched },+ )+ : t('All connected workers match the app release')+ }+ />+ <OverviewRow+ tone={+ !workerChecksReported ? 'off' : workerChecksPassed ? 'ok' : 'warn'+ }+ label={+ !workerChecksReported+ ? t('Worker hardware checks unavailable')+ : workerChecksPassed+ ? t('Workers: RAM and CPU checks passed')+ : t('Workers: one or more hardware checks failed')+ }+ />+ </OverviewRows>+ </OverviewSection>+ </AdminOverview>+ );+}diff --git a/packages/web/src/app/routes/platform/overview/overview-shell.tsx b/packages/web/src/app/routes/platform/overview/overview-shell.tsxnew file mode 100644index 00000000000..83c7bce13f6--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/overview-shell.tsx@@ -0,0 +1,207 @@+import { t } from 'i18next';+import { ChevronRight } from 'lucide-react';+import { ReactNode } from 'react';+import { Link } from 'react-router-dom';++import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';+import { Badge } from '@/components/ui/badge';+import { Skeleton } from '@/components/ui/skeleton';+import { FeatureTier, TIER_LABELS } from '@/features/billing';+import { cn } from '@/lib/utils';++export function AdminOverview({+ title,+ description,+ action,+ children,+}: AdminOverviewProps) {+ return (+ <div className="mx-auto flex w-full max-w-5xl flex-col gap-8 px-6 py-8">+ <div className="flex items-start justify-between gap-6 border-b pb-5">+ <div className="flex flex-col gap-1">+ <h1 className="text-xl font-medium">{title}</h1>+ {description !== undefined && (+ <p className="text-sm text-muted-foreground">{description}</p>+ )}+ </div>+ {action}+ </div>+ {children}+ </div>+ );+}++export function OverviewCards({ children }: { children: ReactNode }) {+ return (+ <div className="grid grid-cols-[repeat(auto-fit,minmax(15rem,1fr))] gap-3 [&>*:only-child]:max-w-60">+ {children}+ </div>+ );+}++export function OverviewCard({+ to,+ title,+ tier,+ value,+ description,+ isLoading = false,+ isError = false,+ errorEntity,+}: OverviewCardProps) {+ return (+ <Link+ to={to}+ className="group flex flex-col gap-2.5 rounded-lg border bg-background p-4 transition-colors hover:border-ring/40 hover:bg-muted/40"+ >+ <div className="flex items-center gap-2">+ <span className="flex-1 truncate font-medium">{title}</span>+ {tier !== undefined && (+ <Badge variant="outline">{TIER_LABELS[tier]}</Badge>+ )}+ <ChevronRight className="size-3.5 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5" />+ </div>+ {isLoading ? (+ <Skeleton className="h-7 w-16" />+ ) : (+ <div className="text-2xl font-semibold leading-none tracking-tight">+ {isError ? '—' : value}+ </div>+ )}+ <div className="text-sm text-muted-foreground">+ {isLoading ? (+ <Skeleton className="h-4 w-32" />+ ) : isError ? (+ t('Trouble loading {entity}', { entity: errorEntity ?? title })+ ) : (+ description+ )}+ </div>+ </Link>+ );+}++export function OverviewSection({+ title,+ description,+ isLoading = false,+ error,+ children,+}: OverviewSectionProps) {+ return (+ <section className="flex flex-col gap-3">+ <div className="flex flex-col gap-1">+ <h2 className="text-base font-semibold">{title}</h2>+ {description !== undefined && (+ <p className="text-sm text-muted-foreground">{description}</p>+ )}+ </div>+ {error !== undefined ? (+ <div className="rounded-lg border">+ <DataFetchErrorState+ entity={error.entity}+ onRetry={error.onRetry}+ className="py-8"+ />+ </div>+ ) : isLoading ? (+ <Skeleton className="h-24 w-full rounded-lg" />+ ) : (+ children+ )}+ </section>+ );+}++export function OverviewEmpty({ children }: { children: ReactNode }) {+ return (+ <div className="rounded-lg border border-dashed p-7 text-center text-sm text-muted-foreground">+ {children}+ </div>+ );+}++export function OverviewRows({ children }: { children: ReactNode }) {+ return (+ <div className="divide-y overflow-hidden rounded-lg border">{children}</div>+ );+}++export function OverviewRow({ tone, label, children }: OverviewRowProps) {+ return (+ <div className="flex items-center gap-3 px-4 py-3">+ <span+ className={cn('size-2 shrink-0 rounded-full', TONE_CLASS[tone])}+ aria-hidden+ />+ <span className="flex-1 text-sm">{label}</span>+ {children !== undefined && (+ <span className="shrink-0 text-sm text-muted-foreground">+ {children}+ </span>+ )}+ </div>+ );+}++export function OverviewRowLink({ to, children }: OverviewRowLinkProps) {+ return (+ <Link+ to={to}+ className="shrink-0 text-sm font-medium text-primary hover:underline"+ >+ {children ?? t('Review')}+ </Link>+ );+}++const TONE_CLASS: Record<OverviewRowTone, string> = {+ ok: 'bg-emerald-500',+ warn: 'bg-amber-500',+ error: 'bg-destructive',+ off: 'bg-muted-foreground/35',+};++export type OverviewRowTone = 'ok' | 'warn' | 'error' | 'off';++export type AdminOverviewProps = {+ title: string;+ description?: string;+ action?: ReactNode;+ children: ReactNode;+};++export type OverviewCardProps = {+ to: string;+ title: string;+ tier?: FeatureTier;+ value: ReactNode;+ description: ReactNode;+ isLoading?: boolean;+ isError?: boolean;+ errorEntity?: string;+};++export type OverviewSectionError = {+ entity: string;+ onRetry?: () => unknown;+};++export type OverviewSectionProps = {+ title: string;+ description?: string;+ isLoading?: boolean;+ error?: OverviewSectionError;+ children: ReactNode;+};++export type OverviewRowProps = {+ tone: OverviewRowTone;+ label: ReactNode;+ children?: ReactNode;+};++export type OverviewRowLinkProps = {+ to: string;+ children?: ReactNode;+};diff --git a/packages/web/src/app/routes/platform/overview/security-overview.tsx b/packages/web/src/app/routes/platform/overview/security-overview.tsxnew file mode 100644index 00000000000..8213ebfb2a8--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/security-overview.tsx@@ -0,0 +1,158 @@+import { t } from 'i18next';++import { apiKeyQueries } from '@/features/platform-admin';+import { secretManagersHooks } from '@/features/secret-managers';+import { platformHooks } from '@/hooks/platform-hooks';++import {+ AdminOverview,+ OverviewCard,+ OverviewCards,+ OverviewRow,+ OverviewRowLink,+ OverviewRows,+ OverviewSection,+} from './overview-shell';++export function SecurityOverview() {+ const { platform } = platformHooks.useCurrentPlatform();+ const {+ data: apiKeys,+ isLoading: isLoadingKeys,+ isError: isKeysError,+ } = apiKeyQueries.useApiKeys();+ const {+ data: secretManagers,+ isLoading: isLoadingSecrets,+ isError: isSecretsError,+ } = secretManagersHooks.useListSecretManagerConnections({+ listForPlatform: true,+ });++ const keysKnown =+ platform.plan.apiKeysEnabled && !isLoadingKeys && !isKeysError;+ const keyCount = apiKeys?.data.length ?? 0;+ const secretCount = secretManagers?.length ?? 0;+ const domains = platform.allowedAuthDomains ?? [];+ const bothLoginsOn = platform.googleAuthEnabled && platform.emailAuthEnabled;++ return (+ <AdminOverview+ title={t('Security')}+ description={t(+ 'Credentials, secrets, and the record of what happens on the platform.',+ )}+ >+ <OverviewCards>+ <OverviewCard+ to="/platform/security?tab=api-keys"+ title={t('API keys')}+ tier="team"+ value={platform.plan.apiKeysEnabled ? keyCount : t('Locked')}+ isLoading={isLoadingKeys}+ isError={isKeysError}+ errorEntity={t('API keys')}+ description={+ keyCount === 0 ? t('No keys issued') : t('Active platform keys')+ }+ />+ <OverviewCard+ to="/platform/security?tab=secrets"+ title={t('Secret managers')}+ tier="enterprise"+ value={+ platform.plan.secretManagersEnabled ? secretCount : t('Locked')+ }+ isLoading={isLoadingSecrets}+ isError={isSecretsError}+ errorEntity={t('secret managers')}+ description={+ secretCount === 0+ ? t('No external vault connected')+ : t('External vaults connected')+ }+ />+ <OverviewCard+ to="/platform/security?tab=audit"+ title={t('Audit logs')}+ tier="enterprise"+ value={platform.plan.auditLogEnabled ? t('On') : t('Locked')}+ description={t('Every user and system action, recorded')}+ />+ <OverviewCard+ to="/platform/security?tab=events"+ title={t('Event streaming')}+ tier="enterprise"+ value={platform.plan.eventStreamingEnabled ? t('On') : t('Locked')}+ description={t('Forward audit events to your own webhook')}+ />+ </OverviewCards>++ <OverviewSection+ title={t('Security checklist')}+ description={t('Recommendations based on your current configuration.')}+ >+ <OverviewRows>+ <OverviewRow+ tone={bothLoginsOn ? 'warn' : 'ok'}+ label={+ bothLoginsOn+ ? t('Email and password login is enabled alongside Google')+ : t('One sign-in method is enabled')+ }+ >+ <OverviewRowLink to="/platform/users?tab=sso">+ {t('Review sign-in')}+ </OverviewRowLink>+ </OverviewRow>+ <OverviewRow+ tone={domains.length > 0 ? 'ok' : 'warn'}+ label={+ domains.length > 0+ ? t(+ 'Sign-up restricted to {count, plural, =1 {# domain} other {# domains}}',+ {+ count: domains.length,+ },+ )+ : t('No allowed email domains set')+ }+ >+ <OverviewRowLink to="/platform/users?tab=sso">+ {t('Restrict domains')}+ </OverviewRowLink>+ </OverviewRow>+ <OverviewRow+ tone={!keysKnown ? 'off' : keyCount === 0 ? 'ok' : 'warn'}+ label={+ !keysKnown+ ? t('API keys')+ : keyCount === 0+ ? t('No API keys issued')+ : t(+ '{count, plural, =1 {# API key is} other {# API keys are}} active',+ { count: keyCount },+ )+ }+ >+ {keysKnown && keyCount === 0 ? t('Nothing to rotate') : undefined}+ </OverviewRow>+ <OverviewRow+ tone={platform.plan.auditLogEnabled ? 'ok' : 'off'}+ label={+ platform.plan.auditLogEnabled+ ? t('Audit logging is recording')+ : t('Audit logging is not available on your plan')+ }+ >+ {platform.plan.auditLogEnabled ? undefined : (+ <OverviewRowLink to="/platform/security?tab=audit">+ {t('Upgrade')}+ </OverviewRowLink>+ )}+ </OverviewRow>+ </OverviewRows>+ </OverviewSection>+ </AdminOverview>+ );+}diff --git a/packages/web/src/app/routes/platform/overview/users-overview.tsx b/packages/web/src/app/routes/platform/overview/users-overview.tsxnew file mode 100644index 00000000000..174fd9fa99f--- /dev/null+++ b/packages/web/src/app/routes/platform/overview/users-overview.tsx@@ -0,0 +1,170 @@+import { isNil, RoleType } from '@activepieces/core-utils';+import { PlatformRole, UserStatus } from '@activepieces/shared';+import { t } from 'i18next';++import {+ platformUserHooks,+ projectRoleQueries,+} from '@/features/platform-admin';+import { platformHooks } from '@/hooks/platform-hooks';++import {+ AdminOverview,+ OverviewCard,+ OverviewCards,+ OverviewEmpty,+ OverviewRow,+ OverviewRows,+ OverviewSection,+} from './overview-shell';++export function UsersOverview() {+ const { platform } = platformHooks.useCurrentPlatform();+ const {+ data: users,+ isLoading: isLoadingUsers,+ isError: isUsersError,+ } = platformUserHooks.useUsers();+ const {+ data: invitations,+ isLoading: isLoadingInvitations,+ isError: isInvitationsError,+ refetch: refetchInvitations,+ } = platformUserHooks.usePlatformInvitations();+ const {+ data: roles,+ isLoading: isLoadingRoles,+ isError: isRolesError,+ } = projectRoleQueries.useProjectRoles(platform.plan.projectRolesEnabled);+ const invitationsError = isInvitationsError+ ? { entity: t('invitations'), onRetry: refetchInvitations }+ : undefined;++ const allUsers = users?.data ?? [];+ const admins = allUsers.filter(+ (user) => user.platformRole === PlatformRole.ADMIN,+ ).length;+ const deactivated = allUsers.filter(+ (user) => user.status === UserStatus.INACTIVE,+ ).length;+ const members = allUsers.length - admins;++ const googleEnabled = platform.googleAuthEnabled;+ const samlEnabled = !isNil(platform.federatedAuthProviders?.saml);+ const domains = platform.allowedAuthDomains ?? [];+ const signInMethods = [+ googleEnabled,+ platform.emailAuthEnabled,+ samlEnabled,+ ].filter(Boolean).length;++ const customRoles = (roles?.data ?? []).filter(+ (role) => role.type === RoleType.CUSTOM,+ ).length;+ const pending = invitations ?? [];++ return (+ <AdminOverview+ title={t('Users & access')}+ description={t(+ 'Who can sign in, how they sign in, and what they can do inside projects.',+ )}+ >+ <OverviewCards>+ <OverviewCard+ to="/platform/users?tab=members"+ title={t('Members')}+ value={allUsers.length}+ isLoading={isLoadingUsers}+ isError={isUsersError}+ errorEntity={t('members')}+ description={t(+ '{admins, plural, =1 {# admin} other {# admins}} · {members, plural, =1 {# member} other {# members}} · {deactivated} deactivated',+ { admins, members, deactivated },+ )}+ />+ <OverviewCard+ to="/platform/users?tab=sso"+ title={t('Single sign on')}+ tier="team"+ value={t('{count} of 3', { count: signInMethods })}+ description={+ samlEnabled ? t('SAML connected.') : t('SAML not connected yet.')+ }+ />+ <OverviewCard+ to="/platform/users?tab=roles"+ title={t('Project roles')}+ tier="team"+ value={platform.plan.projectRolesEnabled ? customRoles : t('Locked')}+ isLoading={isLoadingRoles}+ isError={platform.plan.projectRolesEnabled && isRolesError}+ errorEntity={t('project roles')}+ description={+ customRoles === 0+ ? t('No custom roles. Built-in roles in use.')+ : t('Custom roles on top of the built-in ones.')+ }+ />+ </OverviewCards>++ <OverviewSection+ title={t('Sign-in policy')}+ description={t(+ 'How people get into this platform. Individual providers are configured under Single sign on.',+ )}+ >+ <OverviewRows>+ <OverviewRow+ tone={googleEnabled ? 'ok' : 'off'}+ label={t('Google sign-in')}+ >+ {googleEnabled ? t('Enabled') : t('Off')}+ </OverviewRow>+ <OverviewRow+ tone={platform.emailAuthEnabled ? 'ok' : 'off'}+ label={t('Email and password')}+ >+ {platform.emailAuthEnabled ? t('Enabled') : t('Off')}+ </OverviewRow>+ <OverviewRow tone={samlEnabled ? 'ok' : 'off'} label={t('SAML 2.0')}>+ {samlEnabled ? t('Enabled') : t('Off')}+ </OverviewRow>+ <OverviewRow+ tone={domains.length > 0 ? 'ok' : 'off'}+ label={t('Allowed email domains')}+ >+ {domains.length > 0+ ? t('{count, plural, =1 {# domain} other {# domains}}', {+ count: domains.length,+ })+ : t('Any domain')}+ </OverviewRow>+ </OverviewRows>+ </OverviewSection>++ <OverviewSection+ title={t('Pending invitations')}+ description={t(+ 'Invites sent from any project that have not been accepted yet.',+ )}+ isLoading={isLoadingInvitations}+ error={invitationsError}+ >+ {pending.length === 0 ? (+ <OverviewEmpty>{t('No pending invitations')}</OverviewEmpty>+ ) : (+ <OverviewRows>+ {pending.map((invitation) => (+ <OverviewRow+ key={invitation.id}+ tone="warn"+ label={invitation.email}+ />+ ))}+ </OverviewRows>+ )}+ </OverviewSection>+ </AdminOverview>+ );+}diff --git a/packages/web/src/app/routes/platform/projects/index.tsx b/packages/web/src/app/routes/platform/projects/index.tsxindex aef8d948055..f5df2b753c3 100644--- a/packages/web/src/app/routes/platform/projects/index.tsx+++ b/packages/web/src/app/routes/platform/projects/index.tsx@@ -9,7 +9,6 @@ import { toast } from 'sonner';import { platformApi } from '@/api/platforms-api';import { DashboardPageHeader } from '@/app/components/dashboard-page-header';-import { LockedFeatureGuard } from '@/app/components/locked-feature-guard';import {DataTable,RowDataWithActions,@@ -50,7 +49,6 @@ export default function ProjectsPage() {const queryClient = useQueryClient();const navigate = useNavigate();const [searchParams, setSearchParams] = useSearchParams();- const isEnabled = platform.plan.billedTeamProjectsLimit !== 0;const { project: currentProject } =projectCollectionUtils.useCurrentProject();@@ -362,98 +360,88 @@ export default function ProjectsPage() {];return (- <LockedFeatureGuard- featureKey="PROJECTS"- locked={!isEnabled}- lockTitle={t('Unlock Projects')}- lockDescription={t(- 'Orchestrate your automation teams across projects with their own flows, connections and usage quotas',- )}- lockVideoUrl="https://cdn.activepieces.com/videos/showcase/projects.mp4"- >- <div className="flex flex-col w-full">- <DashboardPageHeader- title={t('Projects')}- description={t('Manage your automation projects')}- />- <div className="px-6 pt-4">- <Item variant="outline">- <ItemMedia variant="icon">- <UserCircle />- </ItemMedia>- <ItemContent>- <ItemTitle>{t('Automatic personal project creation')}</ItemTitle>- <ItemDescription>- {t(- 'Create a personal project for every new user on signup. Turn off if you provision users into team projects manually (e.g. via SSO or SCIM).',- )}- </ItemDescription>- </ItemContent>- <ItemActions>- <Switch- checked={platform.autoCreatePersonalProjects}- onCheckedChange={(checked) =>- toggleAutoCreatePersonalProjects(checked)- }- disabled={isAutoCreatePersonalProjectsPending}- />- </ItemActions>- </Item>- </div>- <DataTable- emptyStateTextTitle={t('No projects found')}- emptyStateTextDescription={t(- 'Start by creating projects to manage your automation teams',- )}- emptyStateIcon={<Package className="size-14" />}- onRowClick={async (project) => {- await projectCollectionUtils.setCurrentProject(project.id);- navigate('/');- }}- filters={[- {- type: 'input',- title: t('Name'),- accessorKey: 'displayName',- icon: CheckIcon,- },- {- type: 'select',- title: t('Type'),- accessorKey: 'type',- options: Object.values(ProjectType).map((type) => {- return {- label:- formatUtils.convertEnumToHumanReadable(type) + ' Project',- value: type,- };- }),- icon: CheckIcon,- },- ]}- columns={columnsWithCheckbox}- page={{- data: allProjectsWithGlobalConnectionsCount,- next: null,- previous: null,- }}- isLoading={false}- isError={false}- errorStateEntity={t('projects')}- clientPagination={true}- bulkActions={bulkActions}- toolbarButtons={toolbarButtons}- actions={actions}- />- <EditProjectDialog- open={editDialogOpen}- onClose={() => {- setEditDialogOpen(false);- }}- initialValues={editDialogInitialValues}- projectId={editDialogProjectId}- />+ <div className="flex flex-col w-full">+ <DashboardPageHeader+ title={t('Projects')}+ description={t('Manage your automation projects')}+ />+ <div className="px-6 pt-4">+ <Item variant="outline">+ <ItemMedia variant="icon">+ <UserCircle />+ </ItemMedia>+ <ItemContent>+ <ItemTitle>{t('Automatic personal project creation')}</ItemTitle>+ <ItemDescription>+ {t(+ 'Create a personal project for every new user on signup. Turn off if you provision users into team projects manually (e.g. via SSO or SCIM).',+ )}+ </ItemDescription>+ </ItemContent>+ <ItemActions>+ <Switch+ checked={platform.autoCreatePersonalProjects}+ onCheckedChange={(checked) =>+ toggleAutoCreatePersonalProjects(checked)+ }+ disabled={isAutoCreatePersonalProjectsPending}+ />+ </ItemActions>+ </Item></div>- </LockedFeatureGuard>+ <DataTable+ emptyStateTextTitle={t('No projects found')}+ emptyStateTextDescription={t(+ 'Start by creating projects to manage your automation teams',+ )}+ emptyStateIcon={<Package className="size-14" />}+ onRowClick={async (project) => {+ await projectCollectionUtils.setCurrentProject(project.id);+ navigate('/');+ }}+ filters={[+ {+ type: 'input',+ title: t('Name'),+ accessorKey: 'displayName',+ icon: CheckIcon,+ },+ {+ type: 'select',+ title: t('Type'),+ accessorKey: 'type',+ options: Object.values(ProjectType).map((type) => {+ return {+ label:+ formatUtils.convertEnumToHumanReadable(type) + ' Project',+ value: type,+ };+ }),+ icon: CheckIcon,+ },+ ]}+ columns={columnsWithCheckbox}+ page={{+ data: allProjectsWithGlobalConnectionsCount,+ next: null,+ previous: null,+ }}+ isLoading={false}+ isError={false}+ errorStateEntity={t('projects')}+ clientPagination={true}+ bulkActions={bulkActions}+ toolbarButtons={toolbarButtons}+ actions={actions}+ />+ <EditProjectDialog+ open={editDialogOpen}+ onClose={() => {+ setEditDialogOpen(false);+ }}+ initialValues={editDialogInitialValues}+ projectId={editDialogProjectId}+ />+ </div>);}diff --git a/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx b/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsxindex fe4feccc3f6..4dd2d380817 100644--- a/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx+++ b/packages/web/src/app/routes/platform/setup/ai/capabilities-tab/index.tsx@@ -48,7 +48,7 @@ export function CapabilitiesTab() {});return (- <div className="flex flex-col gap-4">+ <div className="flex w-full mx-auto max-w-6xl flex-col gap-4 px-6 py-6"><SectionHeadertitle={t('Assistant capabilities')}count={AI_TOOL_CATALOG.length}diff --git a/packages/web/src/app/routes/platform/setup/ai/index.tsx b/packages/web/src/app/routes/platform/setup/ai/index.tsxdeleted file mode 100644index 02145a08ad4..00000000000--- a/packages/web/src/app/routes/platform/setup/ai/index.tsx+++ /dev/null@@ -1,128 +0,0 @@-import { ApEdition, ApFlagId, PlatformRole } from '@activepieces/shared';-import { t } from 'i18next';-import { Bot, WandSparkles } from 'lucide-react';-import { useSearchParams } from 'react-router-dom';--import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';-import { flagsHooks } from '@/hooks/flags-hooks';-import { userHooks } from '@/hooks/user-hooks';-import { cn } from '@/lib/utils';--import { LockedFeatureGuard } from '../../../../components/locked-feature-guard';--import { CapabilitiesTab } from './capabilities-tab';-import { ProvidersTab } from './providers-tab';--export default function AIProvidersPage() {- const { data: currentUser } = userHooks.useCurrentUser();-- return (- <LockedFeatureGuard- featureKey="UNIVERSAL_AI"- locked={currentUser?.platformRole !== PlatformRole.ADMIN}- lockTitle={t('Unlock AI')}- lockDescription={t(- 'Set your AI providers so your users enjoy a seamless building experience with our universal AI pieces',- )}- >- <AICenter />- </LockedFeatureGuard>- );-}--function AICenter() {- const [searchParams, setSearchParams] = useSearchParams();- const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);- const capabilitiesEnabled = edition !== ApEdition.COMMUNITY;-- const rawTab = searchParams.get('tab');- const requestedTab = isTabValue(rawTab) ? rawTab : 'providers';- const activeTab =- requestedTab === 'capabilities' && !capabilitiesEnabled- ? 'providers'- : requestedTab;-- const setTab = (tab: TabValue) => {- const newParams = new URLSearchParams(searchParams);- if (tab === 'providers') {- newParams.delete('tab');- } else {- newParams.set('tab', tab);- }- setSearchParams(newParams, { replace: true });- };-- const navItems: { value: TabValue; label: string; icon: typeof Bot }[] = [- { value: 'providers', label: t('Providers'), icon: Bot },- ...(capabilitiesEnabled- ? [- {- value: 'capabilities' as const,- label: t('Capabilities'),- icon: WandSparkles,- },- ]- : []),- ];-- return (- <Tabs- value={activeTab}- orientation="vertical"- onValueChange={(value) => {- const next = TAB_VALUES.find((candidate) => candidate === value);- if (next) {- setTab(next);- }- }}- className="flex w-full flex-1 min-h-0"- >- <aside className="flex w-60 shrink-0 flex-col min-h-0 border-r">- <div className="flex flex-col gap-1 px-4 pt-6 pb-4">- <h1 className="text-lg font-semibold tracking-tight">- {t('AI Center')}- </h1>- <p className="text-xs text-muted-foreground">- {t('Providers and capabilities for your platform.')}- </p>- </div>- <TabsList className="flex-col items-stretch h-auto gap-1 bg-transparent p-2">- {navItems.map((item) => (- <TabsTrigger- key={item.value}- value={item.value}- className={cn(- 'w-full justify-start gap-2 rounded-md px-3 py-2 text-sm text-muted-foreground',- 'hover:bg-sidebar-accent/60 hover:text-foreground',- 'data-[state=active]:bg-sidebar-accent data-[state=active]:font-medium data-[state=active]:text-foreground',- )}- >- <item.icon className="size-4 shrink-0" />- {item.label}- </TabsTrigger>- ))}- </TabsList>- </aside>- <div className="flex-1 min-w-0 overflow-auto">- <div className="flex min-h-full w-full max-w-6xl flex-col px-8 py-6">- <TabsContent value="providers" className="mt-0 flex flex-1 flex-col">- <ProvidersTab />- </TabsContent>- {capabilitiesEnabled && (- <TabsContent value="capabilities" className="mt-0">- <CapabilitiesTab />- </TabsContent>- )}- </div>- </div>- </Tabs>- );-}--function isTabValue(value: string | null): value is TabValue {- return TAB_VALUES.some((tab) => tab === value);-}--const TAB_VALUES = ['providers', 'capabilities'] as const;--type TabValue = (typeof TAB_VALUES)[number];diff --git a/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx b/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsxindex 769c6ecf41a..89c7e8f0adf 100644--- a/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx+++ b/packages/web/src/app/routes/platform/setup/ai/providers-tab/index.tsx@@ -167,23 +167,25 @@ export function ProvidersTab() {if (activeConfig && activeInfo && allowWrite) {return (<>- <ConfigDetail- key={`${activeConfig.id}:${credentialsVersion}`}- config={activeConfig}- info={activeInfo}- projects={projects}- isSaving={isSaving}- onSave={(request) =>- tryCatch(() =>- updateProvider({ providerId: activeConfig.id, request }),- )- }- onDelete={() => deleteProvider(activeConfig.id)}- onReplaceCredentials={() => openReplaceCredentials(activeConfig)}- isRechecking={isRechecking}- onRecheck={() => recheckProvider(activeConfig.id)}- onBack={closeConfig}- />+ <div className="flex min-h-full w-full max-w-6xl flex-col px-8 py-6">+ <ConfigDetail+ key={`${activeConfig.id}:${credentialsVersion}`}+ config={activeConfig}+ info={activeInfo}+ projects={projects}+ isSaving={isSaving}+ onSave={(request) =>+ tryCatch(() =>+ updateProvider({ providerId: activeConfig.id, request }),+ )+ }+ onDelete={() => deleteProvider(activeConfig.id)}+ onReplaceCredentials={() => openReplaceCredentials(activeConfig)}+ isRechecking={isRechecking}+ onRecheck={() => recheckProvider(activeConfig.id)}+ onBack={closeConfig}+ />+ </div><ConnectProviderDialogopen={dialogOpen}onOpenChange={setDialogOpen}@@ -197,7 +199,7 @@ export function ProvidersTab() {return (<>- <div className="flex flex-col gap-6">+ <div className="flex w-full mx-auto max-w-6xl flex-col gap-6 px-6 py-6"><div className="flex items-start justify-between gap-3"><SectionHeadertitle={t('Providers')}diff --git a/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx b/packages/web/src/app/routes/platform/setup/general/appearance-section.tsxindex d4e4cbe5387..71807f04e0c 100644--- a/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx+++ b/packages/web/src/app/routes/platform/setup/general/appearance-section.tsx@@ -1,5 +1,5 @@import { isNil } from '@activepieces/core-utils';-import { HEX_COLOR_PATTERN } from '@activepieces/shared';+import { formErrors, HEX_COLOR_PATTERN } from '@activepieces/shared';import { zodResolver } from '@hookform/resolvers/zod';import { useMutation } from '@tanstack/react-query';import { t } from 'i18next';@@ -9,6 +9,7 @@ import { toast } from 'sonner';import { z } from 'zod';import { platformApi } from '@/api/platforms-api';+import { FeatureBanner } from '@/app/components/feature-banner';import { ColorPicker } from '@/components/custom/color-picker';import { Button } from '@/components/ui/button';import {@@ -20,73 +21,21 @@ import {FormMessage,} from '@/components/ui/form';import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';import { Switch } from '@/components/ui/switch';import { flagsHooks } from '@/hooks/flags-hooks';import { platformHooks } from '@/hooks/platform-hooks';-const hexColor = z.string().regex(HEX_COLOR_PATTERN, 'invalidHexColor');--const ThemeColorsSchema = z.object({- avatar: hexColor,- 'blue-link': hexColor,- danger: hexColor,- selection: hexColor,- primary: z.object({- dark: hexColor,- light: hexColor,- medium: hexColor,- }),- warn: z.object({- default: hexColor,- light: hexColor,- dark: hexColor,- }),- success: z.object({- default: hexColor,- light: hexColor,- }),-});--const FromSchema = z.object({- name: z.string(),- logoUrl: z.string(),- iconUrl: z.string(),- faviconUrl: z.string(),- color: z.string(),- customThemeColors: z.boolean(),- themeColors: ThemeColorsSchema,-});--type FromSchema = z.infer<typeof FromSchema>;--const THEME_COLOR_FIELDS: { name: FieldPath<FromSchema>; label: string }[] = [- { name: 'themeColors.primary.dark', label: 'Primary Dark' },- { name: 'themeColors.primary.light', label: 'Primary Light' },- { name: 'themeColors.primary.medium', label: 'Primary Medium' },- { name: 'themeColors.danger', label: 'Danger' },- { name: 'themeColors.warn.default', label: 'Warning' },- { name: 'themeColors.warn.light', label: 'Warning Light' },- { name: 'themeColors.warn.dark', label: 'Warning Dark' },- { name: 'themeColors.success.default', label: 'Success' },- { name: 'themeColors.success.light', label: 'Success Light' },- { name: 'themeColors.blue-link', label: 'Link' },- { name: 'themeColors.avatar', label: 'Avatar' },- { name: 'themeColors.selection', label: 'Selection' },-];-export const AppearanceSection = () => {const { platform } = platformHooks.useCurrentPlatform();const branding = flagsHooks.useWebsiteBranding();const brandingLocked = !platform.plan.customAppearanceEnabled;- const form = useForm<FromSchema>({+ const form = useForm<PlatformAppearanceSchema>({defaultValues: {- name: platform?.name,- logoUrl: platform?.fullLogoUrl,- iconUrl: platform?.logoIconUrl,- faviconUrl: platform?.favIconUrl,- color: platform?.primaryColor,- customThemeColors: !isNil(platform?.themeColors),+ name: platform.name,+ color: platform.primaryColor,+ customThemeColors: !isNil(platform.themeColors),themeColors: {avatar: branding.colors.avatar,'blue-link': branding.colors['blue-link'],@@ -108,8 +57,10 @@ export const AppearanceSection = () => {},},},- resolver: zodResolver(FromSchema),+ resolver: zodResolver(PlatformAppearanceSchema),+ mode: 'onChange',});+const logoRef = useRef<HTMLInputElement>(null);const iconRef = useRef<HTMLInputElement>(null);const faviconRef = useRef<HTMLInputElement>(null);@@ -138,190 +89,216 @@ export const AppearanceSection = () => {window.location.reload();},onSuccess: () => {- toast.success(t('Your changes have been saved.'), {- duration: 3000,- });+ toast.success(t('Your changes have been saved.'), { duration: 3000 });form.reset(form.getValues());},});return (- <>- <div className="grid gap-4">- <Form {...form}>- <form- className="grid space-y-4 mt-4"- onSubmit={form.handleSubmit(() => updatePlatform())}- >- <div className="max-w-[600px] grid space-y-4">- <FormField- name="name"- render={({ field }) => (- <FormItem className="grid space-y-2">- <FormLabel htmlFor="name">{t('Platform Name')}</FormLabel>- <Input- {...field}- required- id="name"- placeholder={t('Platform Name')}- className="rounded-sm"- />- <FormMessage />- </FormItem>- )}- />+ <div className="grid gap-4">+ <Form {...form}>+ <form+ className="grid space-y-4 mt-4"+ onSubmit={form.handleSubmit(() => updatePlatform())}+ >+ <div className="max-w-[600px] grid space-y-4">+ <FormField+ name="name"+ render={({ field }) => (+ <FormItem className="grid space-y-2">+ <FormLabel htmlFor="name">{t('Platform Name')}</FormLabel>+ <Input+ {...field}+ required+ id="name"+ placeholder={t('Platform Name')}+ className="rounded-sm"+ />+ <FormMessage />+ </FormItem>+ )}+ />- <FormField- name="logoUrl"- render={() => (- <FormItem className="grid space-y-2">- <FormLabel htmlFor="logoFile">{t('Logo')}</FormLabel>- <div className="flex flex-row gap-2 items-center">- <Input- type="file"- ref={logoRef}- defaultFileName={platform?.fullLogoUrl}- accept="image/*"- id="logoFile"- disabled={brandingLocked}- className="rounded-sm"- />- </div>- <FormMessage />- </FormItem>+ {brandingLocked && (+ <FeatureBanner+ message={t(+ 'Your logo, colors and favicon are part of custom branding.',)}/>- <FormField- name="iconUrl"- render={() => (- <FormItem className="grid space-y-2">- <FormLabel htmlFor="iconFile">{t('Icon')}</FormLabel>- <div className="flex flex-row gap-2 items-center">- <Input- type="file"- ref={iconRef}- defaultFileName={platform?.logoIconUrl}- accept="image/*"- id="iconFile"- disabled={brandingLocked}- className="rounded-sm"- />- </div>- <FormMessage />- </FormItem>- )}+ )}++ <div className="grid space-y-2">+ <Label htmlFor="logoFile">{t('Logo')}</Label>+ <Input+ type="file"+ ref={logoRef}+ defaultFileName={platform.fullLogoUrl}+ accept="image/*"+ id="logoFile"+ disabled={brandingLocked}+ className="rounded-sm"/>- <FormField- name="faviconUrl"- render={() => (- <FormItem className="grid space-y-2">- <FormLabel htmlFor="faviconUrl">- {t('Favicon URL')}- </FormLabel>- <div className="flex flex-row gap-2 items-center">- <Input- type="file"- ref={faviconRef}- defaultFileName={platform?.favIconUrl}- accept="image/*"- id="faviconFile"- disabled={brandingLocked}- className="rounded-sm"- />- </div>- <FormMessage />- </FormItem>- )}+ </div>+ <div className="grid space-y-2">+ <Label htmlFor="iconFile">{t('Icon')}</Label>+ <Input+ type="file"+ ref={iconRef}+ defaultFileName={platform.logoIconUrl}+ accept="image/*"+ id="iconFile"+ disabled={brandingLocked}+ className="rounded-sm"/>-- <FormField- name="color"- render={({ field }) => (- <FormItem className="grid space-y-2">- <FormLabel htmlFor="color">{t('Primary Color')}</FormLabel>- <div className="flex flex-row gap-2 items-center">- <ColorPicker- disabled={brandingLocked}- value={field.value as string}- onChange={(color: string) => field.onChange(color)}- className="flex flex-row gap-2 items-center"- ></ColorPicker>- <FormMessage />- </div>- </FormItem>- )}+ </div>+ <div className="grid space-y-2">+ <Label htmlFor="faviconFile">{t('Favicon')}</Label>+ <Input+ type="file"+ ref={faviconRef}+ defaultFileName={platform.favIconUrl}+ accept="image/*"+ id="faviconFile"+ disabled={brandingLocked}+ className="rounded-sm"/>+ </div>- <FormField- control={form.control}- name="customThemeColors"- render={({ field }) => (- <FormItem className="grid space-y-2">- <FormLabel htmlFor="customThemeColors">- {t('Customize theme colors')}- </FormLabel>- <div className="flex flex-row gap-2 items-center">- <Switch- id="customThemeColors"- disabled={brandingLocked}- checked={field.value}- onCheckedChange={field.onChange}- />- </div>- <FormDescription>- {t(- 'When disabled, theme colors are derived from your primary color.',- )}- </FormDescription>- </FormItem>- )}- />+ <FormField+ name="color"+ render={({ field }) => (+ <FormItem className="grid space-y-2">+ <FormLabel htmlFor="color">{t('Primary Color')}</FormLabel>+ <div className="flex flex-row gap-2 items-center">+ <ColorPicker+ disabled={brandingLocked}+ value={field.value}+ onChange={(color: string) => field.onChange(color)}+ className="flex flex-row gap-2 items-center"+ ></ColorPicker>+ <FormMessage />+ </div>+ </FormItem>+ )}+ />- {form.watch('customThemeColors') && !brandingLocked && (- <div className="grid grid-cols-3 gap-4">- {THEME_COLOR_FIELDS.map(({ name, label }) => (- <FormField- key={name}- control={form.control}- name={name}- render={({ field }) => (- <FormItem className="grid space-y-2">- <FormLabel>{t(label)}</FormLabel>- <div className="flex flex-row gap-2 items-center">- <ColorPicker- value={field.value as string}- onChange={(color: string) =>- field.onChange(color)- }- className="flex flex-row gap-2 items-center"- ></ColorPicker>- <FormMessage />- </div>- </FormItem>- )}+ <FormField+ control={form.control}+ name="customThemeColors"+ render={({ field }) => (+ <FormItem className="grid space-y-2">+ <FormLabel htmlFor="customThemeColors">+ {t('Customize theme colors')}+ </FormLabel>+ <div className="flex flex-row gap-2 items-center">+ <Switch+ id="customThemeColors"+ disabled={brandingLocked}+ checked={field.value}+ onCheckedChange={field.onChange}/>- ))}- </div>+ </div>+ <FormDescription>+ {t(+ 'When disabled, theme colors are derived from your primary color.',+ )}+ </FormDescription>+ </FormItem>)}- </div>+ />- {form?.formState?.errors?.root?.serverError && (- <FormMessage>- {form.formState.errors.root.serverError.message}- </FormMessage>+ {form.watch('customThemeColors') && !brandingLocked && (+ <div className="grid grid-cols-3 gap-4">+ {THEME_COLOR_FIELDS.map(({ name, label }) => (+ <FormField+ key={name}+ control={form.control}+ name={name}+ render={({ field }) => (+ <FormItem className="grid space-y-2">+ <FormLabel>{t(label)}</FormLabel>+ <div className="flex flex-row gap-2 items-center">+ <ColorPicker+ value={field.value as string}+ onChange={(color: string) => field.onChange(color)}+ className="flex flex-row gap-2 items-center"+ ></ColorPicker>+ <FormMessage />+ </div>+ </FormItem>+ )}+ />+ ))}+ </div>)}- <div className="flex gap-2 justify-end mt-4">- <Button- type="submit"- loading={isPending}- disabled={!form.formState.isValid}- >- {t('Save')}- </Button>- </div>- </form>- </Form>- </div>- </>+ </div>++ {form?.formState?.errors?.root?.serverError && (+ <FormMessage>+ {form.formState.errors.root.serverError.message}+ </FormMessage>+ )}+ <div className="flex gap-2 justify-end mt-4">+ <Button+ type="submit"+ loading={isPending}+ disabled={!form.formState.isValid}+ >+ {t('Save')}+ </Button>+ </div>+ </form>+ </Form>+ </div>);};++const hexColor = z.string().regex(HEX_COLOR_PATTERN, 'invalidHexColor');++const ThemeColorsSchema = z.object({+ avatar: hexColor,+ 'blue-link': hexColor,+ danger: hexColor,+ selection: hexColor,+ primary: z.object({+ dark: hexColor,+ light: hexColor,+ medium: hexColor,+ }),+ warn: z.object({+ default: hexColor,+ light: hexColor,+ dark: hexColor,+ }),+ success: z.object({+ default: hexColor,+ light: hexColor,+ }),+});++const PlatformAppearanceSchema = z.object({+ name: z.string().min(1, formErrors.required),+ color: z.string(),+ customThemeColors: z.boolean(),+ themeColors: ThemeColorsSchema,+});++const THEME_COLOR_FIELDS: {+ name: FieldPath<PlatformAppearanceSchema>;+ label: string;+}[] = [+ { name: 'themeColors.primary.dark', label: 'Primary Dark' },+ { name: 'themeColors.primary.light', label: 'Primary Light' },+ { name: 'themeColors.primary.medium', label: 'Primary Medium' },+ { name: 'themeColors.danger', label: 'Danger' },+ { name: 'themeColors.warn.default', label: 'Warning' },+ { name: 'themeColors.warn.light', label: 'Warning Light' },+ { name: 'themeColors.warn.dark', label: 'Warning Dark' },+ { name: 'themeColors.success.default', label: 'Success' },+ { name: 'themeColors.success.light', label: 'Success Light' },+ { name: 'themeColors.blue-link', label: 'Link' },+ { name: 'themeColors.avatar', label: 'Avatar' },+ { name: 'themeColors.selection', label: 'Selection' },+];++type PlatformAppearanceSchema = z.infer<typeof PlatformAppearanceSchema>;diff --git a/packages/web/src/app/routes/platform/setup/general/index.tsx b/packages/web/src/app/routes/platform/setup/general/index.tsxindex f7b9e1f05e0..6e0cfd91b63 100644--- a/packages/web/src/app/routes/platform/setup/general/index.tsx+++ b/packages/web/src/app/routes/platform/setup/general/index.tsx@@ -21,7 +21,7 @@ export const GeneralPage = () => {return (<CenteredPagetitle={t('General')}- description={t('Change the settings for your platform.')}+ description={t('Your platform name, branding and general settings.')}><AppearanceSection />{canDeletePlatform && (diff --git a/packages/web/src/app/routes/platform/setup/mcp/index.tsx b/packages/web/src/app/routes/platform/setup/mcp/index.tsxindex 596064ed5b2..7fafecca35c 100644--- a/packages/web/src/app/routes/platform/setup/mcp/index.tsx+++ b/packages/web/src/app/routes/platform/setup/mcp/index.tsx@@ -1,13 +1,14 @@import { ApFlagId } from '@activepieces/shared';import { t } from 'i18next';+import React from 'react';-import { CenteredPage } from '@/app/components/centered-page';import { McpTools } from '@/app/components/project-settings/mcp-server/mcp-tools';import { ActivityFeed } from '@/app/routes/mcp-server/activity/activity-feed';import { CopyToClipboardInput } from '@/components/custom/clipboard/copy-to-clipboard';import { CollapsibleJson } from '@/components/custom/collapsible-json';import { DataFetchErrorState } from '@/components/custom/data-fetch-error-state';import { LoadingSpinner } from '@/components/custom/spinner';+import { Separator } from '@/components/ui/separator';import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';import { flagsHooks } from '@/hooks/flags-hooks';@@ -26,8 +27,7 @@ export default function PlatformMcpPage() {if (isLoading) {return (- <CenteredPage- title={t('Platform MCP Server')}+ <McpSectiondescription={t('Configure the platform-wide MCP server used by the AI Chat assistant and external MCP clients.',)}@@ -35,20 +35,19 @@ export default function PlatformMcpPage() {<div className="flex items-center justify-center py-20"><LoadingSpinner /></div>- </CenteredPage>+ </McpSection>);}if (isError) {return (- <CenteredPage- title={t('Platform MCP Server')}+ <McpSectiondescription={t('Configure the platform-wide MCP server used by the AI Chat assistant and external MCP clients.',)}><DataFetchErrorState entity={t('the MCP server')} onRetry={refetch} />- </CenteredPage>+ </McpSection>);}@@ -63,9 +62,7 @@ export default function PlatformMcpPage() {};return (- <CenteredPage- widthClassName="max-w-[1198px]"- title={t('Platform MCP Server')}+ <McpSectiondescription={t('Configure the platform-wide MCP server used by the AI Chat assistant and external MCP clients.',)}@@ -141,6 +138,25 @@ export default function PlatformMcpPage() {</Tabs>)}</div>- </CenteredPage>+ </McpSection>+ );+}++function McpSection({+ description,+ children,+}: {+ description: React.ReactNode;+ children: React.ReactNode;+}) {+ return (+ <div className="w-full mx-auto max-w-page-band py-6">+ <div className="flex flex-col gap-1">+ <h1 className="text-xl font-medium">{t('Platform MCP Server')}</h1>+ <div className="text-sm text-muted-foreground">{description}</div>+ </div>+ <Separator className="my-4" />+ {children}+ </div>);}diff --git a/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx b/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsxindex 347bce647bd..68eab4bfb8e 100644--- a/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx+++ b/packages/web/src/app/routes/platform/setup/pieces/customize-selector-dialog.tsx@@ -8,6 +8,7 @@ import { t } from 'i18next';import {CheckIcon,ChevronDownIcon,+ Crown,EyeIcon,EyeOffIcon,GripVerticalIcon,@@ -51,6 +52,7 @@ import {SortableDragHandle,SortableItem,} from '@/components/ui/sortable';+import { PLATFORM_FEATURES, useFeatureGate } from '@/features/billing';import {PieceIcon,pieceSelectorCustomization,@@ -70,10 +72,27 @@ export const CustomizeSelectorDialog = ({isEnabled: boolean;}) => {const [open, setOpen] = useState(false);+ const gate = useFeatureGate({+ locked: !isEnabled,+ feature: PLATFORM_FEATURES.pieces,+ });++ if (gate.locked) {+ return (+ <>+ <Button variant="outline" size="sm" onClick={gate.open}>+ <Crown className="size-3.5 shrink-0 text-primary" />+ {t('Customize Selector')}+ </Button>+ {gate.dialog}+ </>+ );+ }+return (<Sheet open={open} onOpenChange={setOpen}><SheetTrigger asChild>- <Button variant="outline" size="sm" disabled={!isEnabled}>+ <Button variant="outline" size="sm"><Settings2Icon className="size-4 mr-2" />{t('Customize Selector')}</Button>diff --git a/packages/web/src/app/routes/platform/setup/pieces/index.tsx b/packages/web/src/app/routes/platform/setup/pieces/index.tsxindex 8d3f5e19a3c..c1df3d100e4 100644--- a/packages/web/src/app/routes/platform/setup/pieces/index.tsx+++ b/packages/web/src/app/routes/platform/setup/pieces/index.tsx@@ -11,7 +11,6 @@ import {Package,Hash,GitBranch,- Layers,Puzzle,Trash,} from 'lucide-react';@@ -23,15 +22,13 @@ import { DashboardPageHeader } from '@/app/components/dashboard-page-header';import { CustomizeSelectorDialog } from '@/app/routes/platform/setup/pieces/customize-selector-dialog';import { DownloadPiecesReportButton } from '@/app/routes/platform/setup/pieces/download-pieces-report';import { PieceActions } from '@/app/routes/platform/setup/pieces/piece-actions';+import { PiecesLockedBanner } from '@/app/routes/platform/setup/pieces/pieces-locked-banner';import { SyncPiecesButton } from '@/app/routes/platform/setup/pieces/sync-pieces';import { ConfigurePieceOAuth2Dialog } from '@/app/routes/platform/setup/pieces/update-oauth2-dialog';import { DataTable, RowDataWithActions } from '@/components/custom/data-table';import { DataTableColumnHeader } from '@/components/custom/data-table/data-table-column-header';import { ConfirmationDeleteDialog } from '@/components/custom/delete-dialog';-import { LockedAlert } from '@/components/custom/locked-alert';import { Button } from '@/components/ui/button';-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';-import { RequestTrial } from '@/features/billing';import { oauthAppsQueries } from '@/features/connections';import {InstallPieceDialog,@@ -42,11 +39,7 @@ import {import { platformHooks } from '@/hooks/platform-hooks';import { api } from '@/lib/api';-import { PieceSetsTab } from './piece-sets/piece-sets-tab';--type TabValue = 'pieces' | 'piece-sets';--const PiecesListTab = () => {+export const PiecesListTab = () => {const { platform } = platformHooks.useCurrentPlatform();const isEnabled = platform.plan.managePiecesEnabled;const [searchParams] = useSearchParams();@@ -178,124 +171,58 @@ const PiecesListTab = () => {[isEnabled, refetchPieces, refetchPiecesOAuth2AppsMap],);- return (- <DataTable- emptyStateTextTitle={t('No pieces found')}- emptyStateTextDescription={t(- 'Start by installing pieces that you want to use in your automations',- )}- emptyStateIcon={<Package className="size-14" />}- columns={columns}- filters={[- {- type: 'input',- title: t('Piece Name'),- accessorKey: 'name',- icon: CheckIcon,- },- ]}- page={{- data: pieces ?? [],- next: null,- previous: null,- }}- isLoading={isLoading}- isError={isError}- errorStateEntity={t('pieces')}- onRetry={refetchPieces}- toolbarButtons={[- <CustomizeSelectorDialog key="customize" isEnabled={isEnabled} />,- <DownloadPiecesReportButton key="download-report" />,- <SyncPiecesButton key="sync" />,- <InstallPieceDialog- key="install"- onInstallPiece={() => refetchPieces()}- scope={PieceScope.PLATFORM}- />,- ]}- virtualizeRows={true}- hidePagination={true}- />- );-};--const PlatformPiecesPage = () => {- const { platform } = platformHooks.useCurrentPlatform();- const [searchParams, setSearchParams] = useSearchParams();- const activeTab = (searchParams.get('tab') as TabValue) || 'pieces';-- const setTab = (tab: TabValue) => {- const newParams = new URLSearchParams(searchParams);- if (tab === 'pieces') {- newParams.delete('tab');- } else {- newParams.set('tab', tab);- }- setSearchParams(newParams, { replace: true });- };-return (<><DashboardPageHeader- description={t('Manage the pieces that are available to your users')}title={t('Pieces')}+ description={t('Manage the pieces that are available to your users')}/>- <div className="mx-auto w-full flex flex-col flex-1 min-h-0">- {!platform.plan.managePiecesEnabled && (- <div className="px-4 shrink-0">- <LockedAlert- title={t('Control Pieces')}- description={t(- "Show the pieces that matter most to your users and hide the ones you don't like.",- )}- button={- <RequestTrial- featureKey="ENTERPRISE_PIECES"- buttonVariant="basic"- />- }- />- </div>+ <PiecesLockedBanner+ message={t(+ "Showing and hiding pieces needs a higher plan. You can browse the catalog, but changes won't stick.",)}- <Tabs- value={activeTab}- onValueChange={(v) => setTab(v as TabValue)}- className="flex flex-col flex-1 min-h-0 min-w-0"- >- <TabsList- variant="outline"- className="border-b w-full rounded-none justify-start shrink-0"- >- <TabsTrigger variant="outline" value="pieces">- <Puzzle className="size-4 mr-2" />- {t('Pieces')}- </TabsTrigger>- <TabsTrigger variant="outline" value="piece-sets">- <Layers className="size-4 mr-2" />- {t('Piece Sets')}- </TabsTrigger>- </TabsList>- <TabsContent- value="pieces"- className="flex-1 min-h-0 flex flex-col mt-0 min-w-0"- >- <PiecesListTab />- </TabsContent>- <TabsContent- value="piece-sets"- className="flex-1 min-h-0 flex flex-col mt-0 min-w-0"- >- <PieceSetsTab />- </TabsContent>- </Tabs>- </div>+ />+ <DataTable+ emptyStateTextTitle={t('No pieces found')}+ emptyStateTextDescription={t(+ 'Start by installing pieces that you want to use in your automations',+ )}+ emptyStateIcon={<Package className="size-14" />}+ columns={columns}+ filters={[+ {+ type: 'input',+ title: t('Piece Name'),+ accessorKey: 'name',+ icon: CheckIcon,+ },+ ]}+ page={{+ data: pieces ?? [],+ next: null,+ previous: null,+ }}+ isLoading={isLoading}+ isError={isError}+ errorStateEntity={t('pieces')}+ onRetry={refetchPieces}+ toolbarButtons={[+ <CustomizeSelectorDialog key="customize" isEnabled={isEnabled} />,+ <DownloadPiecesReportButton key="download-report" />,+ <SyncPiecesButton key="sync" />,+ <InstallPieceDialog+ key="install"+ onInstallPiece={() => refetchPieces()}+ scope={PieceScope.PLATFORM}+ />,+ ]}+ virtualizeRows={true}+ hidePagination={true}+ /></>);};-PlatformPiecesPage.displayName = 'PlatformPiecesPage';-export { PlatformPiecesPage };-function shouldShowOauth2SettingForPiece(piece: PieceMetadataModelSummary) {const pieceAuth = Array.isArray(piece.auth)? piece.auth.find((auth) => auth.type === PropertyType.OAUTH2)diff --git a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsxindex c71657c15c2..09c0237daa6 100644--- a/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx+++ b/packages/web/src/app/routes/platform/setup/pieces/piece-sets/piece-sets-tab.tsx@@ -14,6 +14,8 @@ import {import { useMemo, useState } from 'react';import { useNavigate, useSearchParams } from 'react-router-dom';+import { DashboardPageHeader } from '@/app/components/dashboard-page-header';+import { PiecesLockedBanner } from '@/app/routes/platform/setup/pieces/pieces-locked-banner';import {CURSOR_QUERY_PARAM,DataTable,@@ -167,6 +169,13 @@ export const PieceSetsTab = () => {return (<>+ <DashboardPageHeader+ title={t('Piece Sets')}+ description={t(+ 'Group pieces into sets and choose which projects can use each one',+ )}+ />+ <PiecesLockedBanner message={t('Piece sets need a higher plan.')} /><DataTableemptyStateTextTitle={t('No piece sets found')}emptyStateTextDescription={t(diff --git a/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsx b/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsxnew file mode 100644index 00000000000..4b269e000fa--- /dev/null+++ b/packages/web/src/app/routes/platform/setup/pieces/pieces-locked-banner.tsx@@ -0,0 +1,20 @@+import { FeatureBanner } from '@/app/components/feature-banner';+import { platformHooks } from '@/hooks/platform-hooks';++export function PiecesLockedBanner({ message }: PiecesLockedBannerProps) {+ const { platform } = platformHooks.useCurrentPlatform();++ if (platform.plan.managePiecesEnabled) {+ return null;+ }++ return (+ <div className="px-6 shrink-0 pb-4">+ <FeatureBanner message={message} />+ </div>+ );+}++export type PiecesLockedBannerProps = {+ message: string;+};diff --git a/packages/web/src/app/routes/platform/usage/index.tsx b/packages/web/src/app/routes/platform/usage/index.tsxdeleted file mode 100644index 8152d708cb1..00000000000--- a/packages/web/src/app/routes/platform/usage/index.tsx+++ /dev/null@@ -1,47 +0,0 @@-import { t } from 'i18next';-import { Info } from 'lucide-react';--import { BillingPageShell } from '@/app/components/billing-page-shell';-import { Separator } from '@/components/ui/separator';-import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from '@/components/ui/tooltip';-import { FeatureUsageCards, ProjectsUsageTable } from '@/features/billing';--export default function Usage() {- return (- <BillingPageShell- lockTitle={t('Unlock Usage Page')}- errorMessage={t('Failed to load usage information')}- >- {({ platform, info }) => (- <div className="flex w-full flex-col gap-4 p-6">- <div className="flex flex-col gap-1">- <div className="flex items-center gap-1.5">- <h1 className="text-xl font-medium">{t('Usage')}</h1>- <Tooltip>- <TooltipTrigger asChild>- <Info className="size-3.5 text-muted-foreground cursor-help" />- </TooltipTrigger>- <TooltipContent side="right" className="max-w-[240px]">- <p className="text-sm">- {t('Usage figures may be a few minutes out of date.')}- </p>- </TooltipContent>- </Tooltip>- </div>- <div className="text-sm text-muted-foreground">- {t('Track your workspace usage across your plan limits.')}- </div>- </div>- <Separator />- <FeatureUsageCards platformSubscription={info} />- <Separator />- <ProjectsUsageTable platformId={platform.id} />- </div>- )}- </BillingPageShell>- );-}diff --git a/packages/web/src/features/platform-admin/hooks/ai-tool-config-hooks.ts b/packages/web/src/features/platform-admin/hooks/ai-tool-config-hooks.tsindex 19c639fd87a..1dba7d62793 100644--- a/packages/web/src/features/platform-admin/hooks/ai-tool-config-hooks.ts+++ b/packages/web/src/features/platform-admin/hooks/ai-tool-config-hooks.ts@@ -1,10 +1,14 @@import {+ ApEdition,+ ApFlagId,CreateAiToolConfigRequest,UpdateAiToolConfigRequest,} from '@activepieces/shared';import { useMutation, useQuery } from '@tanstack/react-query';import { AxiosError } from 'axios';+import { flagsHooks } from '@/hooks/flags-hooks';+import { aiToolConfigApi } from '../api/ai-tool-config-api';export const aiToolConfigKeys = {@@ -12,11 +16,14 @@ export const aiToolConfigKeys = {};export const aiToolConfigQueries = {- useAiToolConfigs: () =>- useQuery({+ useAiToolConfigs: () => {+ const { data: edition } = flagsHooks.useFlag<ApEdition>(ApFlagId.EDITION);+ return useQuery({queryKey: aiToolConfigKeys.all,queryFn: () => aiToolConfigApi.list(),- }),+ enabled: edition !== ApEdition.COMMUNITY,+ });+ },};export const aiToolConfigMutations = {diff --git a/packages/web/src/styles.css b/packages/web/src/styles.cssindex fcc8a13e357..a061eefae4f 100644--- a/packages/web/src/styles.css+++ b/packages/web/src/styles.css@@ -157,6 +157,8 @@--radius-xs: calc(var(--radius) - 8px);--radius-xss: calc(var(--radius) - 10px);+ --container-page-band: 1198px;+--text-xss: 0.65rem;--text-3xl: 1.75rem;--text-4xl: 2rem;