Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+7
-4
@@ -11,6 +11,7 @@ import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { connectionStatusBadge } from "./integrationsBadges";
|
||||
import { APP_TIME_ZONE } from "~/locale/format";
|
||||
|
||||
export type ConnectionCardProps = {
|
||||
row: ConnectionRow;
|
||||
@@ -25,7 +26,7 @@ export type ConnectionCardProps = {
|
||||
|
||||
export function ConnectionCard({ row, canDisconnect, canManualSync, canReconnect, submitting, onManualSync, onReconnect, onDisconnect }: ConnectionCardProps) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { dateStyle: "medium", timeStyle: "short" });
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { timeZone: APP_TIME_ZONE, dateStyle: "medium", timeStyle: "short" });
|
||||
const unhealthy = row.status === "degraded" || row.status === "broken";
|
||||
const revoked = row.status === "revoked";
|
||||
|
||||
@@ -46,9 +47,11 @@ export function ConnectionCard({ row, canDisconnect, canManualSync, canReconnect
|
||||
{t("integrations.connections.column.lastCheck")}: {row.lastHealthCheckIso ? dateFormatter.format(new Date(row.lastHealthCheckIso)) : "—"}
|
||||
</span>
|
||||
<div className="flex w-full flex-wrap items-center justify-between gap-2">
|
||||
<Link to={row.syncsHref} className="contents no-underline">
|
||||
<LinkButton variant="subtle">{t("integrations.connections.actions.history")}</LinkButton>
|
||||
</Link>
|
||||
{row.syncsHref ? (
|
||||
<Link to={row.syncsHref} className="contents no-underline">
|
||||
<LinkButton variant="subtle">{t("integrations.connections.actions.history")}</LinkButton>
|
||||
</Link>
|
||||
) : null}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{canManualSync && !revoked ? (
|
||||
<Button variant="secondary" size="small" loading={submitting} onClick={() => onManualSync(row.id)} data-ui-id="ui.integrations.app.resync">
|
||||
|
||||
+66
-24
@@ -7,16 +7,15 @@
|
||||
// Klartext requirement). Final Subframe optics = tracked design-nachzug.
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherPlus } from "@subframe/core";
|
||||
import { FeatherDownloadCloud, FeatherPlug, FeatherPlus } from "@subframe/core";
|
||||
import type { AppCredentialField } from "@hivegrid/integrations";
|
||||
import type { ConnectionDetailVM, ConnectionRow } from "@hivegrid/view-models";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Dialog } from "~/ui/components/Dialog";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { PageBody, PageIntro, PageShell } from "../shared/PageShell";
|
||||
import { ConnectionCard } from "./ConnectionCard";
|
||||
import { ConnectWizardDialog, type ConnectWizardMode, type ConnectWizardSubmit } from "./ConnectWizardDialog";
|
||||
|
||||
@@ -35,17 +34,21 @@ export type ConnectionDetailPageProps = {
|
||||
vm: ConnectionDetailVM;
|
||||
connectionType: string;
|
||||
credentialFields: readonly AppCredentialField[];
|
||||
backHref: string;
|
||||
actions: ConnectionDetailActions;
|
||||
submitting: boolean;
|
||||
errorMessage: string | null;
|
||||
feedback?: {
|
||||
readonly variant: "success" | "error";
|
||||
readonly titleKey: string;
|
||||
readonly descriptionKey: string;
|
||||
} | null;
|
||||
/** Increments after a successful mutation — closes any open dialog. */
|
||||
closeSignal: number;
|
||||
};
|
||||
|
||||
type WizardState = ConnectWizardMode | null;
|
||||
|
||||
export function ConnectionDetailPage({ vm, connectionType, credentialFields, backHref, actions, submitting, errorMessage, closeSignal }: ConnectionDetailPageProps) {
|
||||
export function ConnectionDetailPage({ vm, connectionType, credentialFields, actions, submitting, errorMessage, feedback, closeSignal }: ConnectionDetailPageProps) {
|
||||
const { t } = useTranslation();
|
||||
const [wizard, setWizard] = useState<WizardState>(null);
|
||||
const [disconnectRow, setDisconnectRow] = useState<ConnectionRow | null>(null);
|
||||
@@ -58,32 +61,70 @@ export function ConnectionDetailPage({ vm, connectionType, credentialFields, bac
|
||||
}, [closeSignal]);
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.app" />;
|
||||
return <PageShell uiId="ui.integrations.app" />;
|
||||
}
|
||||
|
||||
const { appTitleKey, rows, canConnect, canDisconnect, canManualSync, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
const { appKey, appTitleKey, rows, canConnect, canDisconnect, canManualSync, connectHref, projectImportHref, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
const unhealthy = rows.filter((row) => row.status === "degraded" || row.status === "broken");
|
||||
const openConnect = (mode: ConnectWizardMode) => {
|
||||
if (appKey === "kwp") {
|
||||
window.location.assign(connectHref);
|
||||
return;
|
||||
}
|
||||
setWizard(mode);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.app">
|
||||
{/* Breadcrumb back to the catalog (DoD B9) + header with connect CTA */}
|
||||
<Link to={backHref} className="contents no-underline" data-ui-id="ui.integrations.app.back">
|
||||
<LinkButton variant="subtle">{t("integrations.connections.back")}</LinkButton>
|
||||
</Link>
|
||||
<div className="flex flex-wrap items-start justify-between gap-4">
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-heading-2 font-heading-2 text-text-neutral-primary">{t(appTitleKey)}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.connections.subtitle")}
|
||||
</span>
|
||||
<PageShell uiId="ui.integrations.app">
|
||||
<PageBody>
|
||||
{/* Embedded in the Erweiterungen hub (AK-SET-01): the hub owns the page
|
||||
<h1> and tab bar, so this screen carries a simple section heading. */}
|
||||
<div className="flex w-full items-start justify-between gap-4 mobile:flex-col">
|
||||
<div className="flex min-w-0 flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<FeatherPlug className="text-heading-3 font-heading-3 text-icon-neutral-tertiary" />
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary" data-ui-id="ui.integrations.app.title">
|
||||
{t(appTitleKey)}
|
||||
</span>
|
||||
</div>
|
||||
<PageIntro uiId="ui.integrations.app.intro">{t("integrations.connections.subtitle")}</PageIntro>
|
||||
</div>
|
||||
{canConnect ? (
|
||||
<Button icon={<FeatherPlus />} onClick={() => setWizard({ type: "connect" })} data-ui-id="ui.integrations.app.connect">
|
||||
{/* The empty state below carries its own connect button — only show the
|
||||
header action once at least one connection exists. */}
|
||||
{canConnect && rows.length > 0 ? (
|
||||
<Button icon={<FeatherPlus />} onClick={() => openConnect({ type: "connect" })} data-ui-id="ui.integrations.app.connect">
|
||||
{t("integrations.connections.add")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{feedback ? (
|
||||
<Alert
|
||||
variant={feedback.variant}
|
||||
title={t(feedback.titleKey)}
|
||||
description={t(feedback.descriptionKey)}
|
||||
data-ui-id="ui.integrations.kwp.oauth.feedback"
|
||||
/>
|
||||
) : null}
|
||||
{projectImportHref ? (
|
||||
<Alert
|
||||
variant="information"
|
||||
title={t("integrations.kwp.projectImport.entry.title")}
|
||||
description={t("integrations.kwp.projectImport.entry.body")}
|
||||
actions={
|
||||
<Button
|
||||
variant="tertiary"
|
||||
size="small"
|
||||
icon={<FeatherDownloadCloud />}
|
||||
onClick={() => window.location.assign(projectImportHref)}
|
||||
data-ui-id="ui.integrations.kwp.project-import.open"
|
||||
>
|
||||
{t("integrations.kwp.projectImport.entry.action")}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{/* Screen banner (hierarchy §8): at least one degraded/broken connection. */}
|
||||
{unhealthy.length > 0 ? (
|
||||
<Alert
|
||||
@@ -92,7 +133,7 @@ export function ConnectionDetailPage({ vm, connectionType, credentialFields, bac
|
||||
description={unhealthy[0].healthMessageKey ? t(unhealthy[0].healthMessageKey) : undefined}
|
||||
actions={
|
||||
canConnect ? (
|
||||
<Button variant="secondary" size="small" onClick={() => setWizard({ type: "reconnect", connectionId: unhealthy[0].id, label: unhealthy[0].label })}>
|
||||
<Button variant="secondary" size="small" onClick={() => openConnect({ type: "reconnect", connectionId: unhealthy[0].id, label: unhealthy[0].label })}>
|
||||
{t("integrations.connections.actions.reconnect")}
|
||||
</Button>
|
||||
) : undefined
|
||||
@@ -105,7 +146,7 @@ export function ConnectionDetailPage({ vm, connectionType, credentialFields, bac
|
||||
<div className="flex w-full flex-col items-center gap-4" data-ui-id="ui.integrations.app.empty">
|
||||
<EmptyState title={t(emptyHeadlineKey)} body={t(emptyBodyKey)} />
|
||||
{canConnect ? (
|
||||
<Button icon={<FeatherPlus />} onClick={() => setWizard({ type: "connect" })}>
|
||||
<Button icon={<FeatherPlus />} onClick={() => openConnect({ type: "connect" })}>
|
||||
{t("integrations.connections.add")}
|
||||
</Button>
|
||||
) : null}
|
||||
@@ -121,7 +162,7 @@ export function ConnectionDetailPage({ vm, connectionType, credentialFields, bac
|
||||
canReconnect={canConnect}
|
||||
submitting={submitting}
|
||||
onManualSync={actions.onManualSync}
|
||||
onReconnect={(target) => setWizard({ type: "reconnect", connectionId: target.id, label: target.label })}
|
||||
onReconnect={(target) => openConnect({ type: "reconnect", connectionId: target.id, label: target.label })}
|
||||
onDisconnect={setDisconnectRow}
|
||||
/>
|
||||
))}
|
||||
@@ -172,6 +213,7 @@ export function ConnectionDetailPage({ vm, connectionType, credentialFields, bac
|
||||
)}
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</div>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
+98
-53
@@ -8,27 +8,50 @@
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherLayers, FeatherPlug } from "@subframe/core";
|
||||
import type { CatalogAppRow, IntegrationCatalogVM } from "@hivegrid/view-models";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { SearchInput } from "~/ui/components/SearchInput";
|
||||
import { PAGE_HEADER_ICON_CLASS, PageBody, PageHeader, PageIntro, PageShell } from "../shared/PageShell";
|
||||
import { FacetFilterBar } from "../shared/FacetFilterBar";
|
||||
|
||||
export type IntegrationsCatalogPageProps = {
|
||||
vm: IntegrationCatalogVM;
|
||||
/** Inside the Erweiterungen hub (AK-SET-01) the hub owns the header. */
|
||||
embedded?: boolean;
|
||||
};
|
||||
|
||||
export function IntegrationsCatalogPage({ vm }: IntegrationsCatalogPageProps) {
|
||||
export function IntegrationsCatalogPage({ vm, embedded = false }: IntegrationsCatalogPageProps) {
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState("");
|
||||
const [category, setCategory] = useState<string | null>(null);
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.catalog" />;
|
||||
return (
|
||||
<PageShell uiId="ui.integrations.catalog">
|
||||
{embedded ? null : (
|
||||
<PageHeader
|
||||
icon={<FeatherPlug className={PAGE_HEADER_ICON_CLASS} />}
|
||||
title={t("integrations.catalog.title")}
|
||||
subtitle={t("integrations.catalog.subtitle")}
|
||||
/>
|
||||
)}
|
||||
<PageBody>{null}</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
const { rows, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
const needle = query.trim().toLowerCase();
|
||||
const visible = needle ? rows.filter((row) => t(row.titleKey).toLowerCase().includes(needle) || t(row.categoryKey).toLowerCase().includes(needle)) : rows;
|
||||
// Category options come from the catalog itself, in first-appearance order,
|
||||
// so the facet can never offer a category that has no app behind it.
|
||||
const categoryKeys = [...new Set(rows.map((row) => row.categoryKey))];
|
||||
const visible = rows.filter((row) => {
|
||||
if (category && row.categoryKey !== category) return false;
|
||||
if (!needle) return true;
|
||||
return t(row.titleKey).toLowerCase().includes(needle) || t(row.categoryKey).toLowerCase().includes(needle);
|
||||
});
|
||||
|
||||
// Group by category (stable order: first appearance in the catalog).
|
||||
const groups: { categoryKey: string; rows: CatalogAppRow[] }[] = [];
|
||||
@@ -39,55 +62,77 @@ export function IntegrationsCatalogPage({ vm }: IntegrationsCatalogPageProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.catalog">
|
||||
{/* Header: title + subtitle (0px rhythm) */}
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-heading-2 font-heading-2 text-text-neutral-primary">{t("integrations.catalog.title")}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.catalog.subtitle")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<SearchInput
|
||||
className="max-w-[320px]"
|
||||
placeholder={t("integrations.catalog.searchPlaceholder")}
|
||||
hideShortcut
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
/>
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<div data-ui-id="ui.integrations.catalog.empty">
|
||||
<EmptyState title={t(emptyHeadlineKey)} body={t(emptyBodyKey)} />
|
||||
</div>
|
||||
) : visible.length === 0 ? (
|
||||
<EmptyState variant="no-results" title={t("integrations.catalog.noMatches")} body={t(emptyBodyKey)} />
|
||||
) : (
|
||||
<div className="flex w-full flex-col gap-6" data-ui-id="ui.integrations.catalog.list">
|
||||
{groups.map((group) => (
|
||||
<div key={group.categoryKey} className="flex w-full flex-col gap-3" data-catalog-category={group.categoryKey}>
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t(group.categoryKey)}</span>
|
||||
<div className="grid w-full grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{group.rows.map((row) => (
|
||||
<Link key={row.key} to={row.detailHref} className="contents no-underline" data-row-id={row.key}>
|
||||
<Card>
|
||||
<div className="flex w-full items-start justify-between gap-2">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t(row.titleKey)}</span>
|
||||
<BadgeFeedback farbe={row.connectionCount > 0 ? "subtle-positive" : "subtle-neutral"} size="small">
|
||||
{t("integrations.catalog.connectionCount", { count: row.connectionCount })}
|
||||
</BadgeFeedback>
|
||||
</div>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">
|
||||
{t(row.categoryKey)} · {t(`integrations.catalog.connectionType.${row.connectionType}`)}
|
||||
</span>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<PageShell uiId="ui.integrations.catalog">
|
||||
{embedded ? null : (
|
||||
<PageHeader
|
||||
icon={<FeatherPlug className={PAGE_HEADER_ICON_CLASS} />}
|
||||
title={t("integrations.catalog.title")}
|
||||
subtitle={t("integrations.catalog.subtitle")}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<PageBody>
|
||||
{embedded ? <PageIntro uiId="ui.integrations.catalog.intro">{t("integrations.catalog.subtitle")}</PageIntro> : null}
|
||||
{/* --- Filter bar: the shared strip every list wears, in its inline
|
||||
shape - the Erweiterungen hub owns the page chrome above it. The
|
||||
category is a facet now; the cards stay grouped by it, so a picked
|
||||
category simply leaves one group standing. --- */}
|
||||
<FacetFilterBar
|
||||
uiId="ui.integrations.catalog.filter"
|
||||
variant="inline"
|
||||
facets={[
|
||||
{
|
||||
key: "category",
|
||||
label: category ? t(category) : t("integrations.catalog.filter.category"),
|
||||
icon: <FeatherLayers />,
|
||||
tone: "violet-subtle",
|
||||
options: categoryKeys.map((key) => ({ value: key, label: t(key) })),
|
||||
selected: new Set(category ? [category] : []),
|
||||
},
|
||||
]}
|
||||
onToggle={(_facetKey, value) => setCategory(category === value ? null : value)}
|
||||
search={query}
|
||||
onSearchChange={setQuery}
|
||||
searchPlaceholder={t("integrations.catalog.searchPlaceholder")}
|
||||
onReset={() => {
|
||||
setQuery("");
|
||||
setCategory(null);
|
||||
}}
|
||||
labels={{ reset: t("integrations.catalog.filter.reset"), removeChip: t("integrations.catalog.filter.removeChip") }}
|
||||
/>
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<div data-ui-id="ui.integrations.catalog.empty">
|
||||
<EmptyState title={t(emptyHeadlineKey)} body={t(emptyBodyKey)} />
|
||||
</div>
|
||||
) : visible.length === 0 ? (
|
||||
<EmptyState variant="no-results" title={t("integrations.catalog.noMatches")} body={t(emptyBodyKey)} />
|
||||
) : (
|
||||
<div className="flex w-full flex-col gap-6" data-ui-id="ui.integrations.catalog.list">
|
||||
{groups.map((group) => (
|
||||
<div key={group.categoryKey} className="flex w-full flex-col gap-3" data-catalog-category={group.categoryKey}>
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t(group.categoryKey)}</span>
|
||||
<div className="grid w-full grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{group.rows.map((row) => (
|
||||
<Link key={row.key} to={row.detailHref} className="contents no-underline" data-row-id={row.key}>
|
||||
<Card>
|
||||
<div className="flex w-full items-start justify-between gap-2">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t(row.titleKey)}</span>
|
||||
<BadgeFeedback farbe={row.connectionCount > 0 ? "subtle-positive" : "subtle-neutral"} size="small">
|
||||
{t("integrations.catalog.connectionCount", { count: row.connectionCount })}
|
||||
</BadgeFeedback>
|
||||
</div>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">
|
||||
{t(row.categoryKey)} · {t(`integrations.catalog.connectionType.${row.connectionType}`)}
|
||||
</span>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
// @vitest-environment jsdom
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import React from "react";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { KwpProjectImportVM } from "@hivegrid/view-models";
|
||||
|
||||
import { KwpProjectImportPage } from "./KwpProjectImportPage";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) =>
|
||||
values ? `${key}:${Object.values(values).join("/")}` : key,
|
||||
}),
|
||||
}));
|
||||
|
||||
const searchVm: KwpProjectImportVM = {
|
||||
status: "ready",
|
||||
data: {
|
||||
tenantSlug: "acme",
|
||||
backHref: "/acme/integrations/kwp",
|
||||
connectionId: "connection-1",
|
||||
connections: [{ id: "connection-1", label: "KWP" }],
|
||||
query: "P-100",
|
||||
results: [{
|
||||
externalProjectNumber: "P-100",
|
||||
name: "Heizung Schule",
|
||||
status: 8,
|
||||
statusLabel: "Erhalten",
|
||||
}],
|
||||
preview: null,
|
||||
pipelines: [],
|
||||
localProjects: [],
|
||||
boundProjects: [],
|
||||
capability: {
|
||||
status: "active",
|
||||
reasonCode: null,
|
||||
revision: 6,
|
||||
observedFingerprint: "a".repeat(64),
|
||||
diff: null,
|
||||
},
|
||||
catalog: {
|
||||
status: "ready",
|
||||
discoveredCount: 48,
|
||||
hydratedCount: 48,
|
||||
lastDiscoveryAt: "2026-07-24T12:00:00.000Z",
|
||||
lastCompletedAt: "2026-07-24T12:10:00.000Z",
|
||||
},
|
||||
canWrite: true,
|
||||
feedbackKey: null,
|
||||
},
|
||||
};
|
||||
|
||||
const previewVm: KwpProjectImportVM = {
|
||||
...searchVm,
|
||||
data: {
|
||||
...searchVm.data,
|
||||
preview: {
|
||||
externalProjectNumber: "P-100",
|
||||
name: "Heizung Schule",
|
||||
status: 8,
|
||||
statusLabel: "Erhalten",
|
||||
startDate: null,
|
||||
orderValue: null,
|
||||
routing: null,
|
||||
addresses: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const noOp = (): void => undefined;
|
||||
|
||||
describe("KWP project details interaction", () => {
|
||||
it("shows immediate progress and brings successfully loaded details into view", () => {
|
||||
const onSelectProject = vi.fn();
|
||||
const scrollIntoView = vi.fn();
|
||||
const originalScrollIntoView = Element.prototype.scrollIntoView;
|
||||
Object.defineProperty(Element.prototype, "scrollIntoView", {
|
||||
configurable: true,
|
||||
value: scrollIntoView,
|
||||
});
|
||||
const actions = {
|
||||
onSearch: noOp,
|
||||
onSelectProject,
|
||||
onSaveRouting: noOp,
|
||||
onImport: noOp,
|
||||
onApproveContract: noOp,
|
||||
onUnlink: noOp,
|
||||
onRestore: noOp,
|
||||
};
|
||||
|
||||
try {
|
||||
const { rerender } = render(
|
||||
<MemoryRouter>
|
||||
<KwpProjectImportPage vm={searchVm} submitting={false} actions={actions} />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", {
|
||||
name: "integrations.kwp.projectImport.search.select",
|
||||
}));
|
||||
|
||||
expect(onSelectProject).toHaveBeenCalledWith("connection-1", "P-100", "P-100");
|
||||
expect(screen.getByRole("button", {
|
||||
name: "integrations.kwp.projectImport.search.loadingDetails",
|
||||
})).toHaveAttribute("aria-busy", "true");
|
||||
|
||||
rerender(
|
||||
<MemoryRouter>
|
||||
<KwpProjectImportPage vm={previewVm} submitting={false} actions={actions} />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
expect(scrollIntoView).toHaveBeenCalledWith({ behavior: "smooth", block: "start" });
|
||||
expect(screen.getByText("integrations.kwp.projectImport.preview.summary:P-100/Erhalten"))
|
||||
.toBeInTheDocument();
|
||||
} finally {
|
||||
if (originalScrollIntoView) {
|
||||
Object.defineProperty(Element.prototype, "scrollIntoView", {
|
||||
configurable: true,
|
||||
value: originalScrollIntoView,
|
||||
});
|
||||
} else {
|
||||
Reflect.deleteProperty(Element.prototype, "scrollIntoView");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
+614
@@ -0,0 +1,614 @@
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherArrowRight, FeatherDownloadCloud, FeatherRefreshCw } from "@subframe/core";
|
||||
|
||||
import type {
|
||||
KwpAddressRoleVM,
|
||||
KwpProjectImportVM,
|
||||
} from "@hivegrid/view-models";
|
||||
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { RadioGroup } from "~/ui/components/RadioGroup";
|
||||
import { SearchInput } from "~/ui/components/SearchInput";
|
||||
import { Select } from "~/ui/components/Select";
|
||||
import { StepperHorizontal } from "~/ui/components/StepperHorizontal";
|
||||
import { PageBackLink, PageBody, PageIntro, PageShell } from "../shared/PageShell";
|
||||
|
||||
type AddressDecisionState = {
|
||||
contactId: string;
|
||||
personId: string;
|
||||
};
|
||||
|
||||
export type KwpProjectImportActions = {
|
||||
onSearch: (connectionId: string, query: string) => void;
|
||||
onSelectProject: (connectionId: string, query: string, externalProjectNumber: string) => void;
|
||||
onSaveRouting: (input: {
|
||||
connectionId: string;
|
||||
externalStatus: number;
|
||||
pipelineId: string;
|
||||
stageId: string;
|
||||
expectedRevision: number | null;
|
||||
externalProjectNumber: string;
|
||||
query: string;
|
||||
}) => void;
|
||||
onImport: (input: {
|
||||
connectionId: string;
|
||||
externalProjectNumber: string;
|
||||
target: { kind: "create" } | { kind: "link"; projectId: string; expectedUpdatedAt: string };
|
||||
addressDecisions: Array<{
|
||||
role: "project" | "invoice" | "client";
|
||||
addressCode: string;
|
||||
addressContact: { kind: "create" } | { kind: "existing"; contactId: string };
|
||||
primaryContact: null | {
|
||||
externalContactId: string;
|
||||
contact: { kind: "create" };
|
||||
};
|
||||
}>;
|
||||
}) => void;
|
||||
onApproveContract: (input: {
|
||||
connectionId: string;
|
||||
observedFingerprint: string;
|
||||
expectedRevision: number;
|
||||
externalProjectNumber: string;
|
||||
}) => void;
|
||||
onUnlink: (input: {
|
||||
connectionId: string;
|
||||
projectId: string;
|
||||
expectedBindingRevision: number;
|
||||
}) => void;
|
||||
onRestore: (input: {
|
||||
connectionId: string;
|
||||
projectId: string;
|
||||
expectedBindingRevision: number;
|
||||
expectedProjectUpdatedAt: string;
|
||||
}) => void;
|
||||
};
|
||||
|
||||
function defaultAddressDecisions(addresses: readonly KwpAddressRoleVM[]): Record<string, AddressDecisionState> {
|
||||
return Object.fromEntries(addresses.map((address) => [
|
||||
address.role,
|
||||
{
|
||||
contactId: address.candidates[0]?.id ?? "create",
|
||||
personId: "none",
|
||||
},
|
||||
]));
|
||||
}
|
||||
|
||||
function scrollKwpProjectPreviewIntoView(): void {
|
||||
document
|
||||
.querySelector<HTMLElement>("[data-ui-id='ui.integrations.kwp.project-import.preview']")
|
||||
?.scrollIntoView?.({ behavior: "smooth", block: "start" });
|
||||
}
|
||||
|
||||
export function KwpProjectImportPage({
|
||||
vm,
|
||||
actions,
|
||||
submitting,
|
||||
}: {
|
||||
readonly vm: KwpProjectImportVM;
|
||||
readonly actions: KwpProjectImportActions;
|
||||
readonly submitting: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState(vm.status === "ready" ? vm.data.query : "");
|
||||
const [target, setTarget] = useState("create");
|
||||
const [pipelineId, setPipelineId] = useState("");
|
||||
const [stageId, setStageId] = useState("");
|
||||
const preview = vm.status === "ready" ? vm.data.preview : null;
|
||||
const [selectingProjectNumber, setSelectingProjectNumber] = useState<string | null>(null);
|
||||
const selectionNavigationStarted = useRef(false);
|
||||
const [addressDecisions, setAddressDecisions] = useState<Record<string, AddressDecisionState>>(
|
||||
() => defaultAddressDecisions(preview?.addresses ?? []),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setAddressDecisions(defaultAddressDecisions(preview?.addresses ?? []));
|
||||
setPipelineId(preview?.routing?.pipelineId ?? "");
|
||||
setStageId(preview?.routing?.stageId ?? "");
|
||||
}, [preview?.externalProjectNumber, preview?.routing?.pipelineId, preview?.routing?.stageId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectingProjectNumber) {
|
||||
selectionNavigationStarted.current = false;
|
||||
return;
|
||||
}
|
||||
if (submitting) selectionNavigationStarted.current = true;
|
||||
if (
|
||||
preview?.externalProjectNumber === selectingProjectNumber
|
||||
) {
|
||||
setSelectingProjectNumber(null);
|
||||
scrollKwpProjectPreviewIntoView();
|
||||
} else if (selectionNavigationStarted.current && !submitting) {
|
||||
setSelectingProjectNumber(null);
|
||||
}
|
||||
}, [preview?.externalProjectNumber, selectingProjectNumber, submitting]);
|
||||
|
||||
const pipeline = vm.status === "ready"
|
||||
? vm.data.pipelines.find((row) => row.id === pipelineId)
|
||||
: undefined;
|
||||
const localProject = vm.status === "ready"
|
||||
? vm.data.localProjects.find((row) => row.id === target)
|
||||
: undefined;
|
||||
const canImport = Boolean(
|
||||
vm.status === "ready" &&
|
||||
vm.data.canWrite &&
|
||||
preview?.routing &&
|
||||
(target === "create" || localProject) &&
|
||||
preview.addresses.every((address) => addressDecisions[address.role]),
|
||||
);
|
||||
const step = preview ? (preview.routing ? 3 : 2) : vm.status === "ready" && vm.data.results.length > 0 ? 1 : 0;
|
||||
const steps = useMemo(() => [
|
||||
t("integrations.kwp.projectImport.steps.search"),
|
||||
t("integrations.kwp.projectImport.steps.routing"),
|
||||
t("integrations.kwp.projectImport.steps.link"),
|
||||
t("integrations.kwp.projectImport.steps.addresses"),
|
||||
], [t]);
|
||||
|
||||
if (vm.status === "empty") {
|
||||
return (
|
||||
<PageShell uiId="ui.integrations.kwp.project-import">
|
||||
<PageBody>
|
||||
<EmptyState
|
||||
outlined
|
||||
title={t("integrations.kwp.projectImport.noConnection.title")}
|
||||
body={t("integrations.kwp.projectImport.noConnection.body")}
|
||||
/>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
if (vm.status !== "ready") {
|
||||
return (
|
||||
<PageShell uiId="ui.integrations.kwp.project-import.loading">
|
||||
<PageBody>
|
||||
<Alert
|
||||
variant="information"
|
||||
title={t("integrations.kwp.projectImport.loading.title")}
|
||||
description={t("integrations.kwp.projectImport.loading.body")}
|
||||
/>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
const data = vm.data;
|
||||
const connectionId = data.connectionId;
|
||||
return (
|
||||
<PageShell uiId="ui.integrations.kwp.project-import">
|
||||
<PageBody>
|
||||
<PageBackLink to={data.backHref} label={t("integrations.kwp.projectImport.back")} />
|
||||
<PageIntro>{t("integrations.kwp.projectImport.subtitle")}</PageIntro>
|
||||
<StepperHorizontal>
|
||||
{steps.map((label, index) => (
|
||||
<StepperHorizontal.Step
|
||||
key={label}
|
||||
firstStep={index === 0}
|
||||
lastStep={index === steps.length - 1}
|
||||
stepNumber={index + 1}
|
||||
label={label}
|
||||
variant={index < step ? "completed" : index === step ? "active" : "default"}
|
||||
/>
|
||||
))}
|
||||
</StepperHorizontal>
|
||||
|
||||
{data.feedbackKey ? <Alert variant="success" title={t(data.feedbackKey)} /> : null}
|
||||
{data.capability.status === "paused" ? (
|
||||
<Alert
|
||||
variant="error"
|
||||
title={t("integrations.kwp.projectImport.contract.title")}
|
||||
description={t("integrations.kwp.projectImport.contract.body")}
|
||||
actions={
|
||||
data.canWrite && data.capability.observedFingerprint && preview ? (
|
||||
<Button
|
||||
variant="tertiary"
|
||||
size="small"
|
||||
icon={<FeatherRefreshCw />}
|
||||
loading={submitting}
|
||||
onClick={() => actions.onApproveContract({
|
||||
connectionId,
|
||||
observedFingerprint: data.capability.observedFingerprint!,
|
||||
expectedRevision: data.capability.revision,
|
||||
externalProjectNumber: preview.externalProjectNumber,
|
||||
})}
|
||||
>
|
||||
{t("integrations.kwp.projectImport.contract.approve")}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
{data.capability.diff ? (
|
||||
<Card variant="warning" contentOverflow="wrap" data-ui-id="ui.integrations.kwp.project-import.contract-diff">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
|
||||
{t("integrations.kwp.projectImport.contract.diffTitle")}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{[
|
||||
...data.capability.diff.added.map((path) => `+ ${path}`),
|
||||
...data.capability.diff.removed.map((path) => `− ${path}`),
|
||||
...data.capability.diff.changed.map((path) => `~ ${path}`),
|
||||
].join("\n")}
|
||||
</span>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{data.boundProjects.length > 0 ? (
|
||||
<Card data-ui-id="ui.integrations.kwp.project-import.bindings">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">
|
||||
{t("integrations.kwp.projectImport.bindings.title")}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.kwp.projectImport.bindings.body")}
|
||||
</span>
|
||||
{data.boundProjects.map((binding) => (
|
||||
<Card key={binding.bindingId} size="small" variant={binding.state === "active" ? "neutral" : "warning"}>
|
||||
<div className="flex w-full items-center justify-between gap-4 mobile:flex-col mobile:items-start">
|
||||
<div className="flex min-w-0 flex-col items-start gap-1">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
|
||||
{binding.projectNumber} · {binding.name}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.kwp.projectImport.bindings.external", {
|
||||
number: binding.externalProjectNumber,
|
||||
})}
|
||||
</span>
|
||||
<BadgeFeedback farbe={binding.state === "active" ? "subtle-positive" : "subtle-warning"}>
|
||||
{t(`integrations.kwp.projectImport.bindings.state.${binding.state}`)}
|
||||
</BadgeFeedback>
|
||||
</div>
|
||||
{data.canWrite ? (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{binding.canRestore ? (
|
||||
<Button
|
||||
variant="warning"
|
||||
size="small"
|
||||
loading={submitting}
|
||||
onClick={() => actions.onRestore({
|
||||
connectionId,
|
||||
projectId: binding.projectId,
|
||||
expectedBindingRevision: binding.revision,
|
||||
expectedProjectUpdatedAt: binding.projectUpdatedAt,
|
||||
})}
|
||||
>
|
||||
{t("integrations.kwp.projectImport.bindings.restore")}
|
||||
</Button>
|
||||
) : null}
|
||||
<Button
|
||||
variant="tertiary"
|
||||
size="small"
|
||||
loading={submitting}
|
||||
onClick={() => actions.onUnlink({
|
||||
connectionId,
|
||||
projectId: binding.projectId,
|
||||
expectedBindingRevision: binding.revision,
|
||||
})}
|
||||
>
|
||||
{t("integrations.kwp.projectImport.bindings.unlink")}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
<Alert
|
||||
variant={data.catalog.status === "paused"
|
||||
? "error"
|
||||
: data.catalog.status === "partial"
|
||||
? "warning"
|
||||
: "information"}
|
||||
title={t(`integrations.kwp.projectImport.catalog.${data.catalog.status}.title`)}
|
||||
description={t(`integrations.kwp.projectImport.catalog.${data.catalog.status}.body`, {
|
||||
discovered: data.catalog.discoveredCount,
|
||||
hydrated: data.catalog.hydratedCount,
|
||||
})}
|
||||
/>
|
||||
|
||||
<Card contentOverflow="wrap">
|
||||
<div className="flex w-full flex-col items-start gap-6">
|
||||
<Select
|
||||
className="max-w-none"
|
||||
showLabel
|
||||
label={t("integrations.kwp.projectImport.connection")}
|
||||
value={connectionId}
|
||||
onValueChange={(value) => actions.onSearch(value, query)}
|
||||
>
|
||||
{data.connections.map((connection) => (
|
||||
<Select.Item key={connection.id} value={connection.id}>{connection.label}</Select.Item>
|
||||
))}
|
||||
</Select>
|
||||
<SearchInput
|
||||
className="h-auto"
|
||||
fillContainer
|
||||
showLabel
|
||||
label={t("integrations.kwp.projectImport.search.label")}
|
||||
helpText={t("integrations.kwp.projectImport.search.help")}
|
||||
placeholder={t("integrations.kwp.projectImport.search.placeholder")}
|
||||
value={query}
|
||||
onChange={(event) => setQuery(event.currentTarget.value)}
|
||||
state={submitting ? "loading" : query ? "filled" : "default"}
|
||||
error={query.length > 0 && query.trim().length < 2}
|
||||
/>
|
||||
<Button
|
||||
icon={<FeatherDownloadCloud />}
|
||||
disabled={query.trim().length < 2}
|
||||
loading={submitting}
|
||||
onClick={() => actions.onSearch(connectionId, query)}
|
||||
>
|
||||
{t("integrations.kwp.projectImport.search.action")}
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{data.query.length >= 2 && data.results.length === 0 ? (
|
||||
<EmptyState
|
||||
outlined
|
||||
variant="no-results"
|
||||
title={t("integrations.kwp.projectImport.search.emptyTitle")}
|
||||
body={t("integrations.kwp.projectImport.search.emptyBody")}
|
||||
/>
|
||||
) : null}
|
||||
{data.results.length > 0 ? (
|
||||
<Card data-ui-id="ui.integrations.kwp.project-import.results">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
|
||||
{t("integrations.kwp.projectImport.search.results")}
|
||||
</span>
|
||||
{data.results.map((row) => {
|
||||
const isSelecting = selectingProjectNumber === row.externalProjectNumber;
|
||||
const isSelected = preview?.externalProjectNumber === row.externalProjectNumber;
|
||||
return (
|
||||
<Card key={row.externalProjectNumber} size="small" variant={isSelected ? "information" : "neutral"}>
|
||||
<div className="flex w-full items-center justify-between gap-4">
|
||||
<div className="flex min-w-0 flex-col items-start gap-1">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{row.name}</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{row.externalProjectNumber}
|
||||
</span>
|
||||
<BadgeFeedback farbe="subtle-information">{row.statusLabel}</BadgeFeedback>
|
||||
</div>
|
||||
<Button
|
||||
variant="tertiary"
|
||||
size="small"
|
||||
disabled={submitting || selectingProjectNumber !== null}
|
||||
aria-busy={isSelecting}
|
||||
iconRight={isSelecting ? undefined : <FeatherArrowRight />}
|
||||
onClick={() => {
|
||||
if (isSelected) {
|
||||
scrollKwpProjectPreviewIntoView();
|
||||
return;
|
||||
}
|
||||
setSelectingProjectNumber(row.externalProjectNumber);
|
||||
actions.onSelectProject(connectionId, data.query, row.externalProjectNumber);
|
||||
}}
|
||||
>
|
||||
{t(isSelecting
|
||||
? "integrations.kwp.projectImport.search.loadingDetails"
|
||||
: "integrations.kwp.projectImport.search.select")}
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
})}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{preview ? (
|
||||
<>
|
||||
<Card data-ui-id="ui.integrations.kwp.project-import.preview">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">{preview.name}</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.kwp.projectImport.preview.summary", {
|
||||
number: preview.externalProjectNumber,
|
||||
status: preview.statusLabel,
|
||||
})}
|
||||
</span>
|
||||
{!preview.routing ? (
|
||||
<>
|
||||
<Alert
|
||||
variant="warning"
|
||||
title={t("integrations.kwp.projectImport.routing.required")}
|
||||
description={t("integrations.kwp.projectImport.routing.requiredBody")}
|
||||
/>
|
||||
<Select
|
||||
showLabel
|
||||
label={t("integrations.kwp.projectImport.routing.pipeline")}
|
||||
value={pipelineId || undefined}
|
||||
onValueChange={(value) => {
|
||||
setPipelineId(value);
|
||||
setStageId("");
|
||||
}}
|
||||
>
|
||||
{data.pipelines.map((row) => <Select.Item key={row.id} value={row.id}>{row.label}</Select.Item>)}
|
||||
</Select>
|
||||
<Select
|
||||
showLabel
|
||||
label={t("integrations.kwp.projectImport.routing.stage")}
|
||||
value={stageId || undefined}
|
||||
onValueChange={setStageId}
|
||||
>
|
||||
{(pipeline?.stages ?? []).map((row) => <Select.Item key={row.id} value={row.id}>{row.label}</Select.Item>)}
|
||||
</Select>
|
||||
<Button
|
||||
disabled={!pipelineId || !stageId || !data.canWrite}
|
||||
loading={submitting}
|
||||
onClick={() => actions.onSaveRouting({
|
||||
connectionId,
|
||||
externalStatus: preview.status,
|
||||
pipelineId,
|
||||
stageId,
|
||||
expectedRevision: null,
|
||||
externalProjectNumber: preview.externalProjectNumber,
|
||||
query: data.query,
|
||||
})}
|
||||
>
|
||||
{t("integrations.kwp.projectImport.routing.save")}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Alert variant="success" title={t("integrations.kwp.projectImport.routing.ready")} />
|
||||
)}
|
||||
</Card>
|
||||
|
||||
{preview.routing ? (
|
||||
<>
|
||||
<Card>
|
||||
<RadioGroup
|
||||
label={t("integrations.kwp.projectImport.target.label")}
|
||||
helpText={t("integrations.kwp.projectImport.target.help")}
|
||||
value={target}
|
||||
onValueChange={setTarget}
|
||||
>
|
||||
<RadioGroup.Option value="create" label={t("integrations.kwp.projectImport.target.create")} />
|
||||
{data.localProjects.map((project) => (
|
||||
<RadioGroup.Option
|
||||
key={project.id}
|
||||
value={project.id}
|
||||
label={`${project.projectNumber} · ${project.name}`}
|
||||
/>
|
||||
))}
|
||||
</RadioGroup>
|
||||
</Card>
|
||||
|
||||
{localProject ? (
|
||||
<Card variant="information" data-ui-id="ui.integrations.kwp.project-import.link-diff">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
|
||||
{t("integrations.kwp.projectImport.target.diffTitle")}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.kwp.projectImport.target.diffBody")}
|
||||
</span>
|
||||
{[
|
||||
{
|
||||
key: "name",
|
||||
local: localProject.name,
|
||||
kwp: preview.name,
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
local: data.pipelines
|
||||
.flatMap((row) => row.stages)
|
||||
.find((row) => row.id === localProject.stageId)?.label ?? localProject.stageId,
|
||||
kwp: preview.statusLabel,
|
||||
},
|
||||
{
|
||||
key: "startDate",
|
||||
local: localProject.startDate ?? t("shared.notSet"),
|
||||
kwp: preview.startDate ?? t("shared.notSet"),
|
||||
},
|
||||
{
|
||||
key: "orderValue",
|
||||
local: localProject.orderValue ?? t("shared.notSet"),
|
||||
kwp: preview.orderValue === null ? t("shared.notSet") : String(preview.orderValue),
|
||||
},
|
||||
].map((row) => (
|
||||
<div key={row.key} className="grid w-full grid-cols-3 gap-3 mobile:grid-cols-1">
|
||||
<span className="text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-primary">
|
||||
{t(`integrations.kwp.projectImport.target.fields.${row.key}`)}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.kwp.projectImport.target.local", { value: row.local })}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.kwp.projectImport.target.kwp", { value: row.kwp })}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{preview.addresses.map((address) => {
|
||||
const decision = addressDecisions[address.role] ?? { contactId: "create", personId: "none" };
|
||||
return (
|
||||
<Card key={address.role}>
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
|
||||
{t(`integrations.kwp.projectImport.address.role.${address.role}`)}
|
||||
</span>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
||||
{address.label} · {address.addressLabel}
|
||||
</span>
|
||||
<Select
|
||||
showLabel
|
||||
label={t("integrations.kwp.projectImport.address.contact")}
|
||||
value={decision.contactId}
|
||||
onValueChange={(contactId) => setAddressDecisions((current) => ({
|
||||
...current,
|
||||
[address.role]: { ...decision, contactId },
|
||||
}))}
|
||||
>
|
||||
<Select.Item value="create">{t("integrations.kwp.projectImport.address.create")}</Select.Item>
|
||||
{address.candidates.map((candidate) => (
|
||||
<Select.Item key={candidate.id} value={candidate.id}>
|
||||
{candidate.label}{candidate.email ? ` · ${candidate.email}` : ""}
|
||||
</Select.Item>
|
||||
))}
|
||||
</Select>
|
||||
<Select
|
||||
showLabel
|
||||
label={t("integrations.kwp.projectImport.address.primary")}
|
||||
value={decision.personId}
|
||||
onValueChange={(personId) => setAddressDecisions((current) => ({
|
||||
...current,
|
||||
[address.role]: { ...decision, personId },
|
||||
}))}
|
||||
>
|
||||
<Select.Item value="none">{t("integrations.kwp.projectImport.address.noPrimary")}</Select.Item>
|
||||
{address.people.map((person) => (
|
||||
<Select.Item key={person.externalContactId} value={person.externalContactId}>
|
||||
{person.label}{person.email ? ` · ${person.email}` : ""}
|
||||
</Select.Item>
|
||||
))}
|
||||
</Select>
|
||||
</Card>
|
||||
);
|
||||
})}
|
||||
<Button
|
||||
disabled={!canImport}
|
||||
loading={submitting}
|
||||
icon={<FeatherDownloadCloud />}
|
||||
onClick={() => {
|
||||
if (!preview.routing) return;
|
||||
actions.onImport({
|
||||
connectionId,
|
||||
externalProjectNumber: preview.externalProjectNumber,
|
||||
target: target === "create"
|
||||
? { kind: "create" }
|
||||
: {
|
||||
kind: "link",
|
||||
projectId: localProject!.id,
|
||||
expectedUpdatedAt: localProject!.updatedAt,
|
||||
},
|
||||
addressDecisions: preview.addresses.map((address) => {
|
||||
const decision = addressDecisions[address.role]!;
|
||||
return {
|
||||
role: address.role,
|
||||
addressCode: address.addressCode,
|
||||
addressContact: decision.contactId === "create"
|
||||
? { kind: "create" as const }
|
||||
: { kind: "existing" as const, contactId: decision.contactId },
|
||||
primaryContact: decision.personId === "none"
|
||||
? null
|
||||
: {
|
||||
externalContactId: decision.personId,
|
||||
contact: { kind: "create" as const },
|
||||
},
|
||||
};
|
||||
}),
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("integrations.kwp.projectImport.import")}
|
||||
</Button>
|
||||
</>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
// @vitest-environment jsdom
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { KwpProjectImportVM } from "@hivegrid/view-models";
|
||||
|
||||
import { KwpProjectImportPage } from "./KwpProjectImportPage";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) =>
|
||||
values ? `${key}:${Object.values(values).join("/")}` : key,
|
||||
}),
|
||||
}));
|
||||
|
||||
const vm: KwpProjectImportVM = {
|
||||
status: "ready",
|
||||
data: {
|
||||
tenantSlug: "acme",
|
||||
backHref: "/acme/integrations/kwp",
|
||||
connectionId: "connection-1",
|
||||
connections: [{ id: "connection-1", label: "KWP Geerkens" }],
|
||||
query: "P-100",
|
||||
results: [{
|
||||
externalProjectNumber: "P-100",
|
||||
name: "Heizung Schule",
|
||||
status: 8,
|
||||
statusLabel: "Erhalten",
|
||||
}],
|
||||
preview: {
|
||||
externalProjectNumber: "P-100",
|
||||
name: "Heizung Schule",
|
||||
status: 8,
|
||||
statusLabel: "Erhalten",
|
||||
startDate: "2026-07-01T00:00:00.000Z",
|
||||
orderValue: 42_500,
|
||||
routing: { pipelineId: "pipeline-1", stageId: "stage-2", revision: 3 },
|
||||
addresses: [
|
||||
{
|
||||
role: "project",
|
||||
addressCode: "ADR-1",
|
||||
label: "Geerkens GmbH",
|
||||
addressLabel: "Werkstraße 7, 52511, Geilenkirchen",
|
||||
email: "info@example.test",
|
||||
candidates: [{
|
||||
id: "contact-1",
|
||||
label: "Geerkens GmbH",
|
||||
email: "info@example.test",
|
||||
addressLabel: "Werkstraße 7, 52511 Geilenkirchen",
|
||||
reason: "exact_email",
|
||||
}],
|
||||
people: [{
|
||||
externalContactId: "99",
|
||||
label: "Maria Muster",
|
||||
email: "maria@example.test",
|
||||
phone: "+49 123",
|
||||
}],
|
||||
},
|
||||
],
|
||||
},
|
||||
pipelines: [{
|
||||
id: "pipeline-1",
|
||||
label: "Projektpipeline",
|
||||
stages: [
|
||||
{ id: "stage-1", label: "Anfrage" },
|
||||
{ id: "stage-2", label: "Auftrag" },
|
||||
],
|
||||
}],
|
||||
localProjects: [{
|
||||
id: "project-1",
|
||||
projectNumber: "PR-0042",
|
||||
name: "Schule Altbau",
|
||||
pipelineId: "pipeline-1",
|
||||
stageId: "stage-1",
|
||||
startDate: "2026-06-01T00:00:00.000Z",
|
||||
orderValue: "40000",
|
||||
updatedAt: "2026-07-23T10:00:00.000Z",
|
||||
}],
|
||||
boundProjects: [{
|
||||
bindingId: "binding-1",
|
||||
projectId: "project-2",
|
||||
externalProjectNumber: "P-099",
|
||||
projectNumber: "PR-0041",
|
||||
name: "Rathaus",
|
||||
state: "missing",
|
||||
revision: 4,
|
||||
projectUpdatedAt: "2026-07-22T10:00:00.000Z",
|
||||
canRestore: true,
|
||||
}],
|
||||
capability: {
|
||||
status: "paused",
|
||||
reasonCode: "kwp.project.contract_drift",
|
||||
revision: 5,
|
||||
observedFingerprint: "a".repeat(64),
|
||||
diff: {
|
||||
added: ["$.project.fields.newField.type"],
|
||||
removed: [],
|
||||
changed: ["$.project.fields.projNr.type"],
|
||||
truncated: false,
|
||||
},
|
||||
},
|
||||
catalog: {
|
||||
status: "syncing",
|
||||
discoveredCount: 50_000,
|
||||
hydratedCount: 120,
|
||||
lastDiscoveryAt: "2026-07-24T12:00:00.000Z",
|
||||
lastCompletedAt: null,
|
||||
},
|
||||
canWrite: true,
|
||||
feedbackKey: null,
|
||||
},
|
||||
};
|
||||
|
||||
const noOp = (): void => undefined;
|
||||
|
||||
describe("VR-P32 KWP project import interim visual baseline", () => {
|
||||
it("renders search, contract alarm, bindings and role mapping from a serializable VM", () => {
|
||||
const { container } = render(
|
||||
<MemoryRouter>
|
||||
<KwpProjectImportPage
|
||||
vm={vm}
|
||||
submitting={false}
|
||||
actions={{
|
||||
onSearch: noOp,
|
||||
onSelectProject: noOp,
|
||||
onSaveRouting: noOp,
|
||||
onImport: noOp,
|
||||
onApproveContract: noOp,
|
||||
onUnlink: noOp,
|
||||
onRestore: noOp,
|
||||
}}
|
||||
/>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
expect(container.querySelector("[data-ui-id='ui.integrations.kwp.project-import']")).toBeInTheDocument();
|
||||
expect(container.querySelector("[data-ui-id='ui.integrations.kwp.project-import.contract-diff']")).toBeInTheDocument();
|
||||
expect(container.querySelector("[data-ui-id='ui.integrations.kwp.project-import.bindings']")).toBeInTheDocument();
|
||||
expect(container.querySelector("[data-ui-id='ui.integrations.kwp.project-import.results']")).toBeInTheDocument();
|
||||
const stableMarkup = container.innerHTML.replace(
|
||||
/<svg\b[^>]*>[\s\S]*?<\/svg>/gu,
|
||||
'<svg data-visual-icon="true"></svg>',
|
||||
);
|
||||
expect(stableMarkup).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
import { useState } from "react";
|
||||
import { Form } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import type { KwpSetupData, KwpSetupFeedback, KwpSetupVM } from "@hivegrid/view-models";
|
||||
|
||||
import { AuthShell } from "~/components/auth/AuthShell";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { ButtonGroup } from "~/ui/components/ButtonGroup";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { RadioGroup } from "~/ui/components/RadioGroup";
|
||||
import { TextInput } from "~/ui/components/TextInput";
|
||||
import { kwpMandantSelectionPath, kwpSetupPath } from "~/utils/integrations/integrationsRoutePaths";
|
||||
|
||||
const MAX_CONTEXT_CODE_LENGTH = 128;
|
||||
|
||||
export type KwpSetupPageProps = {
|
||||
readonly vm: KwpSetupVM;
|
||||
readonly csrf: string;
|
||||
readonly submitting: boolean;
|
||||
};
|
||||
|
||||
function FeedbackAlert({ feedback }: { readonly feedback: KwpSetupFeedback }) {
|
||||
const { t } = useTranslation();
|
||||
if (!feedback) return null;
|
||||
const key =
|
||||
feedback === "configuration-error"
|
||||
? "configurationError"
|
||||
: feedback === "selection-error"
|
||||
? "selectionError"
|
||||
: feedback === "selection-expired"
|
||||
? "selectionExpired"
|
||||
: "error";
|
||||
return (
|
||||
<Alert
|
||||
variant="error"
|
||||
title={t(`integrations.kwp.oauth.${key}`)}
|
||||
description={t(`integrations.kwp.oauth.${key}Body`)}
|
||||
data-ui-id="ui.integrations.kwp.oauth.feedback"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function MandantSelectionForm({ data, csrf, submitting }: {
|
||||
readonly data: Extract<KwpSetupData, { readonly mode: "mandant" }>;
|
||||
readonly csrf: string;
|
||||
readonly submitting: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const onlyOption = data.discoveryMode === "available" && data.mandants.length === 1 ? data.mandants[0] : undefined;
|
||||
const [choice, setChoice] = useState(onlyOption ? `selected:${onlyOption.code}` : "");
|
||||
const [manualCode, setManualCode] = useState("");
|
||||
const selectedCode = choice.startsWith("selected:") ? choice.slice("selected:".length) : choice === "manual" ? manualCode.trim() : "";
|
||||
const selectionKind = choice === "none" ? "none" : "selected";
|
||||
const canSubmit = choice === "none" || (choice.startsWith("selected:") && selectedCode.length > 0) || (choice === "manual" && selectedCode.length > 0);
|
||||
const discovered = data.discoveryMode === "available" && data.mandants.length > 0;
|
||||
|
||||
return (
|
||||
<Form method="post" action={kwpMandantSelectionPath(data.tenantSlug, data.connectionId)}>
|
||||
<input type="hidden" name="csrf" value={csrf} readOnly />
|
||||
<input type="hidden" name="tenant" value={data.tenantSlug} readOnly />
|
||||
<input type="hidden" name="connectionId" value={data.connectionId} readOnly />
|
||||
<input type="hidden" name="connectionVersion" value={data.connectionVersion} readOnly />
|
||||
<input type="hidden" name="selectionKind" value={selectionKind} readOnly />
|
||||
<input type="hidden" name="mandantCode" value={selectedCode} readOnly />
|
||||
<ButtonGroup align="stack">
|
||||
<Alert
|
||||
variant="information"
|
||||
title={t("integrations.kwp.oauth.customerCodeSummary", { customerCode: data.customerCode })}
|
||||
description={t("integrations.kwp.oauth.mandantBindingBody")}
|
||||
/>
|
||||
{!discovered ? (
|
||||
<Alert
|
||||
variant="warning"
|
||||
title={t("integrations.kwp.oauth.mandantManualTitle")}
|
||||
description={t("integrations.kwp.oauth.mandantManualBody")}
|
||||
/>
|
||||
) : null}
|
||||
<RadioGroup
|
||||
value={choice}
|
||||
onValueChange={setChoice}
|
||||
label={t("integrations.kwp.oauth.mandantChoiceLabel")}
|
||||
helpText={t("integrations.kwp.oauth.mandantChoiceHelp")}
|
||||
data-ui-id="ui.integrations.kwp.oauth.mandants"
|
||||
>
|
||||
{discovered
|
||||
? data.mandants.map((mandant) => (
|
||||
<RadioGroup.Option
|
||||
key={`${mandant.id}:${mandant.code}`}
|
||||
value={`selected:${mandant.code}`}
|
||||
label={`${mandant.label} (${mandant.code})`}
|
||||
/>
|
||||
))
|
||||
: (
|
||||
<>
|
||||
<RadioGroup.Option value="none" label={t("integrations.kwp.oauth.noMandant")} />
|
||||
<RadioGroup.Option value="manual" label={t("integrations.kwp.oauth.manualMandant")} />
|
||||
</>
|
||||
)}
|
||||
</RadioGroup>
|
||||
{!discovered && choice === "manual" ? (
|
||||
<TextInput
|
||||
fillContainer
|
||||
showLabel
|
||||
label={t("integrations.kwp.oauth.mandantCode")}
|
||||
helpText={t("integrations.kwp.oauth.mandantCodeHelp")}
|
||||
>
|
||||
<TextInput.Input
|
||||
value={manualCode}
|
||||
onChange={(event) => setManualCode(event.target.value)}
|
||||
maxLength={MAX_CONTEXT_CODE_LENGTH}
|
||||
autoCapitalize="none"
|
||||
autoCorrect="off"
|
||||
required
|
||||
data-ui-id="ui.integrations.kwp.oauth.mandantCode"
|
||||
/>
|
||||
</TextInput>
|
||||
) : null}
|
||||
<Button type="submit" name="intent" value="confirm-mandant" loading={submitting} disabled={submitting || !canSubmit}>
|
||||
{t("integrations.kwp.oauth.confirmMandant")}
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
name="intent"
|
||||
value="cancel-mandant"
|
||||
variant="tertiary"
|
||||
formNoValidate
|
||||
disabled={submitting}
|
||||
>
|
||||
{t("integrations.kwp.oauth.cancel")}
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
export function KwpSetupPage({ vm, csrf, submitting }: KwpSetupPageProps) {
|
||||
const { t } = useTranslation();
|
||||
if (vm.status !== "ready") return null;
|
||||
const data = vm.data;
|
||||
|
||||
if (data.mode === "entry") {
|
||||
if (!data.authenticated) {
|
||||
return (
|
||||
<AuthShell
|
||||
title={t("integrations.kwp.oauth.title")}
|
||||
subtitle={t("integrations.kwp.oauth.loginBody")}
|
||||
dataUiId="ui.integrations.kwp.oauth.setup"
|
||||
>
|
||||
<FeedbackAlert feedback={data.feedback} />
|
||||
<Button onClick={() => window.location.assign(data.loginHref)}>{t("integrations.kwp.oauth.login")}</Button>
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthShell
|
||||
title={t("integrations.kwp.oauth.title")}
|
||||
subtitle={t("integrations.kwp.oauth.selectTenantBody")}
|
||||
dataUiId="ui.integrations.kwp.oauth.setup"
|
||||
>
|
||||
<FeedbackAlert feedback={data.feedback} />
|
||||
{data.tenants.length > 0 ? (
|
||||
<ButtonGroup align="stack" data-ui-id="ui.integrations.kwp.oauth.tenants">
|
||||
{data.tenants.map((tenant) => (
|
||||
<Button key={tenant.id} variant="secondary" onClick={() => window.location.assign(tenant.setupHref)}>
|
||||
{tenant.name}
|
||||
</Button>
|
||||
))}
|
||||
</ButtonGroup>
|
||||
) : (
|
||||
<EmptyState title={t("integrations.kwp.oauth.noTenants")} body={t("integrations.kwp.oauth.noTenantsBody")} />
|
||||
)}
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (data.mode === "mandant") {
|
||||
return (
|
||||
<AuthShell
|
||||
title={t("integrations.kwp.oauth.mandantTitle")}
|
||||
subtitle={t("integrations.kwp.oauth.mandantBody")}
|
||||
dataUiId="ui.integrations.kwp.oauth.mandantSetup"
|
||||
titleAlign="start"
|
||||
>
|
||||
<FeedbackAlert feedback={data.feedback} />
|
||||
<MandantSelectionForm data={data} csrf={csrf} submitting={submitting} />
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthShell
|
||||
title={t("integrations.kwp.oauth.title")}
|
||||
subtitle={t("integrations.kwp.oauth.confirmBody")}
|
||||
dataUiId="ui.integrations.kwp.oauth.setup"
|
||||
titleAlign="start"
|
||||
>
|
||||
<FeedbackAlert feedback={data.feedback} />
|
||||
<Form method="post" action={kwpSetupPath(data.tenantSlug)}>
|
||||
<input type="hidden" name="csrf" value={csrf} readOnly />
|
||||
<input type="hidden" name="tenant" value={data.tenantSlug} readOnly />
|
||||
<input type="hidden" name="intent" value="connect" readOnly />
|
||||
<ButtonGroup align="stack">
|
||||
<TextInput
|
||||
fillContainer
|
||||
showLabel
|
||||
label={t("integrations.kwp.oauth.customerCode")}
|
||||
helpText={t("integrations.kwp.oauth.customerCodeHelp")}
|
||||
>
|
||||
<TextInput.Input
|
||||
name="customerCode"
|
||||
maxLength={MAX_CONTEXT_CODE_LENGTH}
|
||||
autoCapitalize="none"
|
||||
autoCorrect="off"
|
||||
required
|
||||
data-ui-id="ui.integrations.kwp.oauth.customerCode"
|
||||
/>
|
||||
</TextInput>
|
||||
<Button type="submit" loading={submitting} disabled={submitting}>
|
||||
{t("integrations.kwp.oauth.continue")}
|
||||
</Button>
|
||||
<LinkButton onClick={() => window.location.assign(data.settingsHref)}>{t("integrations.kwp.oauth.cancel")}</LinkButton>
|
||||
</ButtonGroup>
|
||||
</Form>
|
||||
</AuthShell>
|
||||
);
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
// @vitest-environment jsdom
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { createRoutesStub } from "react-router";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { KwpSetupData, KwpSetupVM } from "@hivegrid/view-models";
|
||||
|
||||
import { KwpSetupPage } from "./KwpSetupPage";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${Object.values(values).join("/")}` : key),
|
||||
}),
|
||||
}));
|
||||
|
||||
// Radix radio inputs measure themselves; jsdom has no ResizeObserver.
|
||||
class ResizeObserverStub {
|
||||
observe(): void {}
|
||||
unobserve(): void {}
|
||||
disconnect(): void {}
|
||||
}
|
||||
globalThis.ResizeObserver = globalThis.ResizeObserver ?? (ResizeObserverStub as unknown as typeof ResizeObserver);
|
||||
|
||||
const CREDENTIAL_SENTINELS = ["CLIENT_SECRET_MUST_NOT_RENDER", "ACCESS_TOKEN_MUST_NOT_RENDER", "REFRESH_TOKEN_MUST_NOT_RENDER"];
|
||||
|
||||
function setupVM(data: KwpSetupData): KwpSetupVM {
|
||||
return {
|
||||
status: "ready",
|
||||
data: {
|
||||
...data,
|
||||
clientSecret: CREDENTIAL_SENTINELS[0],
|
||||
accessToken: CREDENTIAL_SENTINELS[1],
|
||||
refreshToken: CREDENTIAL_SENTINELS[2],
|
||||
},
|
||||
} as unknown as KwpSetupVM;
|
||||
}
|
||||
|
||||
function renderPage(vm: KwpSetupVM) {
|
||||
const Stub = createRoutesStub([
|
||||
{
|
||||
path: "/",
|
||||
Component: () => <KwpSetupPage vm={vm} csrf="csrf-visual-baseline" submitting={false} />,
|
||||
action: async () => null,
|
||||
},
|
||||
]);
|
||||
|
||||
return render(<Stub initialEntries={["/"]} />);
|
||||
}
|
||||
|
||||
function stableMarkup(container: HTMLElement): string {
|
||||
return container.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
||||
}
|
||||
|
||||
function expectNoCredentialLeak(container: HTMLElement): void {
|
||||
for (const sentinel of CREDENTIAL_SENTINELS) expect(container).not.toHaveTextContent(sentinel);
|
||||
expect(container.innerHTML).not.toMatch(/CLIENT_SECRET_MUST_NOT_RENDER|ACCESS_TOKEN_MUST_NOT_RENDER|REFRESH_TOKEN_MUST_NOT_RENDER/u);
|
||||
for (const input of container.querySelectorAll<HTMLInputElement>('input[type="hidden"]')) {
|
||||
expect(input.name).not.toMatch(/client.?secret|access.?token|refresh.?token|credential/iu);
|
||||
}
|
||||
}
|
||||
|
||||
afterEach(() => cleanup());
|
||||
|
||||
describe("VR-P32a KWP setup interim visual baseline", () => {
|
||||
it("submits the customer code with an explicit tenant-bound action and fallback field", () => {
|
||||
const { container } = renderPage(setupVM({
|
||||
mode: "oauth",
|
||||
tenantSlug: "acme",
|
||||
settingsHref: "/acme/settings/integrations/kwp",
|
||||
feedback: null,
|
||||
}));
|
||||
|
||||
const form = container.querySelector("form");
|
||||
expect(form).toHaveAttribute("action", "/integrations/kwp/setup?tenant=acme");
|
||||
expect(container.querySelector<HTMLInputElement>('input[name="tenant"]')).toHaveValue("acme");
|
||||
expect(container.querySelector<HTMLInputElement>('input[name="intent"]')).toHaveValue("connect");
|
||||
expect(container.querySelector<HTMLInputElement>('input[name="customerCode"]')).toBeRequired();
|
||||
expectNoCredentialLeak(container);
|
||||
});
|
||||
|
||||
it("renders an explicit choice when KWP discovers multiple companies", () => {
|
||||
const { container } = renderPage(setupVM({
|
||||
mode: "mandant",
|
||||
tenantSlug: "acme",
|
||||
settingsHref: "/app/acme/integrations/kwp",
|
||||
connectionId: "connection-discovered-multi",
|
||||
connectionVersion: "2026-07-21T09:30:00.000Z",
|
||||
customerCode: "acme-kwp",
|
||||
discoveryMode: "available",
|
||||
mandants: [
|
||||
{ id: 1, code: "BERLIN", label: "Acme Berlin GmbH" },
|
||||
{ id: 2, code: "HAMBURG", label: "Acme Hamburg GmbH" },
|
||||
],
|
||||
feedback: null,
|
||||
}));
|
||||
|
||||
expect(screen.getByRole("heading", { name: "integrations.kwp.oauth.mandantTitle" })).toBeInTheDocument();
|
||||
expect(screen.getAllByRole("radio")).toHaveLength(2);
|
||||
expect(screen.getByRole("button", { name: "integrations.kwp.oauth.confirmMandant" })).toBeDisabled();
|
||||
expect(container.querySelector("form")).toHaveAttribute(
|
||||
"action",
|
||||
"/integrations/kwp/setup?tenant=acme&connection=connection-discovered-multi",
|
||||
);
|
||||
expect(container.querySelector<HTMLInputElement>('input[name="tenant"]')).toHaveValue("acme");
|
||||
expect(container.querySelector("[data-ui-id='ui.integrations.kwp.oauth.mandants']")).toBeInTheDocument();
|
||||
expectNoCredentialLeak(container);
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders the manual fallback and binds only the explicitly entered company code", () => {
|
||||
const { container } = renderPage(setupVM({
|
||||
mode: "mandant",
|
||||
tenantSlug: "acme",
|
||||
settingsHref: "/app/acme/integrations/kwp",
|
||||
connectionId: "connection-manual-fallback",
|
||||
connectionVersion: "2026-07-21T09:35:00.000Z",
|
||||
customerCode: "acme-kwp",
|
||||
discoveryMode: "manual",
|
||||
mandants: [],
|
||||
feedback: "selection-error",
|
||||
}));
|
||||
|
||||
fireEvent.click(screen.getByRole("radio", { name: "integrations.kwp.oauth.manualMandant" }));
|
||||
const manualCode = container.querySelector<HTMLInputElement>("[data-ui-id='ui.integrations.kwp.oauth.mandantCode']");
|
||||
expect(manualCode).toBeInTheDocument();
|
||||
fireEvent.change(manualCode as HTMLInputElement, { target: { value: "FIRMA-02" } });
|
||||
|
||||
expect(screen.getByRole("button", { name: "integrations.kwp.oauth.confirmMandant" })).toBeEnabled();
|
||||
expect(container.querySelector<HTMLInputElement>('input[name="selectionKind"]')).toHaveValue("selected");
|
||||
expect(container.querySelector<HTMLInputElement>('input[name="mandantCode"]')).toHaveValue("FIRMA-02");
|
||||
expect(container.querySelector("[data-ui-id='ui.integrations.kwp.oauth.feedback']")).toBeInTheDocument();
|
||||
expectNoCredentialLeak(container);
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
+21
-16
@@ -7,6 +7,7 @@
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherRefreshCw } from "@subframe/core";
|
||||
import type { SyncHistoryVM, SyncKind, SyncStatus } from "@hivegrid/view-models";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
@@ -14,7 +15,9 @@ import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { Select } from "~/ui/components/Select";
|
||||
import { Table } from "~/ui/components/Table";
|
||||
import { PageBody, PageIntro, PageShell } from "../shared/PageShell";
|
||||
import { syncStatusBadge } from "./integrationsBadges";
|
||||
import { APP_TIME_ZONE } from "~/locale/format";
|
||||
|
||||
const FILTER_ALL = "__all__";
|
||||
const STATUSES: readonly SyncStatus[] = ["pending", "running", "completed", "partial", "failed", "cancelled"];
|
||||
@@ -27,38 +30,39 @@ export type SyncHistoryActions = {
|
||||
|
||||
export type SyncHistoryPageProps = {
|
||||
vm: SyncHistoryVM;
|
||||
backHref: string;
|
||||
/** Base path of this connection's syncs route; run detail = `${base}/${runId}`. */
|
||||
runHrefBase: string;
|
||||
actions: SyncHistoryActions;
|
||||
submitting: boolean;
|
||||
};
|
||||
|
||||
export function SyncHistoryPage({ vm, backHref, runHrefBase, actions, submitting }: SyncHistoryPageProps) {
|
||||
export function SyncHistoryPage({ vm, runHrefBase, actions, submitting }: SyncHistoryPageProps) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [status, setStatus] = useState<SyncStatus | null>(null);
|
||||
const [kind, setKind] = useState<SyncKind | null>(null);
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.syncs" />;
|
||||
return <PageShell uiId="ui.integrations.syncs" />;
|
||||
}
|
||||
|
||||
const { connectionId, rows, canManualSync, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { dateStyle: "medium", timeStyle: "short" });
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { timeZone: APP_TIME_ZONE, dateStyle: "medium", timeStyle: "short" });
|
||||
const visible = rows.filter((row) => (status ? row.status === status : true) && (kind ? row.kind === kind : true));
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.syncs">
|
||||
{/* Breadcrumb back to the connection management (DoD B9) + header */}
|
||||
<Link to={backHref} className="contents no-underline" data-ui-id="ui.integrations.syncs.back">
|
||||
<LinkButton variant="subtle">{t("integrations.syncs.back")}</LinkButton>
|
||||
</Link>
|
||||
<div className="flex flex-wrap items-start justify-between gap-4">
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-heading-2 font-heading-2 text-text-neutral-primary">{t("integrations.syncs.title")}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.syncs.subtitle")}
|
||||
</span>
|
||||
<PageShell uiId="ui.integrations.syncs">
|
||||
<PageBody>
|
||||
{/* Embedded in the Erweiterungen hub (AK-SET-01): the hub owns the page
|
||||
<h1> and tab bar, so this screen carries a simple section heading. */}
|
||||
<div className="flex w-full items-start justify-between gap-4 mobile:flex-col">
|
||||
<div className="flex min-w-0 flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<FeatherRefreshCw className="text-heading-3 font-heading-3 text-icon-neutral-tertiary" />
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary" data-ui-id="ui.integrations.syncs.title">
|
||||
{t("integrations.syncs.title")}
|
||||
</span>
|
||||
</div>
|
||||
<PageIntro uiId="ui.integrations.syncs.intro">{t("integrations.syncs.subtitle")}</PageIntro>
|
||||
</div>
|
||||
{canManualSync ? (
|
||||
<Button loading={submitting} onClick={() => actions.onManualSync(connectionId)} data-ui-id="ui.integrations.syncs.resync">
|
||||
@@ -158,6 +162,7 @@ export function SyncHistoryPage({ vm, backHref, runHrefBase, actions, submitting
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
+23
-14
@@ -4,16 +4,17 @@
|
||||
// error) and the AppSyncRunLog lines with severity badges. Pure presentational.
|
||||
// Final Subframe optics = tracked design-nachzug.
|
||||
|
||||
import { Link } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherRefreshCw } from "@subframe/core";
|
||||
import type { SyncRunDetailVM } from "@hivegrid/view-models";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { Table } from "~/ui/components/Table";
|
||||
import { PageBackLink, PageBody, PageShell } from "../shared/PageShell";
|
||||
import { syncItemStatusBadge, syncLogSeverityBadge, syncStatusBadge } from "./integrationsBadges";
|
||||
import { APP_TIME_ZONE } from "~/locale/format";
|
||||
|
||||
export type SyncRunDetailPageProps = {
|
||||
vm: SyncRunDetailVM;
|
||||
@@ -24,22 +25,29 @@ export function SyncRunDetailPage({ vm, backHref }: SyncRunDetailPageProps) {
|
||||
const { t, i18n } = useTranslation();
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.runDetail" />;
|
||||
return <PageShell uiId="ui.integrations.runDetail" />;
|
||||
}
|
||||
|
||||
const data = vm.data;
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { dateStyle: "medium", timeStyle: "short" });
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { timeZone: APP_TIME_ZONE, dateStyle: "medium", timeStyle: "short" });
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.runDetail">
|
||||
{/* Breadcrumb back to the sync history (DoD B9) + run header */}
|
||||
<Link to={backHref} className="contents no-underline" data-ui-id="ui.integrations.runDetail.back">
|
||||
<LinkButton variant="subtle">{t("integrations.runDetail.back")}</LinkButton>
|
||||
</Link>
|
||||
<div className="flex flex-wrap items-start justify-between gap-4">
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-heading-2 font-heading-2 text-text-neutral-primary">{t("integrations.runDetail.title")}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
<PageShell uiId="ui.integrations.runDetail">
|
||||
<PageBody>
|
||||
{/* Breadcrumb back to the sync history (DoD B9) */}
|
||||
<PageBackLink to={backHref} label={t("integrations.runDetail.back")} uiId="ui.integrations.runDetail.back" />
|
||||
|
||||
{/* Embedded in the Erweiterungen hub (AK-SET-01): the hub owns the page
|
||||
<h1> and tab bar, so this screen carries a simple section heading. */}
|
||||
<div className="flex w-full items-start justify-between gap-4 mobile:flex-col">
|
||||
<div className="flex min-w-0 flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<FeatherRefreshCw className="text-heading-3 font-heading-3 text-icon-neutral-tertiary" />
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary" data-ui-id="ui.integrations.runDetail.title">
|
||||
{t("integrations.runDetail.title")}
|
||||
</span>
|
||||
</div>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">
|
||||
{t(data.kindKey)} · {data.startedIso ? dateFormatter.format(new Date(data.startedIso)) : "—"}
|
||||
</span>
|
||||
</div>
|
||||
@@ -140,6 +148,7 @@ export function SyncRunDetailPage({ vm, backHref }: SyncRunDetailPageProps) {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`VR-P32 KWP project import interim visual baseline > renders search, contract alarm, bindings and role mapping from a serializable VM 1`] = `
|
||||
"<div class="flex w-full flex-col items-start" data-ui-id="ui.integrations.kwp.project-import"><div class="flex w-full flex-col gap-6 p-6 mobile:p-4"><div><a class="contents no-underline" href="/acme/integrations/kwp" data-discover="true"><button class="group/3b777358 flex cursor-pointer items-center justify-center rounded-md text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled h-8 gap-2 px-3 py-2 border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button"><span class="text-body-default-regular-0 font-body-default-regular-0 group-disabled/3b777358:text-icon-neutral-disabled text-icon-neutral-on-subtle icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 group-disabled/3b777358:text-icon-neutral-disabled group-hover/3b777358:group-disabled/3b777358:text-icon-neutral-on-solid group-active/3b777358:group-disabled/3b777358:text-icon-neutral-disabled text-icon-neutral-on-subtle loader-module_root__-0Kak"></div></div><span class="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 group-disabled/3b777358:text-text-neutral-disabled text-text-neutral-primary">integrations.kwp.projectImport.back</span></button></a></div><p class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">integrations.kwp.projectImport.subtitle</p><div class="flex w-full items-start justify-center" role="list"><div class="group/c1145464 flex w-full flex-col items-center justify-center gap-1" role="listitem"><div class="flex w-full items-center justify-center gap-2"><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-transparent"></div><div class="flex h-7 w-7 flex-none flex-col items-center justify-center gap-2 rounded-round bg-[#dbeafe]"><span class="font-['Inter'] text-[12px] font-[500] leading-[16px] text-[#1d4ed8]">1</span></div><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-[#d4d4d4]"></div></div><span class="font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373]">integrations.kwp.projectImport.steps.search</span></div><div class="group/c1145464 flex w-full flex-col items-center justify-center gap-1" role="listitem"><div class="flex w-full items-center justify-center gap-2"><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-[#d4d4d4]"></div><div class="flex h-7 w-7 flex-none flex-col items-center justify-center gap-2 rounded-round bg-[#dbeafe]"><span class="font-['Inter'] text-[12px] font-[500] leading-[16px] text-[#1d4ed8]">2</span></div><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-[#d4d4d4]"></div></div><span class="font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373]">integrations.kwp.projectImport.steps.routing</span></div><div class="group/c1145464 flex w-full flex-col items-center justify-center gap-1" role="listitem"><div class="flex w-full items-center justify-center gap-2"><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-[#d4d4d4]"></div><div class="flex h-7 w-7 flex-none flex-col items-center justify-center gap-2 rounded-round bg-[#dbeafe]"><span class="font-['Inter'] text-[12px] font-[500] leading-[16px] text-[#1d4ed8]">3</span></div><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-[#d4d4d4]"></div></div><span class="font-['Inter'] text-[14px] font-[400] leading-[20px] text-[#737373]">integrations.kwp.projectImport.steps.link</span></div><div class="group/c1145464 flex w-full flex-col items-center justify-center gap-1" role="listitem" aria-current="step"><div class="flex w-full items-center justify-center gap-2"><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-[#d4d4d4]"></div><div class="flex h-7 w-7 flex-none flex-col items-center justify-center gap-2 rounded-round bg-[#dbeafe]"><span class="font-['Inter'] text-[12px] font-[500] leading-[16px] text-[#1d4ed8]">4</span></div><div class="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-transparent"></div></div><span class="font-['Inter'] text-[14px] font-[500] leading-[20px] tracking-normal text-[#171717]">integrations.kwp.projectImport.steps.addresses</span></div></div><div class="group/3a65613d flex w-full flex-col items-start gap-2 rounded-md px-4 py-5 relative border border-solid border-border-negative-subtle bg-surface-feedback-subtle-negative"><div class="flex w-full items-start gap-3"><span class="text-heLine truncated
|
||||
~ $.project.fields.projNr.type</span></div><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-4 py-4 shadow-sm" data-ui-id="ui.integrations.kwp.project-import.bindings"><span class="text-heading-3 font-heading-3 text-text-neutral-primary">integrations.kwp.projectImport.bindings.title</span><span class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">integrations.kwp.projectImport.bindings.body</span><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md shadow-sm border border-solid border-border-warning-subtle bg-surface-feedback-subtle-warning px-2 py-2"><div class="flex w-full items-center justify-between gap-4 mobile:flex-col mobile:items-start"><div class="flex min-w-0 flex-col items-start gap-1"><span class="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">PR-0041 · Rathaus</span><span class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">integrations.kwp.projectImport.bindings.external:P-099</span><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-surface-feedback-subtle-warning"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-feedback-warning"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-on-subtle">integrations.kwp.projectImport.bindings.state.missing</span></div></div><div class="flex flex-wrap items-center gap-2"><button class="group/3b777358 flex cursor-pointer items-center justify-center rounded-md border-none text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled h-8 gap-2 px-3 py-2 bg-surface-feedback-solid-warning hover:bg-surface-feedback-solid-warning-hover active:bg-surface-feedback-solid-warning-active" type="button"><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-icon-neutral-on-solid group-disabled/3b777358:text-icon-neutral-disabled group-hover/3b777358:group-disabled/3b777358:text-icon-neutral-on-solid group-active/3b777358:group-disabled/3b777358:text-icon-neutral-disabled loader-module_root__-0Kak"></div></div><span class="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-on-solid group-disabled/3b777358:text-text-neutral-disabled">integrations.kwp.projectImport.bindings.restore</span></button><button class="group/3b777358 flex cursor-pointer items-center justify-center rounded-md text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled h-8 gap-2 px-3 py-2 border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button"><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 group-disabled/3b777358:text-icon-neutral-disabled group-hover/3b777358:group-disabled/3b777358:text-icon-neutral-on-solid group-active/3b777358:group-disabled/3b777358:text-icon-neutral-disabled text-icon-neutral-on-subtle loader-module_root__-0Kak"></div></div><span class="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 group-disabled/3b777358:text-text-neutral-disabled text-text-neutral-primary">integrations.kwp.projectImport.bindings.unlink</span></button></div></div></div></div><div class="group/3a65613d flex w-full flex-col items-start gap-2 rounded-md border border-solid border-border-information-subtle bg-surface-feedback-subtle-information px-4 py-5 relative"><div class="flex w-full items-start gap-3"><span class="text-heading-0 font-heading-0 text-icon-feedback-information icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="hidden text-heading-0 font-heading-0 text-icon-feedback-positive icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="hidden text-heading-0 font-heading-0 text-icon-feedback-warning icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="hidden text-heading-0 font-heading-0 text-icon-feedback-negative icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="hidden text-heading-0 font-heading-0 text-icon-neutral-secondary icon-wrapper-module_root__-l6uP"><svgLine truncated
|
||||
`;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`VR-P32a KWP setup interim visual baseline > renders an explicit choice when KWP discovers multiple companies 1`] = `"<div class="flex min-h-screen w-full flex-col items-center justify-center gap-8 bg-surface-neutral-primary px-4 py-12 mobile:gap-6 mobile:py-6" data-ui-id="ui.integrations.kwp.oauth.mandantSetup"><div class="group/609493cb flex w-fit items-center justify-center gap-4"><img class="hidden flex-none object-contain h-16" alt="" src="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_302_142' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='96' height='84'%3E%3Cpath d='M0 0H96V83.12H0V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_302_142)'%3E%3Cpath d='M95.9449 41.52L83.9589 20.76L48.0009 41.52H71.9719L59.9869 62.281H36.0139L24.0279 41.52L36.0139 20.76H83.9589L74.3919 4.188L71.9719 0H24.0279L0.0549316 41.52L24.0279 83.042H71.9719L95.9449 41.52Z' fill='%23F1B729'/%3E%3C/g%3E%3C/svg%3E"><img class="flex-none object-contain h-16" alt="HiveGrid" src="data:image/svg+xml,%3Csvg width='243' height='44' viewBox='3.4 3.6 243 44' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='123' height='55'%3E%3Cpath d='M122.88 0H0V55H122.88V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_15_21)'%3E%3Cpath d='M3.48022 8.81384H11.1272V22.1967H28.3362V8.81384H35.9831V42.2736H28.3362V28.8803H11.1285V42.2736H3.48022V8.81384Z' fill='%23111111'/%3E%3Cpath d='M42.4373 8.81384H50.0842V42.2736H42.4373V8.81384Z' fill='%23111111'/%3E%3Cpath d='M53.9084 12.6387V8.81519H61.0803L71.1187 34.8656H71.5978L81.6336 8.81519H88.8054V12.6387L76.3755 42.2736H66.3371L53.9084 12.6387Z' fill='%23111111'/%3E%3C/g%3E%3Cmask id='mask1_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='154' y='0' width='93' height='55'%3E%3Cpath d='M246.806 0H154.907V55H246.806V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask1_15_21)'%3E%3Cpath d='M197.555 8.78772H205.202V42.2462H197.555V8.78772Z' fill='%23111111'/%3E%3Cpath d='M211.657 8.78772H236.274C238.663 8.78772 240.575 9.50438 242.01 10.939C243.443 12.3736 244.161 14.286 244.161 16.6749V34.3603C244.161 36.7505 243.444 38.6616 242.01 40.0962C240.575 41.5308 238.663 42.2475 236.274 42.2475H211.657V8.78772ZM233.405 35.5547C235.478 35.5547 236.513 34.5196 236.513 32.4492V18.5873C236.513 16.5143 235.476 15.4791 233.405 15.4791H219.304V35.5547H233.405Z' fill='%23111111'/%3E%3C/g%3E%3Cpath d='M185.126 29.819C186.306 29.5958 187.374 29.1976 188.33 28.6246C189.157 28.1155 189.907 27.3753 190.576 26.4028C191.245 25.429 191.58 24.0988 191.58 22.4109V16.675C191.58 14.2861 190.864 12.3737 189.429 10.9391C187.994 9.50581 186.082 8.78784 183.693 8.78784H159.554V10.5501L168.179 25.5047L159.554 40.4135V42.2463H167.201V28.8948L174.939 28.8791L185.365 42.2463H192.297V38.4228L185.126 29.819ZM183.933 20.4985C183.933 22.5688 182.79 22.1968 180.718 22.1968H167.203V15.478H180.825C182.898 15.478 183.933 16.5144 183.933 18.5861V20.4985Z' fill='%23111111'/%3E%3Cpath d='M118.412 35.5797H100.041V28.8791H114.548L112.566 25.442L114.444 22.1968H100.041V15.5041H118.314L121.075 10.7329V8.81396H92.3943V42.2737H121.075V40.1968L118.412 35.5797Z' fill='%23111111'/%3E%3Cpath d='M165.334 25.3873L159.062 14.5213L140.242 25.3873H152.788L146.516 36.2521H133.968L127.696 25.3873L133.968 14.5213H159.062L154.054 5.84824L152.788 3.65649H127.696L115.15 25.3873L127.696 47.1181H152.788L165.334 25.3873Z' fill='%23F1B729'/%3E%3C/svg%3E"></div><div class="group/56067c50 flex w-full flex-col gap-4 rounded-md border border-solid border-border-default bg-surface-neutral-secondary shadow-sm px-6 py-6 items-stretch max-w-[448px]"><div class="flex w-full flex-col gap-1.5 items-start"><h1 class="text-heading- font-heading- text-text-neutral-primary">integrations.kwp.oauth.mandantTitle</h1><p class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">integrations.kwp.oauth.mandantBody</p></div><form method="post" action="/integrations/kwp/setup?tenant=acme&connection=connection-discovered-multi" data-discover="true"><input readonly="" type="hidden" value="csrf-visual-baseline" name="csrf"><input readonly="" type="hidden" value="acme" name="tenant"><input readonly="" type="hidden" value="connection-discovered-multi" name="connectionId"><input readonly="" type="hidden" value="2026-07-21T09:30:00.000Z" name="connectionVersion"><input readonly="" type="hidden" value="selected" name="selectionKind"><input readonly="" type="hidden" value="" name="mandantCode"><div class="group/e0379327 flex w-full items-center gap-2 flex-col"><div class="group/3a65613d flex w-full flex-col items-start gap-2 rounded-md border border-solid border-border-information-subtle bg-surface-feedback-subtle-information px-4 py-5 relative"><div class="flex w-full items-start gap-3"><span class="text-heading-0 font-headLine truncated
|
||||
|
||||
exports[`VR-P32a KWP setup interim visual baseline > renders the manual fallback and binds only the explicitly entered company code 1`] = `"<div class="flex min-h-screen w-full flex-col items-center justify-center gap-8 bg-surface-neutral-primary px-4 py-12 mobile:gap-6 mobile:py-6" data-ui-id="ui.integrations.kwp.oauth.mandantSetup"><div class="group/609493cb flex w-fit items-center justify-center gap-4"><img class="hidden flex-none object-contain h-16" alt="" src="data:image/svg+xml,%3Csvg width='96' height='84' viewBox='0 0 96 84' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_302_142' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='96' height='84'%3E%3Cpath d='M0 0H96V83.12H0V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_302_142)'%3E%3Cpath d='M95.9449 41.52L83.9589 20.76L48.0009 41.52H71.9719L59.9869 62.281H36.0139L24.0279 41.52L36.0139 20.76H83.9589L74.3919 4.188L71.9719 0H24.0279L0.0549316 41.52L24.0279 83.042H71.9719L95.9449 41.52Z' fill='%23F1B729'/%3E%3C/g%3E%3C/svg%3E"><img class="flex-none object-contain h-16" alt="HiveGrid" src="data:image/svg+xml,%3Csvg width='243' height='44' viewBox='3.4 3.6 243 44' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='123' height='55'%3E%3Cpath d='M122.88 0H0V55H122.88V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_15_21)'%3E%3Cpath d='M3.48022 8.81384H11.1272V22.1967H28.3362V8.81384H35.9831V42.2736H28.3362V28.8803H11.1285V42.2736H3.48022V8.81384Z' fill='%23111111'/%3E%3Cpath d='M42.4373 8.81384H50.0842V42.2736H42.4373V8.81384Z' fill='%23111111'/%3E%3Cpath d='M53.9084 12.6387V8.81519H61.0803L71.1187 34.8656H71.5978L81.6336 8.81519H88.8054V12.6387L76.3755 42.2736H66.3371L53.9084 12.6387Z' fill='%23111111'/%3E%3C/g%3E%3Cmask id='mask1_15_21' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='154' y='0' width='93' height='55'%3E%3Cpath d='M246.806 0H154.907V55H246.806V0Z' fill='white'/%3E%3C/mask%3E%3Cg mask='url(%23mask1_15_21)'%3E%3Cpath d='M197.555 8.78772H205.202V42.2462H197.555V8.78772Z' fill='%23111111'/%3E%3Cpath d='M211.657 8.78772H236.274C238.663 8.78772 240.575 9.50438 242.01 10.939C243.443 12.3736 244.161 14.286 244.161 16.6749V34.3603C244.161 36.7505 243.444 38.6616 242.01 40.0962C240.575 41.5308 238.663 42.2475 236.274 42.2475H211.657V8.78772ZM233.405 35.5547C235.478 35.5547 236.513 34.5196 236.513 32.4492V18.5873C236.513 16.5143 235.476 15.4791 233.405 15.4791H219.304V35.5547H233.405Z' fill='%23111111'/%3E%3C/g%3E%3Cpath d='M185.126 29.819C186.306 29.5958 187.374 29.1976 188.33 28.6246C189.157 28.1155 189.907 27.3753 190.576 26.4028C191.245 25.429 191.58 24.0988 191.58 22.4109V16.675C191.58 14.2861 190.864 12.3737 189.429 10.9391C187.994 9.50581 186.082 8.78784 183.693 8.78784H159.554V10.5501L168.179 25.5047L159.554 40.4135V42.2463H167.201V28.8948L174.939 28.8791L185.365 42.2463H192.297V38.4228L185.126 29.819ZM183.933 20.4985C183.933 22.5688 182.79 22.1968 180.718 22.1968H167.203V15.478H180.825C182.898 15.478 183.933 16.5144 183.933 18.5861V20.4985Z' fill='%23111111'/%3E%3Cpath d='M118.412 35.5797H100.041V28.8791H114.548L112.566 25.442L114.444 22.1968H100.041V15.5041H118.314L121.075 10.7329V8.81396H92.3943V42.2737H121.075V40.1968L118.412 35.5797Z' fill='%23111111'/%3E%3Cpath d='M165.334 25.3873L159.062 14.5213L140.242 25.3873H152.788L146.516 36.2521H133.968L127.696 25.3873L133.968 14.5213H159.062L154.054 5.84824L152.788 3.65649H127.696L115.15 25.3873L127.696 47.1181H152.788L165.334 25.3873Z' fill='%23F1B729'/%3E%3C/svg%3E"></div><div class="group/56067c50 flex w-full flex-col gap-4 rounded-md border border-solid border-border-default bg-surface-neutral-secondary shadow-sm px-6 py-6 items-stretch max-w-[448px]"><div class="flex w-full flex-col gap-1.5 items-start"><h1 class="text-heading- font-heading- text-text-neutral-primary">integrations.kwp.oauth.mandantTitle</h1><p class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">integrations.kwp.oauth.mandantBody</p></div><div class="group/3a65613d flex w-full flex-col items-start gap-2 rounded-md px-4 py-5 relative border border-solid border-border-negative-subtle bg-surface-feedback-subtle-negative" data-ui-id="ui.integrations.kwp.oauth.feedback"><div class="flex w-full items-start gap-3"><span class="text-heading-0 font-heading-0 text-icon-feedback-information hidden icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="hidden text-heading-0 font-heading-0 text-icon-feedback-positive icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="hidden text-heading-0 font-heading-0 text-icon-feedback-warning icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><span class="text-heading-0 font-heading-0 text-icon-feedback-negative inline-flex icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><spanLine truncated
|
||||
Reference in new issue
Block a user