Skip to content

Commit

Permalink
Merge branch 'main' into serverless-role-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Nov 14, 2023
2 parents 59a49fb + 830e8b8 commit 11eb3c9
Show file tree
Hide file tree
Showing 22 changed files with 239 additions and 184 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,8 @@ packages/kbn-monaco/src/esql @elastic/kibana-visualizations
/x-pack/plugins/infra/public/common @elastic/obs-ux-infra_services-team
/x-pack/plugins/infra/public/observability_logs @elastic/obs-ux-logs-team
/x-pack/plugins/infra/public/services @elastic/obs-ux-infra_services-team
/x-pack/test/functional/apps/infra @elastic/infra-monitoring-ui @elastic/obs-ux-infra_services-team @elastic/obs-ux-logs-team
/x-pack/test/functional/apps/infra @elastic/infra-monitoring-ui @elastic/obs-ux-infra_services-team
/x-pack/test/functional/apps/infra/logs @elastic/infra-monitoring-ui @elastic/obs-ux-logs-team
/x-pack/test/api_integration/apis/infra @elastic/infra-monitoring-ui @elastic/obs-ux-infra_services-team

# Observability UX management team
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
infrastructureThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/infrastructure-threshold-alert.html`,
logsThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/logs-threshold-alert.html`,
metricsThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/metrics-threshold-alert.html`,
threshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/threshold-alert.html`,
customThreshold: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/custom-threshold-alert.html`,
monitorStatus: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-status-alert.html`,
monitorUptime: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/monitor-uptime.html`,
tlsCertificate: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/tls-certificate-alert.html`,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export interface DocLinks {
infrastructureThreshold: string;
logsThreshold: string;
metricsThreshold: string;
threshold: string;
customThreshold: string;
monitorStatus: string;
monitorUptime: string;
tlsCertificate: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { FtrProviderContext } from '../../../services';
export default function ({ getService }: FtrProviderContext) {
const ebtServerHelper = getService('kibana_ebt_server');

describe('core-overall_status_changed', () => {
// Failing: See https://github.com/elastic/kibana/issues/171164
describe.skip('core-overall_status_changed', () => {
let initialEvent: Event<Record<string, unknown>>;
let secondEvent: Event<Record<string, unknown>>;

Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/console/_xjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
const log = getService('log');
const PageObjects = getPageObjects(['common', 'console', 'header']);

// FLAKY: https://github.com/elastic/kibana/issues/145477
describe.skip('XJSON', function testXjson() {
describe('XJSON', function testXjson() {
this.tags('includeFirefox');
before(async () => {
await PageObjects.common.navigateToApp('console');
Expand Down
2 changes: 2 additions & 0 deletions test/functional/page_objects/console_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ export class ConsolePageObject extends FtrService {
}

public async getRequestQueryParams() {
await this.sleepForDebouncePeriod();
const requestEditor = await this.getRequestEditor();
const requestQueryParams = await requestEditor.findAllByCssSelector('.ace_url.ace_param');

Expand Down Expand Up @@ -531,6 +532,7 @@ export class ConsolePageObject extends FtrService {
}

public async getRequestLineHighlighting() {
await this.sleepForDebouncePeriod();
const requestEditor = await this.getRequestEditor();
const requestLine = await requestEditor.findAllByCssSelector('.ace_line > *');
const line = [];
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"previousMinor": true
},
{
"version": "7.17.15",
"version": "7.17.16",
"branch": "7.17",
"previousMajor": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { useCallback } from 'react';
import type { TypedLensByValueInput } from '@kbn/lens-plugin/public';

import { isOfAggregateQueryType } from '@kbn/es-query';
import { AttachmentActionType } from '../../../../client/attachment_framework/types';
import { useKibana } from '../../../../common/lib/kibana';
import {
Expand All @@ -24,6 +25,8 @@ export const useLensOpenVisualization = ({ comment }: { comment: string }) => {
lens: { navigateToPrefilledEditor, canUseEditor },
} = useKibana().services;

const hasLensPermissions = canUseEditor();

const handleClick = useCallback(() => {
navigateToPrefilledEditor(
{
Expand All @@ -38,15 +41,26 @@ export const useLensOpenVisualization = ({ comment }: { comment: string }) => {
);
}, [lensVisualization, navigateToPrefilledEditor]);

if (!lensVisualization.length || lensVisualization?.[0]?.attributes == null) {
return { canUseEditor: hasLensPermissions, actionConfig: null };
}

const lensAttributes = lensVisualization[0]
.attributes as unknown as TypedLensByValueInput['attributes'];

const isESQLQuery = isOfAggregateQueryType(lensAttributes.state.query);

if (isESQLQuery) {
return { canUseEditor: hasLensPermissions, actionConfig: null };
}

return {
canUseEditor: canUseEditor(),
actionConfig: !lensVisualization.length
? null
: {
type: AttachmentActionType.BUTTON as const,
iconType: 'lensApp',
label: OPEN_IN_VISUALIZATION,
onClick: handleClick,
},
canUseEditor: hasLensPermissions,
actionConfig: {
type: AttachmentActionType.BUTTON as const,
iconType: 'lensApp',
label: OPEN_IN_VISUALIZATION,
onClick: handleClick,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ describe('getVisualizationAttachmentType', () => {

const attachmentViewProps: PersistableStateAttachmentViewProps = {
persistableStateAttachmentTypeId: LENS_ATTACHMENT_TYPE,
persistableStateAttachmentState: { attributes: {}, timeRange: {} },
persistableStateAttachmentState: {
attributes: { state: { query: {} } },
timeRange: {},
},
attachmentId: 'test',
caseData: { title: basicCase.title, id: basicCase.id },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { set } from 'lodash';
import React from 'react';
import { screen } from '@testing-library/react';
import type { AppMockRenderer } from '../../common/mock';
Expand Down Expand Up @@ -60,4 +61,18 @@ describe('OpenLensButton', () => {

expect(screen.queryByText('Open visualization')).not.toBeInTheDocument();
});

it('does not show the button if the query is an ESQL', () => {
const esqlProps = {
attachmentId: 'test',
...lensVisualization,
};

set(esqlProps, 'attributes.state.query', { esql: '' });

// @ts-expect-error: props are correct
appMockRender.render(<OpenLensButton {...esqlProps} />);

expect(screen.queryByText('Open visualization')).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { isOfAggregateQueryType } from '@kbn/es-query';
import { EuiButtonEmpty } from '@elastic/eui';
import React, { useCallback } from 'react';
import { useKibana } from '../../common/lib/kibana';
Expand Down Expand Up @@ -32,8 +33,9 @@ const OpenLensButtonComponent: React.FC<Props> = ({ attachmentId, attributes, ti
}, [attachmentId, attributes, navigateToPrefilledEditor, timeRange]);

const hasLensPermissions = canUseEditor();
const isESQLQuery = isOfAggregateQueryType(attributes.state.query);

if (!hasLensPermissions) {
if (!hasLensPermissions || isESQLQuery) {
return null;
}

Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/maps/public/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
overflow: hidden;
}

.mapFullScreen {
// sass-lint:disable no-important
height: 100vh !important;
}

#react-maps-root {
flex-grow: 1;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const registerObservabilityRuleTypes = (
),
iconClass: 'bell',
documentationUrl(docLinks) {
return `${docLinks.links.observability.threshold}`;
return `${docLinks.links.observability.customThreshold}`;
},
ruleParamsExpression: lazy(
() => import('../components/custom_threshold/custom_threshold_rule_expression')
Expand Down
12 changes: 6 additions & 6 deletions x-pack/test/functional/apps/infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export default ({ loadTestFile }: FtrProviderContext) => {
});

describe('Logs UI', function () {
loadTestFile(require.resolve('./log_entry_categories_tab'));
loadTestFile(require.resolve('./log_entry_rate_tab'));
loadTestFile(require.resolve('./logs_source_configuration'));
loadTestFile(require.resolve('./log_stream_date_nano'));
loadTestFile(require.resolve('./link_to'));
loadTestFile(require.resolve('./log_stream'));
loadTestFile(require.resolve('./logs/log_entry_categories_tab'));
loadTestFile(require.resolve('./logs/log_entry_rate_tab'));
loadTestFile(require.resolve('./logs/logs_source_configuration'));
loadTestFile(require.resolve('./logs/log_stream_date_nano'));
loadTestFile(require.resolve('./logs/link_to'));
loadTestFile(require.resolve('./logs/log_stream'));
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from '@kbn/expect';
import { URL } from 'url';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

const ONE_HOUR = 60 * 60 * 1000;
const LOG_VIEW_ID = 'testView';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from '@kbn/expect';

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default ({ getService }: FtrProviderContext) => {
const logsUi = getService('logsUi');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from '@kbn/expect';
import { URL } from 'url';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

const SERVICE_ID = '49a18510598271e924253ed2581d7ada';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import expect from '@kbn/expect';
import { URL } from 'url';
import { FtrProviderContext } from '../../ftr_provider_context';
import { DATES } from './constants';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { DATES } from '../constants';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const retry = getService('retry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
ELASTIC_HTTP_VERSION_HEADER,
X_ELASTIC_INTERNAL_ORIGIN_REQUEST,
} from '@kbn/core-http-common';
import { DATES } from './constants';
import { DATES } from '../constants';

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

const COMMON_REQUEST_HEADERS = {
'kbn-xsrf': 'some-xsrf-token',
Expand Down
5 changes: 5 additions & 0 deletions x-pack/test/functional/apps/maps/group1/full_screen_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['maps', 'common']);
const retry = getService('retry');
const security = getService('security');
const testSubjects = getService('testSubjects');

describe('maps full screen mode', () => {
before(async () => {
Expand Down Expand Up @@ -38,6 +39,10 @@ export default function ({ getService, getPageObjects }) {
});
});

it('layer control is visible', async () => {
expect(await testSubjects.isDisplayed('addLayerButton')).to.be(true);
});

it('displays exit full screen logo button', async () => {
const exists = await PageObjects.maps.exitFullScreenLogoButtonExists();
expect(exists).to.be(true);
Expand Down
Loading

0 comments on commit 11eb3c9

Please sign in to comment.