Skip to content

Commit

Permalink
Merge branch 'main' into obs-ai-assistant-polish
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic authored Aug 16, 2023
2 parents 816e3f0 + 9604db3 commit 57ee6ee
Show file tree
Hide file tree
Showing 149 changed files with 2,947 additions and 553 deletions.
13 changes: 12 additions & 1 deletion .buildkite/pipelines/pull_request/security_solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@ steps:
- exit_status: '*'
limit: 1
artifact_paths:
- "target/kibana-security-solution/**/*"
- "target/kibana-security-solution/**/*"

- command: .buildkite/scripts/steps/functional/security_solution_burn.sh
label: 'Security Solution Cypress tests, burning changed specs'
agents:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
parallelism: 1
soft_fail: true
artifact_paths:
- "target/kibana-security-solution/**/*"
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"@elastic/apm-rum-react": "^1.4.4",
"@elastic/charts": "59.1.0",
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/[email protected].0",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.9.1-canary.1",
"@elastic/ems-client": "8.4.0",
"@elastic/eui": "86.0.0",
"@elastic/filesaver": "1.1.2",
Expand Down Expand Up @@ -1355,7 +1355,7 @@
"@types/source-map-support": "^0.5.3",
"@types/stats-lite": "^2.2.0",
"@types/styled-components": "^5.1.0",
"@types/supertest": "^2.0.5",
"@types/supertest": "^2.0.12",
"@types/tapable": "^1.0.6",
"@types/tar": "^6.1.5",
"@types/tempy": "^0.2.0",
Expand Down Expand Up @@ -1537,8 +1537,8 @@
"style-loader": "^1.1.3",
"stylelint": "^14.9.1",
"stylelint-scss": "^4.3.0",
"superagent": "^3.8.2",
"supertest": "^3.1.0",
"superagent": "^8.1.2",
"supertest": "^6.3.3",
"supports-color": "^7.0.0",
"svgo": "^2.8.0",
"tape": "^5.0.1",
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
connectorsConfluence: `${ENTERPRISE_SEARCH_DOCS}connectors-confluence.html`,
connectorsDropbox: `${ENTERPRISE_SEARCH_DOCS}connectors-dropbox.html`,
connectorsContentExtraction: `${ENTERPRISE_SEARCH_DOCS}connectors-content-extraction.html`,
connectorsGithub: `${ENTERPRISE_SEARCH_DOCS}connectors-github.html`,
connectorsGmail: `${ENTERPRISE_SEARCH_DOCS}connectors-gmail.html`,
connectorsGoogleCloudStorage: `${ENTERPRISE_SEARCH_DOCS}connectors-google-cloud.html`,
connectorsGoogleDrive: `${ENTERPRISE_SEARCH_DOCS}connectors-google-drive.html`,
connectorsJira: `${ENTERPRISE_SEARCH_DOCS}connectors-jira.html`,
Expand All @@ -146,12 +148,15 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
connectorsMySQL: `${ENTERPRISE_SEARCH_DOCS}connectors-mysql.html`,
connectorsNative: `${ENTERPRISE_SEARCH_DOCS}connectors.html#connectors-native`,
connectorsNetworkDrive: `${ENTERPRISE_SEARCH_DOCS}connectors-network-drive.html`,
connectorsOneDrive: `${ENTERPRISE_SEARCH_DOCS}connectors-onedrive.html`,
connectorsOracle: `${ENTERPRISE_SEARCH_DOCS}connectors-oracle.html`,
connectorsPostgreSQL: `${ENTERPRISE_SEARCH_DOCS}connectors-postgresql.html`,
connectorsS3: `${ENTERPRISE_SEARCH_DOCS}connectors-s3.html`,
connectorsSalesforce: `${ENTERPRISE_SEARCH_DOCS}connectors-salesforce.html`,
connectorsServiceNow: `${ENTERPRISE_SEARCH_DOCS}connectors-servicenow.html`,
connectorsSharepoint: `${ENTERPRISE_SEARCH_DOCS}connectors-sharepoint.html`,
connectorsSharepointOnline: `${ENTERPRISE_SEARCH_DOCS}connectors-sharepoint-online.html`,
connectorsSlack: `${ENTERPRISE_SEARCH_DOCS}connectors-slack.html`,
connectorsWorkplaceSearch: `${ENTERPRISE_SEARCH_DOCS}workplace-search-connectors.html`,
crawlerExtractionRules: `${ENTERPRISE_SEARCH_DOCS}crawler-extraction-rules.html`,
crawlerManaging: `${ENTERPRISE_SEARCH_DOCS}crawler-managing.html`,
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,25 @@ export interface DocLinks {
readonly connectorsConfluence: string;
readonly connectorsContentExtraction: string;
readonly connectorsDropbox: string;
readonly connectorsGithub: string;
readonly connectorsGoogleCloudStorage: string;
readonly connectorsGoogleDrive: string;
readonly connectorsGmail: string;
readonly connectorsJira: string;
readonly connectorsMicrosoftSQL: string;
readonly connectorsMongoDB: string;
readonly connectorsMySQL: string;
readonly connectorsNative: string;
readonly connectorsNetworkDrive: string;
readonly connectorsOneDrive: string;
readonly connectorsOracle: string;
readonly connectorsPostgreSQL: string;
readonly connectorsS3: string;
readonly connectorsSalesforce: string;
readonly connectorsServiceNow: string;
readonly connectorsSharepoint: string;
readonly connectorsSharepointOnline: string;
readonly connectorsSlack: string;
readonly connectorsWorkplaceSearch: string;
readonly crawlerExtractionRules: string;
readonly crawlerManaging: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const getRulesSchemaMock = (anchorDate: string = ANCHOR_DATE) => ({
enabled: true,
false_positives: ['false positive 1', 'false positive 2'],
from: 'now-6m',
investigation_fields: ['custom.field1', 'custom.field2'],
immutable: false,
name: 'Query with a rule id',
query: 'user.name: root or user.name: admin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ const createSearchFnMock = (nrOfHits: number) => {

const dataViewMock = buildDataViewMock({ name: 'the-data-view', fields: deepMockedFields });

// FLAKY: https:/elastic/kibana/issues/162997
describe.skip('saved search embeddable', () => {
describe('saved search embeddable', () => {
let mountpoint: HTMLDivElement;
let servicesMock: jest.Mocked<DiscoverServices>;

Expand Down Expand Up @@ -322,7 +321,8 @@ describe.skip('saved search embeddable', () => {
expect(search).toHaveBeenCalledTimes(1);
});

it('should not reload when the input title doesnt change', async () => {
// FLAKY: https:/elastic/kibana/issues/162997
it.skip('should not reload when the input title doesnt change', async () => {
const search = jest.fn().mockReturnValue(getSearchResponse(1));
const { embeddable } = createEmbeddable({ searchMock: search, customTitle: 'custom title' });
await waitOneTick();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export const AssistantHeader: React.FC<Props> = ({
justifyContent={'spaceBetween'}
>
<EuiFlexItem grow={false}>
<AssistantTitle {...currentTitle} docLinks={docLinks} />
<AssistantTitle
{...currentTitle}
docLinks={docLinks}
selectedConversation={currentConversation}
/>
</EuiFlexItem>

<EuiFlexItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,29 @@ const testProps = {
title: 'Test Title',
titleIcon: 'globe',
docLinks: { ELASTIC_WEBSITE_URL: 'https://www.elastic.co/', DOC_LINK_VERSION: '7.15' },
selectedConversation: undefined,
};

describe('AssistantTitle', () => {
it('the component renders correctly with valid props', () => {
const { getByText, container } = render(<AssistantTitle {...testProps} />);
const { getByText, container } = render(
<TestProviders>
<AssistantTitle {...testProps} />
</TestProviders>
);
expect(getByText('Test Title')).toBeInTheDocument();
expect(container.querySelector('[data-euiicon-type="globe"]')).not.toBeNull();
});

it('clicking on the popover button opens the popover with the correct link', () => {
const { getByTestId, queryByTestId } = render(<AssistantTitle {...testProps} />, {
wrapper: TestProviders,
});
const { getByTestId, queryByTestId } = render(
<TestProviders>
<AssistantTitle {...testProps} />
</TestProviders>,
{
wrapper: TestProviders,
}
);
expect(queryByTestId('tooltipContent')).not.toBeInTheDocument();
fireEvent.click(getByTestId('tooltipIcon'));
expect(getByTestId('tooltipContent')).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ import {
EuiModalHeaderTitle,
EuiPopover,
EuiText,
EuiTitle,
} from '@elastic/eui';
import type { DocLinksStart } from '@kbn/core-doc-links-browser';
import { FormattedMessage } from '@kbn/i18n-react';
import { css } from '@emotion/react';
import * as i18n from '../translations';
import type { Conversation } from '../../..';
import { ConnectorSelectorInline } from '../../connectorland/connector_selector_inline/connector_selector_inline';

/**
* Renders a header title with an icon, a tooltip button, and a popover with
Expand All @@ -28,7 +32,10 @@ export const AssistantTitle: React.FC<{
title: string | JSX.Element;
titleIcon: string;
docLinks: Omit<DocLinksStart, 'links'>;
}> = ({ title, titleIcon, docLinks }) => {
selectedConversation: Conversation | undefined;
}> = ({ title, titleIcon, docLinks, selectedConversation }) => {
const selectedConnectorId = selectedConversation?.apiConfig?.connectorId;

const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const url = `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/security-assistant.html`;

Expand Down Expand Up @@ -66,32 +73,57 @@ export const AssistantTitle: React.FC<{

return (
<EuiModalHeaderTitle>
<EuiFlexGroup gutterSize="xs" alignItems="center">
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="m">
<EuiFlexItem
grow={false}
css={css`
margin-top: 3px;
`}
>
<EuiIcon data-test-subj="titleIcon" type={titleIcon} size="xl" />
</EuiFlexItem>
<EuiFlexItem grow={false}>{title}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiPopover
button={
<EuiButtonIcon
aria-label={i18n.TOOLTIP_ARIA_LABEL}
data-test-subj="tooltipIcon"
iconSize="l"
iconType="iInCircle"
onClick={onButtonClick}
/>
}
isOpen={isPopoverOpen}
closePopover={closePopover}
anchorPosition="upCenter"
>
<EuiText data-test-subj="tooltipContent" grow={false} css={{ maxWidth: '400px' }}>
<h4>{i18n.TOOLTIP_TITLE}</h4>
<p>{content}</p>
</EuiText>
</EuiPopover>
</EuiFlexItem>
<EuiFlexGroup direction="column" gutterSize="none" justifyContent="center">
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="xs" alignItems="center">
<EuiFlexItem grow={false}>
<EuiTitle size={'s'}>
<h3>{title}</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiPopover
button={
<EuiButtonIcon
aria-label={i18n.TOOLTIP_ARIA_LABEL}
data-test-subj="tooltipIcon"
iconType="iInCircle"
onClick={onButtonClick}
/>
}
isOpen={isPopoverOpen}
closePopover={closePopover}
anchorPosition="rightUp"
>
<EuiText data-test-subj="tooltipContent" grow={false} css={{ maxWidth: '400px' }}>
<h4>{i18n.TOOLTIP_TITLE}</h4>
<EuiText size={'s'}>
<p>{content}</p>
</EuiText>
</EuiText>
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<ConnectorSelectorInline
isDisabled={selectedConversation === undefined}
onConnectorModalVisibilityChange={() => {}}
onConnectorSelectionChange={() => {}}
selectedConnectorId={selectedConnectorId}
selectedConversation={selectedConversation}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexGroup>
</EuiModalHeaderTitle>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const ConnectorMissingCallout: React.FC<Props> = React.memo(
<p>
{' '}
<FormattedMessage
defaultMessage="Select a connector from the {link} to continue"
defaultMessage="Select a connector above or from the {link} to continue"
id="xpack.elasticAssistant.assistant.connectors.connectorMissingCallout.calloutDescription"
values={{
link: (
Expand Down
Loading

0 comments on commit 57ee6ee

Please sign in to comment.