LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
import {
Bell,
CloudDownload,
Code,
FileSearch,
Key,
RefreshCw,
} from "lucide-react";
import PropTypes from "prop-types";
import { Switch } from "@/components/ui/shims/antd-inputs";
import { Flex, Space } from "@/components/ui/shims/antd-layout";
import { Tooltip } from "@/components/ui/shims/antd-overlays";
import { Typography } from "@/components/ui/shims/antd-typography";
import { canEditResource } from "../../../helpers/resourceAccess";
import { StatusPills } from "../../pipelines-or-deployments/pipelines/PipelineCardConfig";
import {
ApiEndpointSection,
CardActionBox,
CardHeaderRow,
Last5RunsFieldRow,
LastRunFieldRow,
OwnerFieldRow,
WorkflowFieldRow,
} from "../../widgets/card-grid-view/CardFieldComponents";
/**
* Create API deployment card configuration for list mode - Row-based layout
* No expand/collapse - all content visible directly on card
* @return {Object} Card configuration object
*/
function createApiDeploymentCardConfig({
setSelectedRow,
updateStatus,
sessionDetails,
location,
onEdit,
onShare,
onDelete,
onViewLogs,
onManageKeys,
onSetupNotifications,
onCodeSnippets,
onDownloadPostman,
onManageCoOwners,
listContext,
}) {
return {
header: {
title: (deployment) => deployment.display_name,
actions: [],
},
expandable: false,
listContent: (deployment) => {
const kebabMenuItems = {
items: [
{
key: "view-logs",
icon: <FileSearch />,
label: "View Logs",
onClick: () => onViewLogs?.(deployment),
},
{ type: "divider" },
{
key: "manage-keys",
icon: <Key />,
label: "Manage Keys",
onClick: () => onManageKeys?.(deployment),
},
{
key: "notifications",
icon: <Bell />,
label: "Notifications",
onClick: () => onSetupNotifications?.(deployment),
},
{ type: "divider" },
{
key: "code-snippets",
icon: <Code />,
label: "Code Snippets",
onClick: () => onCodeSnippets?.(deployment),
},
{
key: "download-postman",
icon: <CloudDownload />,
label: "Download Postman Collection",
onClick: () => onDownloadPostman?.(deployment),
},
],
};
// Enabling or disabling is use, not configuration, so anyone the
// deployment is shared with may do it -- the backend admits an
// activation-only PATCH for exactly this.
const toggleTitle = deployment.is_active
? "Disable API deployment"
: "Enable API deployment";
return (
<div className="card-list-content">
<CardHeaderRow
title={deployment.display_name}
description={deployment.description}
>
<Space size={16} className="card-list-actions">
<Tooltip title={toggleTitle}>
<Switch
size="small"
checked={deployment.is_active}
data-testid={`api-deployment-toggle-${deployment.id}`}
onChange={(checked, e) => {
e.stopPropagation();
updateStatus(deployment);
}}
/>
</Tooltip>
<CardActionBox
item={deployment}
testIdPrefix="api-deployment"
setSelectedItem={setSelectedRow}
onEdit={onEdit}
onShare={onShare}
onDelete={onDelete}
deleteTitle="Delete API deployment?"
kebabMenuItems={kebabMenuItems}
/>
</Space>
</CardHeaderRow>
<div className="card-list-row-layout">
<WorkflowFieldRow
workflowId={deployment.workflow}
workflowName={deployment.workflow_name}
sessionDetails={sessionDetails}
location={location}
itemId={deployment.id}
listContext={listContext}
/>
<OwnerFieldRow
item={deployment}
sessionDetails={sessionDetails}
onManageCoOwners={() => onManageCoOwners?.(deployment)}
/>
<LastRunFieldRow lastRunTime={deployment.last_run_time} />
<Last5RunsFieldRow
statuses={deployment.last_5_run_statuses}
executionType="API"
itemId={deployment.id}
StatusPillsComponent={StatusPills}
listContext={listContext}
/>
</div>
<Flex align="center" gap={32} className="card-list-footer-row">
<Space size={10} className="card-list-footer-item">
<RefreshCw />
<Typography.Text
type="secondary"
className="card-list-footer-label"
>
Total Runs
</Typography.Text>
<Typography.Text>{deployment.run_count || 0}</Typography.Text>
</Space>
</Flex>
<ApiEndpointSection apiEndpoint={deployment.api_endpoint} />
</div>
);
},
sections: [],
};
}
createApiDeploymentCardConfig.propTypes = {
setSelectedRow: PropTypes.func.isRequired,
updateStatus: PropTypes.func.isRequired,
sessionDetails: PropTypes.object,
location: PropTypes.object,
onEdit: PropTypes.func,
onShare: PropTypes.func,
onDelete: PropTypes.func,
onViewLogs: PropTypes.func,
onManageKeys: PropTypes.func,
onSetupNotifications: PropTypes.func,
onCodeSnippets: PropTypes.func,
onDownloadPostman: PropTypes.func,
listContext: PropTypes.object,
};
export { createApiDeploymentCardConfig };