Skip to content

Commit

Permalink
Revert "feat: only support visual editor alerts to navigate to discov…
Browse files Browse the repository at this point in the history
…er (#368) (#370)"

This reverts commit 2ba4853.

Signed-off-by: tygao <[email protected]>
  • Loading branch information
raintygao committed Nov 11, 2024
1 parent 2ba4853 commit 29fbf69
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
53 changes: 0 additions & 53 deletions public/components/incontext_insight/generate_popover_body.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ describe('GeneratePopoverBody', () => {
index: 'mock_index',
dataSourceId: `test-data-source-id`,
monitorType: 'query_level_monitor',
isVisualEditorMonitor: true,
},
});
mockPost.mockImplementation((path: string, body) => {
Expand Down Expand Up @@ -385,56 +384,4 @@ describe('GeneratePopoverBody', () => {
});
expect(window.open).toHaveBeenCalledWith('formattedUrl', '_blank');
});

it('should hide navigate to discover if not from visual editor monitor', async () => {
incontextInsightMock.contextProvider = jest.fn().mockResolvedValue({
additionalInfo: {
dsl: mockDSL,
index: 'mock_index',
dataSourceId: `test-data-source-id`,
monitorType: 'query_level_monitor',
isVisualEditorMonitor: false,
},
});
mockPost.mockImplementation((path: string, body) => {
let value;
switch (path) {
case SUMMARY_ASSISTANT_API.SUMMARIZE:
value = {
summary: 'Generated summary content',
insightAgentIdExists: true,
};
break;

case SUMMARY_ASSISTANT_API.INSIGHT:
value = 'Generated insight content';
break;

default:
return null;
}
return Promise.resolve(value);
});

const coreStart = coreMock.createStart();
const dataStart = dataPluginMock.createStartContract();
const getStartServices = jest.fn().mockResolvedValue([
coreStart,
{
data: dataStart,
},
]);
const { queryByText } = render(
<GeneratePopoverBody
incontextInsight={incontextInsightMock}
httpSetup={mockHttpSetup}
closePopover={closePopoverMock}
getStartServices={getStartServices}
/>
);

await waitFor(() => {
expect(queryByText('Discover details')).not.toBeInTheDocument();
});
});
});
5 changes: 0 additions & 5 deletions public/components/incontext_insight/generate_popover_body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ export const GeneratePopoverBody: React.FC<{
if (!contextObject) return;
const monitorType = contextObject?.additionalInfo?.monitorType;
const dsl = contextObject?.additionalInfo?.dsl;
const isVisualEditorMonitor = contextObject?.additionalInfo?.isVisualEditorMonitor;
// Only alerts from visual editor monitor support to navigate to discover.
if (!isVisualEditorMonitor) {
return;
}
// Only this two types from alerting contain DSL and index.
const isSupportedMonitorType =
monitorType === 'query_level_monitor' || monitorType === 'bucket_level_monitor';
Expand Down

0 comments on commit 29fbf69

Please sign in to comment.