diff --git a/api_handler.go b/api_handler.go index 787ef23..c7c2776 100644 --- a/api_handler.go +++ b/api_handler.go @@ -358,8 +358,7 @@ type StatesAndCountsResponse struct { } type WorkflowGetResponse struct { - Supervisor *RiverJob `json:"supervisor"` - Tasks []RiverJob `json:"tasks"` + Tasks []RiverJob `json:"tasks"` } func (a *apiHandler) WorkflowGet(rw http.ResponseWriter, req *http.Request) { @@ -372,13 +371,10 @@ func (a *apiHandler) WorkflowGet(rw http.ResponseWriter, req *http.Request) { return } - const workflowSupervisorJobKind = "WorkflowSupervisor" - dbJobs, err := a.queries.JobListWorkflow(ctx, db.JobListWorkflowParams{ - PaginationLimit: 1000, - PaginationOffset: 0, - WorkflowSupervisorKind: workflowSupervisorJobKind, - WorkflowID: workflowID, + PaginationLimit: 1000, + PaginationOffset: 0, + WorkflowID: workflowID, }) if err != nil { http.Error(rw, err.Error(), http.StatusInternalServerError) @@ -393,14 +389,7 @@ func (a *apiHandler) WorkflowGet(rw http.ResponseWriter, req *http.Request) { jobs := internalJobsToSerializableJobs(dbJobs) resp := WorkflowGetResponse{} - if len(jobs) != 0 { - startIndex := 0 - if jobs[0].Kind == workflowSupervisorJobKind { - resp.Supervisor = &jobs[0] - startIndex = 1 - } - resp.Tasks = jobs[startIndex:] - } + resp.Tasks = jobs if err = json.NewEncoder(rw).Encode(resp); err != nil { http.Error(rw, err.Error(), http.StatusInternalServerError) diff --git a/internal/db/query.sql b/internal/db/query.sql index 1e453a0..add88c5 100644 --- a/internal/db/query.sql +++ b/internal/db/query.sql @@ -19,7 +19,6 @@ FROM WHERE metadata @> jsonb_build_object('workflow_id', @workflow_id::text) ORDER BY - kind = @workflow_supervisor_kind::text DESC, id ASC LIMIT @pagination_limit::integer OFFSET @pagination_offset::bigint; diff --git a/internal/db/query.sql.go b/internal/db/query.sql.go index ff5d299..920fca8 100644 --- a/internal/db/query.sql.go +++ b/internal/db/query.sql.go @@ -123,26 +123,19 @@ FROM WHERE metadata @> jsonb_build_object('workflow_id', $1::text) ORDER BY - kind = $2::text DESC, id ASC -LIMIT $4::integer -OFFSET $3::bigint +LIMIT $3::integer +OFFSET $2::bigint ` type JobListWorkflowParams struct { - WorkflowID string - WorkflowSupervisorKind string - PaginationOffset int64 - PaginationLimit int32 + WorkflowID string + PaginationOffset int64 + PaginationLimit int32 } func (q *Queries) JobListWorkflow(ctx context.Context, arg JobListWorkflowParams) ([]RiverJob, error) { - rows, err := q.db.Query(ctx, jobListWorkflow, - arg.WorkflowID, - arg.WorkflowSupervisorKind, - arg.PaginationOffset, - arg.PaginationLimit, - ) + rows, err := q.db.Query(ctx, jobListWorkflow, arg.WorkflowID, arg.PaginationOffset, arg.PaginationLimit) if err != nil { return nil, err } diff --git a/ui/src/components/WorkflowDetail.tsx b/ui/src/components/WorkflowDetail.tsx index 6a56def..de5bfc2 100644 --- a/ui/src/components/WorkflowDetail.tsx +++ b/ui/src/components/WorkflowDetail.tsx @@ -6,7 +6,7 @@ type WorkflowDetailProps = { }; export default function WorkflowDetail({ workflow }: WorkflowDetailProps) { - const { supervisor, tasks } = workflow; + const { tasks } = workflow; return ( <>
@@ -25,17 +25,15 @@ export default function WorkflowDetail({ workflow }: WorkflowDetailProps) {

ID:{" "} - - {supervisor.metadata.workflow_id} - + {tasks[0].metadata.workflow_id} {/* {capitalize(job.state)} */}

-
- +
+
); diff --git a/ui/src/components/WorkflowDiagram.tsx b/ui/src/components/WorkflowDiagram.tsx index 8c2dce4..126195b 100644 --- a/ui/src/components/WorkflowDiagram.tsx +++ b/ui/src/components/WorkflowDiagram.tsx @@ -1,4 +1,4 @@ -import ReactFlow from "reactflow"; +import ReactFlow, { MiniMap } from "reactflow"; import type { Edge, Node, NodeTypes, Position } from "reactflow"; import dagre from "@dagrejs/dagre"; @@ -10,7 +10,6 @@ import { JobState } from "@services/types"; import WorkflowNode, { WorkflowNodeData } from "@components/WorkflowNode"; type WorkflowDetailProps = { - supervisor: JobWithKnownMetadata; tasks: JobWithKnownMetadata[]; }; @@ -21,7 +20,7 @@ type nameToJobMap = { const dagreGraph = new dagre.graphlib.Graph(); dagreGraph.setDefaultEdgeLabel(() => ({})); -const nodeWidth = 250; +const nodeWidth = 208; const nodeHeight = 180; const getLayoutedElements = ( @@ -35,7 +34,7 @@ const getLayoutedElements = ( edgesep: 100, nodesep: 80, rankdir: direction, - ranksep: 80, + ranksep: 100, }); nodes.forEach((node) => { @@ -164,12 +163,15 @@ export default function WorkflowDiagram({ tasks }: WorkflowDetailProps) { return (
+ > + +
); } diff --git a/ui/src/components/WorkflowNode.tsx b/ui/src/components/WorkflowNode.tsx index 6a62a19..6a7fef8 100644 --- a/ui/src/components/WorkflowNode.tsx +++ b/ui/src/components/WorkflowNode.tsx @@ -18,7 +18,7 @@ const WorkflowNode = memo( const { hasDownstreamDeps, hasUpstreamDeps, job } = data; return ( -
+
= async ({ }; const apiWorkflowToWorkflow = (job: WorkflowFromAPI): Workflow => ({ - supervisor: apiJobToJob(job.supervisor) as JobWithKnownMetadata, tasks: job.tasks.map(apiJobToJob) as JobWithKnownMetadata[], });