import { noop } from 'lodash';
import React, { ReactNode, useState } from 'react';
import { NavLink } from 'react-router-dom';
import Tooltip from 'wdk-client/Components/Overlays/Tooltip';
import { Plugin } from 'wdk-client/Utils/ClientPlugin';
import { RecordClass } from 'wdk-client/Utils/WdkModel';
import { Step } from 'wdk-client/Utils/WdkUser';
import { makeStepBoxDisplayName } from 'wdk-client/Views/Strategy/StrategyUtils';
import { StepBoxesProps, StepBoxProps, isTransformUiStepTree, isCombineUiStepTree, isCompleteUiStepTree, PartialUiStepTree, isPartialCombineUiStepTree } from 'wdk-client/Views/Strategy/Types';
import StepDetailsDialog from 'wdk-client/Views/Strategy/StepDetailsDialog';
import { cxStepBoxes as cx } from 'wdk-client/Views/Strategy/ClassNames';
import { useBinaryStepBoxClassName } from 'wdk-client/Utils/Operations';
import { TransformIcon } from 'wdk-client/Views/Strategy/TransformIcon';
const INVALID_SEARCH_TITLE = 'This step refers to a search that is no longer valid. In order to fix your strategy, this step must be deleted.';
const INVALID_PARAMS_TITLE = 'This step contains a configuration that is no longer valid and must be revised to view results.'
const INVALID_NESTED_TITLE = 'This nested strategy contains a step that is no longer valid. Expand this nested strategy to see which steps need to be updated.'
export const ADD_STEP_BUTTON_VERBIAGE = 'Combine the results of your strategy with the results of a new search, or convert the results of your strategy with available data transformations.';
/**
* Render each step of a strategy as a grid.
*/
export default function StepBoxes(props: StepBoxesProps) {
return (
)
}
/**
* Recursively render the step tree. Steps are rendered into "slots", where a
* slot contains a primary input and its secondary input if it has one (the
* left-most rendered step, and transforms, do not have seondary inputs)
*
* We also close over provided handlers with the appropriate step id and
* sequence of actions.
*/
function StepTree(props: StepBoxesProps) {
const {
stepTree,
isDeleteable = true
} = props;
if (!isCompleteUiStepTree(stepTree)) {
return props.onDeleteStep(stepTree.step.id)}/>
}
const { step, primaryInput, secondaryInput, question, areInputsValid } = stepTree;
// primary input is deleteable if the current step accepts
// the record type of the primary input's primary input record type,
// or if the primary input does not have a primary input.
const primaryInputIsDeletable = primaryInput != null && question.allowedPrimaryInputRecordClassNames != null && (
primaryInput.primaryInput == null ||
question.allowedPrimaryInputRecordClassNames.includes(primaryInput.primaryInput.step.recordClassName)
)
return (
{primaryInput && }