Skip to content

Commit

Permalink
Merge branch '7.x' into security/ml-privileges-deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 20, 2021
2 parents 2f6ba40 + 5744be6 commit 104bf63
Show file tree
Hide file tree
Showing 40 changed files with 420 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
readonly links: {
readonly settings: string;
readonly elasticStackGetStarted: string;
readonly upgrade: {
readonly upgradingElasticStack: string;
};
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
Expand Down
7 changes: 7 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class DocLinksService {
public start({ injectedMetadata }: StartDeps): DocLinksStart {
const DOC_LINK_VERSION = injectedMetadata.getKibanaBranch();
const ELASTIC_WEBSITE_URL = 'https://www.elastic.co/';
const STACK_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack/${DOC_LINK_VERSION}/`;
const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`;
const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;
const FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`;
Expand All @@ -34,6 +35,9 @@ export class DocLinksService {
links: {
settings: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/settings.html`,
elasticStackGetStarted: `${STACK_GETTING_STARTED}get-started-elastic-stack.html`,
upgrade: {
upgradingElasticStack: `${STACK_DOCS}upgrading-elastic-stack.html`,
},
apm: {
kibanaSettings: `${KIBANA_DOCS}apm-settings-in-kibana.html`,
supportedServiceMaps: `${KIBANA_DOCS}service-maps.html#service-maps-supported`,
Expand Down Expand Up @@ -522,6 +526,9 @@ export interface DocLinksStart {
readonly links: {
readonly settings: string;
readonly elasticStackGetStarted: string;
readonly upgrade: {
readonly upgradingElasticStack: string;
};
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
Expand Down
3 changes: 3 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ export interface DocLinksStart {
readonly links: {
readonly settings: string;
readonly elasticStackGetStarted: string;
readonly upgrade: {
readonly upgradingElasticStack: string;
};
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

// TODO use engine_logic.mock instead of setMockValues({ engineName: 'some-engine' }), currently that breaks the test
import { setMockValues } from '../../../../../../__mocks__/kea_logic';
// import '../../../../../__mocks__/engine_logic.mock';

import React from 'react';

import { shallow } from 'enzyme';

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

import { AutomatedCurationsHistoryPanel } from './automated_curations_history_panel';

describe('AutomatedCurationsHistoryPanel', () => {
beforeEach(() => {
jest.clearAllMocks();
setMockValues({ engineName: 'some-engine' });
});

it('renders', () => {
const wrapper = shallow(<AutomatedCurationsHistoryPanel />);

expect(wrapper.is(DataPanel)).toBe(true);
expect(wrapper.find(EntSearchLogStream).prop('query')).toEqual(
'event.kind: event and event.dataset: search-relevance-suggestions and appsearch.search_relevance_suggestions.engine: some-engine and event.action: curation_suggestion and appsearch.search_relevance_suggestions.suggestion.new_status: automated'
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { useValues } from 'kea';

import { i18n } from '@kbn/i18n';

import { EntSearchLogStream } from '../../../../../../shared/log_stream';
import { DataPanel } from '../../../../data_panel';
import { EngineLogic } from '../../../../engine';

export const AutomatedCurationsHistoryPanel: React.FC = () => {
const { engineName } = useValues(EngineLogic);

const filters = [
'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 (
<DataPanel
iconType="tableDensityNormal"
title={
<h2>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.automatedCurationsHistoryPanel.tableTitle',
{
defaultMessage: 'Automated curation changes',
}
)}
</h2>
}
subtitle={i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.automatedCurationsHistoryPanel.tableDecription',
{
defaultMessage: 'A detailed log of recent changes to your automated curations.',
}
)}
hasBorder
>
<EntSearchLogStream
hoursAgo={720}
query={filters.join(' and ')}
columns={[
{
type: 'field',
field: 'appsearch.search_relevance_suggestions.query',
header: i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.automatedCurationsHistoryPanel.queryColumnHeader',
{ defaultMessage: 'Query' }
),
},
{ type: 'timestamp' },
{ type: 'message' },
]}
/>
</DataPanel>
);
};

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* 2.0.
*/

export { CurationChangesPanel } from './curation_changes_panel';
export { AutomatedCurationsHistoryPanel } from './automated_curations_history_panel';
export { IgnoredQueriesPanel } from './ignored_queries_panel';
export { RejectedCurationsPanel } from './rejected_curations_panel';
export { RejectedCurationsHistoryPanel } from './rejected_curations_history_panel';
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

// TODO use engine_logic.mock instead of setMockValues({ engineName: 'some-engine' }), currently that breaks the test
import { setMockValues } from '../../../../../../__mocks__/kea_logic';
// import '../../../../../__mocks__/engine_logic.mock';

import React from 'react';

import { shallow } from 'enzyme';

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

import { RejectedCurationsHistoryPanel } from './rejected_curations_history_panel';

describe('RejectedCurationsHistoryPanel', () => {
beforeEach(() => {
jest.clearAllMocks();
setMockValues({ engineName: 'some-engine' });
});

it('renders', () => {
const wrapper = shallow(<RejectedCurationsHistoryPanel />);

expect(wrapper.is(DataPanel)).toBe(true);
expect(wrapper.find(EntSearchLogStream).prop('query')).toEqual(
'event.kind: event and event.dataset: search-relevance-suggestions and appsearch.search_relevance_suggestions.engine: some-engine and event.action: curation_suggestion and appsearch.search_relevance_suggestions.suggestion.new_status: rejected'
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { useValues } from 'kea';

import { i18n } from '@kbn/i18n';

import { EntSearchLogStream } from '../../../../../../shared/log_stream';
import { DataPanel } from '../../../../data_panel';
import { EngineLogic } from '../../../../engine';

export const RejectedCurationsHistoryPanel: React.FC = () => {
const { engineName } = useValues(EngineLogic);

const filters = [
'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: rejected',
];

return (
<DataPanel
iconType="tableDensityNormal"
title={
<h2>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.rejectedCurationsHistoryPanel.tableTitle',
{
defaultMessage: 'Recently rejected suggestions',
}
)}
</h2>
}
subtitle={i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.rejectedCurationsHistoryPanel.tableDescription',
{
defaultMessage: 'View suggestions you’ve previously rejected.',
}
)}
hasBorder
>
<EntSearchLogStream
hoursAgo={720}
query={filters.join(' and ')}
columns={[
{
type: 'field',
field: 'appsearch.search_relevance_suggestions.query',
header: i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.curations.rejectedCurationsHistoryPanel.queryColumnHeader',
{ defaultMessage: 'Query' }
),
},
{ type: 'timestamp' },
{ type: 'message' },
]}
/>
</DataPanel>
);
};

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ import React from 'react';

import { shallow } from 'enzyme';

import { CurationChangesPanel, IgnoredQueriesPanel, RejectedCurationsPanel } from './components';
import {
AutomatedCurationsHistoryPanel,
IgnoredQueriesPanel,
RejectedCurationsHistoryPanel,
} from './components';
import { CurationsHistory } from './curations_history';

describe('CurationsHistory', () => {
it('renders', () => {
const wrapper = shallow(<CurationsHistory />);

expect(wrapper.find(CurationChangesPanel)).toHaveLength(1);
expect(wrapper.find(RejectedCurationsPanel)).toHaveLength(1);
expect(wrapper.find(AutomatedCurationsHistoryPanel)).toHaveLength(1);
expect(wrapper.find(RejectedCurationsHistoryPanel)).toHaveLength(1);
expect(wrapper.find(IgnoredQueriesPanel)).toHaveLength(1);
});
});
Loading

0 comments on commit 104bf63

Please sign in to comment.