Manta Developers
GitHub
Menu

Plan detail

Read one action plan and render its detail view.

useActionPlanDetail reads a single plan. ActionPlanDetailView renders it.

What it is

Pass the plan’s graph IRI. null skips the read. The view shows the plan name, status, optional slots for rules, changes and the graph, and the run history tab.

@manta-eu/react/ldo-ui also exports a useActionPlanDetail. That one takes an object, planGraphIri, optional limit and enabled, and returns data, isLoading and error. Import the hooks one below for this detail.

Import

import { useActionPlanDetail } from "@manta-eu/react/hooks/useActionPlanDetail";
import { ActionPlanDetailView } from "@manta-eu/react/components/planning/ActionPlanDetailView";

Example

const { plan, isLoading, error } = useActionPlanDetail(planGraphIri);

return plan ? <ActionPlanDetailView plan={plan} isLoading={isLoading} error={error} /> : null;

Request

The hook takes planGraphIri: string | null.

ActionPlanDetailView takes:

  • plan, isLoading, and error
  • execution, with isExecuting, isComplete, isFailed, progress, and activities (id, typeName, entityName, operation, status of pending, in_progress, or completed)
  • graphSlot, rulesSlot, changesSlot, topBarActions, and leadingAction
  • issueCount (default 0), isValidating (default false), isDryRun (default false)
  • hideTopBar, hideChanges, and fitContent (each default false)
  • viewMode: overview (default), visual, or history, and onViewModeChange
  • onExecute, onCancel, onRerun, and onModify, each called with the plan IRI
  • onRunClick, called with an activity IRI

plan has iri, hasCurrentFacts, hasExecutionHistory, description, duration, state, primaryIntegration, createdBy, and optional estimatedCost, estimatedReturn, estimatedROI, and potentialProfit.

Response

The hook returns plan (or null), graphDocument (the plan graph, or null), isLoading, and error (a string or null).

plan has iri, hasCurrentFacts, hasExecutionHistory, description, duration, state, primaryIntegration, createdBy (reason and confidenceScore), and optional estimatedCost, estimatedReturn, estimatedROI, and potentialProfit.

“Why this plan” on the plans screen

PlansScreen draws a plan’s “Why this plan” section from the plan’s rules by default. Pass renderWhyThisPlan to draw it your own way. It receives the plan’s graph IRI, the plan as the page loaded it, and the page’s link component. renderDefaultWhyThisPlan is the default, if you want to show it beside your own.

import { PlansScreen, renderDefaultWhyThisPlan, type RenderWhyThisPlan } from "@manta-eu/react/screens/plans";

const renderWhyThisPlan: RenderWhyThisPlan = (props) => (
  <>
    <YourPlanNotes planGraphIri={props.planGraphIri} />
    {renderDefaultWhyThisPlan(props)}
  </>
);

<PlansScreen renderWhyThisPlan={renderWhyThisPlan} />;

The plan’s steps row

A plan’s page can show its steps as one row under its title and line of facts: a check on each finished step, a ring on the one under way and a number on each waiting one. Only the step under way says its state and date (“Needs a person · since 4 Nov”). Before the plan runs every step waits and none is ringed. A plan without steps shows no row.

The row reads the steps the plan states, the same ones its brief lists, with the state of the manual action each step names and the run state the page’s top bar shows, so the row and the page never disagree. A step that names no manual action waits until the run completes. When the plan’s steps name none of its manual actions, the row shows the manual actions instead. Clicking a step the page lists scrolls to its card and moves focus to it.

The row is opt-in: PlansScreen leaves it out unless you pass showStepsRow.

<PlansScreen showStepsRow />