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

feat: update backend to support MDS #190

Merged
merged 11 commits into from
May 30, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fetch root agent id before executing the agent ([#165](https://github.com/opensearch-project/dashboards-assistant/pull/165))
- Integrate chatbot with sidecar service ([#164](https://github.com/opensearch-project/dashboards-assistant/pull/164))
- Add data source service ([#191](https://github.com/opensearch-project/dashboards-assistant/pull/191))
- Update router and controller to support MDS ([#190](https://github.com/opensearch-project/dashboards-assistant/pull/190))
2 changes: 1 addition & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"dataSourceManagement"
],
"configPath": [
"assistant"
"assistant"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as coreContextExports from '../../contexts/core_context';
import { IMessage } from '../../../common/types/chat_saved_object_attributes';

import { ChatWindowHeaderTitle } from '../chat_window_header_title';
import { DataSourceServiceMock } from '../../services/data_source_service.mock';

const setup = ({
messages = [],
Expand All @@ -37,6 +38,7 @@ const setup = ({
}),
reload: jest.fn(),
},
dataSource: new DataSourceServiceMock(),
},
};
useCoreMock.services.http.put.mockImplementation(() => Promise.resolve());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import {
EditConversationNameModalProps,
} from '../edit_conversation_name_modal';
import { HttpHandler } from '../../../../../src/core/public';
import { DataSourceServiceMock } from '../../services/data_source_service.mock';

const setup = ({ onClose, defaultTitle, conversationId }: EditConversationNameModalProps) => {
const useCoreMock = {
services: coreMock.createStart(),
services: { ...coreMock.createStart(), dataSource: new DataSourceServiceMock() },
};
jest.spyOn(coreContextExports, 'useCore').mockReturnValue(useCoreMock);

Expand Down Expand Up @@ -156,7 +157,10 @@ describe('<EditConversationNameModal />', () => {
expect(useCoreMock.services.http.put).not.toHaveBeenCalled();

fireEvent.click(renderResult.getByTestId('confirmModalConfirmButton'));
expect(useCoreMock.services.http.put).toHaveBeenCalled();

await waitFor(() => {
expect(useCoreMock.services.http.put).toHaveBeenCalled();
});

fireEvent.click(renderResult.getByTestId('confirmModalCancelButton'));

Expand Down
309 changes: 0 additions & 309 deletions public/components/feedback_modal.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion public/contexts/__mocks__/core_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { BehaviorSubject } from 'rxjs';
import { coreMock } from '../../../../../src/core/public/mocks';
import { DataSourceServiceMock } from '../../services/data_source_service.mock';

export const useCore = jest.fn(() => {
const useCoreMock = {
Expand All @@ -24,7 +25,7 @@ export const useCore = jest.fn(() => {
load: jest.fn(),
},
conversationLoad: {},
dataSource: {},
dataSource: new DataSourceServiceMock(),
},
};
useCoreMock.services.http.delete.mockReturnValue(Promise.resolve());
Expand Down
1 change: 1 addition & 0 deletions public/contexts/core_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface AssistantServices extends Required<OpenSearchDashboardsServices
startDeps: AssistantPluginStartDependencies;
conversationLoad: ConversationLoadService;
conversations: ConversationsService;
// This service is maintained in chatbot instead of dataSource exported from core plugin.
dataSource: DataSourceService;
}

Expand Down
Loading
Loading