Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stepped status in input form #178

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions public/pages/workflow_detail/workflow_inputs/workflow_inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
EuiHorizontalRule,
EuiLoadingSpinner,
EuiPanel,
EuiTitle,
EuiStepsHorizontal,
} from '@elastic/eui';
import {
Workflow,
Expand Down Expand Up @@ -46,9 +46,9 @@ interface WorkflowInputsProps {
setIngestResponse: (ingestResponse: string) => void;
}

export enum CREATE_STEP {
INGEST = 'Step 1: Define ingestion pipeline',
SEARCH = 'Step 2: Define search pipeline',
export enum STEP {
INGEST = 'Ingestion pipeline',
SEARCH = 'Search pipeline',
}

/**
Expand All @@ -63,9 +63,7 @@ export function WorkflowInputs(props: WorkflowInputsProps) {
const dispatch = useAppDispatch();

// selected step state
const [selectedStep, setSelectedStep] = useState<CREATE_STEP>(
CREATE_STEP.INGEST
);
const [selectedStep, setSelectedStep] = useState<STEP>(STEP.INGEST);

// ingest state
const [ingestDocs, setIngestDocs] = useState<{}[]>([]);
Expand Down Expand Up @@ -201,9 +199,22 @@ export function WorkflowInputs(props: WorkflowInputsProps) {
}}
>
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h4>{selectedStep}</h4>
</EuiTitle>
<EuiStepsHorizontal
steps={[
{
title: STEP.INGEST,
isComplete: selectedStep === STEP.SEARCH,
isSelected: selectedStep === STEP.INGEST,
onClick: () => {},
},
{
title: STEP.SEARCH,
isComplete: false,
isSelected: selectedStep === STEP.SEARCH,
onClick: () => {},
},
]}
></EuiStepsHorizontal>
</EuiFlexItem>
<EuiFlexItem
grow={true}
Expand All @@ -212,7 +223,7 @@ export function WorkflowInputs(props: WorkflowInputsProps) {
overflowX: 'hidden',
}}
>
{selectedStep === CREATE_STEP.INGEST ? (
{selectedStep === STEP.INGEST ? (
<IngestInputs
onFormChange={props.onFormChange}
ingestDocs={ingestDocs}
Expand All @@ -231,11 +242,11 @@ export function WorkflowInputs(props: WorkflowInputsProps) {
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup direction="row" justifyContent="flexEnd">
{selectedStep === CREATE_STEP.INGEST ? (
{selectedStep === STEP.INGEST ? (
<>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
onClick={() => setSelectedStep(CREATE_STEP.SEARCH)}
onClick={() => setSelectedStep(STEP.SEARCH)}
>
Skip
</EuiButtonEmpty>
Expand All @@ -255,7 +266,7 @@ export function WorkflowInputs(props: WorkflowInputsProps) {
<>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
onClick={() => setSelectedStep(CREATE_STEP.INGEST)}
onClick={() => setSelectedStep(STEP.INGEST)}
>
Back
</EuiButtonEmpty>
Expand Down
Loading