Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-2610 [FEAT] Implement simplified workflow studio UI (#1442)

jagadeeswaran-zipstackec06bfd3125d
diff --git a/backend/api_v2/api_deployment_views.py b/backend/api_v2/api_deployment_views.py
index dc307396e..b8fcbb1ba 100644
--- a/backend/api_v2/api_deployment_views.py
+++ b/backend/api_v2/api_deployment_views.py
@@ -130,7 +130,14 @@ class APIDeploymentViewSet(viewsets.ModelViewSet):
permission_classes = [IsOwner]
def get_queryset(self) -> QuerySet | None:
- return APIDeployment.objects.filter(created_by=self.request.user)
+ queryset = APIDeployment.objects.filter(created_by=self.request.user)
+
+ # Filter by workflow ID if provided
+ workflow_filter = self.request.query_params.get("workflow", None)
+ if workflow_filter:
+ queryset = queryset.filter(workflow_id=workflow_filter)
+
+ return queryset
def get_serializer_class(self) -> serializers.Serializer:
if self.action in ["list"]:
diff --git a/backend/pipeline_v2/views.py b/backend/pipeline_v2/views.py
index 2ef5f74d9..dfd0ee349 100644
--- a/backend/pipeline_v2/views.py
+++ b/backend/pipeline_v2/views.py
@@ -46,6 +46,12 @@ class PipelineViewSet(viewsets.ModelViewSet):
pipeline_type = self.request.query_params.get(PipelineConstants.TYPE)
if pipeline_type is not None:
queryset = queryset.filter(pipeline_type=pipeline_type)
+
+ # Filter by workflow ID if provided
+ workflow_filter = self.request.query_params.get("workflow", None)
+ if workflow_filter:
+ queryset = queryset.filter(workflow_id=workflow_filter)
+
return queryset
def get_serializer_class(self) -> serializers.Serializer:
diff --git a/frontend/src/components/agency/actions/Actions.css b/frontend/src/components/agency/actions/Actions.css
deleted file mode 100644
index 1ec61eb91..000000000
--- a/frontend/src/components/agency/actions/Actions.css
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Styles for Actions */
-
-.actions-container {
- display: flex;
- justify-content: space-between;
- /* Space between the buttons and the status bar */
- align-items: center;
- /* Vertically center align the status bar */
-}
-
-.status-bar {
- flex-grow: 1;
- /* Allow the status bar to expand and fill the available space */
- text-align: right;
- /* Align text to the right within the status bar */
-}
-
-.step-icon {
- opacity: 0.60;
- image-rendering: pixelated;
-}
diff --git a/frontend/src/components/agency/actions/Actions.jsx b/frontend/src/components/agency/actions/Actions.jsx
deleted file mode 100644
index 4b61e1892..000000000
--- a/frontend/src/components/agency/actions/Actions.jsx
+++ /dev/null
@@ -1,591 +0,0 @@
-import {
- ApiOutlined,
- ClearOutlined,
- DeploymentUnitOutlined,
- FastForwardOutlined,
- HistoryOutlined,
- PlayCircleOutlined,
- StepForwardOutlined,
- StopOutlined,
-} from "@ant-design/icons";
-import { Button, Divider, Space, Tooltip, Typography, Alert } from "antd";
-import PropTypes from "prop-types";
-import { useEffect, useState } from "react";
-import { Link } from "react-router-dom";
-
-import { StepIcon } from "../../../assets/index.js";
-import {
- deploymentsStaticContent,
- wfExecutionTypes,
-} from "../../../helpers/GetStaticData";
-import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
-import { useAlertStore } from "../../../store/alert-store";
-import { useSessionStore } from "../../../store/session-store";
-import { useWorkflowStore } from "../../../store/workflow-store";
-import { CreateApiDeploymentModal } from "../../deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx";
-import { EtlTaskDeploy } from "../../pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx";
-import FileUpload from "../file-upload/FileUpload.jsx";
-import "./Actions.css";
-import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
-import usePostHogEvents from "../../../hooks/usePostHogEvents.js";
-
-// Remove this variable and its usages from the code after the fix for step execution is implemented.
-const DISABLE_STEP_EXECUTION = true;
-
-function Actions({ statusBarMsg, initializeWfComp, stepLoader }) {
- const [executionId, setExecutionId] = useState("");
- const [execType, setExecType] = useState("");
- const [stepExecType, setStepExecType] = useState("");
- const [openFileUploadModal, setOpenFileUploadModal] = useState(false);
- const [fileList, setFileList] = useState([]);
- const [wfExecutionParams, setWfExecutionParams] = useState([]);
- const [openAddApiModal, setOpenAddApiModal] = useState(false);
- const [apiOpsPresent, setApiOpsPresent] = useState(false);
- const [canAddTaskPipeline, setCanAddTaskPipeline] = useState(false);
- const [canAddETLPipeline, setCanAddETLPipeline] = useState(false);
- const [openAddTaskModal, setOpenAddTaskModal] = useState(false);
- const [openAddETLModal, setOpenAddETLModal] = useState(false);
- const [deploymentName, setDeploymentName] = useState("");
- const [deploymentType, setDeploymentType] = useState("");
- const handleException = useExceptionHandler();
- const {
- projectName,
- details,
- isLoading,
- loadingType,
- updateWorkflow,
- source,
- destination,
- } = useWorkflowStore();
- const { setAlertDetails } = useAlertStore();
- const { sessionDetails } = useSessionStore();
- const { orgName } = sessionDetails;
- const axiosPrivate = useAxiosPrivate();
- const { posthogWfDeploymentEventText, setPostHogCustomEvent } =
- usePostHogEvents();
-
- useEffect(() => {
- // Enable Deploy as API only when
- // Source & Destination connection_type are selected as API
- setApiOpsPresent(
- source?.connection_type === "API" &&
- destination?.connection_type === "API"
- );
- // Enable Deploy as Task Pipeline only when
- // destination connection_type is FILESYSTEM and Source & Destination are Configured
- setCanAddTaskPipeline(
- destination?.connection_type === "FILESYSTEM" &&
- source?.connector_instance &&
- destination?.connector_instance
- );
- // Enable Deploy as ETL Pipeline only when
- // destination connection_type is DATABASE and Source & Destination are Configured
- setCanAddETLPipeline(
- source?.connector_instance &&
- ((destination?.connection_type === "DATABASE" &&
- destination.connector_instance) ||
- destination.connection_type === "MANUALREVIEW")
- );
- }, [source, destination]);
- useEffect(() => {
- if (apiOpsPresent) {
- setDeploymentType("API");
- } else if (canAddTaskPipeline) {
- setDeploymentType("Task Pipeline");
- } else if (canAddETLPipeline) {
- setDeploymentType("ETL Pipeline");
- }
- }, [deploymentName]);
- useEffect(() => {
- if (stepExecType === wfExecutionTypes[1]) {
- setStepExecType("");
- }
- }, [stepLoader]);
-
- const getInputFile = (isInitial, isStepExecution, executionAction) => {
- setWfExecutionParams([isInitial, isStepExecution, executionAction]);
- setFileList([]);
- setOpenFileUploadModal(true);
- };
-
- const handleInitialExecution = async (
- body,
- isStepExecution,
- executionAction
- ) => {
- initializeWfComp();
- if (isStepExecution) {
- setExecType("STEP");
- body["execution_action"] = wfExecutionTypes[0];
- } else {
- setExecType("NORMAL");
- }
-
- const loadingStatus = {
- isLoading: true,
- loadingType: "EXECUTE",
- };
- updateWorkflow(loadingStatus);
-
- try {
- const initialRes = await handleWfExecutionApi(body);
- const execIdValue = initialRes?.data?.execution_id;
-
- setExecutionId(execIdValue);
- body["execution_id"] = execIdValue;
- if (isStepExecution) {
- body["execution_action"] = wfExecutionTypes[executionAction];
- }
- const wfExecRes = await handleWfExecutionApi(body);
- const data = wfExecRes?.data;
- if (data?.execution_status === "ERROR") {
- setAlertDetails({
- type: "error",
- content: data?.error,
- });
- }
- } catch (err) {
- const errorDetail =
- err?.response?.data?.errors?.length > 0
- ? err.response.data.errors[0].detail
- : "Something went wrong";
- setAlertDetails({
- type: "error",
- content: errorDetail,
- });
- } finally {
- handleClearStates();
- loadingStatus["isLoading"] = false;
- loadingStatus["loadingType"] = "";
- updateWorkflow(loadingStatus);
- }
- };
-
- const handleWfExecution = async (
- isInitial,
- isStepExecution,
- executionAction
- ) => {
- try {
- if (isStepExecution) {
- setPostHogCustomEvent("wf_step", {
- info: `Clicked on '${wfExecutionTypes[executionAction]}' button (Step Execution)`,
- });
- } else {
- setPostHogCustomEvent("wf_run_wf", {
- info: "Clicked on 'Run Workflow' button (Normal Execution)",
- });
- }
- } catch (err) {
- // If an error occurs while setting custom posthog event, ignore it and continue
- }
- const workflowId = details?.id;
-
- if (!workflowId) {
- setAlertDetails({
- type: "error",
- content: "Invalid workflow id",
- });
- return;
- }
-
- const body = {
- workflow_id: workflowId,
- };
-
- if (isInitial) {
- await handleInitialExecution(body, isStepExecution, executionAction);
- } else {
- setStepExecType(wfExecutionTypes[executionAction]);
- body["execution_id"] = executionId;
- body["execution_action"] = wfExecutionTypes[executionAction];
-
- handleWfExecutionApi(body)
- .then(() => {})
- .catch((err) => {
- setAlertDetails(handleException(err));
- });
- }
- };
-
- const getRequestBody = (body) => {
- const formData = new FormData();
- fileList.forEach((file) => {
- formData.append("files", file);
- });
- formData.append("workflow_id", body["workflow_id"]);
- formData.append("execution_id", body["execution_id"]);
- if (body["execution_action"]) {
- formData.append("execution_action", body["execution_action"]);
- }
- return formData;
- };
-
- const shouldIncludeFile = (body) => {
- return body["execution_id"] && body["execution_id"].length > 0;
- };
-
- const handleWfExecutionApi = async (body) => {
- let header = {
- "X-CSRFToken": sessionDetails?.csrfToken,
- "Content-Type": "application/json",
- };
- if (shouldIncludeFile(body) && apiOpsPresent && fileList.length > 0) {
- body = getRequestBody(body);
- header = {
- "X-CSRFToken": sessionDetails?.csrfToken,
- "Content-Type": "multipart/form-data",
- };
- }
- const requestOptions = {
- method: "POST",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/workflow/execute/`,
- headers: header,
- data: body,
- };
-
- return axiosPrivate(requestOptions)
- .then((res) => res)
- .catch((err) => {
- setAlertDetails(handleException(err));
- });
- };
-
- const handleDisable = (wfExecTypeIndex) => {
- if (!isLoading) {
- return (
- wfExecTypeIndex === 1 || wfExecTypeIndex === 2 || wfExecTypeIndex === 3
- );
- }
-
- if (loadingType === "GENERATE") {
- return true;
- }
-
- // We can assume that the "loadingType" value is always going to be "EXECUTE" from here onwards.
- if (execType === "NORMAL") {
- return true;
- }
-
- // We can assume that the "execType" value is always going to be "STEP" from here onwards.
- if (wfExecTypeIndex === 0 || wfExecTypeIndex === 4) {
- return true;
- }
-
- if (
- stepExecType === wfExecutionTypes[1] ||
- stepExecType === wfExecutionTypes[2]
- ) {
- return true;
- }
-
- return stepExecType === wfExecutionTypes[wfExecTypeIndex];
- };
-
- const handleClearStates = () => {
- setExecType("");
- setStepExecType("");
- setExecutionId("");
- };
-
- const isIncompleteWorkflow = () => {
- if (details?.tool_instances.length === 0) {
- return true;
- }
- };
-
- // Disable Run & Step execution -
- // when NO tool present in the workflow
- // When source OR destination is NOT configured
- const disableAction = () => {
- if (isIncompleteWorkflow()) {
- return true;
- }
- if (
- source?.connection_type === "API" &&
- destination?.connection_type === "API"
- ) {
- return false;
- }
- if (
- source?.connection_type === "FILESYSTEM" &&
- destination?.connection_type === "MANUALREVIEW"
- ) {
- return false;
- }
- return !source?.connector_instance || !destination?.connector_instance;
- };
-
- const createDeployment = (type) => {
- const workflowId = details?.id;
- if (!workflowId) {
- setAlertDetails({
- type: "error",
- content: "Invalid workflow id",
- });
- return;
- }
- if (type === "API") {
- setOpenAddApiModal(true);
- }
- if (type === "TASK") {
- setOpenAddTaskModal(true);
- }
- if (type === "ETL") {
- setOpenAddETLModal(true);
- }
- };
-
- const handleClearCache = () => {
- const workflowId = details?.id;
-
- if (!workflowId) {
- setAlertDetails({
- type: "error",
- content: "Invalid workflow id",
- });
- return;
- }
-
- const requestOptions = {
- method: "GET",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/workflow/${workflowId}/clear-cache/`,
- };
-
- axiosPrivate(requestOptions)
- .then((res) => {
- const msg = res?.data;
- setAlertDetails({
- type: "success",
- content: msg,
- });
- })
- .catch((err) => {
- const msg = err?.response?.data || "Failed to clear cache.";
- setAlertDetails({
- type: "error",
- content: msg,
- });
- });
- };
-
- const handleClearFileMarker = () => {
- const workflowId = details?.id;
-
- if (!workflowId) {
- setAlertDetails({
- type: "error",
- content: "Invalid workflow id",
- });
- return;
- }
-
- const requestOptions = {
- method: "GET",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/workflow/${workflowId}/clear-file-marker/`,
- };
-
- axiosPrivate(requestOptions)
- .then((res) => {
- const msg = res?.data;
- setAlertDetails({
- type: "success",
- content: msg,
- });
- })
- .catch((err) => {
- const msg = err?.response?.data || "Failed to clear file marker.";
- setAlertDetails({
- type: "error",
- content: msg,
- });
- });
- };
-
- const handleDeployBtnClick = (deployType) => {
- createDeployment(deployType);
-
- try {
- setPostHogCustomEvent(posthogWfDeploymentEventText[deployType], {
- info: `Clicked on 'Deploy as ${deployType}' button`,
- workflow_name: projectName,
- });
- } catch (err) {
- // If an error occurs while setting custom posthog event, ignore it and continue
- }
- };
-
- return (
- <>
- <div className="actions-container">
- <Space direction="horizontal" className="display-flex-left">
- <Tooltip title="Run Workflow">
- <Button
- onClick={() =>
- apiOpsPresent
- ? getInputFile(true, false, 4)
- : handleWfExecution(true, false, 4)
- }
- disabled={disableAction() || handleDisable(4)}
- loading={execType === "NORMAL"}
- >
- <PlayCircleOutlined />
- </Button>
- </Tooltip>
- <Divider type="vertical" />
- {!DISABLE_STEP_EXECUTION && (
- <>
- <Tooltip title="Start step execution">
- <Button
- onClick={() =>
- apiOpsPresent
- ? getInputFile(true, true, 0)
- : handleWfExecution(true, true, 0)
- }
- disabled={disableAction() || handleDisable(0)}
- loading={execType === "STEP"}
- >
- <StepIcon className="step-icon" />
- </Button>
- </Tooltip>
- <Tooltip title="Next step">
- <Button
- onClick={() => handleWfExecution(false, true, 1)}
- disabled={handleDisable(1)}
- loading={stepExecType === wfExecutionTypes[1]}
- >
- <StepForwardOutlined />
- </Button>
- </Tooltip>
- <Tooltip title="Execute remaining steps">
- <Button
- onClick={() => handleWfExecution(false, true, 3)}
- disabled={handleDisable(3)}
- loading={stepExecType === wfExecutionTypes[3]}
- >
- <FastForwardOutlined />
- </Button>
- </Tooltip>
- <Tooltip title="Stop execution">
- <Button
- onClick={() => handleWfExecution(false, true, 2)}
- disabled={handleDisable(2)}
- loading={stepExecType === wfExecutionTypes[2]}
- >
- <StopOutlined />
- </Button>
- </Tooltip>
- <Divider type="vertical" />
- </>
- )}
- <Tooltip title="Clear Cache">
- <Button disabled={isLoading} onClick={handleClearCache}>
- <ClearOutlined />
- </Button>
- </Tooltip>
- <Tooltip title="Clear Processed File History">
- <Button disabled={isLoading} onClick={handleClearFileMarker}>
- <HistoryOutlined />
- </Button>
- </Tooltip>
- <Divider type="vertical" />
- <Tooltip title="Deploy as API">
- <Button
- disabled={isIncompleteWorkflow() || !apiOpsPresent}
- onClick={() => handleDeployBtnClick("API")}
- >
- <ApiOutlined />
- </Button>
- </Tooltip>
- <Tooltip title="Deploy as ETL Pipeline">
- <Button
- disabled={isIncompleteWorkflow() || !canAddETLPipeline}
- onClick={() => handleDeployBtnClick("ETL")}
- >
- <DeploymentUnitOutlined />
- </Button>
- </Tooltip>
- <Tooltip title="Deploy as Task Pipeline">
- <Button
- onClick={() => handleDeployBtnClick("TASK")}
- disabled={isIncompleteWorkflow() || !canAddTaskPipeline}
- >
- <ApiOutlined />
- </Button>
- </Tooltip>
- <Divider type="vertical" />
- {deploymentName && (
- <Alert
- message={
- <>
- <span>
- This Workflow has been deployed as an {deploymentType}:{" "}
- </span>
- <Link
- to={`/${orgName}/${deploymentType
- .split(" ")[0]
- .toLowerCase()}`}
- >
- {deploymentName}
- </Link>
- </>
- }
- type="success"
- />
- )}
- </Space>
- <div className="status-bar">
- <Typography.Text>{statusBarMsg}</Typography.Text>
- </div>
- </div>
- {openFileUploadModal && (
- <FileUpload
- open={openFileUploadModal}
- setFileList={setFileList}
- fileList={fileList}
- setOpen={setOpenFileUploadModal}
- wfExecutionParams={wfExecutionParams}
- continueWfExecution={handleWfExecution}
- />
- )}
- {openAddApiModal && (
- <CreateApiDeploymentModal
- open={openAddApiModal}
- setOpen={setOpenAddApiModal}
- isEdit={false}
- workflowId={details?.id}
- setDeploymentName={setDeploymentName}
- workflowEndpointList={[]}
- />
- )}
- {openAddTaskModal && (
- <EtlTaskDeploy
- open={openAddTaskModal}
- setOpen={setOpenAddTaskModal}
- type="task"
- title={deploymentsStaticContent["task"].modalTitle}
- workflowId={details?.id}
- setDeploymentName={setDeploymentName}
- />
- )}
- {openAddETLModal && (
- <EtlTaskDeploy
- open={openAddETLModal}
- setOpen={setOpenAddETLModal}
- type="etl"
- title={deploymentsStaticContent["etl"].modalTitle}
- workflowId={details?.id}
- setDeploymentName={setDeploymentName}
- />
- )}
- </>
- );
-}
-
-Actions.propTypes = {
- statusBarMsg: PropTypes.string,
- initializeWfComp: PropTypes.func.isRequired,
- stepLoader: PropTypes.bool.isRequired,
-};
-
-export { Actions };
diff --git a/frontend/src/components/agency/agency/Agency.css b/frontend/src/components/agency/agency/Agency.css
index 3eb162ba6..f5c0425c6 100644
--- a/frontend/src/components/agency/agency/Agency.css
+++ b/frontend/src/components/agency/agency/Agency.css
@@ -1,11 +1,5 @@
/* Styles for Agency */
-.agency-layout {
- height: 100%;
- display: flex;
- flex-direction: column;
-}
-
.agency-sider-layout {
height: 100%;
background-color: transparent !important;
@@ -17,6 +11,9 @@
flex-direction: column;
}
+.island-layout > div:has(.agency-layout) {
+ overflow: auto;
+}
.agency-main {
flex: 1;
}
@@ -50,10 +47,246 @@
border-radius: 0px;
}
-.agency-ide-log-modal .ant-modal-content{
+.agency-ide-log-modal .ant-modal-content {
height: 80vh;
}
-.agency-ide-log-modal .agency-ide-logs{
+.agency-ide-log-modal .agency-ide-logs {
height: 70vh !important;
}
+
+.agency-layout {
+ display: flex;
+ flex-direction: column;
+ overflow: auto;
+}
+
+.agency-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px;
+ gap: 24px;
+}
+
+.workflow-title {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.workflow-progress-section {
+ padding: 8px;
+ width: 100%;
+}
+
+.progress-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 8px;
+}
+
+.progress-label {
+ font-weight: 500;
+ font-size: 16px;
+}
+
+.progress-count {
+ font-size: 14px;
+ color: #8c8c8c;
+}
+
+.workflow-grid-container {
+ padding: 24px;
+}
+
+.workflow-card {
+ background: #f9fafb;
+ border-radius: 12px;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.deployment-alert {
+ margin: 0 24px;
+}
+.workflow-card-header {
+ display: flex;
+ align-items: flex-start;
+ gap: 16px;
+ padding: 20px 24px 16px;
+}
+
+.workflow-card-number {
+ width: 32px;
+ height: 32px;
+ background: #1890ff;
+ color: white;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-weight: 600;
+ flex-shrink: 0;
+ transition: background-color 0.3s ease;
+}
+
+.workflow-card-number.completed {
+ background: #e6f7ff;
+ color: #1890ff;
+}
+
+.workflow-card-number.completed .anticon {
+ font-size: 16px;
+ color: #1890ff;
+}
+
+.workflow-card-info {
+ flex: 1;
+}
+
+.workflow-card-info .ant-typography {
+ margin: 0;
+}
+
+.workflow-card-info h4 {
+ margin: 0 0 4px 0;
+ font-size: 16px;
+}
+
+.workflow-card-content {
+ flex: 1;
+ padding: 10px 0px;
+ display: flex;
+ flex-direction: row;
+ gap: 12px;
+}
+
+.workflow-select {
+ width: 200px !important;
+}
+
+.workflow-select:focus {
+ outline: none;
+ border-color: #1890ff;
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
+}
+
+.debug-panel {
+ background: white;
+ margin: 12px;
+}
+
+.debug-panel-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px 24px;
+ border-radius: 8px;
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
+ border: 1px solid #f0f0f0;
+}
+
+.debug-panel-title {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-weight: 500;
+}
+
+.debug-panel-content {
+ padding: 16px;
+ text-align: center;
+ color: #8c8c8c;
+ height: 600px;
+}
+
+.workflow-sidebar {
+ position: fixed;
+ top: 0;
+ right: 0;
+ width: 400px;
+ height: 100vh;
+ background: white;
+ border-left: 1px solid #d9d9d9;
+ box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
+ z-index: 1000;
+ overflow-y: auto;
+}
+
+.close-sidebar-btn {
+ position: absolute;
+ top: 8px;
+ right: 8px;
+ width: 24px;
+ height: 24px;
+ border: none;
+ background: #f0f0f0;
+ color: #8c8c8c;
+ font-size: 16px;
+ line-height: 1;
+}
+
+.show-debug-btn {
+ color: #8c8c8c;
+}
+
+/* Tool Selection Display */
+.tool-selection-display {
+ margin-bottom: 16px;
+}
+
+.selected-tool-info {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 4px 12px;
+ background: #f6f8fa;
+ border: 1px solid #d0d7de;
+ border-radius: 6px;
+}
+
+.selected-tool-name {
+ font-weight: 500;
+ color: #24292f;
+}
+
+.select-tool-btn {
+ width: 100%;
+ height: 40px;
+ border-style: dashed;
+ border-color: #d9d9d9;
+ color: #8c8c8c;
+ background: #fafafa;
+}
+
+.select-tool-btn:hover {
+ border-color: #1890ff;
+ color: #1890ff;
+}
+
+/* Status Message */
+.status-message {
+ padding: 8px 16px;
+ background: #f6f8fa;
+ border: 1px solid #e1e4e8;
+ border-radius: 6px;
+ margin-bottom: 16px;
+}
+
+.status-text {
+ font-size: 14px;
+ color: #586069;
+ font-style: italic;
+}
+
+/* Loading Container */
+.agency-loading-container {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-height: 60vh;
+ width: 100%;
+}
diff --git a/frontend/src/components/agency/agency/Agency.jsx b/frontend/src/components/agency/agency/Agency.jsx
index 74fd98528..936b4cd8e 100644
--- a/frontend/src/components/agency/agency/Agency.jsx
+++ b/frontend/src/components/agency/agency/Agency.jsx
@@ -1,20 +1,47 @@
-import { Button, Layout } from "antd";
-import { LeftOutlined, RightOutlined } from "@ant-design/icons";
-import Sider from "antd/es/layout/Sider";
+import {
+ Button,
+ Row,
+ Col,
+ Typography,
+ Progress,
+ Dropdown,
+ Select,
+ Alert,
+} from "antd";
+import {
+ BugOutlined,
+ SettingOutlined,
+ PlayCircleOutlined,
+} from "@ant-design/icons";
import { useEffect, useState } from "react";
+import { Link } from "react-router-dom";
-import { IslandLayout } from "../../../layouts/island-layout/IslandLayout";
-import { Actions } from "../actions/Actions";
-import { WorkflowExecution } from "../workflow-execution/WorkflowExecution";
import "./Agency.css";
import { useSocketMessagesStore } from "../../../store/socket-messages-store";
import { useWorkflowStore } from "../../../store/workflow-store";
+import { useToolSettingsStore } from "../../../store/tool-settings";
import { SidePanel } from "../side-panel/SidePanel";
import { PageTitle } from "../../widgets/page-title/PageTitle";
-
+import { WorkflowCard } from "../workflow-card/WorkflowCard";
+import { sourceTypes, wfExecutionTypes } from "../../../helpers/GetStaticData";
+import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
+import { useAlertStore } from "../../../store/alert-store";
+import { useSessionStore } from "../../../store/session-store";
+import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
+import useRequestUrl from "../../../hooks/useRequestUrl";
+import { CreateApiDeploymentModal } from "../../deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx";
+import { EtlTaskDeploy } from "../../pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx";
+import usePostHogEvents from "../../../hooks/usePostHogEvents.js";
+import FileUpload from "../file-upload/FileUpload.jsx";
+import { IslandLayout } from "../../../layouts/island-layout/IslandLayout.jsx";
+import { apiDeploymentsService } from "../../deployments/api-deployment/api-deployments-service.js";
+import { pipelineService } from "../../pipelines-or-deployments/pipeline-service.js";
+import { InputOutput } from "../input-output/InputOutput";
+import { ToolSelectionSidebar } from "../tool-selection-sidebar/ToolSelectionSidebar.jsx";
+import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
function Agency() {
- const [isCollapsed, setIsCollapsed] = useState(false);
const [steps, setSteps] = useState([]);
+ const [workflowProgress, setWorkflowProgress] = useState(0);
const [inputMd, setInputMd] = useState("");
const [outputMd, setOutputMd] = useState("");
const [statusBarMsg, setStatusBarMsg] = useState("");
@@ -22,12 +49,98 @@ function Agency() {
const [destinationMsg, setDestinationMsg] = useState("");
const { message, setDefault } = useSocketMessagesStore();
const workflowStore = useWorkflowStore();
- const { details, loadingType, projectName } = workflowStore;
+ const {
+ details,
+ loadingType,
+ projectName,
+ source,
+ destination,
+ projectId,
+ updateWorkflow,
+ allowChangeEndpoint,
+ } = workflowStore;
+ const { sessionDetails } = useSessionStore();
+ const { orgName } = sessionDetails;
+ const { getUrl } = useRequestUrl();
+ const axiosPrivate = useAxiosPrivate();
+ const { setAlertDetails } = useAlertStore();
+ const handleException = useExceptionHandler();
+ const apiDeploymentService = apiDeploymentsService();
+ const pipelineServiceInstance = pipelineService();
const prompt = details?.prompt_text;
- const [activeToolId, setActiveToolId] = useState("");
const [prevLoadingType, setPrevLoadingType] = useState("");
const [isUpdateSteps, setIsUpdateSteps] = useState(false);
- const [stepLoader, setStepLoader] = useState(false);
+ const [showDebug, setShowDebug] = useState(false);
+ const [showSidebar, setShowSidebar] = useState(false);
+ const [showToolSelectionSidebar, setShowToolSelectionSidebar] =
+ useState(false);
+ const [isInitialLoading, setIsInitialLoading] = useState(true);
+ const [exportedTools, setExportedTools] = useState([]);
+ const [selectedTool, setSelectedTool] = useState(null);
+ const [selectedDeploymentType, setSelectedDeploymentType] = useState(null);
+ const [openAddApiModal, setOpenAddApiModal] = useState(false);
+ const [openAddETLModal, setOpenAddETLModal] = useState(false);
+ const [openAddTaskModal, setOpenAddTaskModal] = useState(false);
+ const [deploymentName, setDeploymentName] = useState("");
+ const [deploymentType, setDeploymentType] = useState("");
+ const [apiOpsPresent, setApiOpsPresent] = useState(false);
+ const [canAddTaskPipeline, setCanAddTaskPipeline] = useState(false);
+ const [canAddETLPipeline, setCanAddETLPipeline] = useState(false);
+ const [deploymentInfo, setDeploymentInfo] = useState(null);
+ const [executionId, setExecutionId] = useState("");
+ const [openFileUploadModal, setOpenFileUploadModal] = useState(false);
+ const [fileList, setFileList] = useState([]);
+ const [wfExecutionParams, setWfExecutionParams] = useState([]);
+
+ const { setPostHogCustomEvent } = usePostHogEvents();
+
+ useEffect(() => {
+ const abortController = new AbortController();
+ const signal = abortController.signal;
+
+ const initializeData = async () => {
+ try {
+ setIsInitialLoading(true);
+ await Promise.all([
+ getWfEndpointDetails(signal),
+ canUpdateWorkflow(signal),
+ getExportedTools(signal),
+ fetchDeploymentInfo(signal),
+ ]);
+
+ if (!signal.aborted) {
+ initializeSelectedTool();
+ }
+ } catch (error) {
+ if (!signal.aborted) {
+ console.error("Error initializing workflow data:", error);
+ }
+ } finally {
+ if (!signal.aborted) {
+ // Add a small delay to prevent flash of content
+ setTimeout(() => {
+ setIsInitialLoading(false);
+ }, 500);
+ }
+ }
+ };
+
+ initializeData();
+
+ return () => {
+ abortController.abort();
+ };
+ }, []);
+
+ useEffect(() => {
+ if (apiOpsPresent) {
+ setDeploymentType("API");
+ } else if (canAddTaskPipeline) {
+ setDeploymentType("Task Pipeline");
+ } else if (canAddETLPipeline) {
+ setDeploymentType("ETL Pipeline");
+ }
+ }, [apiOpsPresent, canAddTaskPipeline, canAddETLPipeline]);
useEffect(() => {
if (prevLoadingType !== "EXECUTE") {
@@ -45,6 +158,281 @@ function Agency() {
setIsUpdateSteps(false);
}, [isUpdateSteps, prompt]);
+ useEffect(() => {
+ // Enable Deploy as API only when
+ // Source & Destination connection_type are selected as API
+ const isApiOps =
+ source?.connection_type === "API" &&
+ destination?.connection_type === "API";
+ setApiOpsPresent(isApiOps);
+
+ // If API ops is enabled and other deployment types were selected, reset
+ if (
+ isApiOps &&
+ selectedDeploymentType &&
+ selectedDeploymentType !== "API"
+ ) {
+ setSelectedDeploymentType(null);
+ }
+ // Enable Deploy as Task Pipeline only when
+ // destination connection_type is FILESYSTEM and Source & Destination are Configured
+ setCanAddTaskPipeline(
+ destination?.connection_type === "FILESYSTEM" &&
+ source?.connector_instance &&
+ destination?.connector_instance
+ );
+ // Enable Deploy as ETL Pipeline only when
+ // destination connection_type is DATABASE and Source & Destination are Configured
+ setCanAddETLPipeline(
+ source?.connector_instance &&
+ ((destination?.connection_type === "DATABASE" &&
+ destination.connector_instance) ||
+ destination.connection_type === "MANUALREVIEW")
+ );
+ }, [source, destination]);
+
+ const getWfEndpointDetails = (signal) => {
+ const requestOptions = {
+ method: "GET",
+ url: getUrl(`workflow/${projectId}/endpoint/`),
+ signal,
+ };
+ return axiosPrivate(requestOptions)
+ .then((res) => {
+ if (!signal?.aborted) {
+ const data = res?.data || [];
+ const sourceDetails = data.find(
+ (item) => item?.endpoint_type === "SOURCE"
+ );
+ const destDetails = data.find(
+ (item) => item?.endpoint_type === "DESTINATION"
+ );
+ const body = {
+ source: sourceDetails,
+ destination: destDetails,
+ };
+ updateWorkflow(body);
+ }
+ })
+ .catch((err) => {
+ if (!signal?.aborted) {
+ setAlertDetails(handleException(err, "Failed to get endpoints"));
+ }
+ throw err;
+ });
+ };
+
+ const canUpdateWorkflow = (signal) => {
+ const requestOptions = {
+ method: "GET",
+ url: getUrl(`workflow/${projectId}/can-update/`),
+ signal,
+ };
+ return axiosPrivate(requestOptions)
+ .then((res) => {
+ if (!signal?.aborted) {
+ const data = res?.data || {};
+ const body = {
+ allowChangeEndpoint: data?.can_update,
+ };
+ updateWorkflow(body);
+ }
+ })
+ .catch((err) => {
+ if (!signal?.aborted) {
+ setAlertDetails(
+ handleException(err, "Failed to get can update status")
+ );
+ }
+ throw err;
+ });
+ };
+
+ const getExportedTools = (signal) => {
+ const requestOptions = {
+ method: "GET",
+ url: getUrl(`tool/`),
+ signal,
+ };
+ return axiosPrivate(requestOptions)
+ .then((res) => {
+ if (!signal?.aborted) {
+ const data = res?.data || [];
+ setExportedTools(data);
+ }
+ })
+ .catch((err) => {
+ if (!signal?.aborted) {
+ setAlertDetails(handleException(err, "Failed to get exported tools"));
+ }
+ throw err;
+ });
+ };
+
+ // Fetch deployment information for the current workflow
+ const fetchDeploymentInfo = async (signal) => {
+ if (!projectId) {
+ return;
+ }
+
+ try {
+ // Fetch API deployments and pipelines in parallel
+ const [apiDeployments, pipelines] = await Promise.all([
+ apiDeploymentService.getDeploymentsByWorkflowId(projectId),
+ pipelineServiceInstance.getPipelinesByWorkflowId(projectId),
+ ]);
+
+ // Check if request was aborted before setting state
+ if (signal?.aborted) {
+ return;
+ }
+
+ const apiDeploymentData = apiDeployments?.data || [];
+ const pipelineData = pipelines?.data || [];
+
+ // Find active deployments
+ const activeApiDeployment = apiDeploymentData.find(
+ (deployment) => deployment.is_active
+ );
+
+ // For pipelines, any pipeline associated with this workflow is considered a deployment
+ // regardless of active status, since workflows can only have one deployment
+ const workflowPipelines = pipelineData;
+
+ // Set deployment info
+ let deploymentInfo = null;
+ if (activeApiDeployment) {
+ deploymentInfo = {
+ type: "API",
+ name: activeApiDeployment.display_name,
+ id: activeApiDeployment.id,
+ };
+ } else if (workflowPipelines.length > 0) {
+ // If multiple pipelines, prioritize by type: ETL > TASK
+ const etlPipeline = workflowPipelines.find(
+ (p) => p.pipeline_type === "ETL"
+ );
+ const taskPipeline = workflowPipelines.find(
+ (p) => p.pipeline_type === "TASK"
+ );
+ const pipeline = etlPipeline || taskPipeline || workflowPipelines[0];
+
+ deploymentInfo = {
+ type: pipeline.pipeline_type,
+ name: pipeline.pipeline_name,
+ id: pipeline.id,
+ };
+ }
+
+ if (!signal?.aborted) {
+ setDeploymentInfo(deploymentInfo);
+ }
+ } catch (err) {
+ // Don't show alert for this as it's not critical
+ // Also check if error is due to abort
+ if (signal?.aborted) {
+ return;
+ }
+ }
+ };
+
+ // Initialize selected tool from existing tool instances on page load
+ const initializeSelectedTool = () => {
+ if (details?.tool_instances?.length > 0) {
+ const toolInstance = details.tool_instances[0]; // Get first tool instance
+ setSelectedTool(toolInstance.tool_id);
+
+ // Also update tool settings store for proper sidebar functionality
+ const { setToolSettings } = useToolSettingsStore.getState();
+ setToolSettings({
+ id: toolInstance.id,
+ tool_id: toolInstance.tool_id,
+ });
+ }
+ };
+
+ // Check if workflow has any active deployments (for progress calculation)
+ // Check if workflow is deployed using allowChangeEndpoint flag
+ const isWorkflowDeployed = () => {
+ // When allowChangeEndpoint is false, workflow is deployed and locked
+ return !allowChangeEndpoint;
+ };
+
+ const createDeployment = (type) => {
+ const workflowId = details?.id;
+ if (!workflowId) {
+ setAlertDetails({
+ type: "error",
+ content: "Invalid workflow id",
+ });
+ return;
+ }
+ if (type === "API") {
+ setOpenAddApiModal(true);
+ }
+ if (type === "TASK") {
+ setOpenAddTaskModal(true);
+ }
+ if (type === "ETL") {
+ setOpenAddETLModal(true);
+ }
+ };
+
+ const handleDeployBtnClick = (deployType) => {
+ createDeployment(deployType);
+
+ try {
+ const posthogWfDeploymentEventText = {
+ API: "wf_deploy_as_api_clicked",
+ ETL: "wf_deploy_as_etl_clicked",
+ TASK: "wf_deploy_as_task_clicked",
+ };
+
+ setPostHogCustomEvent(posthogWfDeploymentEventText[deployType], {
+ info: `Clicked on 'Deploy as ${deployType}' button`,
+ workflow_name: projectName,
+ });
+ } catch (err) {
+ // If an error occurs while setting custom posthog event, ignore it and continue
+ }
+ };
+
+ const handleDeploymentTypeChange = (value) => {
+ setSelectedDeploymentType(value);
+ };
+
+ // Get deployment status text for a specific type
+ const getDeploymentStatusText = (type) => {
+ return `Deploy as ${type}`;
+ };
+
+ // Generate deployment alert message content
+ const generateDeploymentMessage = () => {
+ if (deploymentInfo) {
+ const article = deploymentInfo.type === "API" ? "an" : "a";
+ const urlPath =
+ deploymentInfo.type === "API"
+ ? "api"
+ : deploymentInfo.type.toLowerCase();
+
+ return (
+ <>
+ {article} {deploymentInfo.type}:{" "}
+ <Link to={`/${orgName}/${urlPath}`}>{deploymentInfo.name}</Link>
+ </>
+ );
+ } else {
+ const urlPath = deploymentType.split(" ")[0].toLowerCase();
+
+ return (
+ <>
+ an {deploymentType}:{" "}
+ <Link to={`/${orgName}/${urlPath}`}>{deploymentName}</Link>
+ </>
+ );
+ }
+ };
+
const setToolInstances = () => {
const toolInstances = [...(details?.tool_instances || [])];
setSteps(toolInstances);
@@ -52,7 +440,6 @@ function Agency() {
const initializeWfComp = () => {
setToolInstances();
- setActiveToolId("");
setInputMd("");
setOutputMd("");
setStatusBarMsg("");
@@ -110,12 +497,11 @@ function Agency() {
if (msgComp === "DESTINATION") {
const destMsg = message?.state + ": " + message?.message;
setDestinationMsg(destMsg);
- setActiveToolId("");
return;
}
if (msgComp === "NEXT_STEP") {
- setStepLoader((prev) => !prev);
+ // Step execution is disabled - ignoring NEXT_STEP messages
return;
}
@@ -126,7 +512,6 @@ function Agency() {
return stepObj;
}
- setActiveToolId(msgComp);
stepObj["progress"] = message?.state;
stepObj["status"] = message?.message;
return stepObj;
@@ -134,52 +519,777 @@ function Agency() {
setSteps(newSteps);
}, [message]);
+ // Get connector status information
+ const getConnectorStatus = (endpoint, isDeployed = false) => {
+ // If workflow is deployed, connectors are considered completed
+ if (isDeployed) {
+ return {
+ configured: true,
+ type: endpoint?.connection_type || "Deployed",
+ name: endpoint?.connector_name || "Configured",
+ };
+ }
+
+ // If no endpoint exists, not configured
+ if (!endpoint) {
+ return { configured: false, type: null, name: null };
+ }
+
+ // For API connections, just having an endpoint is sufficient
+ if (endpoint.connection_type === "API") {
+ return {
+ configured: true,
+ type: "API",
+ name: endpoint.connector_name || "API Endpoint",
+ };
+ }
+
+ // For filesystem connectors, they are automatically configured
+ if (endpoint.connection_type === "FILESYSTEM") {
+ return {
+ configured: true,
+ type: "File System",
+ name: "Local File System",
+ };
+ }
+
+ // For other connection types, check if connector instance is configured
+ if (!endpoint?.connector_instance) {
+ return { configured: false, type: null, name: null };
+ }
+
+ return {
+ configured: true,
+ type: endpoint.connection_type,
+ name: endpoint.connector_name || "Configured",
+ };
+ };
+
+ // Calculate workflow progress based on completed steps
+ const calculateProgress = () => {
+ let completedSteps = 0;
+
+ // Check if source connector is configured
+ const sourceStatus = getConnectorStatus(source, !allowChangeEndpoint);
+ if (sourceStatus.configured) {
+ completedSteps++;
+ }
+
+ // Check if destination connector is configured
+ const destStatus = getConnectorStatus(destination, !allowChangeEndpoint);
+ if (destStatus.configured) {
+ completedSteps++;
+ }
+
+ // Check if tool is selected AND tool instance exists
+ if (selectedTool && details?.tool_instances?.length > 0) {
+ completedSteps++;
+ }
+
+ // Check if workflow is deployed (step 4)
+ const workflowDeployed = isWorkflowDeployed() || deploymentInfo !== null;
+ if (workflowDeployed) {
+ completedSteps++;
+ }
+
+ const progress = (completedSteps / 4) * 100;
+ return { progress, completedSteps };
+ };
+
+ // Initialize selected tool when workflow details are loaded
+ useEffect(() => {
+ if (details?.tool_instances?.length > 0 && !selectedTool) {
+ initializeSelectedTool();
+ }
+ }, [details?.tool_instances, details?.id]);
+
+ // Refresh deployment info when allowChangeEndpoint changes (indicates deployment status change)
+ useEffect(() => {
+ if (projectId) {
+ const abortController = new AbortController();
+ fetchDeploymentInfo(abortController.signal);
+
+ return () => {
+ abortController.abort();
+ };
+ }
+ }, [allowChangeEndpoint, projectId]);
+
+ // Update progress whenever relevant state changes
+ useEffect(() => {
+ const { progress } = calculateProgress();
+ setWorkflowProgress(progress);
+ }, [
+ source,
+ destination,
+ selectedTool,
+ details?.tool_instances,
+ allowChangeEndpoint,
+ deploymentInfo,
+ ]);
+
+ // Disable Run & Step execution - when NO tool present in the workflow
+ // When source OR destination is NOT configured
+ const disableAction = () => {
+ if (!details?.tool_instances?.length) {
+ return true;
+ }
+ if (
+ source?.connection_type === "API" &&
+ destination?.connection_type === "API"
+ ) {
+ return false;
+ }
+ if (
+ source?.connection_type === "FILESYSTEM" &&
+ destination?.connection_type === "MANUALREVIEW"
+ ) {
+ return false;
+ }
+ return !source?.connector_instance || !destination?.connector_instance;
+ };
+
+ const getInputFile = (isInitial, isStepExecution, executionAction) => {
+ setWfExecutionParams([isInitial, isStepExecution, executionAction]);
+ setFileList([]);
+ setOpenFileUploadModal(true);
+ };
+
+ const handleInitialExecution = async (
+ body,
+ isStepExecution,
+ executionAction
+ ) => {
+ initializeWfComp();
+ if (isStepExecution) {
+ body["execution_action"] = wfExecutionTypes[0];
+ }
+
+ const loadingStatus = {
+ isLoading: true,
+ loadingType: "EXECUTE",
+ };
+ updateWorkflow(loadingStatus);
+
+ try {
+ const initialRes = await handleWfExecutionApi(body);
+ const execIdValue = initialRes?.data?.execution_id;
+
+ setExecutionId(execIdValue);
+ body["execution_id"] = execIdValue;
+ if (isStepExecution) {
+ body["execution_action"] = wfExecutionTypes[executionAction];
+ }
+ const wfExecRes = await handleWfExecutionApi(body);
+ const data = wfExecRes?.data;
+ if (data?.execution_status === "ERROR") {
+ setAlertDetails({
+ type: "error",
+ content: data?.error,
+ });
+ }
+ } catch (err) {
+ const errorDetail =
+ err?.response?.data?.errors?.length > 0
+ ? err.response.data.errors[0].detail
+ : "Something went wrong";
+ setAlertDetails({
+ type: "error",
+ content: errorDetail,
+ });
+ } finally {
+ handleClearStates();
+ loadingStatus["isLoading"] = false;
+ loadingStatus["loadingType"] = "";
+ updateWorkflow(loadingStatus);
+ }
+ };
+
+ const handleClearStates = () => {
+ setExecutionId("");
+ };
+
+ const getRequestBody = (body) => {
+ const formData = new FormData();
+ fileList.forEach((file) => {
+ formData.append("files", file);
+ });
+ formData.append("workflow_id", body["workflow_id"]);
+ formData.append("execution_id", body["execution_id"]);
+ if (body["execution_action"]) {
+ formData.append("execution_action", body["execution_action"]);
+ }
+ return formData;
+ };
+
+ const shouldIncludeFile = (body) => {
+ return body["execution_id"] && body["execution_id"].length > 0;
+ };
+
+ const handleWfExecutionApi = async (body) => {
+ let header = {
+ "X-CSRFToken": sessionDetails?.csrfToken,
+ "Content-Type": "application/json",
+ };
+ if (shouldIncludeFile(body) && apiOpsPresent && fileList.length > 0) {
+ body = getRequestBody(body);
+ header = {
+ "X-CSRFToken": sessionDetails?.csrfToken,
+ "Content-Type": "multipart/form-data",
+ };
+ }
+ const requestOptions = {
+ method: "POST",
+ url: getUrl(`workflow/execute/`),
+ headers: header,
+ data: body,
+ };
+
+ return axiosPrivate(requestOptions)
+ .then((res) => res)
+ .catch((err) => {
+ setAlertDetails(handleException(err));
+ });
+ };
+
+ const handleWfExecution = async (
+ isInitial,
+ isStepExecution,
+ executionAction
+ ) => {
+ try {
+ if (isStepExecution) {
+ setPostHogCustomEvent("wf_step", {
+ info: `Clicked on '${wfExecutionTypes[executionAction]}' button (Step Execution)`,
+ });
+ } else {
+ setPostHogCustomEvent("wf_run_wf", {
+ info: "Clicked on 'Run Workflow' button (Normal Execution)",
+ });
+ }
+ } catch (err) {
+ // If an error occurs while setting custom posthog event, ignore it and continue
+ }
+ const workflowId = details?.id;
+
+ if (!workflowId) {
+ setAlertDetails({
+ type: "error",
+ content: "Invalid workflow id",
+ });
+ return;
+ }
+
+ const body = {
+ workflow_id: workflowId,
+ };
+
+ if (isInitial) {
+ await handleInitialExecution(body, isStepExecution, executionAction);
+ } else {
+ body["execution_id"] = executionId;
+ body["execution_action"] = wfExecutionTypes[executionAction];
+
+ handleWfExecutionApi(body)
+ .then(() => {})
+ .catch((err) => {
+ setAlertDetails(handleException(err));
+ });
+ }
+ };
+
+ // Handle Run Workflow action
+ const handleRunWorkflow = async () => {
+ if (disableAction()) {
+ setAlertDetails({
+ type: "error",
+ content: "Please configure all workflow components before running",
+ });
+ return;
+ }
+
+ // Auto-open debug panel when workflow starts
+ setShowDebug(true);
+
+ if (apiOpsPresent) {
+ getInputFile(true, false, 4);
+ } else {
+ await handleWfExecution(true, false, 4);
+ }
+ };
+
+ // Handle Clear Cache action
+ const handleClearCache = () => {
+ const workflowId = details?.id;
+ if (!workflowId) {
+ setAlertDetails({
+ type: "error",
+ content: "Invalid workflow id",
+ });
+ return;
+ }
+
+ const requestOptions = {
+ method: "GET",
+ url: getUrl(`workflow/${workflowId}/clear-cache/`),
+ };
+
+ axiosPrivate(requestOptions)
+ .then((res) => {
+ const msg = res?.data;
+ setAlertDetails({
+ type: "success",
+ content: msg,
+ });
+ })
+ .catch((err) => {
+ const msg = err?.response?.data || "Failed to clear cache.";
+ setAlertDetails({
+ type: "error",
+ content: msg,
+ });
+ });
+ };
+
+ // Handle tool selection from sidebar
+ const handleToolSelection = async (functionName) => {
+ setSelectedTool(functionName);
+
+ const tool = exportedTools.find((t) => t.function_name === functionName);
+
+ if (tool && details?.id) {
+ try {
+ // Check if there are existing tool instances
+ if (details?.tool_instances?.length > 0) {
+ // Remove existing tool instances
+ for (const existingTool of details.tool_instances) {
+ const deleteOptions = {
+ method: "DELETE",
+ url: getUrl(`tool_instance/${existingTool.id}/`),
+ headers: {
+ "X-CSRFToken": sessionDetails?.csrfToken,
+ },
+ };
+ await axiosPrivate(deleteOptions);
+ }
+
+ // Update workflow store to remove old tool instances
+ const { deleteToolInstance } = useWorkflowStore.getState();
+ details.tool_instances.forEach((instance) => {
+ deleteToolInstance(instance.id);
+ });
+ }
+
+ // Create new tool instance
+ const body = {
+ tool_id: functionName,
+ workflow_id: details.id,
+ };
+
+ const requestOptions = {
+ method: "POST",
+ url: getUrl(`tool_instance/`),
+ headers: {
+ "X-CSRFToken": sessionDetails?.csrfToken,
+ "Content-Type": "application/json",
+ },
+ data: body,
+ };
+
+ const res = await axiosPrivate(requestOptions);
+ const newToolInstance = res.data;
+
+ // Update tool settings for sidebar
+ const { setToolSettings } = useToolSettingsStore.getState();
+ setToolSettings({
+ id: newToolInstance.id,
+ tool_id: newToolInstance.tool_id,
+ });
+
+ // Update workflow store with new tool instance
+ const { addNewTool } = useWorkflowStore.getState();
+ addNewTool(newToolInstance);
+
+ setAlertDetails({
+ type: "success",
+ content:
+ details?.tool_instances?.length > 0
+ ? "Tool replaced successfully"
+ : "Tool added successfully",
+ });
+ } catch (err) {
+ setAlertDetails(handleException(err, "Failed to update tool"));
+ }
+ }
+ };
+
+ // Handle Clear Processed File History action
+ const handleClearFileMarker = () => {
+ const workflowId = details?.id;
+ if (!workflowId) {
+ setAlertDetails({
+ type: "error",
+ content: "Invalid workflow id",
+ });
+ return;
+ }
+
+ const requestOptions = {
+ method: "GET",
+ url: getUrl(`workflow/${workflowId}/clear-file-marker/`),
+ };
+
+ axiosPrivate(requestOptions)
+ .then((res) => {
+ const msg = res?.data;
+ setAlertDetails({
+ type: "success",
+ content: msg,
+ });
+ })
+ .catch((err) => {
+ const msg = err?.response?.data || "Failed to clear file marker.";
+ setAlertDetails({
+ type: "error",
+ content: msg,
+ });
+ });
+ };
+
+ // Handle dropdown menu click
+ const handleMenuClick = ({ key }) => {
+ switch (key) {
+ case "run-workflow":
+ handleRunWorkflow();
+ break;
+ case "clear-cache":
+ handleClearCache();
+ break;
+ case "clear-history":
+ handleClearFileMarker();
+ break;
+ default:
+ break;
+ }
+ };
+
+ const actionsMenuItems = [
+ {
+ key: "run-workflow",
+ label: "Run Workflow",
+ icon: <PlayCircleOutlined />,
+ },
+ {
+ key: "clear-cache",
+ label: "Clear Cache",
+ },
+ {
+ key: "clear-history",
+ label: "Clear Processed File History",
+ },
+ ];
+
+ // Show loading spinner during initial data load
+ if (isInitialLoading) {
+ return (
+ <IslandLayout>
+ <div className="agency-loading-container">
+ <SpinnerLoader text="Loading workflow data..." align="center" />
+ </div>
+ </IslandLayout>
+ );
+ }
+
return (
- <div className="agency-layout">
- <PageTitle title={projectName} />
- <Layout className="agency-sider-layout">
- <Layout className="agency-sider-layout">
- <IslandLayout>
- <WorkflowExecution
- setSteps={setSteps}
- activeToolId={activeToolId}
- inputMd={inputMd}
- outputMd={outputMd}
- sourceMsg={sourceMsg}
- destinationMsg={destinationMsg}
+ <IslandLayout>
+ <div className="agency-layout">
+ <PageTitle title={projectName} />
+
+ {/* Header */}
+ <div className="agency-header">
+ <div className="workflow-progress-section">
+ <div className="progress-header">
+ <Typography.Text className="progress-label">
+ Workflow Setup Progress
+ </Typography.Text>
+ <Typography.Text className="progress-count">
+ {Math.floor(workflowProgress / 25)} of 4 steps completed
+ </Typography.Text>
+ </div>
+ <Progress
+ percent={workflowProgress}
+ strokeColor={workflowProgress === 100 ? "#52c41a" : "#1890ff"}
/>
- </IslandLayout>
- </Layout>
- <div className="agency-sider-content">
- <div>
- <Sider
- className="agency-sider-layout"
- width={350}
- collapsed={isCollapsed}
- collapsedWidth={30}
+ </div>
+ <Dropdown
+ menu={{ items: actionsMenuItems, onClick: handleMenuClick }}
+ placement="bottomRight"
+ trigger={["click"]}
+ >
+ <Button
+ type="primary"
+ icon={<SettingOutlined />}
+ loading={loadingType === "EXECUTE"}
+ disabled={loadingType === "EXECUTE"}
>
- <div className="tool-ide-sider-btn">
- <Button
- shape="circle"
- size="small"
- onClick={() => setIsCollapsed(!isCollapsed)}
- icon={isCollapsed ? <LeftOutlined /> : <RightOutlined />}
- />
- </div>
- {!isCollapsed && <SidePanel />}
- </Sider>
+ Actions
+ </Button>
+ </Dropdown>
+ </div>
+
+ {/* Progress Section */}
+
+ {/* 2x2 Grid */}
+ <div className="workflow-grid-container">
+ <Row gutter={[24, 24]}>
+ {/* Configure Source Connector */}
+ <Col span={12}>
+ <WorkflowCard
+ number={(() => {
+ const status = getConnectorStatus(
+ source,
+ !allowChangeEndpoint
+ );
+ return status.configured ? "✓" : "1";
+ })()}
+ title="Configure Source Connector"
+ description="Select and configure your data input connector"
+ type={sourceTypes.connectors[0]}
+ endpointDetails={source}
+ message={sourceMsg}
+ />
+ </Col>
+
+ {/* Configure Output Destination */}
+ <Col span={12}>
+ <WorkflowCard
+ number={(() => {
+ const status = getConnectorStatus(
+ destination,
+ !allowChangeEndpoint
+ );
+ return status.configured ? "✓" : "2";
+ })()}
+ title="Configure Output Destination"
+ description="Select and configure your data output connector"
+ type={sourceTypes.connectors[1]}
+ endpointDetails={destination}
+ message={destinationMsg}
+ />
+ </Col>
+ <Col span={12}>
+ <WorkflowCard
+ number={selectedTool ? "✓" : "3"}
+ title="Select Exported Tool"
+ description="Choose an exported tool for processing your data"
+ customContent={
+ <div className="workflow-card-content">
+ <div className="tool-selection-display">
+ {selectedTool ? (
+ <div className="selected-tool-info">
+ <span className="selected-tool-name">
+ {exportedTools.find(
+ (t) => t.function_name === selectedTool
+ )?.name || selectedTool}
+ </span>
+ <Button
+ type="link"
+ onClick={() => setShowToolSelectionSidebar(true)}
+ size="small"
+ >
+ Change Tool
+ </Button>
+ </div>
+ ) : (
+ <Button
+ type="default"
+ onClick={() => setShowToolSelectionSidebar(true)}
+ className="select-tool-btn"
+ >
+ Select Tool
+ </Button>
+ )}
+ </div>
+ <Button
+ type="primary"
+ onClick={() => setShowSidebar(!showSidebar)}
+ disabled={!selectedTool}
+ >
+ Configure Settings
+ </Button>
+ </div>
+ }
+ />
+ </Col>
+
+ {/* Deploy Workflow */}
+ <Col span={12}>
+ <WorkflowCard
+ number={deploymentInfo || !allowChangeEndpoint ? "✓" : "4"}
+ title="Deploy Workflow"
+ description="Deploy your workflow for processing"
+ customContent={
+ <div className="workflow-card-content">
+ <Select
+ className="workflow-select"
+ placeholder="Select Deployment Type"
+ value={
+ deploymentInfo
+ ? deploymentInfo.type
+ : selectedDeploymentType
+ }
+ onChange={handleDeploymentTypeChange}
+ disabled={deploymentInfo || !allowChangeEndpoint}
+ options={[
+ {
+ value: "API",
+ label: getDeploymentStatusText("API"),
+ disabled: false,
+ },
+ ...(apiOpsPresent && !deploymentInfo
+ ? []
+ : [
+ {
+ value: "ETL",
+ label: getDeploymentStatusText("ETL"),
+ disabled: false,
+ },
+ {
+ value: "TASK",
+ label: getDeploymentStatusText("TASK"),
+ disabled: false,
+ },
+ ]),
+ ]}
+ />
+ <Button
+ type="primary"
+ disabled={
+ deploymentInfo ||
+ !allowChangeEndpoint ||
+ !selectedDeploymentType
+ }
+ onClick={() =>
+ selectedDeploymentType &&
+ handleDeployBtnClick(selectedDeploymentType)
+ }
+ >
+ Deploy Workflow
+ </Button>
+ </div>
+ }
+ />
+ </Col>
+ </Row>
+ </div>
+ {(deploymentName || deploymentInfo) && (
+ <Alert
+ className="deployment-alert"
+ message={
+ <span>
+ This Workflow has been deployed as {generateDeploymentMessage()}
+ </span>
+ }
+ type="success"
+ />
+ )}
+
+ {/* Debug Panel */}
+ <div className="debug-panel">
+ <div className="debug-panel-header">
+ <div className="debug-panel-title">
+ <BugOutlined />
+ <Typography.Text>Debug Panel</Typography.Text>
+ </div>
+ <Button
+ type="text"
+ onClick={() => setShowDebug(!showDebug)}
+ className="show-debug-btn"
+ >
+ Show Debug {showDebug ? "▲" : "▼"}
+ </Button>
</div>
+ {showDebug && (
+ <div className="debug-panel-content">
+ {statusBarMsg && (
+ <div className="status-message">
+ <Typography.Text type="secondary" className="status-text">
+ {statusBarMsg}
+ </Typography.Text>
+ </div>
+ )}
+ <InputOutput input={inputMd} output={outputMd} />
+ </div>
+ )}
</div>
- </Layout>
- <div className="agency-actions">
- <Actions
- statusBarMsg={statusBarMsg}
- initializeWfComp={initializeWfComp}
- stepLoader={stepLoader}
+
+ {/* Sidebar - conditionally shown */}
+ {showSidebar && (
+ <div className="workflow-sidebar">
+ <SidePanel />
+ <Button
+ className="close-sidebar-btn"
+ onClick={() => setShowSidebar(false)}
+ size="small"
+ >
+ ×
+ </Button>
+ </div>
+ )}
+
+ {/* File Upload Modal */}
+ {openFileUploadModal && (
+ <FileUpload
+ open={openFileUploadModal}
+ setFileList={setFileList}
+ fileList={fileList}
+ setOpen={setOpenFileUploadModal}
+ wfExecutionParams={wfExecutionParams}
+ continueWfExecution={handleWfExecution}
+ />
+ )}
+
+ {/* Deployment Modals */}
+ {openAddApiModal && (
+ <CreateApiDeploymentModal
+ open={openAddApiModal}
+ setOpen={setOpenAddApiModal}
+ workflowId={details?.id}
+ isEdit={false}
+ setDeploymentName={setDeploymentName}
+ onDeploymentCreated={fetchDeploymentInfo}
+ />
+ )}
+
+ <EtlTaskDeploy
+ open={openAddETLModal}
+ setOpen={setOpenAddETLModal}
+ type="ETL"
+ workflowId={details?.id}
+ setDeploymentName={setDeploymentName}
+ onDeploymentCreated={fetchDeploymentInfo}
+ />
+
+ <EtlTaskDeploy
+ open={openAddTaskModal}
+ setOpen={setOpenAddTaskModal}
+ type="TASK"
+ workflowId={details?.id}
+ setDeploymentName={setDeploymentName}
+ onDeploymentCreated={fetchDeploymentInfo}
+ />
+
+ {/* Tool Selection Sidebar */}
+ <ToolSelectionSidebar
+ visible={showToolSelectionSidebar}
+ onClose={() => setShowToolSelectionSidebar(false)}
+ tools={exportedTools}
+ selectedTool={selectedTool}
+ onToolSelect={handleToolSelection}
+ onSave={() => setShowToolSelectionSidebar(false)}
/>
</div>
- <div className="height-20" />
- </div>
+ </IslandLayout>
);
}
diff --git a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.css b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.css
index 9010c744a..c1af18e8a 100644
--- a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.css
+++ b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.css
@@ -5,3 +5,11 @@
.ds-set-card-col2 {
z-index: 20;
}
+
+.ds-set-card-select{
+ width: 200px !important;
+}
+
+.ds-set-card-btn{
+ align-self: flex-end;
+}
diff --git a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
index 8c1e34b82..9555bee7d 100644
--- a/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
+++ b/frontend/src/components/agency/ds-settings-card/DsSettingsCard.jsx
@@ -1,10 +1,3 @@
-import {
- ExclamationCircleOutlined,
- ExportOutlined,
- ImportOutlined,
- SettingOutlined,
- CheckCircleTwoTone,
-} from "@ant-design/icons";
import {
Button,
Col,
@@ -18,7 +11,7 @@ import {
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
-import { getMenuItem, titleCase } from "../../../helpers/GetStaticData";
+import { getMenuItem } from "../../../helpers/GetStaticData";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../../store/alert-store";
import { useSessionStore } from "../../../store/session-store";
@@ -29,11 +22,6 @@ import { ConfigureConnectorModal } from "../configure-connector-modal/ConfigureC
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
import "./DsSettingsCard.css";
-const tooltip = {
- input: "Data Source Settings",
- output: "Data Destination Settings",
-};
-
const disabledIdsByType = {
FILE_SYSTEM: [
"box|4d94d237-ce4b-45d8-8f34-ddeefc37c0bf",
@@ -85,11 +73,6 @@ function DsSettingsCard({ type, endpointDetails, message }) {
const { flags } = sessionDetails;
const { getUrl } = useRequestUrl();
- const icons = {
- input: <ImportOutlined className="ds-set-icon-size" />,
- output: <ExportOutlined className="ds-set-icon-size" />,
- };
-
const setUpdatedInputoptions = (inputOption) => {
setInputOptions((prevInputOptions) => {
// Check if inputOption already exists in prevInputOptions
@@ -347,12 +330,20 @@ function DsSettingsCard({ type, endpointDetails, message }) {
});
};
+ // Generate configure button tooltip message
+ const getConfigureTooltipMessage = () => {
+ if (!allowChangeEndpoint) {
+ return "Configuration disabled - Workflow is deployed";
+ }
+ if (!endpointDetails?.connection_type) {
+ return "Select the connector type from the dropdown";
+ }
+ return "";
+ };
+
return (
<>
<Row className="ds-set-card-row">
- <Col span={4} className="ds-set-card-col1">
- <Tooltip title={tooltip[type]}>{icons[type]}</Tooltip>
- </Col>
<Col span={12} className="ds-set-card-col2">
<SpaceWrapper>
<Space>
@@ -364,7 +355,6 @@ function DsSettingsCard({ type, endpointDetails, message }) {
>
<Select
className="ds-set-card-select"
- size="small"
options={options}
placeholder="Select Connector Type"
value={endpointDetails?.connection_type || undefined}
@@ -379,68 +369,21 @@ function DsSettingsCard({ type, endpointDetails, message }) {
/>
</Tooltip>
- <Tooltip
- title={`${
- endpointDetails?.connection_type
- ? ""
- : "Select the connector type from the dropdown"
- }`}
- >
+ <Tooltip title={getConfigureTooltipMessage()}>
<Button
- type="text"
- size="small"
+ type="primary"
onClick={() => setOpenModal(true)}
disabled={
!endpointDetails?.connection_type ||
connType === "API" ||
- connType === "APPDEPLOYMENT"
+ connType === "APPDEPLOYMENT" ||
+ !allowChangeEndpoint
}
>
- <SettingOutlined />
+ Configure
</Button>
</Tooltip>
</Space>
- <div className="display-flex-align-center">
- {connDetails?.connector_name ? (
- <Space>
- <Image
- src={connDetails?.icon}
- height={20}
- width={20}
- preview={false}
- />
- <Typography.Text className="font-size-12">
- {connDetails?.connector_name}
- </Typography.Text>
- </Space>
- ) : (
- <>
- {connType === "API" || connType === "APPDEPLOYMENT" ? (
- <Typography.Text
- className="font-size-12 display-flex-align-center"
- ellipsis={{ rows: 1, expandable: false }}
- type="secondary"
- >
- <CheckCircleTwoTone twoToneColor="#52c41a" />
- <span style={{ marginLeft: "5px" }}>
- {titleCase(type)} set to {connType} successfully
- </span>
- </Typography.Text>
- ) : (
- <Typography.Text
- className="font-size-12 display-flex-align-center"
- ellipsis={{ rows: 1, expandable: false }}
- type="secondary"
- >
- <ExclamationCircleOutlined />
- <span style={{ marginLeft: "5px" }}>
- Connector not configured
- </span>
- </Typography.Text>
- )}
- </>
- )}
- </div>
</SpaceWrapper>
</Col>
<Col span={8} className="ds-set-card-col3">
diff --git a/frontend/src/components/agency/side-panel/SidePanel.css b/frontend/src/components/agency/side-panel/SidePanel.css
index 616c5e193..fd17a02b1 100644
--- a/frontend/src/components/agency/side-panel/SidePanel.css
+++ b/frontend/src/components/agency/side-panel/SidePanel.css
@@ -8,6 +8,16 @@
padding-bottom: 10px;
}
+.sidepanel-header {
+ padding: 16px 0;
+ border-bottom: 1px solid #f0f0f0;
+ margin-bottom: 16px;
+}
+
+.sidepanel-header h4 {
+ margin: 0;
+}
+
.sidepanel-content {
flex: 1;
overflow-y: auto;
diff --git a/frontend/src/components/agency/side-panel/SidePanel.jsx b/frontend/src/components/agency/side-panel/SidePanel.jsx
index 4b92272bf..d6476ad0a 100644
--- a/frontend/src/components/agency/side-panel/SidePanel.jsx
+++ b/frontend/src/components/agency/side-panel/SidePanel.jsx
@@ -1,4 +1,4 @@
-import { Tabs } from "antd";
+import { Typography } from "antd";
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
@@ -6,11 +6,9 @@ import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { useSessionStore } from "../../../store/session-store";
import { useToolSettingsStore } from "../../../store/tool-settings";
import { ToolSettings } from "../tool-settings/ToolSettings";
-import { Tools } from "../tools/Tools";
import "./SidePanel.css";
function SidePanel() {
- const [activeTabKey, setActiveTabKey] = useState("1");
const [spec, setSpec] = useState({});
const [isSpecLoading, setSpecLoading] = useState(false);
const [toolId, setToolId] = useState("");
@@ -19,49 +17,24 @@ function SidePanel() {
const { sessionDetails } = useSessionStore();
const axiosPrivate = useAxiosPrivate();
- const items = [
- {
- key: "1",
- label: "Tools",
- },
- {
- key: "2",
- label: "Tool Settings",
- disabled: toolId?.length === 0,
- },
- {
- key: "3",
- label: "Workflow Template",
- disabled: true,
- },
- ];
-
- const handleTabKey = (key) => {
- setActiveTabKey(key.toString());
- };
-
const isObjectEmpty = (obj) => {
return Object.keys(obj).length === 0;
};
useEffect(() => {
const toolSettingsId = toolSettings?.tool_id;
+
if (!toolSettingsId) {
- if (activeTabKey === "2") {
- setActiveTabKey("1");
- setSpec({});
- setToolId("");
- }
+ setSpec({});
+ setToolId("");
return;
}
if (toolSettingsId === toolId) {
- setActiveTabKey("2");
return;
}
if (toolSettingsId !== toolId) {
- setActiveTabKey("2");
const requestOptions = {
method: "GET",
url: `/api/v1/unstract/${sessionDetails?.orgId}/tool_settings_schema/?function_name=${toolSettingsId}&workflow_id=${id}`,
@@ -70,16 +43,19 @@ function SidePanel() {
axiosPrivate(requestOptions)
.then((res) => {
if (isObjectEmpty(res?.data?.properties)) {
- // Disable tool settings & switch to Tools tab - when custom tool is selected
+ // Prompt Studio tools don't have configurable settings via this interface
setSpec({});
- setToolId("");
- setActiveTabKey("1");
+ setToolId(toolSettingsId);
} else {
setToolId(toolSettingsId);
setSpec(res?.data);
}
})
- .catch((err) => {})
+ .catch((err) => {
+ // Handle API errors for tool settings schema
+ setSpec({});
+ setToolId("");
+ })
.finally(() => {
setSpecLoading(false);
});
@@ -88,19 +64,11 @@ function SidePanel() {
return (
<div className="sidepanel-layout">
- <div className="sidepanel-tabs">
- <Tabs
- activeKey={activeTabKey}
- items={items}
- onChange={handleTabKey}
- moreIcon={<></>}
- />
+ <div className="sidepanel-header">
+ <Typography.Title level={4}>Tool Settings</Typography.Title>
</div>
<div className="sidepanel-content">
- {activeTabKey === "1" && <Tools />}
- {activeTabKey === "2" && (
- <ToolSettings spec={spec} isSpecLoading={isSpecLoading} />
- )}
+ <ToolSettings spec={spec} isSpecLoading={isSpecLoading} />
</div>
</div>
);
diff --git a/frontend/src/components/agency/step-card/StepCard.css b/frontend/src/components/agency/step-card/StepCard.css
deleted file mode 100644
index 2a0835eef..000000000
--- a/frontend/src/components/agency/step-card/StepCard.css
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Styles for Workflow */
-
-.wf-step-card-layout {
- border: 1px solid #D4D4D4;
- border-radius: 8px;
- border-style: solid;
-}
-
-.wf-step-card-status {
- font-size: 12px;
-}
-
-.wf-step-card-progress {
- padding: 0px;
-}
-
-.ant-progress-inner {
- height: 30px !important;
- width: 30px !important;
-}
-.card-col{
- border-radius: 8px 0px 0px 8px;
- background-color: #F8FBFF;
- border: 1px solid;
- border-color: transparent #D4D4D4 transparent transparent;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 5px;
-}
-.wf-steps-container{
- height: 100%;
-}
-
-.wf-steps-list {
- flex: 1;
- overflow-y: auto;
-}
-
-.wf-steps-list-2 {
- padding: 8px;
- height: 100%;
-}
-
-.wf-steps-empty-state {
- font-size: 12px;
- color: #484848;
-}
diff --git a/frontend/src/components/agency/step-card/StepCard.jsx b/frontend/src/components/agency/step-card/StepCard.jsx
deleted file mode 100644
index 9fef8a7b1..000000000
--- a/frontend/src/components/agency/step-card/StepCard.jsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { Typography } from "antd";
-import PropTypes from "prop-types";
-import { useDrop } from "react-dnd";
-
-import { ListOfWfStepsPlaceholder } from "../../../assets";
-import { CardsList } from "../cards-list/CardsList.jsx";
-import "./StepCard.css";
-import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper.jsx";
-
-const StepCard = ({ steps, activeTool, moveItem }) => {
- const [, drop] = useDrop({
- accept: "STEP",
- drop: (draggedItem, indexNew) => {
- if (
- (steps.length === 0 || draggedItem?.function_name) &&
- !draggedItem?.index
- ) {
- const index = steps.length;
- moveItem(draggedItem.index, index, draggedItem?.function_name);
- }
- },
- });
-
- return (
- <div ref={drop} className="wf-steps-container">
- {steps.length === 0 && (
- <div className="content-center-body-3 display-flex-center-h-and-v">
- <SpaceWrapper>
- <div>
- <ListOfWfStepsPlaceholder />
- </div>
- <div>
- <Typography.Text className="wf-steps-empty-state">
- Enter the prompt to generate the workflow <br />
- OR <br /> Drag tool and drop.
- </Typography.Text>
- </div>
- </SpaceWrapper>
- </div>
- )}
- <SpaceWrapper>
- {steps.map((step, index) => {
- return (
- <CardsList
- key={step.id}
- step={step}
- activeTool={activeTool}
- moveItem={moveItem}
- index={index}
- />
- );
- })}
- </SpaceWrapper>
- </div>
- );
-};
-
-StepCard.propTypes = {
- steps: PropTypes.array,
- activeTool: PropTypes.string.isRequired,
- moveItem: PropTypes.func.isRequired,
-};
-
-export { StepCard };
diff --git a/frontend/src/components/agency/steps/Steps.css b/frontend/src/components/agency/steps/Steps.css
deleted file mode 100644
index a76aee995..000000000
--- a/frontend/src/components/agency/steps/Steps.css
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Styles for Steps */
-
-.wf-steps-layout {
- height: 100%;
- background-color: #F8FBFF;
- border-radius: 8px;
- border: 1px solid #D4D4D4;
- overflow-y: hidden;
- display: flex;
- flex-direction: column;
-}
-
-.content-center-body-2 {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
-}
-
-.content-center-body-3 {
- text-align: center;
-}
-
-.content-center-desc {
- font-size: 12px;
- color: #484848;
-}
-
-.wf-steps-ds {
- padding: 8px;
-}
-
-.wf-steps-div {
- margin: 0px;
- border-color: #D4D4D4;
-}
-
-.ds-set-card-row {
- background-color: #DAE3EC;
- min-height: 70px;
-}
-
-.ds-set-card-col1 {
- border-right: 1px solid #D4D4D4;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.ds-set-card-col2 {
- padding: 8px;
- border-right: 1px solid #D4D4D4;
-}
-
-.ds-set-card-col3 {
- padding: 8px;
-}
-
-.ds-set-icon-size {
- font-size: 25px;
-}
-
-.ds-set-card-select {
- width: 120px;
-}
diff --git a/frontend/src/components/agency/steps/Steps.jsx b/frontend/src/components/agency/steps/Steps.jsx
deleted file mode 100644
index 9c2f926a5..000000000
--- a/frontend/src/components/agency/steps/Steps.jsx
+++ /dev/null
@@ -1,231 +0,0 @@
-import { Divider } from "antd";
-import PropTypes from "prop-types";
-import { useEffect } from "react";
-import { DndProvider } from "react-dnd";
-import { HTML5Backend } from "react-dnd-html5-backend";
-
-import { sourceTypes } from "../../../helpers/GetStaticData.js";
-import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
-import { useAlertStore } from "../../../store/alert-store";
-import { useSessionStore } from "../../../store/session-store";
-import { useWorkflowStore } from "../../../store/workflow-store";
-import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader.jsx";
-import { DsSettingsCard } from "../ds-settings-card/DsSettingsCard.jsx";
-import { StepCard } from "../step-card/StepCard.jsx";
-import "./Steps.css";
-import { useExceptionHandler } from "../../../hooks/useExceptionHandler.jsx";
-import usePostHogEvents from "../../../hooks/usePostHogEvents.js";
-
-function Steps({ setSteps, activeToolId, sourceMsg, destinationMsg }) {
- const workflowStore = useWorkflowStore();
- const {
- projectId,
- details,
- isLoading,
- loadingType,
- addNewTool,
- source,
- destination,
- updateWorkflow,
- } = workflowStore;
- const { sessionDetails } = useSessionStore();
- const axiosPrivate = useAxiosPrivate();
- const { setAlertDetails } = useAlertStore();
- const handleException = useExceptionHandler();
- const { setPostHogCustomEvent } = usePostHogEvents();
-
- useEffect(() => {
- getWfEndpointDetails();
- canUpdateWorkflow();
- }, []);
-
- const canUpdateWorkflow = () => {
- const requestOptions = {
- method: "GET",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/workflow/${projectId}/can-update/`,
- };
- axiosPrivate(requestOptions)
- .then((res) => {
- const data = res?.data || {};
- const body = {
- allowChangeEndpoint: data?.can_update,
- };
- updateWorkflow(body);
- })
- .catch((err) => {
- setAlertDetails(
- handleException(err, "Failed to get can update status")
- );
- });
- };
-
- const moveItem = (fromIndex, toIndex, funcName, dragging) => {
- const toolInstance = details?.tool_instances || [];
- if (fromIndex === undefined && funcName) {
- try {
- setPostHogCustomEvent("wf_tool_drag_dropped", {
- info: `Tool dragged and dropped`,
- tool_name: funcName,
- });
- } catch (err) {
- // If an error occurs while setting custom posthog event, ignore it and continue
- }
- handleAddToolInstance(funcName)
- .then((res) => {
- const data = res?.data;
- const newList = [...toolInstance];
- newList.push(data);
- addNewTool(data);
- return rearrangeTools(newList);
- })
- .then((res) => {
- setSteps(res);
- })
- .catch((err) => {
- const msg = "Failed to re-order the tools.";
- setAlertDetails(handleException(err, msg));
- });
- } else {
- const updatedSteps = [...toolInstance];
- const [movedStep] = updatedSteps.splice(fromIndex, 1);
- updatedSteps.splice(toIndex, 0, movedStep);
- if (!dragging) {
- rearrangeTools(toolInstance).then((res) => {
- setSteps(res);
- });
- } else {
- rearrangeTools(updatedSteps).then((res) => {
- setSteps(updatedSteps);
- });
- }
- }
- };
-
- const rearrangeTools = async (updatedSteps) => {
- // API to update the order
- const toolInstances = updatedSteps.map((step) => step?.id);
- const body = {
- workflow_id: details?.id,
- tool_instances: toolInstances,
- };
- const requestOptions = {
- method: "POST",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/tool_instance/reorder/`,
- headers: {
- "X-CSRFToken": sessionDetails?.csrfToken,
- "Content-Type": "application/json",
- },
- data: body,
- };
-
- return axiosPrivate(requestOptions)
- .then(() => {
- details.tool_instances = updatedSteps;
- return updatedSteps;
- })
-
- .catch((err) => {
- throw err;
- });
- };
-
- const getWfEndpointDetails = () => {
- const requestOptions = {
- method: "GET",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/workflow/${projectId}/endpoint/`,
- };
- axiosPrivate(requestOptions)
- .then((res) => {
- const data = res?.data || [];
- const sourceDetails = data.find(
- (item) => item?.endpoint_type === "SOURCE"
- );
- const destDetails = data.find(
- (item) => item?.endpoint_type === "DESTINATION"
- );
- const body = {
- source: sourceDetails,
- destination: destDetails,
- };
- updateWorkflow(body);
- })
- .catch((err) => {
- setAlertDetails(handleException(err, "Failed to get endpoints"));
- });
- };
-
- const handleAddToolInstance = (funcName) => {
- const workflowId = details?.id;
- if (!workflowId || !funcName) {
- return;
- }
-
- const body = {
- tool_id: funcName,
- workflow_id: workflowId,
- };
-
- const requestOptions = {
- method: "POST",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/tool_instance/`,
- headers: {
- "X-CSRFToken": sessionDetails?.csrfToken,
- "Content-Type": "application/json",
- },
- data: body,
- };
-
- return axiosPrivate(requestOptions)
- .then((res) => res)
- .catch((err) => {
- throw err;
- });
- };
-
- return (
- <div className="wf-steps-layout">
- <div className="ds-src-set">
- <DsSettingsCard
- type={sourceTypes.connectors[0]}
- endpointDetails={source}
- message={sourceMsg}
- />
- <Divider className="wf-steps-div" />
- </div>
- <div className="wf-steps-list">
- <div className="wf-steps-list-2">
- {isLoading && loadingType === "GENERATE" ? (
- <div className="wf-steps-layout">
- <SpinnerLoader />
- </div>
- ) : (
- <DndProvider backend={HTML5Backend}>
- <StepCard
- steps={details?.tool_instances}
- activeTool={activeToolId}
- moveItem={moveItem}
- />
- </DndProvider>
- )}
- </div>
- </div>
- <div className="ds-dst-set">
- <Divider className="wf-steps-div" />
- <DsSettingsCard
- type={sourceTypes.connectors[1]}
- endpointDetails={destination}
- message={destinationMsg}
- />
- </div>
- </div>
- );
-}
-
-Steps.propTypes = {
- setSteps: PropTypes.func,
- activeToolId: PropTypes.string,
- sourceMsg: PropTypes.string,
- destinationMsg: PropTypes.string,
-};
-
-export { Steps };
diff --git a/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.css b/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.css
new file mode 100644
index 000000000..01afa5dd4
--- /dev/null
+++ b/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.css
@@ -0,0 +1,185 @@
+/* Tool Selection Sidebar Overlay */
+.tool-selection-sidebar-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.45);
+ z-index: 1000;
+ display: flex;
+ justify-content: flex-end;
+}
+
+/* Main Sidebar Container */
+.tool-selection-sidebar {
+ width: 400px;
+ height: 100vh;
+ background: white;
+ box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
+ display: flex;
+ flex-direction: column;
+ animation: slideInRight 0.3s ease-out;
+}
+
+@keyframes slideInRight {
+ from {
+ transform: translateX(100%);
+ }
+ to {
+ transform: translateX(0);
+ }
+}
+
+/* Header Section */
+.tool-selection-header {
+ padding: 24px;
+}
+
+.tool-search-input {
+ width: 100%;
+}
+
+/* Content Section */
+.tool-selection-content {
+ flex: 1;
+ overflow-y: auto;
+ padding: 0 24px;
+}
+
+/* Tool List Items */
+.tool-list-item {
+ margin-bottom: 12px;
+ cursor: pointer;
+ padding: 0 !important;
+ border: none !important;
+}
+
+.tool-list-item.selected .tool-card {
+ border: 1px solid #0958d9;
+ background: #eff6ff;
+}
+
+.tool-card {
+ width: 100%;
+ transition: all 0.2s ease;
+ border: 1px solid #e8e8e8;
+ border-radius: 8px;
+ box-shadow: none;
+ margin: 0 !important;
+}
+
+.tool-card:hover {
+ border-color: #d9d9d9;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+}
+
+.tool-card-content {
+ padding: 0;
+}
+
+.tool-info {
+ padding: 20px;
+}
+
+.tool-header {
+ display: flex;
+ align-items: flex-start;
+ gap: 12px;
+}
+
+.tool-icon {
+ font-size: 20px;
+ color: #262626;
+ flex-shrink: 0;
+ margin-top: 2px;
+}
+
+.tool-details {
+ flex: 1;
+ min-width: 0;
+}
+
+.tool-name {
+ display: block;
+ font-size: 16px;
+ font-weight: 600;
+ margin-bottom: 6px;
+ color: #262626;
+ line-height: 1.3;
+}
+
+.tool-description {
+ display: block;
+ font-size: 14px;
+ line-height: 1.5;
+ color: #6b7280;
+ word-wrap: break-word;
+ margin-bottom: 0;
+}
+
+/* Tool Meta Information */
+.tool-meta {
+ margin-bottom: 12px;
+}
+
+.tool-author {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+
+.author-icon {
+ color: #9ca3af;
+ font-size: 14px;
+}
+
+.author-text {
+ font-size: 14px;
+ color: #6b7280;
+}
+
+.time-text {
+ font-size: 14px;
+ color: #9ca3af;
+ margin-left: 8px;
+}
+
+/* Tool Category */
+.tool-category {
+ margin-top: 0;
+}
+
+.tool-category-tag {
+ font-size: 12px;
+ padding: 4px 12px;
+ border-radius: 16px;
+ background: #f3f4f6;
+ color: #374151;
+ border: none;
+ font-weight: 500;
+}
+
+/* Footer Section */
+.tool-selection-footer {
+ padding: 16px 24px;
+ border-top: 1px solid #f0f0f0;
+ background: #fafafa;
+ display: flex;
+ gap: 12px;
+ justify-content: flex-end;
+}
+
+/* Responsive Design */
+@media (max-width: 768px) {
+ .tool-selection-sidebar {
+ width: 100vw;
+ }
+}
+
+/* Empty State */
+.tool-selection-content .ant-list-empty-text {
+ padding: 40px 20px;
+ text-align: center;
+ color: #8c8c8c;
+}
diff --git a/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx b/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx
new file mode 100644
index 000000000..2f1a64575
--- /dev/null
+++ b/frontend/src/components/agency/tool-selection-sidebar/ToolSelectionSidebar.jsx
@@ -0,0 +1,147 @@
+import { Button, Input, Typography, List, Card, Tag } from "antd";
+import { SearchOutlined, FileTextOutlined } from "@ant-design/icons";
+import { useState, useEffect } from "react";
+import PropTypes from "prop-types";
+
+import "./ToolSelectionSidebar.css";
+
+function ToolSelectionSidebar({
+ visible,
+ onClose,
+ tools,
+ selectedTool,
+ onToolSelect,
+ onSave,
+}) {
+ const [searchTerm, setSearchTerm] = useState("");
+ const [tempSelectedTool, setTempSelectedTool] = useState(selectedTool);
+ const [hasChanges, setHasChanges] = useState(false);
+
+ // Sync tempSelectedTool when sidebar becomes visible or selectedTool changes
+ useEffect(() => {
+ if (visible) {
+ setTempSelectedTool(selectedTool);
+ setHasChanges(false);
+ setSearchTerm("");
+ }
+ }, [visible, selectedTool]);
+
+ // Filter tools based on search term
+ const filteredTools = tools.filter(
+ (tool) =>
+ tool.name?.toLowerCase().includes(searchTerm.toLowerCase()) ||
+ tool.description?.toLowerCase().includes(searchTerm.toLowerCase())
+ );
+
+ const handleToolSelect = (toolFunctionName) => {
+ setTempSelectedTool(toolFunctionName);
+ setHasChanges(toolFunctionName !== selectedTool);
+ };
+
+ const handleSave = () => {
+ if (hasChanges && tempSelectedTool) {
+ onToolSelect(tempSelectedTool);
+ onSave();
+ }
+ onClose();
+ };
+
+ const handleCancel = () => {
+ setTempSelectedTool(selectedTool);
+ setHasChanges(false);
+ onClose();
+ };
+
+ if (!visible) {
+ return null;
+ }
+
+ return (
+ <div className="tool-selection-sidebar-overlay">
+ <div className="tool-selection-sidebar">
+ <div className="tool-selection-header">
+ <Typography.Title level={4}>Select Exported Tool</Typography.Title>
+ <Input
+ placeholder="Search tools..."
+ prefix={<SearchOutlined />}
+ value={searchTerm}
+ onChange={(e) => setSearchTerm(e.target.value)}
+ className="tool-search-input"
+ />
+ </div>
+
+ <div className="tool-selection-content">
+ <List
+ dataSource={filteredTools}
+ renderItem={(tool) => (
+ <List.Item
+ key={tool.function_name}
+ className={`tool-list-item ${
+ tempSelectedTool === tool.function_name ? "selected" : ""
+ }`}
+ onClick={() => handleToolSelect(tool.function_name)}
+ >
+ <Card
+ className="tool-card"
+ hoverable
+ size="small"
+ bordered={false}
+ >
+ <div className="tool-card-content">
+ <div className="tool-info">
+ <div className="tool-header">
+ {tool.icon || (
+ <FileTextOutlined className="tool-icon" />
+ )}
+ <div className="tool-details">
+ <Typography.Text strong className="tool-name">
+ {tool.name}
+ </Typography.Text>
+ <Typography.Text
+ type="secondary"
+ className="tool-description"
+ >
+ {tool.description || "No description available"}
+ </Typography.Text>
+ </div>
+ </div>
+ {tool.category && (
+ <div className="tool-category">
+ <Tag className="tool-category-tag">
+ {tool.category || "Financial Documents"}
+ </Tag>
+ </div>
+ )}
+ </div>
+ </div>
+ </Card>
+ </List.Item>
+ )}
+ />
+ </div>
+
+ <div className="tool-selection-footer">
+ <Button onClick={handleCancel}>Cancel</Button>
+ <Button
+ type="primary"
+ onClick={handleSave}
+ disabled={!tempSelectedTool}
+ >
+ {hasChanges ? "Save Changes" : "Select Tool"}
+ </Button>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+ToolSelectionSidebar.propTypes = {
+ visible: PropTypes.bool.isRequired,
+ onClose: PropTypes.func.isRequired,
+ tools: PropTypes.array.isRequired,
+ selectedTool: PropTypes.string,
+ onToolSelect: PropTypes.func.isRequired,
+ onSave: PropTypes.func.isRequired,
+};
+
+export { ToolSelectionSidebar };
diff --git a/frontend/src/components/agency/tool-settings/ToolSettings.jsx b/frontend/src/components/agency/tool-settings/ToolSettings.jsx
index fc23419b8..ebae35438 100644
--- a/frontend/src/components/agency/tool-settings/ToolSettings.jsx
+++ b/frontend/src/components/agency/tool-settings/ToolSettings.jsx
@@ -1,5 +1,6 @@
import PropTypes from "prop-types";
import { createRef, useEffect, useState } from "react";
+import { Empty, Typography } from "antd";
import { useAxiosPrivate } from "../../../hooks/useAxiosPrivate";
import { RjsfFormLayout } from "../../../layouts/rjsf-form-layout/RjsfFormLayout.jsx";
@@ -28,9 +29,13 @@ function ToolSettings({ spec, isSpecLoading }) {
setFormData(metadata);
}, [toolSettings, spec]);
+ const isObjectEmpty = (obj) => {
+ return obj && Object.keys(obj).length === 0;
+ };
+
const isFormValid = () => {
if (formRef) {
- formRef?.current?.validateFields((errors, values) => {
+ formRef?.current?.validateFields((errors) => {
if (errors) {
return false;
}
@@ -72,6 +77,31 @@ function ToolSettings({ spec, isSpecLoading }) {
});
};
+ // Show empty state for Prompt Studio tools that don't have configurable settings
+ if (
+ !isSpecLoading &&
+ (isObjectEmpty(spec) || isObjectEmpty(spec?.properties))
+ ) {
+ return (
+ <div className="tool-settings-layout">
+ <Empty
+ description={
+ <div style={{ textAlign: "center" }}>
+ <Typography.Text type="secondary">
+ This Prompt Studio tool doesn&apos;t have configurable settings.
+ </Typography.Text>
+ <br />
+ <Typography.Text type="secondary" style={{ fontSize: "12px" }}>
+ Tool configuration is managed within the Prompt Studio
+ interface.
+ </Typography.Text>
+ </div>
+ }
+ />
+ </div>
+ );
+ }
+
return (
<div className="tool-settings-layout">
<RjsfFormLayout
diff --git a/frontend/src/components/agency/workflow-card/WorkflowCard.css b/frontend/src/components/agency/workflow-card/WorkflowCard.css
new file mode 100644
index 000000000..073b9ba34
--- /dev/null
+++ b/frontend/src/components/agency/workflow-card/WorkflowCard.css
@@ -0,0 +1,19 @@
+/* WorkflowCard specific styles that extend the base styles */
+.workflow-card .ds-set-card-row {
+ margin-bottom: 0;
+}
+
+.workflow-card .ds-set-card-col1,
+.workflow-card .ds-set-card-col2,
+.workflow-card .ds-set-card-col3 {
+ padding: 4px 0;
+}
+
+.workflow-card .ds-set-card-select {
+ width: 100%;
+}
+
+/* Ensure the DsSettingsCard content fits well in the workflow card */
+.workflow-card-content > div {
+ width: 100%;
+}
diff --git a/frontend/src/components/agency/workflow-card/WorkflowCard.jsx b/frontend/src/components/agency/workflow-card/WorkflowCard.jsx
new file mode 100644
index 000000000..26d160493
--- /dev/null
+++ b/frontend/src/components/agency/workflow-card/WorkflowCard.jsx
@@ -0,0 +1,58 @@
+import { CheckOutlined } from "@ant-design/icons";
+import { Flex, Typography } from "antd";
+import PropTypes from "prop-types";
+
+import { DsSettingsCard } from "../ds-settings-card/DsSettingsCard";
+import "./WorkflowCard.css";
+
+function WorkflowCard({
+ number,
+ title,
+ description,
+ type,
+ endpointDetails,
+ message,
+ customContent,
+}) {
+ // Check if step is completed (number starts with ✓ or number is a specific completed indicator)
+ const isCompleted = typeof number === "string" && number.startsWith("✓");
+
+ return (
+ <div className="workflow-card">
+ <div className="workflow-card-header">
+ <div
+ className={`workflow-card-number ${isCompleted ? "completed" : ""}`}
+ >
+ {isCompleted ? <CheckOutlined /> : number}
+ </div>
+ <Flex vertical>
+ <div className="workflow-card-info">
+ <Typography.Title level={4}>{title}</Typography.Title>
+ <Typography.Text type="secondary">{description}</Typography.Text>
+ </div>
+ <div className="workflow-card-content">
+ {customContent || (
+ <DsSettingsCard
+ type={type}
+ endpointDetails={endpointDetails}
+ message={message}
+ />
+ )}
+ </div>
+ </Flex>
+ </div>
+ </div>
+ );
+}
+
+WorkflowCard.propTypes = {
+ number: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
+ title: PropTypes.string.isRequired,
+ description: PropTypes.string.isRequired,
+ type: PropTypes.string,
+ endpointDetails: PropTypes.object,
+ message: PropTypes.string,
+ customContent: PropTypes.node,
+};
+
+export { WorkflowCard };
diff --git a/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.css b/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.css
deleted file mode 100644
index 568e55fb1..000000000
--- a/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.css
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Styles for WorkflowExecutionLayout */
-
-.wf-exec-main-layout {
- height: 100%;
- overflow-y: hidden;
-}
-
-.wf-exec-main-col-1 {
- height: 100%;
- display: flex;
- flex-direction: column;
- padding-right: 6px;
- overflow-y: hidden;
-}
-
-.wf-exec-main-col-2 {
- height: 100%;
- padding-left: 6px;
-}
-
-.wf-exec-main-prompt {
- padding-bottom: 6px;
-}
-
-.wf-exec-main-steps {
- flex: 1;
- overflow: hidden;
-}
diff --git a/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsx b/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsx
deleted file mode 100644
index 2d11f0eeb..000000000
--- a/frontend/src/components/agency/workflow-execution-layout/WorkflowExecutionMain.jsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import { Col, Row } from "antd";
-import PropTypes from "prop-types";
-
-import { Steps } from "../steps/Steps";
-import "./WorkflowExecutionMain.css";
-import { InputOutput } from "../input-output/InputOutput";
-
-function WorkflowExecutionMain({
- setSteps,
- activeToolId,
- inputMd,
- outputMd,
- sourceMsg,
- destinationMsg,
-}) {
- return (
- <div className="wf-exec-main-layout">
- <Row className="wf-exec-main-layout">
- <Col span={8} className="wf-exec-main-layout">
- <div className="wf-exec-main-col-1">
- <div className="wf-exec-main-steps">
- <Steps
- setSteps={setSteps}
- activeToolId={activeToolId}
- sourceMsg={sourceMsg}
- destinationMsg={destinationMsg}
- />
- </div>
- </div>
- </Col>
- <Col span={16} className="wf-exec-main-layout">
- <div className="wf-exec-main-col-2">
- <InputOutput input={inputMd} output={outputMd} />
- </div>
- </Col>
- </Row>
- </div>
- );
-}
-
-WorkflowExecutionMain.propTypes = {
- setSteps: PropTypes.func,
- activeToolId: PropTypes.string,
- inputMd: PropTypes.string,
- outputMd: PropTypes.string,
- sourceMsg: PropTypes.string,
- destinationMsg: PropTypes.string,
-};
-
-export { WorkflowExecutionMain };
diff --git a/frontend/src/components/agency/workflow-execution/WorkflowExecution.css b/frontend/src/components/agency/workflow-execution/WorkflowExecution.css
deleted file mode 100644
index adaa01cee..000000000
--- a/frontend/src/components/agency/workflow-execution/WorkflowExecution.css
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Styles for WorkflowExecution */
-
-.wf-exec-layout {
- height: 100%;
- display: flex;
- flex-direction: column;
- padding: 12px;
-}
-
-.wf-exec-heading {
- margin-bottom: 6px;
-}
-
-.wf-exec-heading-typo {
- font-size: 18px;
-}
-
-.wf-exec-main {
- flex: 1;
- overflow-y: hidden;
-}
diff --git a/frontend/src/components/agency/workflow-execution/WorkflowExecution.jsx b/frontend/src/components/agency/workflow-execution/WorkflowExecution.jsx
deleted file mode 100644
index 8fa9943ce..000000000
--- a/frontend/src/components/agency/workflow-execution/WorkflowExecution.jsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { Typography } from "antd";
-import PropTypes from "prop-types";
-
-import "./WorkflowExecution.css";
-import { WorkflowExecutionMain } from "../workflow-execution-layout/WorkflowExecutionMain";
-
-function WorkflowExecution({
- setSteps,
- activeToolId,
- inputMd,
- outputMd,
- sourceMsg,
- destinationMsg,
-}) {
- return (
- <div className="wf-exec-layout">
- <div className="wf-exec-heading">
- <Typography.Text className="wf-exec-heading-typo" strong>
- Workflow
- </Typography.Text>
- </div>
- <div className="wf-exec-main">
- <WorkflowExecutionMain
- setSteps={setSteps}
- activeToolId={activeToolId}
- inputMd={inputMd}
- outputMd={outputMd}
- sourceMsg={sourceMsg}
- destinationMsg={destinationMsg}
- />
- </div>
- </div>
- );
-}
-
-WorkflowExecution.propTypes = {
- setSteps: PropTypes.func,
- activeToolId: PropTypes.string,
- inputMd: PropTypes.string,
- outputMd: PropTypes.string,
- sourceMsg: PropTypes.string,
- destinationMsg: PropTypes.string,
-};
-
-export { WorkflowExecution };
diff --git a/frontend/src/components/agency/workflow-execution/workflow_actions.js b/frontend/src/components/agency/workflow-execution/workflow_actions.js
deleted file mode 100644
index 787a24795..000000000
--- a/frontend/src/components/agency/workflow-execution/workflow_actions.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const Actions = {
- START: "START",
- NEXT: "NEXT",
- STOP: "STOP",
- CONTINUE: "CONTINUE",
-};
-
-export default Actions;
diff --git a/frontend/src/components/deployments/api-deployment/api-deployments-service.js b/frontend/src/components/deployments/api-deployment/api-deployments-service.js
index 5f062ced8..a2f6947c8 100644
--- a/frontend/src/components/deployments/api-deployment/api-deployments-service.js
+++ b/frontend/src/components/deployments/api-deployment/api-deployments-service.js
@@ -89,6 +89,13 @@ function apiDeploymentsService() {
};
return axiosPrivate(options);
},
+ getDeploymentsByWorkflowId: (workflowId) => {
+ options = {
+ method: "GET",
+ url: `${path}/api/deployment/?workflow=${workflowId}`,
+ };
+ return axiosPrivate(options);
+ },
};
}
diff --git a/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx b/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
index 2f62d05a3..0729d20c6 100644
--- a/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
+++ b/frontend/src/components/deployments/create-api-deployment-modal/CreateApiDeploymentModal.jsx
@@ -1,6 +1,7 @@
import { Form, Input, Modal, Select } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
+
import { getBackendErrorDetail } from "../../../helpers/GetStaticData.js";
import { useAlertStore } from "../../../store/alert-store";
import { apiDeploymentsService } from "../../deployments/api-deployment/api-deployments-service.js";
@@ -26,6 +27,7 @@ const CreateApiDeploymentModal = ({
workflowId,
workflowEndpointList,
setDeploymentName,
+ onDeploymentCreated,
}) => {
const workflowStore = useWorkflowStore();
const { updateWorkflow } = workflowStore;
@@ -117,6 +119,11 @@ const CreateApiDeploymentModal = ({
// Update - can update workflow endpoint status in store
updateWorkflow({ allowChangeEndpoint: false });
setDeploymentName(body.display_name);
+
+ // Call the callback to refresh deployment info
+ if (onDeploymentCreated) {
+ onDeploymentCreated();
+ }
} else {
updateTableData();
setSelectedRow(res?.data);
@@ -289,6 +296,7 @@ CreateApiDeploymentModal.propTypes = {
workflowId: PropTypes.string,
workflowEndpointList: PropTypes.object,
setDeploymentName: PropTypes.func,
+ onDeploymentCreated: PropTypes.func,
};
export { CreateApiDeploymentModal };
diff --git a/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx b/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx
index 255397496..22978d786 100644
--- a/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx
+++ b/frontend/src/components/pipelines-or-deployments/etl-task-deploy/EtlTaskDeploy.jsx
@@ -35,6 +35,7 @@ const EtlTaskDeploy = ({
isEdit,
selectedRow = {},
setDeploymentName,
+ onDeploymentCreated,
}) => {
const [form] = Form.useForm();
const workflowStore = useWorkflowStore();
@@ -247,6 +248,11 @@ const EtlTaskDeploy = ({
// Update - can update workflow endpoint status in store
updateWorkflow({ allowChangeEndpoint: false });
setDeploymentName(body.pipeline_name);
+
+ // Call the callback to refresh deployment info
+ if (onDeploymentCreated) {
+ onDeploymentCreated();
+ }
} else {
addPipeline(res?.data);
}
@@ -395,6 +401,7 @@ EtlTaskDeploy.propTypes = {
isEdit: PropTypes.bool,
selectedRow: PropTypes.object,
setDeploymentName: PropTypes.func,
+ onDeploymentCreated: PropTypes.func,
};
export { EtlTaskDeploy };
diff --git a/frontend/src/components/pipelines-or-deployments/pipeline-service.js b/frontend/src/components/pipelines-or-deployments/pipeline-service.js
index 3ba04ae6f..ed9fd0d8e 100644
--- a/frontend/src/components/pipelines-or-deployments/pipeline-service.js
+++ b/frontend/src/components/pipelines-or-deployments/pipeline-service.js
@@ -87,6 +87,13 @@ function pipelineService() {
};
return axiosPrivate(requestOptions);
},
+ getPipelinesByWorkflowId: (workflowId) => {
+ const requestOptions = {
+ method: "GET",
+ url: `${path}/pipeline/?workflow=${workflowId}`,
+ };
+ return axiosPrivate(requestOptions);
+ },
};
}