@@ -757,6 +787,23 @@ export function ExchangesPage() {
);
}
+const PARTNER_HELP = {
+ title: "What's on this page?",
+ body: (
+ <>
+
+ Each row is one exchange: a message that ran for your company. Retrying one creates a new
+ exchange in the same chain, so one piece of work can show up as several rows.{" "}
+ Latest attempt only hides the attempts that have since been retried.
+
+
+ The status buttons count your exchanges under every other filter. Search by a value your documents carry, such
+ as an order number, to find one.
+
+ >
+ ),
+};
+
function Kbd({ children }: { children: string }) {
return {children};
}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/exchanges/QueryBar.tsx b/SW.Bitween.Web/ClientApp/src/pages/exchanges/QueryBar.tsx
index c2a1a37b..d134a596 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/exchanges/QueryBar.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/exchanges/QueryBar.tsx
@@ -3,6 +3,7 @@ import { Bookmark, Check, ChevronDown, Clock, Link as LinkIcon, Plus, Search, Tr
import { SearchSelect, type SearchSelectOption } from "../../components/ui/SearchSelect";
import { Button } from "../../components/ui/basics";
import { AskButton, type AskedQuestion } from "./AskExchanges";
+import { useExchangeSource } from "./exchangeSource";
import { Dropdown } from "./Dropdown";
import {
BUILT_IN_VIEWS,
@@ -54,6 +55,8 @@ export function QueryBar({
onAsked: (asked: AskedQuestion) => void;
}) {
const chips = filterChips(searchParams, lookups);
+ // A partner's people ask no AI about our traffic: Ask reads every exchange.
+ const { partner } = useExchangeSource();
return (
@@ -67,7 +70,7 @@ export function QueryBar({
-
+ {!partner && }
);
}
@@ -648,6 +651,7 @@ function AddFilterMenu({
const [open, setOpen] = useState(false);
const needle = find.trim().toLowerCase();
const matches = (text: string) => !needle || text.toLowerCase().includes(needle);
+ const { hiddenFilters } = useExchangeSource();
const propertyKeys = options.propertyKeys.filter((o) => matches(o.label) || matches(o.sublabel ?? ""));
const close = () => {
@@ -706,7 +710,7 @@ function AddFilterMenu({
{MENU.map((g, i) => {
- const items = g.items.filter((it) => matches(it.label));
+ const items = g.items.filter((it) => matches(it.label) && !hiddenFilters.has(it.kind));
const groupNode = items.length > 0 && (
{g.group}
@@ -783,7 +787,11 @@ function SearchField({ searchParams, apply }: { searchParams: URLSearchParams; a
const [text, setText] = useState("");
const [active, setActive] = useState(0);
const [focused, setFocused] = useState(false);
- const suggestions = useMemo(() => searchSuggestions(text, searchParams), [text, searchParams]);
+ const { hiddenFilters } = useExchangeSource();
+ const suggestions = useMemo(
+ () => searchSuggestions(text, searchParams).filter((s) => !(s.key === "error" && hiddenFilters.has("error"))),
+ [text, searchParams, hiddenFilters],
+ );
const inputRef = useRef
(null);
const listId = useId();
const open = focused && suggestions.length > 0;
diff --git a/SW.Bitween.Web/ClientApp/src/pages/exchanges/RetryChain.tsx b/SW.Bitween.Web/ClientApp/src/pages/exchanges/RetryChain.tsx
index 1107b5da..bc9227ee 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/exchanges/RetryChain.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/exchanges/RetryChain.tsx
@@ -7,6 +7,7 @@ import { namesSomething } from "../../components/config/subscriptionLabels";
import { timeAgo, timeUntil } from "../../lib/dates";
import { StatusBadge } from "./shared";
import { retryTreeQuery } from "./retryTree";
+import { useExchangeSource } from "./exchangeSource";
const childrenOf = (tree: RetryTree, id: string | null) =>
tree.attempts
@@ -27,6 +28,7 @@ function Attempt({
const isCurrent = node.id === currentId;
const children = childrenOf(tree, node.id);
const navigate = useNavigate();
+ const { listPath } = useExchangeSource();
return (
<>
@@ -34,7 +36,7 @@ function Attempt({
// The whole row opens the attempt, the way a row of the exchange list opens its own
// drawer - the identity on the right can no longer be a link itself, since promoted
// properties bring a panel of their own and a button cannot sit inside a link.
- onClick={isCurrent ? undefined : () => navigate(`/exchanges?ids=${encodeURIComponent(node.id)}`)}
+ onClick={isCurrent ? undefined : () => navigate(`${listPath}?ids=${encodeURIComponent(node.id)}`)}
className={`flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md px-2 py-1.5 ${
isCurrent ? "bg-ink-100/70" : "cursor-pointer hover:bg-ink-50"
}`}
@@ -51,7 +53,7 @@ function Attempt({
) : (
@@ -124,7 +126,7 @@ const ordinal = (n: number) => {
* rule was enforced can fork, and those show as branches rather than being hidden.
*/
export function RetryChain({ id }: { id: string }) {
- const { data: tree, isLoading } = useQuery(retryTreeQuery(id));
+ const { data: tree, isLoading } = useQuery(retryTreeQuery(id, useExchangeSource()));
// A line rather than a spinner block: this sits inside an already-rendered drawer, and it is
// usually filled in before anyone looks at it - the row is prefetched on hover.
diff --git a/SW.Bitween.Web/ClientApp/src/pages/exchanges/exchangeSource.tsx b/SW.Bitween.Web/ClientApp/src/pages/exchanges/exchangeSource.tsx
new file mode 100644
index 00000000..dde60f3a
--- /dev/null
+++ b/SW.Bitween.Web/ClientApp/src/pages/exchanges/exchangeSource.tsx
@@ -0,0 +1,105 @@
+import { createContext, useContext, useMemo, type MouseEvent, type ReactNode } from "react";
+import { Link } from "react-router";
+import { api, type ExchangeBreakdown, type ExchangeQuery, type ExchangeRow, type Paged, type RetryTree } from "../../api";
+import { useSessionCan } from "../../auth/useSessionCan";
+import type { FilterKind } from "./exchangeFilters";
+
+/**
+ * Where the Exchanges page reads from, and what it offers. Our team's: every exchange, through the
+ * staff API, with every tool. A partner's people's (`partner`): their own, through the portal's API,
+ * which limits and strips them on the server; the page then leaves out our tools and the links into
+ * our pages. One page for both, so the portal shows exchanges exactly as Bitween does.
+ */
+export interface ExchangeSource {
+ partner: boolean;
+ /** Where the list lives, for a link to an exchange or a chain. */
+ listPath: string;
+ searchExchanges(query: ExchangeQuery, opts?: { count?: boolean }): Promise>;
+ getExchangeBreakdown(query: ExchangeQuery): Promise;
+ /** A file's content, by the key its row carries: a storage key for us, a signed link for them. */
+ readDocument(key: string): Promise;
+ getRetryTree(id: string): Promise;
+ /** May retry, and may choose to reset to the current settings; a partner's always does. */
+ canRetry: boolean;
+ canChooseReset: boolean;
+ retryExchange(id: string, reset: boolean): Promise<{ id: string }>;
+ /** Filters not offered. */
+ hiddenFilters: ReadonlySet;
+}
+
+const Context = createContext(null);
+
+export function useExchangeSource(): ExchangeSource {
+ const partner = useContext(Context);
+ const canRetry = useSessionCan("exchanges.operate");
+ const staff = useMemo(
+ () => ({
+ partner: false,
+ listPath: "/exchanges",
+ searchExchanges: (query, opts) => api.searchExchanges(query, opts),
+ getExchangeBreakdown: (query) => api.getExchangeBreakdown(query),
+ readDocument: (key) => api.getExchangeDocument(key),
+ getRetryTree: (id) => api.getRetryTree(id),
+ canRetry,
+ canChooseReset: true,
+ retryExchange: (id, reset) => api.retryExchange(id, { reset }),
+ hiddenFilters: new Set(),
+ }),
+ [canRetry],
+ );
+ return partner ?? staff;
+}
+
+/**
+ * A link into one of our own pages, such as a subscription or a partner. A partner's people can't
+ * open those, so it is the same text without the link for them.
+ */
+export function OurPageLink({
+ to,
+ className = "",
+ title,
+ onClick,
+ children,
+}: {
+ to: string;
+ className?: string;
+ title?: string;
+ onClick?: (e: MouseEvent) => void;
+ children: ReactNode;
+}) {
+ const { partner } = useExchangeSource();
+ if (partner)
+ return (
+
+ {children}
+
+ );
+ return (
+
+ {children}
+
+ );
+}
+
+/** The page, and everything it opens, as a partner's people see it. */
+export function PartnerExchangeSource({ children }: { children: ReactNode }) {
+ const canRetry = useSessionCan("portal-exchanges.operate");
+ const canErrors = useSessionCan("portal-exchange-errors.view");
+ const value = useMemo(
+ () => ({
+ partner: true,
+ listPath: "/portal",
+ searchExchanges: (query, opts) => api.searchExchanges(query, { ...opts, portal: true }),
+ getExchangeBreakdown: (query) => api.getExchangeBreakdown(query, { portal: true }),
+ readDocument: (url) => api.readExchangeFileLink(url),
+ getRetryTree: (id) => api.getRetryTree(id, { portal: true }),
+ canRetry,
+ canChooseReset: false,
+ retryExchange: async (id) => ({ id: await api.retryPortalExchange(id) }),
+ // Always their own partner; runs and roll-ups are our wiring; errors only when their role shows them.
+ hiddenFilters: new Set(["partner", "receiveAttempt", "aggregated", ...(canErrors ? [] : ["error" as const])]),
+ }),
+ [canRetry, canErrors],
+ );
+ return {children};
+}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/exchanges/retryTree.ts b/SW.Bitween.Web/ClientApp/src/pages/exchanges/retryTree.ts
index 7203febc..5ec79b2d 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/exchanges/retryTree.ts
+++ b/SW.Bitween.Web/ClientApp/src/pages/exchanges/retryTree.ts
@@ -1,4 +1,4 @@
-import { api, type RetryTree, type RetryTreeNode } from "../../api";
+import { type RetryTree, type RetryTreeNode } from "../../api";
import { keys } from "../../api/queryKeys";
/**
@@ -9,9 +9,10 @@ import { keys } from "../../api/queryKeys";
export const hasRetryChain = (x: { retryFor: string | null; hasRetry: boolean }) =>
x.retryFor !== null || x.hasRetry;
-export const retryTreeQuery = (id: string) => ({
- queryKey: keys.exchanges.retryTree(id),
- queryFn: () => api.getRetryTree(id),
+/** From where the page reads (`ExchangeSource`): our team's chain, or a partner's own attempts. */
+export const retryTreeQuery = (id: string, source: { partner: boolean; getRetryTree: (id: string) => Promise }) => ({
+ queryKey: [...keys.exchanges.retryTree(id), source.partner ? "partner" : "staff"],
+ queryFn: () => source.getRetryTree(id),
/**
* A chain is settled history above the exchange asked about and only ever grows below it, so
* a held copy cannot be wrong about what it shows - at worst it is missing an attempt someone
diff --git a/SW.Bitween.Web/ClientApp/src/pages/exchanges/shared.tsx b/SW.Bitween.Web/ClientApp/src/pages/exchanges/shared.tsx
index 69ae5167..4f892b44 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/exchanges/shared.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/exchanges/shared.tsx
@@ -160,6 +160,7 @@ export function RetryDialog({
error = null,
onConfirm,
onResetChange,
+ chooseReset = true,
onClose,
}: {
count: number;
@@ -177,6 +178,8 @@ export function RetryDialog({
* for an exchange whose subscription is gone - so the caller has to be able to ask again.
*/
onResetChange?: (reset: boolean) => void;
+ /** Whether the current settings may be chosen instead of the captured ones; a partner's always uses them. */
+ chooseReset?: boolean;
onClose: () => void;
}) {
const [reset, setReset] = useState(false);
@@ -291,7 +294,7 @@ export function RetryDialog({
)}
{/* Not once it's under way: it keeps the choice it started with. */}
- {!progress && (
+ {!progress && chooseReset && (
+
+
+
+ );
+}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalExchangesPage.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalExchangesPage.tsx
new file mode 100644
index 00000000..716e4fef
--- /dev/null
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalExchangesPage.tsx
@@ -0,0 +1,14 @@
+import { ExchangesPage } from "../exchanges/ExchangesPage";
+import { PartnerExchangeSource } from "../exchanges/exchangeSource";
+
+/**
+ * A partner's people's Exchanges page: Bitween's own, reading their exchanges through the portal's
+ * API, without our tools and the links into our pages.
+ */
+export function PortalExchangesPage() {
+ return (
+
+
+
+ );
+}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingPage.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingPage.tsx
index 37ee5a8e..44b4ce2f 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingPage.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingPage.tsx
@@ -1,10 +1,11 @@
import { useMemo, useState } from "react";
-import { Link, useParams } from "react-router";
+import { useParams } from "react-router";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { ArrowLeft } from "lucide-react";
import { api } from "../../api";
import { keys } from "../../api/queryKeys";
import { useSession } from "../../auth/useSession";
+import { PageHeader } from "../../components/layout/PageHeader";
+import { usePageTitle } from "../../lib/pageTitle";
import { useSessionCan } from "../../auth/useSessionCan";
import { Badge, Button, FormError, LoadError, LoadingBlock } from "../../components/ui/basics";
import { Select } from "../../components/ui/forms";
@@ -28,6 +29,7 @@ export function PortalMappingPage() {
const [sample, setSample] = useState
(null);
const mapping = useQuery({ queryKey: keys.portal.mapping(id), queryFn: () => api.getPortalMapping(id) });
+ usePageTitle(mapping.data?.subscriptionName);
const samples = useQuery({
queryKey: keys.portal.samples(id),
queryFn: () => api.listPortalMappingSamples(id),
@@ -80,19 +82,8 @@ export function PortalMappingPage() {
.sort((a, b) => b.submittedAt - a.submittedAt)[0]?.data;
return (
-
-
-
-
+
+
What you receive
@@ -210,7 +201,6 @@ export function PortalMappingPage() {
>
)}
-
{editing && (
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingsPage.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingsPage.tsx
new file mode 100644
index 00000000..351e51df
--- /dev/null
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalMappingsPage.tsx
@@ -0,0 +1,72 @@
+import { useNavigate } from "react-router";
+import { useQuery } from "@tanstack/react-query";
+import { api, type PortalMappingPlace } from "../../api";
+import { keys } from "../../api/queryKeys";
+import { PageHeader } from "../../components/layout/PageHeader";
+import { Badge, EmptyState, LoadError, LoadingBlock } from "../../components/ui/basics";
+import { Table } from "../../components/ui/Table";
+import { formatDateTime, timeAgo } from "../../lib/dates";
+
+function MappingBadges({ m }: { m: PortalMappingPlace }) {
+ return (
+
+ {m.waiting && (
+
+ Waiting
+
+ )}
+ {m.setAside ? (
+
+ Set aside
+
+ ) : m.customized ? (
+
+ Yours
+
+ ) : (
+ Ours
+ )}
+
+ );
+}
+
+/** Every place they're connected, and whether what they receive there is shaped their own way. */
+export function PortalMappingsPage() {
+ const navigate = useNavigate();
+ const mappings = useQuery({ queryKey: keys.portal.mappings, queryFn: () => api.listPortalMappings() });
+
+ return (
+
+
+ {mappings.isPending ? (
+
+ ) : mappings.isError ? (
+
void mappings.refetch()} />
+ ) : mappings.data.length === 0 ? (
+ When something runs for your company, it shows here.
+ ) : (
+ m.subscriptionId}
+ onRowClick={(m) => void navigate(`/portal/mappings/${m.subscriptionId}`)}
+ columns={[
+ { header: "Subscription", wrap: true, cell: (m) => {m.subscriptionName} },
+ { header: "How you're connected", headerTitle: "Your own subscription, an API gateway, or a bus gateway route", cell: (m) => m.via },
+ { header: "Information type", cell: (m) => m.documentName },
+ { header: "Mapping", headerTitle: "Ours, or your own version", cell: (m) => },
+ {
+ header: "Changed",
+ headerTitle: "When your own version last changed",
+ align: "right",
+ cell: (m) => (m.modifiedOn ? {timeAgo(m.modifiedOn)} : "-"),
+ },
+ ]}
+ card={(m) => ({ title: m.subscriptionName, status: , subtitle: `${m.via} · ${m.documentName}` })}
+ />
+ )}
+
+ );
+}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPage.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPage.tsx
deleted file mode 100644
index 74b80bc6..00000000
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPage.tsx
+++ /dev/null
@@ -1,401 +0,0 @@
-import { useState } from "react";
-import { Link } from "react-router";
-import { keepPreviousData, useQuery } from "@tanstack/react-query";
-import { Download, ExternalLink, Inbox, LogOut } from "lucide-react";
-import { api, type PortalExchange, type PortalExchangeStatus } from "../../api";
-import { keys } from "../../api/queryKeys";
-import { useSession } from "../../auth/useSession";
-import { useSessionCan } from "../../auth/useSessionCan";
-import { Badge, Button, EmptyState, LoadError, LoadingBlock } from "../../components/ui/basics";
-import { ExceptionBlock } from "../../components/ui/Exception";
-import { Select } from "../../components/ui/forms";
-import { Dialog } from "../../components/ui/overlays";
-import { Panel } from "../../components/ui/Panel";
-import { SegmentedControl } from "../../components/ui/SegmentedControl";
-import { duration, formatDateTime, timeAgo } from "../../lib/dates";
-import { bytes, whole } from "../../lib/numbers";
-import { XchangeId } from "../exchanges/shared";
-import { YourDetails } from "./YourDetails";
-
-const PAGE_SIZE = 25;
-
-const STATUS: Record = {
- success: { label: "Delivered", tone: "ok", title: "Finished without an error." },
- failed: { label: "Failed", tone: "danger", title: "Finished with an error. Open it to see why, if your role shows errors." },
- running: { label: "Running", tone: "neutral", title: "Started and not finished yet." },
-};
-
-const FILE_LABELS: Record = {
- input: { label: "Received", title: "What came in, before any mapping." },
- output: { label: "Sent", title: "What was delivered, after mapping." },
- response: { label: "Response", title: "What the receiving system answered." },
-};
-
-/**
- * The partner portal: the one page a partner's person sees. Their subscriptions and exchanges only;
- * the server scopes every call to their partner, so nothing here has to filter.
- */
-export function PortalPage() {
- const { session, signOut } = useSession();
- const canExchanges = useSessionCan("portal-exchanges.view");
- const canSubscriptions = useSessionCan("portal-subscriptions.view");
- const canMappings = useSessionCan("portal-mappings.view");
- const canManagePeople = useSessionCan("portal-people.edit");
- const canDetails = useSessionCan("portal-properties.view");
- const canPeople = useSessionCan("portal-people.view") || canManagePeople;
-
- return (
-
-
-
-
-
{session?.partner?.name}
-
- Partner portal
-
-
- {canPeople && (
-
- People
-
- )}
- {session?.user.displayName}
-
- Password
-
-
-
-
-
- {!canExchanges && !canSubscriptions && !canMappings && !canDetails ? (
- } title="Nothing to show yet">
- Your role doesn't include anything to see here. Ask whoever set up your account to give you a role.
-
- ) : (
- <>
- {canExchanges && }
-
- {canExchanges ?
:
}
-
- {canDetails && }
- {canMappings && }
- {canSubscriptions && }
-
-
- >
- )}
-
-
- );
-}
-
-function Summary() {
- const summary = useQuery({ queryKey: keys.portal.summary, queryFn: () => api.getPortalSummary(), refetchInterval: 60_000 });
- if (summary.isError) return void summary.refetch()} />;
- const tiles = [
- { label: "Delivered", value: summary.data?.succeeded, title: "Exchanges in the last 24 hours that finished without an error." },
- { label: "Failed", value: summary.data?.failed, title: "Exchanges in the last 24 hours that finished with an error." },
- { label: "Running", value: summary.data?.running, title: "Exchanges in the last 24 hours that haven't finished yet." },
- ];
- return (
-
- {tiles.map((t) => (
-
-
{t.label} · 24 h
-
{t.value == null ? "-" : whole(t.value)}
-
- ))}
-
- );
-}
-
-function Mappings() {
- const mappings = useQuery({ queryKey: keys.portal.mappings, queryFn: () => api.listPortalMappings() });
- return (
-
- {mappings.isPending ? (
-
- ) : mappings.isError ? (
- void mappings.refetch()} />
- ) : mappings.data.length === 0 ? (
- Nothing is connected to you yet.
- ) : (
-
- {mappings.data.map((m) => (
- -
-
-
-
- {m.subscriptionName}
-
-
- {m.via}
-
-
- {m.waiting && (
-
- Waiting
-
- )}
- {m.setAside ? (
-
- Set aside
-
- ) : m.customized ? (
-
- Yours
-
- ) : (
- Ours
- )}
-
-
- ))}
-
- )}
-
- );
-}
-
-function Subscriptions() {
- const subscriptions = useQuery({ queryKey: keys.portal.subscriptions, queryFn: () => api.listPortalSubscriptions() });
- return (
-
- {subscriptions.isPending ? (
-
- ) : subscriptions.isError ? (
- void subscriptions.refetch()} />
- ) : subscriptions.data.length === 0 ? (
- None yet.
- ) : (
-
- {subscriptions.data.map((s) => (
- -
-
-
- {s.name}
-
-
- {s.documentName}
-
-
- {s.paused && (
-
- Paused
-
- )}
-
- ))}
-
- )}
-
- );
-}
-
-function Exchanges() {
- const canSubscriptions = useSessionCan("portal-subscriptions.view");
- const [status, setStatus] = useState("all");
- const [subscriptionId, setSubscriptionId] = useState("");
- const [page, setPage] = useState(0);
- // Kept as the row opened, and followed as the list refreshes: an exchange opened while running
- // shows its result once it has one. Off the page after a refresh, the last copy stays open.
- const [opened, setOpen] = useState(null);
-
- const query = { status: status === "all" ? null : status, subscriptionId: subscriptionId || null, page, size: PAGE_SIZE };
- const exchanges = useQuery({
- queryKey: keys.portal.exchanges(query),
- queryFn: () => api.searchPortalExchanges(query),
- placeholderData: keepPreviousData,
- refetchInterval: page === 0 ? 30_000 : false,
- });
- const subscriptions = useQuery({
- queryKey: keys.portal.subscriptions,
- queryFn: () => api.listPortalSubscriptions(),
- enabled: canSubscriptions,
- });
-
- return (
-
- {
- setStatus(v);
- setPage(0);
- }}
- options={[
- { value: "all", label: "All", title: "Every exchange" },
- { value: "failed", label: "Failed", title: STATUS.failed.title },
- { value: "running", label: "Running", title: STATUS.running.title },
- { value: "success", label: "Delivered", title: STATUS.success.title },
- ]}
- />
- {/* Still shown while a filter is on, even if the list has shrunk, so it can be cleared. */}
- {canSubscriptions && ((subscriptions.data?.length ?? 0) > 1 || subscriptionId !== "") && (
-
-
- )}
-
- }
- >
- {exchanges.isPending ? (
-
- ) : exchanges.isError ? (
- void exchanges.refetch()} />
- ) : exchanges.data.result.length === 0 ? (
- {page === 0 ? "No exchanges match." : "No more exchanges."}
- ) : (
-
-
-
-
- | Started |
- Status |
- Subscription |
- Information type |
- Took |
-
-
-
- {exchanges.data.result.map((x) => (
- setOpen(x)}
- className="cursor-pointer border-b border-ink-100 hover:bg-ink-50 focus-within:bg-ink-50"
- >
- |
- {/* The row is a shortcut for the mouse; this is the control, for everyone. */}
-
- |
-
-
- {STATUS[x.status].label}
-
- |
- {x.subscriptionName ?? "-"} |
- {x.documentName} |
-
- {x.finishedOn ? duration(x.startedOn, x.finishedOn) : "-"}
- |
-
- ))}
-
-
-
- )}
- {exchanges.data && (page > 0 || exchanges.data.hasMore) && (
-
- {/* Off while the next page loads: the rows and "more" shown are still the last page's. */}
-
- Page {page + 1}
-
-
- )}
- {opened && (
- x.id === opened.id) ?? opened} onClose={() => setOpen(null)} />
- )}
-
- );
-}
-
-function ExchangeDialog({ x, onClose }: { x: PortalExchange; onClose: () => void }) {
- return (
-
- );
-}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPeoplePage.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPeoplePage.tsx
index 07b45940..e5a1b3f0 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPeoplePage.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/PortalPeoplePage.tsx
@@ -1,16 +1,15 @@
import { useState } from "react";
-import { Link } from "react-router";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { ArrowLeft, UserPlus } from "lucide-react";
+import { UserPlus } from "lucide-react";
import { api, type PortalInvite, type PortalPerson } from "../../api";
import { keys } from "../../api/queryKeys";
-import { useSession } from "../../auth/useSession";
import { useSessionCan } from "../../auth/useSessionCan";
import { Badge, Button, FormError, LoadError, LoadingBlock } from "../../components/ui/basics";
import { CopyField } from "../../components/ui/CopyField";
import { Field, Select, TextInput } from "../../components/ui/forms";
import { ConfirmDialog, Dialog } from "../../components/ui/overlays";
import { Panel } from "../../components/ui/Panel";
+import { PageHeader } from "../../components/layout/PageHeader";
import { Table } from "../../components/ui/Table";
import { formatDateTime, timeAgo } from "../../lib/dates";
@@ -20,7 +19,6 @@ import { formatDateTime, timeAgo } from "../../lib/dates";
* their admins, so another admin's row has nothing to change.
*/
export function PortalPeoplePage() {
- const { session } = useSession();
const canEdit = useSessionCan("portal-people.edit");
const queryClient = useQueryClient();
const people = useQuery({ queryKey: keys.portal.people, queryFn: () => api.listPortalPeople() });
@@ -68,19 +66,8 @@ export function PortalPeoplePage() {
);
return (
-
-
-
-
+
+
)}
-
{adding && roles.data && (
api.listPortalSubscriptions() });
+ const paused = (p: boolean) =>
+ p ? (
+
+ Paused
+
+ ) : (
+
+ Running
+
+ );
+
+ return (
+
+
+ {subscriptions.isPending ? (
+
+ ) : subscriptions.isError ? (
+
void subscriptions.refetch()} />
+ ) : subscriptions.data.length === 0 ? (
+ When something runs for your company, it shows here.
+ ) : (
+ s.id}
+ columns={[
+ { header: "Name", wrap: true, cell: (s) => {s.name} },
+ { header: "Information type", headerTitle: "The kind of information it carries", cell: (s) => s.documentName },
+ { header: "State", headerTitle: "Running, or paused", align: "right", cell: (s) => paused(s.paused) },
+ ]}
+ card={(s) => ({ title: s.name, status: paused(s.paused), subtitle: s.documentName })}
+ />
+ )}
+
+ );
+}
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/YourDetails.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/YourDetails.tsx
index 380d8af9..df8ee6c3 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/YourDetails.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/YourDetails.tsx
@@ -28,13 +28,13 @@ export function YourDetails() {
if (details.isPending)
return (
-
+
);
if (details.isError)
return (
-
+
void details.refetch()} />
);
@@ -43,8 +43,8 @@ export function YourDetails() {
const editable = d.properties.filter((p) => p.editable);
return (
0 && (
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalFrame.test.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalFrame.test.tsx
new file mode 100644
index 00000000..22476a69
--- /dev/null
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalFrame.test.tsx
@@ -0,0 +1,138 @@
+import { cleanup, screen, waitFor, within } from "@testing-library/react";
+import { http, HttpResponse } from "msw";
+import { describe, expect, it } from "vitest";
+import { ALL_PERMISSIONS, apiPath, renderApp } from "../../../__tests__/support/renderApp";
+
+const ACME = { id: 7, name: "Acme Freight" };
+const LOOK = ["portal-exchanges.view", "portal-exchange-files.view", "portal-exchange-errors.view", "portal-subscriptions.view"];
+const RETRY = [...LOOK, "portal-exchanges.operate"];
+
+/** A row as the portal's search answers it: our team's row, stripped on the server. */
+const failed = {
+ id: "00000000-0000-4000-8000-000000000001",
+ subscriptionId: 3,
+ subscriptionName: "Acme webhook",
+ documentId: 5,
+ documentName: "SHIPMENT",
+ mapperId: "mapper",
+ status: false,
+ responseBad: null,
+ exception: "The remote server returned 500",
+ startedOn: "2026-11-24T10:00:00Z",
+ finishedOn: "2026-11-24T10:00:02Z",
+ inputFileName: "in.json",
+ inputFileSize: 12,
+ inputUrl: "https://bitween.test/api/files/seal/in",
+ outputFileSize: 0,
+ responseFileSize: 0,
+ promotedProperties: { orderNo: "A-1" },
+ retryFor: null,
+ hasRetry: false,
+ aggregationXchangeId: null,
+ correlationId: null,
+ partnerId: 7,
+ scheduledRetryOn: null,
+};
+
+/** The portal's API, recording what the Exchanges page asked of it. */
+function portal(rows: unknown[] = [failed]) {
+ const asked: string[] = [];
+ const retried: unknown[] = [];
+ const handlers = [
+ http.get(apiPath("/portal/xchangesearch"), ({ request }) => {
+ asked.push(new URL(request.url).search);
+ return HttpResponse.json({ result: rows, totalCount: rows.length });
+ }),
+ http.get(apiPath("/portal/xchangesummary"), () =>
+ HttpResponse.json({ counts: { processing: 0, success: 0, badResponse: 0, failed: rows.length }, buckets: [], bucketMinutes: 0 }),
+ ),
+ http.get(apiPath("/portal/subscriptions"), () =>
+ HttpResponse.json([{ id: 3, name: "Acme webhook", type: "Internal", documentName: "SHIPMENT", paused: false }]),
+ ),
+ http.get(apiPath("/portal/informationtypes"), () =>
+ HttpResponse.json([{ id: 5, name: "SHIPMENT", code: null, promotedPropertyKeys: ["orderNo"] }]),
+ ),
+ http.get("https://bitween.test/api/files/seal/in", () => HttpResponse.text('{"orderNo":"A-1"}')),
+ http.post(apiPath("/portal/retry"), async ({ request }) => {
+ retried.push(await request.json());
+ return HttpResponse.json({ xchangeId: "00000000-0000-4000-8000-000000000002" });
+ }),
+ ];
+ return { handlers, asked, retried };
+}
+
+describe("the partner portal, in the app's own frame", () => {
+ it("lands a partner's person on their Exchanges, with only their pages in the sidebar", async () => {
+ const { handlers, asked } = portal();
+ const { router } = renderApp("/exchanges", { as: { partner: ACME, permissions: RETRY }, handlers });
+
+ const nav = await screen.findByRole("navigation", { name: "Main" });
+ await waitFor(() => expect(router.state.location.pathname).toBe("/portal"));
+ expect(within(nav).getByRole("link", { name: "Exchanges" })).toHaveAttribute("href", "/portal");
+ expect(within(nav).getByRole("link", { name: "Subscriptions" })).toBeVisible();
+ expect(within(nav).queryByRole("link", { name: "Partners" })).not.toBeInTheDocument();
+ expect(await screen.findByText("Acme webhook")).toBeVisible();
+ expect(asked.length).toBeGreaterThan(0);
+ });
+
+ it("takes a partner's person from a look-alike address to the portal", async () => {
+ for (const path of ["/portal-old", "/portal/nothing-here"]) {
+ const { router } = renderApp(path, { as: { partner: ACME, permissions: RETRY }, handlers: portal().handlers });
+ await waitFor(() => expect(router.state.location.pathname).toBe("/portal"));
+ cleanup();
+ }
+ });
+
+ it("sends a partner's person whose role has no Exchanges to the first page it does open", async () => {
+ const { router } = renderApp("/", {
+ as: { partner: ACME, permissions: ["portal-mappings.view"] },
+ handlers: [http.get(apiPath("/portal/mappings"), () => HttpResponse.json([]))],
+ });
+ await waitFor(() => expect(router.state.location.pathname).toBe("/portal/mappings"));
+ expect(screen.queryByText(/don't have access/i)).not.toBeInTheDocument();
+ });
+
+ it("keeps our own people out of the portal, and its pages out of their sidebar", async () => {
+ const { router } = renderApp("/portal", { handlers: portal().handlers, as: { permissions: ALL_PERMISSIONS } });
+ const nav = await screen.findByRole("navigation", { name: "Main" });
+ await waitFor(() => expect(router.state.location.pathname).not.toBe("/portal"));
+ expect(within(nav).queryByText("Partner portal")).not.toBeInTheDocument();
+ });
+
+ it("opens an exchange with its document, error and Retry, and none of our tools", async () => {
+ const { handlers, retried } = portal();
+ const { user } = renderApp("/portal", { as: { partner: ACME, permissions: RETRY }, handlers });
+
+ await user.click((await screen.findAllByText("Acme webhook"))[0]);
+ expect((await screen.findAllByText(/The remote server returned 500/)).length).toBeGreaterThan(1);
+ expect(await screen.findByText(/"orderNo"/)).toBeVisible();
+ // No links into our pages, no bulk selection, no AI.
+ expect(screen.queryByRole("link", { name: "Acme webhook" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("checkbox")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /Explain/i })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /Ask/i })).not.toBeInTheDocument();
+
+ await user.click(screen.getByRole("button", { name: /Retry/ }));
+ // Always the current settings: no choice to make.
+ const dialog = await screen.findByRole("dialog", { name: "Retry this exchange?" });
+ expect(within(dialog).queryByRole("checkbox")).not.toBeInTheDocument();
+ await user.click(within(dialog).getByRole("button", { name: "Retry" }));
+ await waitFor(() => expect(retried).toEqual([{ xchangeId: failed.id }]));
+ });
+
+ it("offers no Retry to a role that may only look, and no filter on errors it can't read", async () => {
+ const { user } = renderApp("/portal", {
+ as: { partner: ACME, permissions: ["portal-exchanges.view"] },
+ handlers: portal([{ ...failed, exception: null }]).handlers,
+ });
+ await user.click((await screen.findAllByText("Acme webhook"))[0]);
+ await screen.findByText("Exchange id");
+ expect(screen.queryByRole("button", { name: /Retry/ })).not.toBeInTheDocument();
+
+ await user.click(screen.getByRole("button", { name: "Filter" }));
+ const menu = screen.getByRole("menu", { name: "Add a filter" });
+ expect(within(menu).getByRole("menuitem", { name: "Subscription" })).toBeVisible();
+ expect(within(menu).queryByRole("menuitem", { name: "Partner" })).not.toBeInTheDocument();
+ expect(within(menu).queryByRole("menuitem", { name: /Error message/ })).not.toBeInTheDocument();
+ });
+});
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPage.test.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPage.test.tsx
deleted file mode 100644
index c7500afb..00000000
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPage.test.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-import { cleanup, screen, waitFor, within } from "@testing-library/react";
-import { http, HttpResponse } from "msw";
-import { describe, expect, it } from "vitest";
-import { apiPath, renderApp } from "../../../__tests__/support/renderApp";
-
-const ACME = { id: 7, name: "Acme Freight" };
-const EVERYTHING = [
- "portal-subscriptions.view",
- "portal-exchanges.view",
- "portal-exchange-files.view",
- "portal-exchange-errors.view",
-];
-
-const failed = {
- id: "x-failed-1",
- startedOn: "2026-11-24T10:00:00Z",
- finishedOn: "2026-11-24T10:00:02Z",
- status: "failed",
- documentName: "Shipment",
- subscriptionId: 3,
- subscriptionName: "Acme webhook",
- error: "The remote server returned 500",
- files: [{ kind: "input", name: "in.json", size: 120, url: "https://bitween.test/api/files/seal/in" }],
-};
-
-/** The portal's API, recording which exchange searches were asked for. */
-function portal(rows: unknown[] = [failed]) {
- const searches: string[] = [];
- const handlers = [
- http.get(apiPath("/portal/summary"), () => HttpResponse.json({ partnerName: ACME.name, running: 1, succeeded: 40, failed: 2 })),
- http.get(apiPath("/portal/subscriptions"), () =>
- HttpResponse.json([
- { id: 3, name: "Acme webhook", type: "Internal", documentName: "Shipment", paused: false },
- { id: 4, name: "Acme pickups", type: "Receiving", documentName: "Pickup", paused: true },
- ]),
- ),
- http.get(apiPath("/portal/xchanges"), ({ request }) => {
- searches.push(new URL(request.url).search);
- return HttpResponse.json({ result: rows, hasMore: false });
- }),
- ];
- return { handlers, searches };
-}
-
-describe("the partner portal", () => {
- it("is where a partner's person lands, whatever page they asked for", async () => {
- const { router } = renderApp("/exchanges", { as: { partner: ACME, permissions: EVERYTHING }, handlers: portal().handlers });
-
- expect(await screen.findByRole("heading", { name: ACME.name })).toBeVisible();
- expect(router.state.location.pathname).toBe("/portal");
- // None of the app's own navigation is there to be tried.
- expect(screen.queryByRole("navigation")).not.toBeInTheDocument();
- });
-
- it("takes a partner's person from a look-alike address to the portal, never the app's frame", async () => {
- for (const path of ["/portal-old", "/portal/nothing-here"]) {
- const { router } = renderApp(path, { as: { partner: ACME, permissions: EVERYTHING }, handlers: portal().handlers });
- expect(await screen.findByRole("heading", { name: ACME.name })).toBeVisible();
- expect(router.state.location.pathname).toBe("/portal");
- expect(screen.queryByRole("navigation")).not.toBeInTheDocument();
- cleanup();
- }
- });
-
- it("sends our own people back to the app", async () => {
- const { router } = renderApp("/portal", { handlers: portal().handlers });
- await screen.findByRole("navigation");
- expect(router.state.location.pathname).not.toBe("/portal");
- });
-
- it("shows their exchanges and subscriptions, and an exchange's error and files", async () => {
- const { handlers, searches } = portal();
- const { user } = renderApp("/portal", { as: { partner: ACME, permissions: EVERYTHING }, handlers });
-
- const subscriptions = within((await screen.findByRole("heading", { name: "Subscriptions" })).closest("section")!);
- expect(await subscriptions.findByText("Acme pickups")).toBeVisible();
- expect(subscriptions.getByText("Paused")).toBeVisible();
- expect(await screen.findByText("40")).toBeVisible();
-
- await user.click(await screen.findByRole("button", { name: /Open the exchange of/ }));
- const dialog = within(screen.getByRole("dialog", { name: "Exchange" }));
- expect(dialog.getByText(/The remote server returned 500/)).toBeVisible();
- expect(dialog.getByRole("link", { name: "Download Received" })).toHaveAttribute("href", failed.files[0].url);
- await user.click(dialog.getByRole("button", { name: /close/i }));
-
- await user.click(screen.getByRole("radio", { name: "Failed" }));
- // The rows on screen are the last search's until the filtered one answers.
- await waitFor(() => expect(searches.at(-1)).toContain("status=failed"));
- });
-
- it("shows only what the role allows", async () => {
- renderApp("/portal", {
- as: { partner: ACME, permissions: ["portal-exchanges.view"] },
- handlers: portal([{ ...failed, error: null, files: null }]).handlers,
- });
-
- expect(await screen.findByRole("row", { name: /Acme webhook/ })).toBeVisible();
- expect(screen.queryByRole("heading", { name: "Subscriptions" })).not.toBeInTheDocument();
- });
-
- it("says so when the role allows nothing", async () => {
- renderApp("/portal", { as: { partner: ACME, permissions: [] }, handlers: portal().handlers });
- expect(await screen.findByText("Nothing to show yet")).toBeVisible();
- });
-});
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPeople.test.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPeople.test.tsx
index 63be0894..8f0de37b 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPeople.test.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/PortalPeople.test.tsx
@@ -85,12 +85,13 @@ describe("a partner's admin's people page", () => {
await waitFor(() => expect(disabled).toEqual([{ accountId: 3, disabled: true }]));
});
- it("is reached from the portal only by someone who may see their people", async () => {
- renderApp("/portal", {
+ it("is in the sidebar only for someone who may see their people", async () => {
+ renderApp("/portal/mappings", {
as: { partner: ACME, permissions: ["portal-mappings.view"] },
handlers: [http.get(apiPath("/portal/mappings"), () => HttpResponse.json([]))],
});
- await screen.findByText("Partner portal");
- expect(screen.queryByRole("link", { name: "People" })).not.toBeInTheDocument();
+ const nav = await screen.findByRole("navigation", { name: "Main" });
+ expect(within(nav).getByRole("link", { name: "Mappings" })).toBeVisible();
+ expect(within(nav).queryByRole("link", { name: "People" })).not.toBeInTheDocument();
});
});
diff --git a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/YourDetails.test.tsx b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/YourDetails.test.tsx
index 115dd11b..1fbae236 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/YourDetails.test.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/portal/__tests__/YourDetails.test.tsx
@@ -35,7 +35,7 @@ function backend(needsApproval = false) {
describe("a partner's own details in the portal", () => {
it("shows what we show them, a secret without its value, and changes only what they may", async () => {
const { handlers, saved } = backend();
- const { user } = renderApp("/portal", {
+ const { user } = renderApp("/portal/details", {
as: { partner: ACME, permissions: ["portal-properties.view", "portal-properties.edit"] },
handlers,
});
@@ -56,7 +56,7 @@ describe("a partner's own details in the portal", () => {
it("says a change waits for approval when their changes need it", async () => {
const { handlers } = backend(true);
- const { user } = renderApp("/portal", {
+ const { user } = renderApp("/portal/details", {
as: { partner: ACME, permissions: ["portal-properties.view", "portal-properties.edit"] },
handlers,
});
@@ -67,7 +67,7 @@ describe("a partner's own details in the portal", () => {
});
it("can't be changed by a role that may only look", async () => {
- renderApp("/portal", { as: { partner: ACME, permissions: ["portal-properties.view"] }, handlers: backend().handlers });
+ renderApp("/portal/details", { as: { partner: ACME, permissions: ["portal-properties.view"] }, handlers: backend().handlers });
await screen.findByText("https://acme/in");
expect(screen.queryByRole("button", { name: "Change" })).not.toBeInTheDocument();
});
diff --git a/SW.Bitween.Web/ClientApp/src/pages/team/RoleEditor.tsx b/SW.Bitween.Web/ClientApp/src/pages/team/RoleEditor.tsx
index ae19bfdb..d518b978 100644
--- a/SW.Bitween.Web/ClientApp/src/pages/team/RoleEditor.tsx
+++ b/SW.Bitween.Web/ClientApp/src/pages/team/RoleEditor.tsx
@@ -29,8 +29,17 @@ import { usePageTitle } from "../../lib/pageTitle";
import { usePhone } from "../../lib/useMediaQuery";
/** Live answer to "what would someone with this role actually see?" */
-function AccessPreview({ permissions, total }: { permissions: Set; total: number }) {
- const groups = visibleGroups([...permissions]);
+function AccessPreview({
+ permissions,
+ total,
+ partner = false,
+}: {
+ permissions: Set;
+ total: number;
+ /** A partner role: their portal's sidebar, not ours. */
+ partner?: boolean;
+}) {
+ const groups = visibleGroups([...permissions], partner);
return (
@@ -442,7 +451,7 @@ export function RoleEditor() {
whatever is ticked here. Nothing else in Bitween opens for them.
) : (
-
+
)}
{/* A role that doesn't exist yet has no history, and a system role's grants are
diff --git a/SW.Bitween.Web/ClientApp/src/routePages.tsx b/SW.Bitween.Web/ClientApp/src/routePages.tsx
index 1bcad0bd..604e2a78 100644
--- a/SW.Bitween.Web/ClientApp/src/routePages.tsx
+++ b/SW.Bitween.Web/ClientApp/src/routePages.tsx
@@ -15,7 +15,12 @@ export const AdapterEditorPage = lazy(() => import("./pages/adapters/AdapterEdit
export const AdaptersPage = lazy(() => import("./pages/adapters/AdaptersPage").then((m) => ({ default: m.AdaptersPage })));
export const PortalMappingPage = lazy(() => import("./pages/portal/PortalMappingPage").then((m) => ({ default: m.PortalMappingPage })));
export const PortalPeoplePage = lazy(() => import("./pages/portal/PortalPeoplePage").then((m) => ({ default: m.PortalPeoplePage })));
-export const PortalPage = lazy(() => import("./pages/portal/PortalPage").then((m) => ({ default: m.PortalPage })));
+export const PortalExchangesPage = lazy(() => import("./pages/portal/PortalExchangesPage").then((m) => ({ default: m.PortalExchangesPage })));
+export const PortalMappingsPage = lazy(() => import("./pages/portal/PortalMappingsPage").then((m) => ({ default: m.PortalMappingsPage })));
+export const PortalSubscriptionsPage = lazy(() =>
+ import("./pages/portal/PortalSubscriptionsPage").then((m) => ({ default: m.PortalSubscriptionsPage })),
+);
+export const PortalDetailsPage = lazy(() => import("./pages/portal/PortalDetailsPage").then((m) => ({ default: m.PortalDetailsPage })));
export const ProfilePage = lazy(() => import("./pages/ProfilePage").then((m) => ({ default: m.ProfilePage })));
export const AuditPage = lazy(() => import("./pages/audit/AuditPage").then((m) => ({ default: m.AuditPage })));
export const NodesPage = lazy(() => import("./pages/nodes/NodesPage").then((m) => ({ default: m.NodesPage })));
diff --git a/SW.Bitween.Web/ClientApp/src/router.tsx b/SW.Bitween.Web/ClientApp/src/router.tsx
index 51f0d074..87c1eae2 100644
--- a/SW.Bitween.Web/ClientApp/src/router.tsx
+++ b/SW.Bitween.Web/ClientApp/src/router.tsx
@@ -54,7 +54,10 @@ import {
PartnerChangesPage,
PortalMappingPage,
PortalPeoplePage,
- PortalPage,
+ PortalExchangesPage,
+ PortalMappingsPage,
+ PortalSubscriptionsPage,
+ PortalDetailsPage,
ProfilePage,
QueueHealthPage,
ResponseSubscriptionsPage,
@@ -115,6 +118,12 @@ const PAGE_ELEMENTS: Record = {
partners: ,
partner: ,
partnerChanges: ,
+ portalExchanges: ,
+ portalMappings: ,
+ portalMapping: ,
+ portalSubscriptions: ,
+ portalDetails: ,
+ portalPeople: ,
dataSources: ,
dataSourceNew: ,
dataSource: ,
@@ -161,16 +170,18 @@ export interface PageHandle {
const pageRoutes: RouteObject[] = (Object.keys(PAGES) as PageId[]).map((id) => {
const { path, permission, alsoFor } = PAGES[id];
const element = PAGE_ELEMENTS[id];
+ const guarded = permission ? (
+
+ {element}
+
+ ) : (
+ element
+ );
return {
path,
handle: { page: id } satisfies PageHandle,
- element: permission ? (
-
- {element}
-
- ) : (
- element
- ),
+ // A partner's people's pages are theirs alone, whatever else a session holds.
+ element: PAGES[id].audience === "partner" ? {guarded} : guarded,
};
});
@@ -205,40 +216,6 @@ export const routes: RouteObject[] = [
),
},
- // A partner's person sees this and nothing else; it has its own frame, without the app's
- // sidebar, none of whose pages they may open.
- {
- path: PORTAL_PATH.slice(1),
- element: ,
- children: [
- {
- index: true,
- element: (
- }>
-
-
- ),
- },
- {
- path: "mappings/:subscriptionId",
- element: (
- }>
-
-
- ),
- },
- {
- path: "people",
- element: (
- }>
-
-
- ),
- },
- // Anything else under /portal is not a page: back to the portal, never the app's frame.
- { path: "*", element: },
- ],
- },
{
element: ,
children: [
@@ -247,6 +224,8 @@ export const routes: RouteObject[] = [
// itself is no longer a page - only a bookmark people may still hold.
{ path: "team", element: },
...pageRoutes,
+ // Anything else under /portal is not a page: back to the portal's first page.
+ { path: "portal/*", element: },
{ path: "*", element: },
],
},
diff --git a/docs/security.md b/docs/security.md
index 086c9d25..1ebebf70 100644
--- a/docs/security.md
+++ b/docs/security.md
@@ -100,7 +100,7 @@ A permission is written `area.action`. Every account, person or service account,
| Administration | `adapter-source` | view, edit, operate |
| Administration | `mirror` | view, operate |
| Partner portal | `portal-subscriptions` | view |
-| Partner portal | `portal-exchanges` | view |
+| Partner portal | `portal-exchanges` | view, operate |
| Partner portal | `portal-exchange-files` | view |
| Partner portal | `portal-exchange-errors` | view |
| Partner portal | `portal-mappings` | view, edit |
@@ -141,10 +141,11 @@ A partner's own people can sign in and see their partner's data, and nothing els
- **Partner accounts.** On the Members page, choose **A partner's person** when adding someone, and pick the partner. The partner is fixed once the account exists. The list shows who belongs to which partner under **Belongs to**.
- **Partner roles.** The built-in **Partner viewer** is picked for a new partner's person, ready to use. For anything else, create a role and choose **A partner's people** under **Who it's for**. A partner role holds only the Partner portal permissions, and any other role holds none of them. Partner accounts hold only partner roles. Roles are shared across partners: the role says what someone may do, and the account's partner says whose data. Only someone who holds the Partner portal permissions, which today means an Administrator, can create partner roles or give them out.
-- **What they see.** After signing in, a partner account goes to `/portal`: the last 24 hours of its exchanges, its exchanges newest first, and its subscriptions. Each permission opens one part. `portal-exchange-files` adds the exchange files and `portal-exchange-errors` adds why an exchange failed. Errors can name addresses and systems on your side, so give that permission with care.
+- **What they see.** A partner's people use Bitween's own frame with their own sidebar: **Exchanges**, **Mappings**, **Subscriptions**, **Your details** and **People**, each shown only to a role that opens it, and none of your pages. After signing in they land on the first of those pages their role opens, usually `/portal`, their Exchanges: Bitween's own list, status counts, filters and exchange drawer, reading only their exchanges through `/api/portal`. They filter by subscription, information type, correlation id, exchange id, promoted property, retries and scheduled retries; not by partner, run or aggregation. The drawer shows the documents, the error and the retry chain, without links into your pages, bulk actions, the volume chart or the AI features. `portal-exchange-files` adds the exchange files and `portal-exchange-errors` adds why an exchange failed. Errors can name addresses and systems on your side, so give that permission with care. The server strips what is yours to know from every row (adapters, storage keys, aggregation and response wiring, retry policy reasons) and refuses filters and sorts on anything else.
- **What they can't reach.** Partner accounts get 403 from every endpoint outside `/api/portal`, apart from signing in and out, their profile, changing their password and opening file links. This is enforced in one place for every kind of token, including `/mcp`. Administrators get 403 from `/api/portal`, because they have no partner.
- **Which exchanges.** An exchange belongs to a partner when it carries that partner's id. Exchanges from before that column existed carry none and don't show in the portal.
- A partner with portal users can't be deleted until they are removed.
+- **Retrying.** With `portal-exchanges.operate`, which Partner editor and Partner admin hold, a failed exchange has **Retry**. It runs again with the subscription's current settings and their own mapping and details as they are now, so a fix they just made is used. Only their own failed exchanges, only the latest attempt, and not while a retry policy has one scheduled. Each retry is in the audit trail as made from the partner portal.
- **Their own people.** Someone with `portal-people.edit`, such as the built-in **Partner admin**, gets a **People** page in the portal listing their company's people. They invite someone by email, or with a link to pass on when there is no mail server, and can change a person's role, send the invite again, disable and remove them. They can give only partner roles that don't include `portal-people.edit`, and only what they hold themselves. They can't change their own account, or another of their admins, which only your team can. Only your team makes someone a partner admin, on the Members page. An email already used anywhere in Bitween is refused without saying where.
- **Their own mappings.** The **Mappings** card lists every place the partner is connected: subscriptions that belong to them, API gateways they are attached to, and bus gateway routes that name them. With `portal-mappings.edit` they can make their own version of a place's mapping in the mapping editor, starting from yours, and preview it against one of their recent exchanges. Their version is used for their exchanges only, from the next one on, including retries; everyone else on the same gateway keeps your mapping, and **Go back to ours** deletes theirs. It works for subscriptions that map with the native mapper or don't map at all. Their rules can read the document and the partner properties they can see, but no other partner property or global value that your mapping doesn't already send them, by rule or by `{{globals.…}}` placeholder; saving and previewing refuse it. If your mapping later stops reading a global value theirs reads, theirs is set aside and they get yours until they change it; the portal and the subscription page both say so. Only their rules are kept, never the editor's sample documents. Every change is in the audit trail as **Partner mapping**, in full. The subscription's **Transformation** panel lists the partners with their own mapping, who changed it last and when, with **See rules**, and **Remove** for someone with `subscriptions.edit`, which puts that partner back on your mapping.