mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.18`: - [[Discover] Add "All logs" data view to classic nav (#209042)](https://github.com/elastic/kibana/pull/209042) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Davis McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2025-02-11T01:18:26Z","message":"[Discover] Add \"All logs\" data view to classic nav (#209042)\n\n## Summary\r\n\r\nThis PR adds the default \"All logs\" data view introduced in #205991 to\r\nthe classic nav in addition to Observability nav.\r\n\r\nResolves #209013.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"37465f43d2eb8428a8cc2e845df686c10abe8abe","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Team:DataDiscovery","Team:obs-ux-logs","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Discover] Add \"All logs\" data view to classic nav","number":209042,"url":"https://github.com/elastic/kibana/pull/209042","mergeCommit":{"message":"[Discover] Add \"All logs\" data view to classic nav (#209042)\n\n## Summary\r\n\r\nThis PR adds the default \"All logs\" data view introduced in #205991 to\r\nthe classic nav in addition to Observability nav.\r\n\r\nResolves #209013.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"37465f43d2eb8428a8cc2e845df686c10abe8abe"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209042","number":209042,"mergeCommit":{"message":"[Discover] Add \"All logs\" data view to classic nav (#209042)\n\n## Summary\r\n\r\nThis PR adds the default \"All logs\" data view introduced in #205991 to\r\nthe classic nav in addition to Observability nav.\r\n\r\nResolves #209013.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"37465f43d2eb8428a8cc2e845df686c10abe8abe"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
This commit is contained in:
parent
ee07395957
commit
0eb1a283c2
18 changed files with 232 additions and 159 deletions
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { getAllLogsDataViewSpec } from './get_all_logs_data_view_spec';
|
||||
|
||||
describe('getAllLogsDataViewSpec', () => {
|
||||
it('must return "discover-observability-solution-all-logs" for the "All logs" data view ID or bookmarks will break', () => {
|
||||
const dataView = getAllLogsDataViewSpec({ allLogsIndexPattern: 'logs-*' });
|
||||
expect(dataView).toEqual(
|
||||
expect.objectContaining({
|
||||
id: 'discover-observability-solution-all-logs',
|
||||
name: 'All logs',
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const ALL_LOGS_DATA_VIEW_ID = 'discover-observability-solution-all-logs';
|
||||
|
||||
export const getAllLogsDataViewSpec = ({
|
||||
allLogsIndexPattern,
|
||||
}: {
|
||||
allLogsIndexPattern: string;
|
||||
}) => ({
|
||||
id: ALL_LOGS_DATA_VIEW_ID,
|
||||
name: i18n.translate('discover.observabilitySolution.allLogsDataViewName', {
|
||||
defaultMessage: 'All logs',
|
||||
}),
|
||||
title: allLogsIndexPattern,
|
||||
timeFieldName: '@timestamp',
|
||||
});
|
|
@ -10,3 +10,4 @@
|
|||
export * from './get_log_level_color';
|
||||
export * from './get_log_level_coalesed_value';
|
||||
export * from './get_available_resource_fields';
|
||||
export * from './get_all_logs_data_view_spec';
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { getAllLogsDataViewSpec } from '@kbn/discover-utils/src';
|
||||
import type { ClassicNavRootProfileProvider } from '../types';
|
||||
|
||||
export const getDefaultAdHocDataViews: ClassicNavRootProfileProvider['profile']['getDefaultAdHocDataViews'] =
|
||||
|
||||
(prev, { context }) =>
|
||||
() => {
|
||||
const prevDataViews = prev();
|
||||
|
||||
if (!context.allLogsIndexPattern) {
|
||||
return prevDataViews;
|
||||
}
|
||||
|
||||
return prevDataViews.concat(
|
||||
getAllLogsDataViewSpec({ allLogsIndexPattern: context.allLogsIndexPattern })
|
||||
);
|
||||
};
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { getDefaultAdHocDataViews } from './get_default_ad_hoc_data_views';
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { createClassicNavRootProfileProvider } from './profile';
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { SolutionType } from '../../../profiles';
|
||||
import { createContextAwarenessMocks } from '../../../__mocks__';
|
||||
import { createClassicNavRootProfileProvider } from './profile';
|
||||
|
||||
const mockServices = createContextAwarenessMocks().profileProviderServices;
|
||||
|
||||
describe('classicNavRootProfileProvider', () => {
|
||||
const classicNavRootProfileProvider = createClassicNavRootProfileProvider(mockServices);
|
||||
const RESOLUTION_MATCH = {
|
||||
isMatch: true,
|
||||
context: expect.objectContaining({ solutionType: SolutionType.Default }),
|
||||
};
|
||||
const RESOLUTION_MISMATCH = {
|
||||
isMatch: false,
|
||||
};
|
||||
|
||||
it('should match when the solution nav ID is null or undefined', async () => {
|
||||
expect(await classicNavRootProfileProvider.resolve({ solutionNavId: null })).toEqual(
|
||||
RESOLUTION_MATCH
|
||||
);
|
||||
expect(await classicNavRootProfileProvider.resolve({ solutionNavId: undefined })).toEqual(
|
||||
RESOLUTION_MATCH
|
||||
);
|
||||
});
|
||||
|
||||
it('should NOT match when the solution nav ID is any string', async () => {
|
||||
expect(
|
||||
await classicNavRootProfileProvider.resolve({
|
||||
solutionNavId: 'any string',
|
||||
})
|
||||
).toEqual(RESOLUTION_MISMATCH);
|
||||
});
|
||||
|
||||
describe('getDefaultAdHocDataViews', () => {
|
||||
it('should return an "All logs" default data view', async () => {
|
||||
const result = await classicNavRootProfileProvider.resolve({ solutionNavId: undefined });
|
||||
if (!result.isMatch) {
|
||||
throw new Error('Expected result to match');
|
||||
}
|
||||
expect(result.context.allLogsIndexPattern).toEqual('logs-*');
|
||||
const defaultDataViews = classicNavRootProfileProvider.profile.getDefaultAdHocDataViews?.(
|
||||
() => [],
|
||||
{ context: result.context }
|
||||
)();
|
||||
expect(defaultDataViews).toEqual([
|
||||
{
|
||||
id: 'discover-observability-solution-all-logs',
|
||||
name: 'All logs',
|
||||
timeFieldName: '@timestamp',
|
||||
title: 'logs-*',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should return no default data views', async () => {
|
||||
jest
|
||||
.spyOn(mockServices.logsContextService, 'getAllLogsIndexPattern')
|
||||
.mockReturnValueOnce(undefined);
|
||||
const result = await classicNavRootProfileProvider.resolve({ solutionNavId: undefined });
|
||||
if (!result.isMatch) {
|
||||
throw new Error('Expected result to match');
|
||||
}
|
||||
expect(result.context.allLogsIndexPattern).toEqual(undefined);
|
||||
const defaultDataViews = classicNavRootProfileProvider.profile.getDefaultAdHocDataViews?.(
|
||||
() => [],
|
||||
{ context: result.context }
|
||||
)();
|
||||
expect(defaultDataViews).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { SolutionType } from '../../../profiles';
|
||||
import type { ProfileProviderServices } from '../../profile_provider_services';
|
||||
import { getDefaultAdHocDataViews } from './accessors';
|
||||
import type { ClassicNavRootProfileProvider } from './types';
|
||||
|
||||
export const createClassicNavRootProfileProvider = (
|
||||
services: ProfileProviderServices
|
||||
): ClassicNavRootProfileProvider => ({
|
||||
profileId: 'classic-nav-root-profile',
|
||||
profile: { getDefaultAdHocDataViews },
|
||||
resolve: (params) => {
|
||||
if (typeof params.solutionNavId === 'string') {
|
||||
return { isMatch: false };
|
||||
}
|
||||
|
||||
return {
|
||||
isMatch: true,
|
||||
context: {
|
||||
solutionType: SolutionType.Default,
|
||||
allLogsIndexPattern: services.logsContextService.getAllLogsIndexPattern(),
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { RootProfileProvider } from '../../..';
|
||||
|
||||
export interface ClassicNavRootProfileContext {
|
||||
allLogsIndexPattern: string | undefined;
|
||||
}
|
||||
|
||||
export type ClassicNavRootProfileProvider = RootProfileProvider<ClassicNavRootProfileContext>;
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { SolutionType } from '../../../../profiles';
|
||||
import { getDefaultAdHocDataViews } from './get_default_ad_hoc_data_views';
|
||||
|
||||
describe('getDefaultAdHocDataViews', () => {
|
||||
it('must return "discover-observability-root-profile-all-logs" for the "All logs" data view ID or bookmarks will break', () => {
|
||||
const dataViews = getDefaultAdHocDataViews!(() => [], {
|
||||
context: { solutionType: SolutionType.Observability, allLogsIndexPattern: 'logs-*' },
|
||||
})();
|
||||
expect(dataViews).toEqual([
|
||||
expect.objectContaining({
|
||||
id: 'discover-observability-root-profile-all-logs',
|
||||
name: 'All logs',
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
|
@ -7,11 +7,9 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { getAllLogsDataViewSpec } from '@kbn/discover-utils/src';
|
||||
import type { ObservabilityRootProfileProvider } from '../types';
|
||||
|
||||
const ALL_LOGS_DATA_VIEW_ID = 'discover-observability-root-profile-all-logs';
|
||||
|
||||
export const getDefaultAdHocDataViews: ObservabilityRootProfileProvider['profile']['getDefaultAdHocDataViews'] =
|
||||
|
||||
(prev, { context }) =>
|
||||
|
@ -22,12 +20,7 @@ export const getDefaultAdHocDataViews: ObservabilityRootProfileProvider['profile
|
|||
return prevDataViews;
|
||||
}
|
||||
|
||||
return prevDataViews.concat({
|
||||
id: ALL_LOGS_DATA_VIEW_ID,
|
||||
name: i18n.translate('discover.observabilitySolution.allLogsDataViewName', {
|
||||
defaultMessage: 'All logs',
|
||||
}),
|
||||
title: context.allLogsIndexPattern,
|
||||
timeFieldName: '@timestamp',
|
||||
});
|
||||
return prevDataViews.concat(
|
||||
getAllLogsDataViewSpec({ allLogsIndexPattern: context.allLogsIndexPattern })
|
||||
);
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ describe('observabilityRootProfileProvider', () => {
|
|||
)();
|
||||
expect(defaultDataViews).toEqual([
|
||||
{
|
||||
id: 'discover-observability-root-profile-all-logs',
|
||||
id: 'discover-observability-solution-all-logs',
|
||||
name: 'All logs',
|
||||
timeFieldName: '@timestamp',
|
||||
title: 'logs-*',
|
||||
|
|
|
@ -29,6 +29,7 @@ import {
|
|||
import type { DiscoverServices } from '../../build_services';
|
||||
import { createObservabilityRootProfileProvider } from './observability/observability_root_profile';
|
||||
import { createDeprecationLogsDataSourceProfileProvider } from './common/deprecation_logs';
|
||||
import { createClassicNavRootProfileProvider } from './common/classic_nav_root_profile';
|
||||
|
||||
/**
|
||||
* Register profile providers for root, data source, and document contexts to the profile profile services
|
||||
|
@ -123,6 +124,7 @@ export const registerEnabledProfileProviders = <
|
|||
const createRootProfileProviders = (providerServices: ProfileProviderServices) => [
|
||||
createExampleRootProfileProvider(),
|
||||
createExampleSolutionViewRootProfileProvider(),
|
||||
createClassicNavRootProfileProvider(providerServices),
|
||||
createSecurityRootProfileProvider(providerServices),
|
||||
createObservabilityRootProfileProvider(providerServices),
|
||||
];
|
||||
|
|
|
@ -332,7 +332,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const availableDataViews = await unifiedSearch.getDataViewList(
|
||||
'discover-dataView-switch-link'
|
||||
);
|
||||
expect(availableDataViews).to.eql(['kibana_sample_data_flights', 'logstash-*']);
|
||||
expect(availableDataViews).to.eql(['All logs', 'kibana_sample_data_flights', 'logstash-*']);
|
||||
await dataViews.switchToAndValidate('kibana_sample_data_flights');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const security = getService('security');
|
||||
const dataViews = getService('dataViews');
|
||||
const { common, header, discover } = getPageObjects(['common', 'header', 'discover']);
|
||||
const defaultSettings = {
|
||||
defaultIndex: 'logstash-*',
|
||||
};
|
||||
|
||||
describe('discover greeting screen', function describeIndexTests() {
|
||||
before(async function () {
|
||||
await security.testUser.setRoles(['kibana_admin', 'version_test', 'test_logstash_reader']);
|
||||
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
|
||||
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
|
||||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
|
||||
await kibanaServer.uiSettings.replace(defaultSettings);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await security.testUser.restoreDefaults();
|
||||
});
|
||||
|
||||
it('should create a data view when there are no data views', async () => {
|
||||
await kibanaServer.uiSettings.replace(defaultSettings);
|
||||
await common.navigateToApp('management');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await testSubjects.click('dataViews');
|
||||
await testSubjects.click('checkboxSelectAll');
|
||||
|
||||
await testSubjects.click('delete-data-views-button');
|
||||
await testSubjects.click('confirmModalConfirmButton');
|
||||
|
||||
await common.navigateToApp('discover');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
|
||||
await dataViews.createFromPrompt({ name: 'logs', hasTimeField: true });
|
||||
expect(await dataViews.isAdHoc()).to.be(false);
|
||||
|
||||
await dataViews.createFromSearchBar({ name: 'log', adHoc: true, hasTimeField: true });
|
||||
expect(await dataViews.isAdHoc()).to.be(true);
|
||||
|
||||
expect(await discover.getIndexPatterns()).to.eql(['log*\nTemporary', 'logs*']);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
|
@ -15,9 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const dataGrid = getService('dataGrid');
|
||||
const dataViews = getService('dataViews');
|
||||
const { common, discover, header } = getPageObjects(['common', 'discover', 'header']);
|
||||
const { common, header } = getPageObjects(['common', 'discover', 'header']);
|
||||
|
||||
describe('discover no data', () => {
|
||||
const kbnDirectory = 'test/functional/fixtures/kbn_archiver/discover';
|
||||
|
@ -42,33 +39,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await addIntegrations.click();
|
||||
await common.waitUntilUrlIncludes('integrations/browse');
|
||||
});
|
||||
|
||||
it('adds a new data view when no data views', async () => {
|
||||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
|
||||
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
|
||||
await common.navigateToApp('discover');
|
||||
|
||||
const dataViewToCreate = 'logstash';
|
||||
await dataViews.createFromPrompt({ name: dataViewToCreate });
|
||||
await dataViews.waitForSwitcherToBe(`${dataViewToCreate}*`);
|
||||
});
|
||||
|
||||
it('skips to Discover to try ES|QL', async () => {
|
||||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
|
||||
await kibanaServer.savedObjects.clean({ types: ['search', 'index-pattern'] });
|
||||
await kibanaServer.uiSettings.update({
|
||||
'timepicker:timeDefaults': '{ "from": "2015-09-18T19:37:13.000Z", "to": "now"}',
|
||||
});
|
||||
await common.navigateToApp('discover');
|
||||
|
||||
await testSubjects.click('tryESQLLink');
|
||||
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await testSubjects.existOrFail('ESQLEditor');
|
||||
await testSubjects.existOrFail('unifiedHistogramChart');
|
||||
const rows = await dataGrid.getDocTableRows();
|
||||
expect(rows.length).to.be.above(0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./_shared_links'));
|
||||
loadTestFile(require.resolve('./_source_filters'));
|
||||
loadTestFile(require.resolve('./_large_string'));
|
||||
loadTestFile(require.resolve('./_greeting_screen'));
|
||||
loadTestFile(require.resolve('./_inspector'));
|
||||
loadTestFile(require.resolve('./_url_state'));
|
||||
});
|
||||
|
|
|
@ -156,33 +156,5 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
await unifiedFieldList.expectMissingFieldListItemVisualize('bytes');
|
||||
});
|
||||
});
|
||||
|
||||
describe('space with index pattern management disabled', function () {
|
||||
// unskipped because of flakiness in cloud, caused be ingest management tests
|
||||
// should be unskipped when https://github.com/elastic/kibana/issues/74353 was resolved
|
||||
this.tags(['skipCloud']);
|
||||
before(async () => {
|
||||
await spacesService.create({
|
||||
id: 'custom_space_no_index_patterns',
|
||||
name: 'custom_space_no_index_patterns',
|
||||
disabledFeatures: ['indexPatterns'],
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await spacesService.delete('custom_space_no_index_patterns');
|
||||
});
|
||||
|
||||
it('shows empty prompt when no data views exist', async () => {
|
||||
await common.navigateToUrl('discover', '', {
|
||||
basePath: '/s/custom_space_no_index_patterns',
|
||||
ensureCurrentUrl: false,
|
||||
shouldUseHashForSubUrl: false,
|
||||
});
|
||||
await testSubjects.existOrFail('noDataViewsPrompt', {
|
||||
timeout: config.get('timeouts.waitFor'),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue