Skip to content

Commit

Permalink
feat(ui): Rename commit to save (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
topher-lo authored Jan 8, 2025
1 parent 1226f81 commit fba78a6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
32 changes: 16 additions & 16 deletions frontend/src/components/nav/workbench-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
import {
AlertTriangleIcon,
DownloadIcon,
GitPullRequestCreateArrowIcon,
SaveIcon,
MoreHorizontal,
PlayIcon,
SquarePlay,
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -158,7 +158,7 @@ export function WorkbenchNav() {
disabled={manualTriggerDisabled}
workflowId={workflow.id}
/>
{/* Commit button */}
{/* Save button */}
<div className="flex items-center space-x-2">
<Tooltip>
<TooltipTrigger asChild>
Expand All @@ -174,15 +174,15 @@ export function WorkbenchNav() {
{validationErrors ? (
<AlertTriangleIcon className="mr-2 size-4 fill-red-500 stroke-white" />
) : (
<GitPullRequestCreateArrowIcon className="mr-2 size-4" />
<SaveIcon className="mr-2 size-4" />
)}
Commit
Save
</Button>
</TooltipTrigger>

<TooltipContent
side="bottom"
className="w-auto min-w-72 max-w-lg space-y-2 border bg-background p-0 text-xs text-muted-foreground shadow-lg"
className="w-fit p-0 border bg-background text-xs text-muted-foreground shadow-lg"
>
{validationErrors ? (
<div className="space-y-2 rounded-md border border-rose-400 bg-rose-100 p-2 font-mono tracking-tighter">
Expand All @@ -205,8 +205,7 @@ export function WorkbenchNav() {
) : (
<div className="p-2">
<span>
Create workflow definition v{(workflow.version || 0) + 1}{" "}
with your changes.
Save workflow v{(workflow.version || 0) + 1}{" "} with your changes.
</span>
</div>
)}
Expand All @@ -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"}
</Badge>
</div>

Expand Down Expand Up @@ -246,8 +245,8 @@ export function WorkbenchNav() {
</AlertDialogTitle>
<AlertDialogDescription>
{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."}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
Expand All @@ -260,10 +259,11 @@ export function WorkbenchNav() {
</AlertDialog>
<TooltipContent
side="bottom"
className="max-w-48 border bg-background text-xs text-muted-foreground shadow-lg"
className="w-72 border bg-background text-xs text-muted-foreground shadow-lg"
>
{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."}
</TooltipContent>
</Tooltip>

Expand Down Expand Up @@ -526,7 +526,7 @@ function WorkflowManualTrigger({
</div>
</div>
) : 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."
)}
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/providers/workflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -112,22 +112,22 @@ export function WorkflowProvider({
<div className="flex flex-col space-y-2">
<p>
{response.message ||
"Could not commit workflow due to valiation errors"}
"Could not save workflow due to validation errors."}
</p>
<p>Please hover over the commit button to view errors.</p>
<p>Please hover over the save button to view errors.</p>
</div>
),
variant: "destructive",
})
}
},
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",
})
},
Expand Down
8 changes: 4 additions & 4 deletions tracecat/workflow/management/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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):
Expand All @@ -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(
Expand Down

0 comments on commit fba78a6

Please sign in to comment.