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

filter processors for the add processor section #524

Closed
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ export enum PROCESSOR_TYPE {
NORMALIZATION = 'normalization-processor',
COLLAPSE = 'collapse',
RERANK = 'rerank',
TEXT_EMBEDDING = 'text_embedding-processor',
TEXT_IMAGE_EMBEDDING = 'text_image_embedding-processor',
Comment on lines +134 to +135
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

export enum MODEL_TYPE {
Expand Down
18 changes: 5 additions & 13 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
{
"id": "flowFrameworkDashboards",
"version": "2.19.0.0",
"opensearchDashboardsVersion": "2.19.0",
"opensearchDashboardsVersion": "2.18.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should leave as 2.19

"server": true,
"ui": true,
"requiredBundles": [],
"requiredPlugins": [
"navigation",
"opensearchDashboardsUtils"
],
"requiredPlugins": ["navigation", "opensearchDashboardsUtils"],
"optionalPlugins": [
"dataSource",
"dataSourceManagement",
"contentManagement"
],
"supportedOSDataSourceVersions": ">=2.18.0 <4.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to comment in prev PR, let's change this to >=2.17.0 <4.0.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to comment in prev PR, let's change this to >=2.17.0 <4.0.0

"requiredOSDataSourcePlugins": [
"opensearch-ml",
"opensearch-flow-framework"
],
"configPath": [
"flowFrameworkDashboards"
]
}
"requiredOSDataSourcePlugins": ["opensearch-ml", "opensearch-flow-framework"],
"configPath": ["flowFrameworkDashboards"]
}
Empty file.
65 changes: 0 additions & 65 deletions public/pages/workflow_detail/workflow_detail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,68 +161,3 @@ describe('WorkflowDetail Page Functionality (Custom Workflow)', () => {
});
});
});

describe('WorkflowDetail Page with skip ingestion option (Hybrid Search Workflow)', () => {
beforeEach(() => {
jest.clearAllMocks();
});
test(`renders the WorkflowDetail page with skip ingestion option`, async () => {
const { getByTestId, getAllByText, getAllByTestId } = renderWithRouter(
workflowId,
workflowName,
WORKFLOW_TYPE.HYBRID_SEARCH
);

// Defining a new ingest pipeline & index is enabled by default
const enabledCheckbox = getByTestId('switch-ingest.enabled');

// Skipping ingest pipeline and navigating to search
userEvent.click(enabledCheckbox);
await waitFor(() => {});
const searchPipelineButton = getByTestId('searchPipelineButton');
userEvent.click(searchPipelineButton);

// Search pipeline
await waitFor(() => {
expect(getAllByText('Define search flow').length).toBeGreaterThan(0);
});
expect(getAllByText('Configure query').length).toBeGreaterThan(0);

// Edit Search Query
const queryEditButton = getByTestId('queryEditButton');
expect(queryEditButton).toBeInTheDocument();
userEvent.click(queryEditButton);
await waitFor(() => {
expect(getAllByText('Edit query definition').length).toBeGreaterThan(0);
});
const searchQueryPresetButton = getByTestId('searchQueryPresetButton');
expect(searchQueryPresetButton).toBeInTheDocument();
const updateSearchQueryButton = getByTestId('updateSearchQueryButton');
expect(updateSearchQueryButton).toBeInTheDocument();
userEvent.click(updateSearchQueryButton);

// Add request processor
const addRequestProcessorButton = await waitFor(
() => getAllByTestId('addProcessorButton')[0]
);
userEvent.click(addRequestProcessorButton);
await waitFor(() => {
expect(getAllByText('PROCESSORS').length).toBeGreaterThan(0);
});

// Add response processor
const addResponseProcessorButton = getAllByTestId('addProcessorButton')[1];
userEvent.click(addResponseProcessorButton);
await waitFor(() => {
expect(getAllByText('PROCESSORS').length).toBeGreaterThan(0);
});

// Build and Run query, Back buttons are present
const searchPipelineBackButton = getByTestId('searchPipelineBackButton');
userEvent.click(searchPipelineBackButton);

await waitFor(() => {
expect(enabledCheckbox).not.toBeChecked();
});
});
});
4 changes: 3 additions & 1 deletion public/pages/workflow_detail/workflow_detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export function WorkflowDetail(props: WorkflowDetailProps) {
}, [USE_NEW_HOME_PAGE, dataSourceEnabled, dataSourceId, workflowName]);

// form state
const [formValues, setFormValues] = useState<WorkflowFormValues>({});
const [formValues, setFormValues] = useState<WorkflowFormValues>(
{} as WorkflowFormValues
);
const [formSchema, setFormSchema] = useState<WorkflowSchema>(yup.object({}));

// ingest docs state. we need to persist here to update the form values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,36 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import React, { useState } from 'react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { ProcessorsList } from '../processors_list';
import { PROCESSOR_CONTEXT, WorkflowConfig } from '../../../../../common';
import { ProcessorsTitle } from '../../../../general_components';
import { SavedObject } from '../../../../../../../src/core/public';
import { DataSourceAttributes } from '../../../../../../../src/plugins/data_source/common/data_sources';

interface EnrichDataProps {
uiConfig: WorkflowConfig;
setUiConfig: (uiConfig: WorkflowConfig) => void;
dataSource?: SavedObject<DataSourceAttributes>;
}

/**
* Base component for configuring any data enrichment
*/
export function EnrichData(props: EnrichDataProps) {
const [filteredCount, setFilteredCount] = useState(0);

return (
<EuiFlexGroup direction="column">
<ProcessorsTitle
title="Enrich data"
processorCount={props.uiConfig.ingest.enrich.processors?.length || 0}
/>
<ProcessorsTitle title="Enrich data" processorCount={filteredCount} />
<EuiFlexItem>
<ProcessorsList
uiConfig={props.uiConfig}
setUiConfig={props.setUiConfig}
context={PROCESSOR_CONTEXT.INGEST}
dataSource={props.dataSource}
onProcessorsChange={setFilteredCount}
/>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Loading