Skip to content

Commit

Permalink
Replace default query in inspector when switching steps
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Dec 6, 2024
1 parent 6c8873c commit f8d4e93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ type ReactFlowViewport = {
};

export type UIState = {
version: string;
schema_version: 1;
config: WorkflowConfig;
type: WORKFLOW_TYPE;
// Will be used in future when changing from form-based to flow-based configs via drag-and-drop
Expand Down
13 changes: 8 additions & 5 deletions public/pages/workflow_detail/tools/query/query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ export function Query(props: QueryProps) {
// Standalone / sandboxed search request state. Users can test things out
// without updating the base form / persisted value. We default to different values
// based on the context (ingest or search).
const [tempRequest, setTempRequest] = useState<string>(
props.selectedStep === CONFIG_STEP.INGEST
? customStringify(FETCH_ALL_QUERY)
: values?.search?.request || '{}'
);
const [tempRequest, setTempRequest] = useState<string>('');
useEffect(() => {
setTempRequest(
props.selectedStep === CONFIG_STEP.INGEST
? customStringify(FETCH_ALL_QUERY)
: values?.search?.request || '{}'
);
}, [props.selectedStep]);

// state for if to execute search w/ or w/o any configured search pipeline.
// default based on if there is an available search pipeline or not.
Expand Down

0 comments on commit f8d4e93

Please sign in to comment.