Skip to content

Commit

Permalink
Fix bug of default query overridden on ingest if preset search query …
Browse files Browse the repository at this point in the history
…defined

Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Dec 7, 2024
1 parent 3cc76d4 commit 64d9a7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
18 changes: 10 additions & 8 deletions public/pages/workflow_detail/tools/query/query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ 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).
// based on the context (ingest or search), and update based on changes to the context
// (ingest v. search), or if the parent form values are changed.
const [tempRequest, setTempRequest] = useState<string>('');
useEffect(() => {
setTempRequest(
Expand All @@ -76,6 +77,14 @@ export function Query(props: QueryProps) {
: values?.search?.request || '{}'
);
}, [props.selectedStep]);
useEffect(() => {
if (
!isEmpty(values?.search?.request) &&
props.selectedStep === CONFIG_STEP.SEARCH
) {
setTempRequest(values?.search?.request);
}
}, [values?.search?.request]);

// 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 All @@ -87,13 +96,6 @@ export function Query(props: QueryProps) {
// query params state
const [queryParams, setQueryParams] = useState<QueryParam[]>([]);

// listen for changes to the upstream / form query, and reset the default
useEffect(() => {
if (!isEmpty(values?.search?.request)) {
setTempRequest(values?.search?.request);
}
}, [values?.search?.request]);

// Do a few things when the request is changed:
// 1. Check if there is a new set of query parameters, and if so,
// reset the form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ export function WorkflowInputs(props: WorkflowInputsProps) {
// to clean up any created resources and not have leftover / stale data in some index.
// This is propagated by passing `reprovision=false` to validateAndUpdateWorkflow()
async function validateAndRunIngestion(): Promise<boolean> {
console.log('running ingestion only');
props.setIsRunningIngest(true);
let success = false;
try {
Expand Down

0 comments on commit 64d9a7d

Please sign in to comment.