From fba78a68fa51b76eea46f2615a080443088faee6 Mon Sep 17 00:00:00 2001
From: Chris Lo <46541035+topher-lo@users.noreply.github.com>
Date: Wed, 8 Jan 2025 06:22:35 -0800
Subject: [PATCH] feat(ui): Rename commit to save (#705)
---
frontend/src/components/nav/workbench-nav.tsx | 32 +++++++++----------
frontend/src/providers/workflow.tsx | 14 ++++----
tracecat/workflow/management/management.py | 8 ++---
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/frontend/src/components/nav/workbench-nav.tsx b/frontend/src/components/nav/workbench-nav.tsx
index da656734c..3086184b5 100644
--- a/frontend/src/components/nav/workbench-nav.tsx
+++ b/frontend/src/components/nav/workbench-nav.tsx
@@ -14,7 +14,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
import {
AlertTriangleIcon,
DownloadIcon,
- GitPullRequestCreateArrowIcon,
+ SaveIcon,
MoreHorizontal,
PlayIcon,
SquarePlay,
@@ -101,7 +101,7 @@ export function WorkbenchNav() {
const { workspaceId, workspace, workspaceLoading } = useWorkspace()
const handleCommit = async () => {
- console.log("Committing changes...")
+ console.log("Saving changes...")
try {
const response = await commitWorkflow()
const { status, errors } = response
@@ -111,7 +111,7 @@ export function WorkbenchNav() {
setValidationErrors(null)
}
} catch (error) {
- console.error("Failed to commit workflow:", error)
+ console.error("Failed to save workflow:", error)
}
}
@@ -158,7 +158,7 @@ export function WorkbenchNav() {
disabled={manualTriggerDisabled}
workflowId={workflow.id}
/>
- {/* Commit button */}
+ {/* Save button */}
@@ -174,15 +174,15 @@ export function WorkbenchNav() {
{validationErrors ? (
) : (
-
+
)}
- Commit
+ Save
{validationErrors ? (
@@ -205,8 +205,7 @@ export function WorkbenchNav() {
) : (
- Create workflow definition v{(workflow.version || 0) + 1}{" "}
- with your changes.
+ Save workflow v{(workflow.version || 0) + 1}{" "} with your changes.
)}
@@ -217,7 +216,7 @@ export function WorkbenchNav() {
variant="secondary"
className="h-7 text-xs font-normal text-muted-foreground hover:cursor-default"
>
- {workflow.version ? `v${workflow.version}` : "Not Committed"}
+ {workflow.version ? `v${workflow.version}` : "Draft"}
@@ -246,8 +245,8 @@ export function WorkbenchNav() {
{isOnline
- ? "Are you sure you want to disable the workflow? This will stop new executions and event processing."
- : "Are you sure you want to enable the workflow? This will start new executions and event processing."}
+ ? "Are you sure you want to disable the workflow? This will pause all schedules and block webhook events."
+ : "Are you sure you want to enable the workflow? This will resume all schedules and allow webhook events."}
@@ -260,10 +259,11 @@ export function WorkbenchNav() {
- {isOnline ? "Disable" : "Enable"} the workflow to{" "}
- {isOnline ? "stop" : "start"} new executions and receive events.
+ {isOnline
+ ? "Disable the workflow to pause all schedules and block webhook events."
+ : "Enable the workflow to resume all schedules and allow webhook events."}
@@ -526,7 +526,7 @@ function WorkflowManualTrigger({
) : disabled ? (
- "Please commit changes to enable manual trigger."
+ "Please save changes to enable manual trigger."
) : (
"Run the workflow manually without a webhook. Click to configure inputs."
)}
diff --git a/frontend/src/providers/workflow.tsx b/frontend/src/providers/workflow.tsx
index 51f23cef2..af4abe935 100644
--- a/frontend/src/providers/workflow.tsx
+++ b/frontend/src/providers/workflow.tsx
@@ -102,8 +102,8 @@ export function WorkflowProvider({
if (response.status === "success") {
queryClient.invalidateQueries({ queryKey: ["workflow", workflowId] })
toast({
- title: "Commited changes to workflow",
- description: "New workflow deployment created successfully.",
+ title: "Saved changes to workflow",
+ description: "New workflow version saved successfully.",
})
} else {
toast({
@@ -112,9 +112,9 @@ export function WorkflowProvider({
{response.message ||
- "Could not commit workflow due to valiation errors"}
+ "Could not save workflow due to validation errors."}
-
Please hover over the commit button to view errors.
+
Please hover over the save button to view errors.
),
variant: "destructive",
@@ -122,12 +122,12 @@ export function WorkflowProvider({
}
},
onError: (error: ApiError) => {
- console.warn("Failed to commit workflow:", error)
+ console.warn("Failed to save workflow:", error)
toast({
- title: "Error commiting workflow",
+ title: "Error saving workflow",
description:
(error.body as TracecatErrorMessage).message ||
- "Could not commit workflow. Please try again.",
+ "Could not save workflow. Please try again.",
variant: "destructive",
})
},
diff --git a/tracecat/workflow/management/management.py b/tracecat/workflow/management/management.py
index f9c6d23d2..9006d9160 100644
--- a/tracecat/workflow/management/management.py
+++ b/tracecat/workflow/management/management.py
@@ -146,7 +146,7 @@ async def create_workflow_from_dsl(
# Convert the workflow into a WorkflowDefinition
# XXX: When we commit from the workflow, we have action IDs
dsl = DSLInput.model_validate(dsl_data)
- self.logger.info("Commiting workflow from database")
+ self.logger.info("Creating workflow from database")
except* TracecatValidationError as eg:
self.logger.error(eg.message, error=eg.exceptions)
construction_errors.extend(
@@ -194,12 +194,12 @@ async def build_dsl_from_workflow(self, workflow: Workflow) -> DSLInput:
# If it still falsy, raise a user facing error
if not actions:
raise TracecatValidationError(
- "Workflow has no actions. Please add an action to the workflow before committing."
+ "Workflow has no actions. Please add an action to the workflow before saving."
)
graph = RFGraph.from_workflow(workflow)
if not graph.entrypoints:
raise TracecatValidationError(
- "Workflow has no entrypoints. Please add an action to the workflow before committing."
+ "Workflow has no entrypoints. Please add an action to the workflow before saving."
)
graph_actions = graph.action_nodes()
if len(graph_actions) != len(actions):
@@ -217,7 +217,7 @@ async def build_dsl_from_workflow(self, workflow: Workflow) -> DSLInput:
actions = workflow.actions
if not actions:
raise TracecatValidationError(
- "Workflow has no actions. Please add an action to the workflow before committing."
+ "Workflow has no actions. Please add an action to the workflow before saving."
)
if len(graph_actions) != len(actions):
raise TracecatValidationError(