Skip to content

Commit

Permalink
[App Search] Restrict log stream on Automated Curation Detail page to…
Browse files Browse the repository at this point in the history
… only automated events (elastic#115841)
  • Loading branch information
byronhulcher authored Oct 21, 2021
1 parent 537bce7 commit 7f83ec0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jest.mock('./curation_logic', () => ({ CurationLogic: jest.fn() }));
import { AppSearchPageTemplate } from '../../layout';

import { AutomatedCuration } from './automated_curation';
import { AutomatedCurationHistory } from './automated_curation_history';
import { CurationLogic } from './curation_logic';

import { DeleteCurationButton } from './delete_curation_button';
import { PromotedDocuments, OrganicDocuments } from './documents';
import { History } from './history';

describe('AutomatedCuration', () => {
const values = {
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('AutomatedCuration', () => {

expect(tabs.at(2).prop('isSelected')).toEqual(true);

expect(wrapper.find(History)).toHaveLength(1);
expect(wrapper.find(AutomatedCurationHistory)).toHaveLength(1);
});

it('initializes CurationLogic with a curationId prop from URL param', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import {

import { getCurationsBreadcrumbs } from '../utils';

import { AutomatedCurationHistory } from './automated_curation_history';
import { HIDDEN_DOCUMENTS_TITLE, PROMOTED_DOCUMENTS_TITLE } from './constants';
import { CurationLogic } from './curation_logic';
import { DeleteCurationButton } from './delete_curation_button';
import { PromotedDocuments, OrganicDocuments } from './documents';
import { History } from './history';

export const AutomatedCuration: React.FC = () => {
const { curationId } = useParams<{ curationId: string }>();
Expand Down Expand Up @@ -100,7 +100,7 @@ export const AutomatedCuration: React.FC = () => {
{selectedPageTab === 'promoted' && <PromotedDocuments />}
{selectedPageTab === 'promoted' && <OrganicDocuments />}
{selectedPageTab === 'history' && (
<History query={curation.queries[0]} engineName={engineName} />
<AutomatedCurationHistory query={curation.queries[0]} engineName={engineName} />
)}
</AppSearchPageTemplate>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { shallow } from 'enzyme';

import { EntSearchLogStream } from '../../../../shared/log_stream';

import { History } from './history';
import { AutomatedCurationHistory } from './automated_curation_history';

describe('History', () => {
describe('AutomatedCurationHistory', () => {
it('renders', () => {
const wrapper = shallow(<History engineName="foo" query="some text" />);
const wrapper = shallow(<AutomatedCurationHistory engineName="foo" query="some text" />);
expect(wrapper.find(EntSearchLogStream).prop('query')).toEqual(
'appsearch.search_relevance_suggestions.query: some text and event.kind: event and event.dataset: search-relevance-suggestions and appsearch.search_relevance_suggestions.engine: foo and event.action: curation_suggestion'
'appsearch.search_relevance_suggestions.query: some text and event.kind: event and event.dataset: search-relevance-suggestions and appsearch.search_relevance_suggestions.engine: foo and event.action: curation_suggestion and appsearch.search_relevance_suggestions.suggestion.new_status: automated'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ interface Props {
engineName: string;
}

export const History: React.FC<Props> = ({ query, engineName }) => {
export const AutomatedCurationHistory: React.FC<Props> = ({ query, engineName }) => {
const filters = [
`appsearch.search_relevance_suggestions.query: ${query}`,
'event.kind: event',
'event.dataset: search-relevance-suggestions',
`appsearch.search_relevance_suggestions.engine: ${engineName}`,
'event.action: curation_suggestion',
'appsearch.search_relevance_suggestions.suggestion.new_status: automated',
];

return (
Expand Down

0 comments on commit 7f83ec0

Please sign in to comment.