[Console] show persistent console on pipelines list page (#180422)

This commit is contained in:
Rodney Norris 2024-04-22 13:46:55 -05:00 committed by GitHub
parent 6b0e38ad4e
commit 1e79cfc47d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 151 additions and 2 deletions

View file

@ -19,7 +19,8 @@
],
"optionalPlugins": [
"security",
"usageCollection"
"usageCollection",
"console"
],
"requiredBundles": [
"esUiShared",

View file

@ -12,6 +12,7 @@ import { render, unmountComponentAtNode } from 'react-dom';
import { ApplicationStart } from '@kbn/core/public';
import { NotificationsSetup, IUiSettingsClient } from '@kbn/core/public';
import { ManagementAppMountParams } from '@kbn/management-plugin/public';
import type { ConsolePluginStart } from '@kbn/console-plugin/public';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type { FileUploadPluginStart } from '@kbn/file-upload-plugin/public';
import type { SettingsStart } from '@kbn/core-ui-settings-browser';
@ -46,6 +47,7 @@ export interface AppServices {
fileUpload: FileUploadPluginStart;
application: ApplicationStart;
license: ILicense | null;
consolePlugin?: ConsolePluginStart;
}
type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;

View file

@ -48,6 +48,7 @@ export async function mountManagementSection(
application,
executionContext,
license,
consolePlugin: depsStart.console,
};
return renderApp(element, services, { ...coreStart, http });

View file

@ -130,6 +130,9 @@ export const PipelinesCreate: React.FunctionComponent<RouteComponentProps & Prop
isSaving={isSaving}
saveError={saveError}
/>
{services.consolePlugin?.EmbeddableConsole ? (
<services.consolePlugin.EmbeddableConsole />
) : null}
</>
);
};

View file

@ -213,6 +213,9 @@ export const PipelinesCreateFromCsv: React.FunctionComponent<RouteComponentProps
hasError={hasError}
/>
)}
{services.consolePlugin?.EmbeddableConsole ? (
<services.consolePlugin.EmbeddableConsole />
) : null}
</>
);
};

View file

@ -201,6 +201,9 @@ export const PipelinesEdit: React.FunctionComponent<RouteComponentProps<MatchPar
defaultValue={pipeline as Pipeline}
isEditing={true}
/>
{services.consolePlugin?.EmbeddableConsole ? (
<services.consolePlugin.EmbeddableConsole />
) : null}
</>
);
};

View file

@ -264,6 +264,9 @@ export const PipelinesList: React.FunctionComponent<RouteComponentProps> = ({
pipelinesToDelete={pipelinesToDelete}
/>
) : null}
{services.consolePlugin?.EmbeddableConsole ? (
<services.consolePlugin.EmbeddableConsole />
) : null}
</>
);
};

View file

@ -9,6 +9,7 @@ import { ManagementSetup } from '@kbn/management-plugin/public';
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
import { SharePluginStart, SharePluginSetup } from '@kbn/share-plugin/public';
import type { FileUploadPluginStart } from '@kbn/file-upload-plugin/public';
import type { ConsolePluginStart } from '@kbn/console-plugin/public';
import { LicensingPluginStart } from '@kbn/licensing-plugin/public';
export type { LicenseType, ILicense } from '@kbn/licensing-plugin/public';
@ -22,4 +23,5 @@ export interface StartDependencies {
share: SharePluginStart;
fileUpload: FileUploadPluginStart;
licensing?: LicensingPluginStart;
console?: ConsolePluginStart;
}

View file

