Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+201
@@ -0,0 +1,201 @@
|
||||
// R-P5 Interim-UI (AD-28) — connect/reconnect wizard as a REAL ~/ui Dialog
|
||||
// (D-P5 "Connection-Setup-Wizard", archetype A5+A6, size M 720) with a
|
||||
// StepperHorizontal: prerequisites → auto-generated credential form (from the
|
||||
// app's connectionSchema, secret fields with reveal toggle) → review & connect.
|
||||
// Submit posts the existing connect/reconnect route action (adapter validation +
|
||||
// health check server-side). OAuth2 apps without credential fields show an
|
||||
// interim hint (the guided OAuth redirect ships with the module phases P14/P16).
|
||||
// Final Subframe optics land as a tracked design-nachzug once David's D-P5 ships.
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherEye, FeatherEyeOff } from "@subframe/core";
|
||||
import type { AppCredentialField } from "@hivegrid/integrations";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Dialog } from "~/ui/components/Dialog";
|
||||
import { IconButton } from "~/ui/components/IconButton";
|
||||
import { StepperHorizontal } from "~/ui/components/StepperHorizontal";
|
||||
import { TextInput } from "~/ui/components/TextInput";
|
||||
|
||||
export type ConnectWizardMode = { type: "connect" } | { type: "reconnect"; connectionId: string; label: string };
|
||||
|
||||
export type ConnectWizardSubmit = { label: string; credentials: Record<string, string> };
|
||||
|
||||
export type ConnectWizardDialogProps = {
|
||||
open: boolean;
|
||||
mode: ConnectWizardMode;
|
||||
appTitleKey: string;
|
||||
connectionType: string;
|
||||
credentialFields: readonly AppCredentialField[];
|
||||
submitting: boolean;
|
||||
errorMessage: string | null;
|
||||
onSubmit: (input: ConnectWizardSubmit) => void;
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
const STEPS = ["prerequisites", "credentials", "confirm"] as const;
|
||||
|
||||
export function ConnectWizardDialog({ open, mode, appTitleKey, connectionType, credentialFields, submitting, errorMessage, onSubmit, onClose }: ConnectWizardDialogProps) {
|
||||
const { t } = useTranslation();
|
||||
const [step, setStep] = useState(0);
|
||||
const [label, setLabel] = useState(mode.type === "reconnect" ? mode.label : "");
|
||||
const [values, setValues] = useState<Record<string, string>>({});
|
||||
const [revealed, setRevealed] = useState<ReadonlySet<string>>(new Set());
|
||||
|
||||
// Reset the wizard whenever it (re)opens or the target changes (the parent
|
||||
// passes a fresh `mode` object per open, so state identity stays stable
|
||||
// across mere re-renders like submitting toggles).
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setStep(0);
|
||||
setLabel(mode.type === "reconnect" ? mode.label : "");
|
||||
setValues({});
|
||||
setRevealed(new Set());
|
||||
}
|
||||
}, [open, mode]);
|
||||
|
||||
const isOauthWithoutForm = connectionType === "oauth2" && credentialFields.length === 0;
|
||||
const labelMissing = mode.type === "connect" && label.trim().length === 0;
|
||||
const requiredMissing = credentialFields.some((field) => field.required && !(values[field.name] ?? "").trim());
|
||||
const credentialsIncomplete = labelMissing || requiredMissing;
|
||||
|
||||
function toggleReveal(name: string) {
|
||||
setRevealed((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (next.has(name)) next.delete(name);
|
||||
else next.add(name);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
|
||||
function submit() {
|
||||
onSubmit({ label: label.trim(), credentials: values });
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(nextOpen: boolean) => (nextOpen ? undefined : onClose())}>
|
||||
<Dialog.Content className="w-[720px] max-w-[90vw] p-6">
|
||||
<div className="flex w-full flex-col gap-6" data-ui-id="ui.integrations.app.wizard">
|
||||
<div className="flex flex-col gap-2">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">
|
||||
{mode.type === "reconnect" ? t("integrations.wizard.reconnectTitle", { app: t(appTitleKey) }) : t("integrations.wizard.title", { app: t(appTitleKey) })}
|
||||
</span>
|
||||
{errorMessage ? <Alert variant="error" title={t(errorMessage)} /> : null}
|
||||
</div>
|
||||
|
||||
<StepperHorizontal>
|
||||
{STEPS.map((key, index) => (
|
||||
<StepperHorizontal.Step
|
||||
key={key}
|
||||
firstStep={index === 0}
|
||||
lastStep={index === STEPS.length - 1}
|
||||
stepNumber={String(index + 1)}
|
||||
label={t(`integrations.wizard.step.${key}`)}
|
||||
variant={index === step ? "active" : index < step ? "completed" : "default"}
|
||||
/>
|
||||
))}
|
||||
</StepperHorizontal>
|
||||
|
||||
{step === 0 ? (
|
||||
<div className="flex w-full flex-col gap-2" data-wizard-step="prerequisites">
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.wizard.prerequisites.body", { app: t(appTitleKey) })}
|
||||
</span>
|
||||
{isOauthWithoutForm ? (
|
||||
<Alert variant="information" title={t("integrations.wizard.oauthHint")} />
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{step === 1 ? (
|
||||
<div className="flex w-full flex-col gap-4" data-wizard-step="credentials">
|
||||
{mode.type === "connect" ? (
|
||||
<TextInput className="w-full" label={t("integrations.wizard.label")} showLabel helpText={t("integrations.wizard.labelHelp")}>
|
||||
<TextInput.Input value={label} onChange={(event) => setLabel(event.target.value)} required data-ui-id="ui.integrations.app.wizard.label" />
|
||||
</TextInput>
|
||||
) : (
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.wizard.reconnectHint", { label: mode.label })}
|
||||
</span>
|
||||
)}
|
||||
{credentialFields.map((field) => {
|
||||
const isSecret = field.type === "secret";
|
||||
const shown = revealed.has(field.name);
|
||||
return (
|
||||
<TextInput
|
||||
key={field.name}
|
||||
className="w-full"
|
||||
label={t(field.labelKey)}
|
||||
showLabel
|
||||
type={isSecret && !shown ? "password" : "text"}
|
||||
iconRight={
|
||||
isSecret ? (
|
||||
<IconButton
|
||||
size="small"
|
||||
icon={shown ? <FeatherEyeOff /> : <FeatherEye />}
|
||||
onClick={() => toggleReveal(field.name)}
|
||||
aria-label={t(shown ? "integrations.wizard.hideSecret" : "integrations.wizard.revealSecret")}
|
||||
/>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<TextInput.Input
|
||||
type={isSecret && !shown ? "password" : "text"}
|
||||
value={values[field.name] ?? ""}
|
||||
onChange={(event) => setValues((prev) => ({ ...prev, [field.name]: event.target.value }))}
|
||||
required={field.required}
|
||||
data-wizard-field={field.name}
|
||||
/>
|
||||
</TextInput>
|
||||
);
|
||||
})}
|
||||
{credentialFields.length === 0 && !isOauthWithoutForm ? (
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.wizard.noFields")}
|
||||
</span>
|
||||
) : null}
|
||||
{isOauthWithoutForm ? <Alert variant="information" title={t("integrations.wizard.oauthHint")} /> : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{step === 2 ? (
|
||||
<div className="flex w-full flex-col gap-2" data-wizard-step="confirm">
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.wizard.confirm.body")}
|
||||
</span>
|
||||
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">
|
||||
{t("integrations.wizard.label")}: {mode.type === "reconnect" ? mode.label : label || "—"}
|
||||
</span>
|
||||
{credentialFields.map((field) => (
|
||||
<span key={field.name} className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
|
||||
{t(field.labelKey)}: {(values[field.name] ?? "").trim() ? (field.type === "secret" ? "••••••" : values[field.name]) : "—"}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="flex w-full items-center justify-end gap-2">
|
||||
<Button variant="tertiary" onClick={onClose}>
|
||||
{t("shared.cancel")}
|
||||
</Button>
|
||||
{step > 0 ? (
|
||||
<Button variant="secondary" onClick={() => setStep(step - 1)}>
|
||||
{t("shared.back")}
|
||||
</Button>
|
||||
) : null}
|
||||
{step < STEPS.length - 1 ? (
|
||||
<Button disabled={step === 1 && credentialsIncomplete} onClick={() => setStep(step + 1)} data-ui-id="ui.integrations.app.wizard.next">
|
||||
{t("shared.next")}
|
||||
</Button>
|
||||
) : (
|
||||
<Button loading={submitting} disabled={credentialsIncomplete} onClick={submit} data-ui-id="ui.integrations.app.wizard.submit">
|
||||
{t("integrations.wizard.connect")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// R-P5 Interim-UI (AD-28) — reusable Connection-Card (D-P5: app card with status
|
||||
// traffic light, Klartext health hint, last sync time and the lifecycle buttons
|
||||
// Verbinden/Re-Sync/Reconnect/Trennen). All later app connections (P14/P15/P16/
|
||||
// P20) render through this card. Pure presentational; callbacks injected.
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import type { ConnectionRow } from "@hivegrid/view-models";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { connectionStatusBadge } from "./integrationsBadges";
|
||||
|
||||
export type ConnectionCardProps = {
|
||||
row: ConnectionRow;
|
||||
canDisconnect: boolean;
|
||||
canManualSync: boolean;
|
||||
canReconnect: boolean;
|
||||
submitting: boolean;
|
||||
onManualSync: (connectionId: string) => void;
|
||||
onReconnect: (row: ConnectionRow) => void;
|
||||
onDisconnect: (row: ConnectionRow) => void;
|
||||
};
|
||||
|
||||
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 unhealthy = row.status === "degraded" || row.status === "broken";
|
||||
const revoked = row.status === "revoked";
|
||||
|
||||
return (
|
||||
<Card data-row-id={row.id} data-status={row.status} data-ui-id="ui.integrations.app.connectionCard">
|
||||
<div className="flex w-full flex-wrap items-start justify-between gap-2">
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{row.label}</span>
|
||||
{row.healthMessageKey ? (
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">{t(row.healthMessageKey)}</span>
|
||||
) : null}
|
||||
</div>
|
||||
<BadgeFeedback farbe={connectionStatusBadge(row.status)} size="small">
|
||||
{t(row.statusKey)}
|
||||
</BadgeFeedback>
|
||||
</div>
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">
|
||||
{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>
|
||||
<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">
|
||||
{t("integrations.connections.actions.resync")}
|
||||
</Button>
|
||||
) : null}
|
||||
{canReconnect && (unhealthy || revoked) ? (
|
||||
<Button variant="secondary" size="small" onClick={() => onReconnect(row)} data-ui-id="ui.integrations.app.reconnect">
|
||||
{t("integrations.connections.actions.reconnect")}
|
||||
</Button>
|
||||
) : null}
|
||||
{canDisconnect && !revoked ? (
|
||||
<Button variant="destructive" size="small" onClick={() => onDisconnect(row)} data-ui-id="ui.integrations.app.disconnect">
|
||||
{t("integrations.connections.actions.disconnect")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
// R-P5 Interim-UI (AD-28) — per-app connection management screen composed from
|
||||
// ~/ui (D-P5 "App-Detail / Connection-Verwaltung", archetype A6+A2). Pure
|
||||
// presentational: renders the server-built ConnectionDetailVM and reports the
|
||||
// lifecycle mutations (connect / reconnect / disconnect / manual re-sync)
|
||||
// through injected actions — the route owns the fetcher. Degraded/broken
|
||||
// connections raise a screen banner with a reconnect solution button (D-P5
|
||||
// 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 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 { ConnectionCard } from "./ConnectionCard";
|
||||
import { ConnectWizardDialog, type ConnectWizardMode, type ConnectWizardSubmit } from "./ConnectWizardDialog";
|
||||
|
||||
export type ConnectionDetailActions = {
|
||||
/** POSTs intent=connect to the app route action. */
|
||||
onConnect: (input: ConnectWizardSubmit) => void;
|
||||
/** POSTs intent=reconnect (same connection id, no history loss). */
|
||||
onReconnect: (connectionId: string, input: ConnectWizardSubmit) => void;
|
||||
/** POSTs intent=disconnect (status revoked, no hard delete). */
|
||||
onDisconnect: (connectionId: string) => void;
|
||||
/** POSTs intent=manual-sync. */
|
||||
onManualSync: (connectionId: string) => void;
|
||||
};
|
||||
|
||||
export type ConnectionDetailPageProps = {
|
||||
vm: ConnectionDetailVM;
|
||||
connectionType: string;
|
||||
credentialFields: readonly AppCredentialField[];
|
||||
backHref: string;
|
||||
actions: ConnectionDetailActions;
|
||||
submitting: boolean;
|
||||
errorMessage: 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) {
|
||||
const { t } = useTranslation();
|
||||
const [wizard, setWizard] = useState<WizardState>(null);
|
||||
const [disconnectRow, setDisconnectRow] = useState<ConnectionRow | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (closeSignal > 0) {
|
||||
setWizard(null);
|
||||
setDisconnectRow(null);
|
||||
}
|
||||
}, [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" />;
|
||||
}
|
||||
|
||||
const { appTitleKey, rows, canConnect, canDisconnect, canManualSync, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
const unhealthy = rows.filter((row) => row.status === "degraded" || row.status === "broken");
|
||||
|
||||
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>
|
||||
</div>
|
||||
{canConnect ? (
|
||||
<Button icon={<FeatherPlus />} onClick={() => setWizard({ type: "connect" })} data-ui-id="ui.integrations.app.connect">
|
||||
{t("integrations.connections.add")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{/* Screen banner (hierarchy §8): at least one degraded/broken connection. */}
|
||||
{unhealthy.length > 0 ? (
|
||||
<Alert
|
||||
variant={unhealthy.some((row) => row.status === "broken") ? "error" : "warning"}
|
||||
title={t("integrations.connections.banner.title", { count: unhealthy.length })}
|
||||
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 })}>
|
||||
{t("integrations.connections.actions.reconnect")}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
data-ui-id="ui.integrations.app.banner"
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<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" })}>
|
||||
{t("integrations.connections.add")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid w-full grid-cols-1 gap-4 lg:grid-cols-2" data-ui-id="ui.integrations.app.list">
|
||||
{rows.map((row) => (
|
||||
<ConnectionCard
|
||||
key={row.id}
|
||||
row={row}
|
||||
canDisconnect={canDisconnect}
|
||||
canManualSync={canManualSync}
|
||||
canReconnect={canConnect}
|
||||
submitting={submitting}
|
||||
onManualSync={actions.onManualSync}
|
||||
onReconnect={(target) => setWizard({ type: "reconnect", connectionId: target.id, label: target.label })}
|
||||
onDisconnect={setDisconnectRow}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Connect/Reconnect wizard (A5, M 720) */}
|
||||
{wizard ? (
|
||||
<ConnectWizardDialog
|
||||
open
|
||||
mode={wizard}
|
||||
appTitleKey={appTitleKey}
|
||||
connectionType={connectionType}
|
||||
credentialFields={credentialFields}
|
||||
submitting={submitting}
|
||||
errorMessage={errorMessage}
|
||||
onSubmit={(input) => {
|
||||
if (wizard.type === "reconnect") actions.onReconnect(wizard.connectionId, input);
|
||||
else actions.onConnect(input);
|
||||
}}
|
||||
onClose={() => setWizard(null)}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{/* Disconnect confirm (XS 420, Klartext: sync jobs stop, history preserved) */}
|
||||
<Dialog open={disconnectRow !== null} onOpenChange={(open: boolean) => (open ? undefined : setDisconnectRow(null))}>
|
||||
<Dialog.Content className="w-[420px] max-w-[90vw] p-4">
|
||||
{disconnectRow ? (
|
||||
<div className="flex w-full flex-col gap-6" data-ui-id="ui.integrations.app.disconnectConfirm">
|
||||
<div className="flex flex-col gap-2">
|
||||
<span className="text-heading-3 font-heading-3 text-text-neutral-primary">{t("integrations.disconnect.title", { label: disconnectRow.label })}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("integrations.disconnect.description")}
|
||||
</span>
|
||||
{errorMessage ? <Alert variant="error" title={t(errorMessage)} /> : null}
|
||||
</div>
|
||||
<div className="flex w-full items-center justify-end gap-2">
|
||||
<Button variant="tertiary" onClick={() => setDisconnectRow(null)}>
|
||||
{t("shared.cancel")}
|
||||
</Button>
|
||||
<Button variant="destructive" loading={submitting} onClick={() => actions.onDisconnect(disconnectRow.id)} data-ui-id="ui.integrations.app.disconnectSubmit">
|
||||
{t("integrations.connections.actions.disconnect")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
// R-P5 Interim-UI (AD-28) — integrations catalog preview screen composed from
|
||||
// ~/ui (D-P5 "Integrations-Katalog", archetype A6). Pure presentational: renders
|
||||
// the server-built IntegrationCatalogVM passed as a prop; navigation only, no
|
||||
// mutations. App cards grouped by category with a status light (connection
|
||||
// count) and a client-side search filter. Final Subframe optics land as a
|
||||
// tracked design-nachzug once David's D-P5 ships.
|
||||
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
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";
|
||||
|
||||
export type IntegrationsCatalogPageProps = {
|
||||
vm: IntegrationCatalogVM;
|
||||
};
|
||||
|
||||
export function IntegrationsCatalogPage({ vm }: IntegrationsCatalogPageProps) {
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState("");
|
||||
|
||||
if (vm.status !== "ready" || !vm.data) {
|
||||
return <div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.integrations.catalog" />;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
// Group by category (stable order: first appearance in the catalog).
|
||||
const groups: { categoryKey: string; rows: CatalogAppRow[] }[] = [];
|
||||
for (const row of visible) {
|
||||
const group = groups.find((entry) => entry.categoryKey === row.categoryKey);
|
||||
if (group) group.rows.push(row);
|
||||
else groups.push({ categoryKey: row.categoryKey, rows: [row] });
|
||||
}
|
||||
|
||||
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>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
// R-P5 Interim-UI (AD-28) — sync history screen composed from ~/ui (D-P5
|
||||
// "Sync-History", archetype A2): AppSyncRun table with Klartext summary,
|
||||
// client-side status/kind filters, manual re-sync trigger and a link into the
|
||||
// run detail. Pure presentational; the route owns the fetcher. Final Subframe
|
||||
// optics = tracked design-nachzug.
|
||||
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { SyncHistoryVM, SyncKind, SyncStatus } from "@hivegrid/view-models";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
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 { syncStatusBadge } from "./integrationsBadges";
|
||||
|
||||
const FILTER_ALL = "__all__";
|
||||
const STATUSES: readonly SyncStatus[] = ["pending", "running", "completed", "partial", "failed", "cancelled"];
|
||||
const KINDS: readonly SyncKind[] = ["manual", "scheduled", "webhook"];
|
||||
|
||||
export type SyncHistoryActions = {
|
||||
/** POSTs intent=manual-sync for this connection (app route action). */
|
||||
onManualSync: (connectionId: string) => void;
|
||||
};
|
||||
|
||||
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) {
|
||||
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" />;
|
||||
}
|
||||
|
||||
const { connectionId, rows, canManualSync, emptyHeadlineKey, emptyBodyKey } = vm.data;
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { 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>
|
||||
</div>
|
||||
{canManualSync ? (
|
||||
<Button loading={submitting} onClick={() => actions.onManualSync(connectionId)} data-ui-id="ui.integrations.syncs.resync">
|
||||
{t("integrations.connections.actions.resync")}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{/* Filters: status / kind (client-side, A2) */}
|
||||
<div className="flex flex-wrap items-end gap-4" data-ui-id="ui.integrations.syncs.filter">
|
||||
<Select
|
||||
className="max-w-[200px]"
|
||||
label={t("integrations.syncs.column.status")}
|
||||
showLabel
|
||||
value={status ?? FILTER_ALL}
|
||||
onValueChange={(value: string) => setStatus(value === FILTER_ALL ? null : (value as SyncStatus))}
|
||||
>
|
||||
<Select.Item value={FILTER_ALL}>{t("integrations.syncs.filter.all")}</Select.Item>
|
||||
{STATUSES.map((entry) => (
|
||||
<Select.Item key={entry} value={entry}>
|
||||
{t(`integrations.syncStatus.${entry}`)}
|
||||
</Select.Item>
|
||||
))}
|
||||
</Select>
|
||||
<Select
|
||||
className="max-w-[200px]"
|
||||
label={t("integrations.syncs.column.kind")}
|
||||
showLabel
|
||||
value={kind ?? FILTER_ALL}
|
||||
onValueChange={(value: string) => setKind(value === FILTER_ALL ? null : (value as SyncKind))}
|
||||
>
|
||||
<Select.Item value={FILTER_ALL}>{t("integrations.syncs.filter.all")}</Select.Item>
|
||||
{KINDS.map((entry) => (
|
||||
<Select.Item key={entry} value={entry}>
|
||||
{t(`integrations.syncKind.${entry}`)}
|
||||
</Select.Item>
|
||||
))}
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<div data-ui-id="ui.integrations.syncs.empty">
|
||||
<EmptyState title={t(emptyHeadlineKey)} body={t(emptyBodyKey)} />
|
||||
</div>
|
||||
) : visible.length === 0 ? (
|
||||
<EmptyState variant="no-results" title={t("integrations.syncs.noMatches")} body={t(emptyBodyKey)} />
|
||||
) : (
|
||||
<div className="w-full overflow-x-auto">
|
||||
<Table
|
||||
data-ui-id="ui.integrations.syncs.table"
|
||||
header={
|
||||
<Table.HeaderRow>
|
||||
<Table.HeaderCell>{t("integrations.syncs.column.started")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.syncs.column.kind")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.syncs.column.status")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.syncs.column.items")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.syncs.column.summary")}</Table.HeaderCell>
|
||||
<Table.HeaderCell> </Table.HeaderCell>
|
||||
</Table.HeaderRow>
|
||||
}
|
||||
>
|
||||
{visible.map((row) => (
|
||||
<Table.Row key={row.id} data-row-id={row.id} data-status={row.status}>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
|
||||
{row.startedIso ? dateFormatter.format(new Date(row.startedIso)) : "—"}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
|
||||
{t(row.kindKey)}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<BadgeFeedback farbe={syncStatusBadge(row.status)} size="small">
|
||||
{t(row.statusKey)}
|
||||
</BadgeFeedback>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
|
||||
{row.itemsSucceeded}/{row.itemsTotal}
|
||||
{row.itemsFailed > 0 ? ` (${row.itemsFailed} ✗)` : ""}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-tertiary">
|
||||
{row.summaryKey ? t(row.summaryKey) : "—"}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<Link to={`${runHrefBase}/${row.id}`} className="contents no-underline" data-ui-id="ui.integrations.syncs.detail">
|
||||
<LinkButton variant="subtle">{t("integrations.syncs.detail")}</LinkButton>
|
||||
</Link>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// R-P5 Interim-UI (AD-28) — sync-run detail screen composed from ~/ui (D-P5
|
||||
// "Sync-Run-Detail", archetype A3): run header with item counters + Klartext
|
||||
// summary, AppSyncItem table (entity ↔ external id, operation, status, Klartext
|
||||
// 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 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 { syncItemStatusBadge, syncLogSeverityBadge, syncStatusBadge } from "./integrationsBadges";
|
||||
|
||||
export type SyncRunDetailPageProps = {
|
||||
vm: SyncRunDetailVM;
|
||||
backHref: string;
|
||||
};
|
||||
|
||||
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" />;
|
||||
}
|
||||
|
||||
const data = vm.data;
|
||||
const dateFormatter = new Intl.DateTimeFormat(i18n.language, { 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">
|
||||
{t(data.kindKey)} · {data.startedIso ? dateFormatter.format(new Date(data.startedIso)) : "—"}
|
||||
</span>
|
||||
</div>
|
||||
<BadgeFeedback farbe={syncStatusBadge(data.status)}>{t(data.statusKey)}</BadgeFeedback>
|
||||
</div>
|
||||
|
||||
{/* Counters + Klartext summary */}
|
||||
<Card>
|
||||
<div className="flex w-full flex-wrap items-center gap-6">
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">{t("integrations.runDetail.stats.total")}</span>
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{data.itemsTotal}</span>
|
||||
</div>
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">{t("integrations.runDetail.stats.succeeded")}</span>
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{data.itemsSucceeded}</span>
|
||||
</div>
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">{t("integrations.runDetail.stats.failed")}</span>
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{data.itemsFailed}</span>
|
||||
</div>
|
||||
</div>
|
||||
{data.summaryKey ? (
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">{t(data.summaryKey)}</span>
|
||||
) : null}
|
||||
</Card>
|
||||
|
||||
{data.status === "failed" ? <Alert variant="error" title={data.summaryKey ? t(data.summaryKey) : t("integrations.syncStatus.failed")} /> : null}
|
||||
|
||||
{/* AppSyncItem table (A3) */}
|
||||
<div className="flex w-full flex-col gap-3">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t("integrations.runDetail.itemsHeadline")}</span>
|
||||
{data.items.length === 0 ? (
|
||||
<div data-ui-id="ui.integrations.runDetail.emptyItems">
|
||||
<EmptyState title={t(data.emptyItemsHeadlineKey)} body={t(data.emptyItemsBodyKey)} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full overflow-x-auto">
|
||||
<Table
|
||||
data-ui-id="ui.integrations.runDetail.items"
|
||||
header={
|
||||
<Table.HeaderRow>
|
||||
<Table.HeaderCell>{t("integrations.runDetail.column.entity")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.runDetail.column.externalId")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.runDetail.column.operation")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.runDetail.column.status")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("integrations.runDetail.column.error")}</Table.HeaderCell>
|
||||
</Table.HeaderRow>
|
||||
}
|
||||
>
|
||||
{data.items.map((item) => (
|
||||
<Table.Row key={item.id} data-row-id={item.id} data-status={item.status}>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">
|
||||
{item.entityType}
|
||||
{item.entityId ? ` · ${item.entityId}` : ""}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">{item.externalId}</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">
|
||||
{t(item.operationKey)}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<BadgeFeedback farbe={syncItemStatusBadge(item.status)} size="small">
|
||||
{t(item.statusKey)}
|
||||
</BadgeFeedback>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-tertiary">
|
||||
{item.errorText ? t(item.errorText) : "—"}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* AppSyncRunLog lines with severity */}
|
||||
<div className="flex w-full flex-col gap-3" data-ui-id="ui.integrations.runDetail.logs">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t("integrations.runDetail.logsHeadline")}</span>
|
||||
<div className="flex w-full flex-col gap-2">
|
||||
{data.logs.map((log) => (
|
||||
<div key={log.id} className="flex w-full items-center gap-2" data-log-id={log.id} data-severity={log.severity}>
|
||||
<BadgeFeedback farbe={syncLogSeverityBadge(log.severity)} size="small">
|
||||
{t(log.severityKey)}
|
||||
</BadgeFeedback>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">{t(log.messageKey)}</span>
|
||||
<span className="whitespace-nowrap text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">
|
||||
{dateFormatter.format(new Date(log.createdIso))}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
// R-P5 Interim-UI (AD-28) — shared BadgeFeedback color mappings for the
|
||||
// integrations screens (status traffic light per D-P5: green active / yellow
|
||||
// degraded / red broken / gray revoked|pending). Pure, client-safe.
|
||||
|
||||
import type { ConnectionStatus, SyncItemStatus, SyncLogSeverity, SyncStatus } from "@hivegrid/view-models";
|
||||
|
||||
type BadgeColor =
|
||||
| "subtle-neutral"
|
||||
| "subtle-positive"
|
||||
| "subtle-negative"
|
||||
| "subtle-warning"
|
||||
| "subtle-information";
|
||||
|
||||
export function connectionStatusBadge(status: ConnectionStatus): BadgeColor {
|
||||
switch (status) {
|
||||
case "active":
|
||||
return "subtle-positive";
|
||||
case "degraded":
|
||||
return "subtle-warning";
|
||||
case "broken":
|
||||
return "subtle-negative";
|
||||
case "pending":
|
||||
return "subtle-information";
|
||||
case "revoked":
|
||||
return "subtle-neutral";
|
||||
}
|
||||
}
|
||||
|
||||
export function syncStatusBadge(status: SyncStatus): BadgeColor {
|
||||
switch (status) {
|
||||
case "completed":
|
||||
return "subtle-positive";
|
||||
case "partial":
|
||||
return "subtle-warning";
|
||||
case "failed":
|
||||
return "subtle-negative";
|
||||
case "running":
|
||||
return "subtle-information";
|
||||
case "pending":
|
||||
case "cancelled":
|
||||
return "subtle-neutral";
|
||||
}
|
||||
}
|
||||
|
||||
export function syncItemStatusBadge(status: SyncItemStatus): BadgeColor {
|
||||
switch (status) {
|
||||
case "synced":
|
||||
return "subtle-positive";
|
||||
case "failed":
|
||||
return "subtle-negative";
|
||||
case "pending":
|
||||
return "subtle-information";
|
||||
case "skipped":
|
||||
return "subtle-neutral";
|
||||
}
|
||||
}
|
||||
|
||||
export function syncLogSeverityBadge(severity: SyncLogSeverity): BadgeColor {
|
||||
switch (severity) {
|
||||
case "success":
|
||||
return "subtle-positive";
|
||||
case "error":
|
||||
return "subtle-negative";
|
||||
case "warning":
|
||||
return "subtle-warning";
|
||||
case "info":
|
||||
return "subtle-information";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user