@ -32,6 +32,7 @@
"@kbn/core-ui-settings-browser",
"@kbn/code-editor",
"@kbn/react-kibana-context-render",
"@kbn/console-plugin"
],
"exclude": [
"target/**/*",

View file

@ -0,0 +1,19 @@
/*
* 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 { FtrProviderContext } from '../../ftr_provider_context';
type PageObjects = Pick<ReturnType<FtrProviderContext['getPageObjects']>, 'embeddedConsole'>;
export async function testEmbeddedConsole(pageObjects: PageObjects) {
await pageObjects.embeddedConsole.expectEmbeddedConsoleControlBarExists();
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeClosed();
await pageObjects.embeddedConsole.clickEmbeddedConsoleControlBar();
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeOpen();
await pageObjects.embeddedConsole.clickEmbeddedConsoleControlBar();
await pageObjects.embeddedConsole.expectEmbeddedConsoleToBeClosed();
}

View file

@ -7,11 +7,12 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { testEmbeddedConsole } from '../../dev_tools/embedded_console';
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'settings', 'security']);
const PageObjects = getPageObjects(['common', 'settings', 'security', 'embeddedConsole']);
const appsMenu = getService('appsMenu');
const managementMenu = getService('managementMenu');
@ -69,5 +70,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});
});
});
describe('ingest user with dev tools', () => {
before(async () => {
await security.testUser.setRoles(['global_devtools_read', 'ingest_pipelines_user']);
});
after(async () => {
await security.testUser.restoreDefaults();
});
it('should have the embedded console', async () => {
await PageObjects.common.navigateToApp('ingestPipelines');
await testEmbeddedConsole(PageObjects);
});
});
});
}

View file

@ -0,0 +1,47 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';
export function EmbeddedConsoleProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
return {
async expectEmbeddedConsoleControlBarExists() {
await testSubjects.existOrFail('consoleEmbeddedSection');
},
async expectEmbeddedConsoleToBeOpen() {
await testSubjects.existOrFail('consoleEmbeddedBody');
},
async expectEmbeddedConsoleToBeClosed() {
await testSubjects.missingOrFail('consoleEmbeddedBody');
},
async clickEmbeddedConsoleControlBar() {
await testSubjects.click('consoleEmbeddedControlBar');
},
async expectEmbeddedConsoleNotebooksButtonExists() {
await testSubjects.existOrFail('consoleEmbeddedNotebooksButton');
},
async clickEmbeddedConsoleNotebooksButton() {
await testSubjects.click('consoleEmbeddedNotebooksButton');
},
async expectEmbeddedConsoleNotebooksToBeOpen() {
await testSubjects.existOrFail('consoleEmbeddedNotebooksContainer');
},
async expectEmbeddedConsoleNotebooksToBeClosed() {
await testSubjects.missingOrFail('consoleEmbeddedNotebooksContainer');
},
async expectEmbeddedConsoleNotebookListItemToBeAvailable(id: string) {
await testSubjects.existOrFail(`console-embedded-notebook-select-btn-${id}`);
},
async clickEmbeddedConsoleNotebook(id: string) {
await testSubjects.click(`console-embedded-notebook-select-btn-${id}`);
},
async expectEmbeddedConsoleNotebookToBeAvailable(id: string) {
await testSubjects.click(`console-embedded-notebook-select-btn-${id}`);
},
};
}

View file

@ -15,6 +15,7 @@ import { CanvasPageProvider } from './canvas_page';
import { CopySavedObjectsToSpacePageProvider } from './copy_saved_objects_to_space_page';
import { CrossClusterReplicationPageProvider } from './cross_cluster_replication_page';
import { DetectionsPageObject } from '../../security_solution_ftr/page_objects/detections';
import { EmbeddedConsoleProvider } from './embedded_console';
import { GeoFileUploadPageObject } from './geo_file_upload';
import { GisPageObject } from './gis_page';
import { GraphPageObject } from './graph_page';
@ -65,6 +66,7 @@ export const pageObjects = {
copySavedObjectsToSpace: CopySavedObjectsToSpacePageProvider,
crossClusterReplication: CrossClusterReplicationPageProvider,
detections: DetectionsPageObject,
embeddedConsole: EmbeddedConsoleProvider,
geoFileUpload: GeoFileUploadPageObject,
graph: GraphPageObject,
grokDebugger: GrokDebuggerPageObject,

View file

@ -20,6 +20,7 @@ import { SvlTriggersActionsPageProvider } from './svl_triggers_actions_ui_page';
import { SvlRuleDetailsPageProvider } from './svl_rule_details_ui_page';
import { SvlSearchConnectorsPageProvider } from './svl_search_connectors_page';
import { SvlManagementPageProvider } from './svl_management_page';
import { SvlIngestPipelines } from './svl_ingest_pipelines';
export const pageObjects = {
...xpackFunctionalPageObjects,
@ -36,4 +37,5 @@ export const pageObjects = {
svlTriggersActionsUI: SvlTriggersActionsPageProvider,
svlRuleDetailsUI: SvlRuleDetailsPageProvider,
svlManagementPage: SvlManagementPageProvider,
svlIngestPipelines: SvlIngestPipelines,
};

View file

@ -0,0 +1,11 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';
export function SvlIngestPipelines({}: FtrProviderContext) {
return {};
}

View file

@ -13,6 +13,7 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./connectors/connectors_overview'));
loadTestFile(require.resolve('./default_dataview'));
loadTestFile(require.resolve('./navigation'));
loadTestFile(require.resolve('./pipelines'));
loadTestFile(require.resolve('./cases/attachment_framework'));
loadTestFile(require.resolve('./dashboards/build_dashboard'));
loadTestFile(require.resolve('./dashboards/import_dashboard'));

View file

@ -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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
import { testHasEmbeddedConsole } from './embedded_console';
export default function ({ getPageObjects }: FtrProviderContext) {
const pageObjects = getPageObjects([
'svlCommonPage',
'svlCommonNavigation',
'common',
'svlIngestPipelines',
]);
describe('ingest pipelines', function () {
before(async () => {
await pageObjects.svlCommonPage.login();
await pageObjects.svlCommonNavigation.sidenav.clickLink({
deepLinkId: 'management:ingest_pipelines',
});
});
after(async () => {
await pageObjects.svlCommonPage.forceLogout();
});
it('has embedded console', async () => {
await testHasEmbeddedConsole(pageObjects);
});
});
}