mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Migrate test plugins ⇒ NP (kbn_tp_sample_panel_action) (#60749)
* Migrated sample_action to NP. Panel action tests returned to the test flow. * fixed names Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
12a588986b
commit
5d5c012f3b
12 changed files with 87 additions and 52 deletions
|
@ -35,7 +35,7 @@ kibanaPipeline(timeoutMinutes: 180) {
|
|||
if (!IS_XPACK) {
|
||||
kibanaPipeline.buildOss()
|
||||
if (CI_GROUP == '1') {
|
||||
runbld("./test/scripts/jenkins_build_kbn_tp_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
|
||||
runbld("./test/scripts/jenkins_build_kbn_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
|
||||
}
|
||||
} else {
|
||||
kibanaPipeline.buildXpack()
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"id": "kbn_sample_panel_action",
|
||||
"version": "0.0.1",
|
||||
"kibanaVersion": "kibana",
|
||||
"configPath": ["kbn_sample_panel_action"],
|
||||
"server": false,
|
||||
"ui": true,
|
||||
"requiredPlugins": ["uiActions", "embeddable"]
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "kbn_tp_sample_panel_action",
|
||||
"name": "kbn_sample_panel_action",
|
||||
"version": "1.0.0",
|
||||
"main": "target/test/plugin_functional/plugins/kbn_tp_sample_panel_action",
|
||||
"main": "target/test/plugin_functional/plugins/kbn_sample_panel_action",
|
||||
"kibana": {
|
||||
"version": "kibana",
|
||||
"templateVersion": "1.0.0"
|
||||
|
@ -16,7 +16,6 @@
|
|||
"build": "rm -rf './target' && tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kbn/plugin-helpers": "9.0.2",
|
||||
"typescript": "3.7.2"
|
||||
}
|
||||
}
|
|
@ -17,24 +17,14 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { PluginInitializer } from 'kibana/public';
|
||||
import {
|
||||
SampelPanelActionTestPlugin,
|
||||
SampelPanelActionTestPluginSetup,
|
||||
SampelPanelActionTestPluginStart,
|
||||
} from './plugin';
|
||||
|
||||
// TODO: use something better once https://github.com/elastic/kibana/issues/26555 is
|
||||
// figured out.
|
||||
type KibanaPlugin = any;
|
||||
|
||||
function samplePanelAction(kibana: KibanaPlugin) {
|
||||
return new kibana.Plugin({
|
||||
publicDir: resolve(__dirname, './public'),
|
||||
uiExports: {
|
||||
embeddableActions: [
|
||||
'plugins/kbn_tp_sample_panel_action/sample_panel_action',
|
||||
'plugins/kbn_tp_sample_panel_action/sample_panel_link',
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = (kibana: KibanaPlugin) => {
|
||||
return [samplePanelAction(kibana)];
|
||||
};
|
||||
export const plugin: PluginInitializer<
|
||||
SampelPanelActionTestPluginSetup,
|
||||
SampelPanelActionTestPluginStart
|
||||
> = () => new SampelPanelActionTestPlugin();
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { CoreSetup, Plugin } from 'kibana/public';
|
||||
import { UiActionsSetup } from '../../../../../src/plugins/ui_actions/public';
|
||||
import { CONTEXT_MENU_TRIGGER } from '../../../../../src/plugins/embeddable/public';
|
||||
import { createSamplePanelAction } from './sample_panel_action';
|
||||
import { createSamplePanelLink } from './sample_panel_link';
|
||||
|
||||
export class SampelPanelActionTestPlugin
|
||||
implements Plugin<SampelPanelActionTestPluginSetup, SampelPanelActionTestPluginStart> {
|
||||
public setup(core: CoreSetup, { uiActions }: { uiActions: UiActionsSetup }) {
|
||||
const samplePanelAction = createSamplePanelAction(core.getStartServices);
|
||||
|
||||
uiActions.registerAction(samplePanelAction);
|
||||
uiActions.attachAction(CONTEXT_MENU_TRIGGER, samplePanelAction);
|
||||
|
||||
const samplePanelLink = createSamplePanelLink();
|
||||
|
||||
uiActions.registerAction(samplePanelLink);
|
||||
uiActions.attachAction(CONTEXT_MENU_TRIGGER, samplePanelLink);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
public start() {}
|
||||
public stop() {}
|
||||
}
|
||||
|
||||
export type SampelPanelActionTestPluginSetup = ReturnType<SampelPanelActionTestPlugin['setup']>;
|
||||
export type SampelPanelActionTestPluginStart = ReturnType<SampelPanelActionTestPlugin['start']>;
|
|
@ -16,23 +16,23 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { CoreSetup } from 'kibana/public';
|
||||
import { EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
import { npStart, npSetup } from 'ui/new_platform';
|
||||
|
||||
import { CONTEXT_MENU_TRIGGER, IEmbeddable } from '../../../../../src/plugins/embeddable/public';
|
||||
import { IEmbeddable } from '../../../../../src/plugins/embeddable/public';
|
||||
import { createAction, ActionType } from '../../../../../src/plugins/ui_actions/public';
|
||||
import { toMountPoint } from '../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
// Casting to ActionType is a hack - in a real situation use
|
||||
// declare module and add this id to ActionContextMapping.
|
||||
export const SAMPLE_PANEL_ACTION = 'SAMPLE_PANEL_ACTION' as ActionType;
|
||||
export const SAMPLE_PANEL_ACTION = 'samplePanelAction' as ActionType;
|
||||
|
||||
export interface SamplePanelActionContext {
|
||||
embeddable: IEmbeddable;
|
||||
}
|
||||
|
||||
function createSamplePanelAction() {
|
||||
export function createSamplePanelAction(getStartServices: CoreSetup['getStartServices']) {
|
||||
return createAction<typeof SAMPLE_PANEL_ACTION>({
|
||||
type: SAMPLE_PANEL_ACTION,
|
||||
getDisplayName: () => 'Sample Panel Action',
|
||||
|
@ -40,7 +40,8 @@ function createSamplePanelAction() {
|
|||
if (!embeddable) {
|
||||
return;
|
||||
}
|
||||
npStart.core.overlays.openFlyout(
|
||||
const openFlyout = (await getStartServices())[0].overlays.openFlyout;
|
||||
openFlyout(
|
||||
toMountPoint(
|
||||
<React.Fragment>
|
||||
<EuiFlyoutHeader>
|
||||
|
@ -60,7 +61,3 @@ function createSamplePanelAction() {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
const action = createSamplePanelAction();
|
||||
npSetup.plugins.uiActions.registerAction(action);
|
||||
npSetup.plugins.uiActions.attachAction(CONTEXT_MENU_TRIGGER, action);
|
|
@ -16,9 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { Action, createAction, ActionType } from '../../../../../src/plugins/ui_actions/public';
|
||||
import { CONTEXT_MENU_TRIGGER } from '../../../../../src/plugins/embeddable/public';
|
||||
|
||||
// Casting to ActionType is a hack - in a real situation use
|
||||
// declare module and add this id to ActionContextMapping.
|
||||
|
@ -31,7 +29,3 @@ export const createSamplePanelLink = (): Action =>
|
|||
execute: async () => {},
|
||||
getHref: () => 'https://example.com/kibana/test',
|
||||
});
|
||||
|
||||
const action = createSamplePanelLink();
|
||||
npStart.plugins.uiActions.registerAction(action);
|
||||
npStart.plugins.uiActions.attachAction(CONTEXT_MENU_TRIGGER, action);
|
|
@ -32,10 +32,9 @@ export default function({ getService, getPageObjects, loadTestFile }) {
|
|||
const browser = getService('browser');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const PageObjects = getPageObjects(['dashboard']);
|
||||
const PageObjects = getPageObjects(['common', 'dashboard']);
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/41050
|
||||
describe.skip('pluggable panel actions', function() {
|
||||
describe('pluggable panel actions', function() {
|
||||
before(async () => {
|
||||
await browser.setWindowSize(1300, 900);
|
||||
await esArchiver.load(KIBANA_ARCHIVE_PATH);
|
||||
|
|
9
test/scripts/jenkins_build_kbn_sample_panel_action.sh
Normal file
9
test/scripts/jenkins_build_kbn_sample_panel_action.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source src/dev/ci_setup/setup_env.sh
|
||||
|
||||
cd test/plugin_functional/plugins/kbn_sample_panel_action;
|
||||
if [[ ! -d "target" ]]; then
|
||||
checks-reporter-with-killswitch "Build kbn_sample_panel_action" yarn build;
|
||||
fi
|
||||
cd -;
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source src/dev/ci_setup/setup_env.sh
|
||||
|
||||
cd test/plugin_functional/plugins/kbn_tp_sample_panel_action;
|
||||
if [[ ! -d "target" ]]; then
|
||||
checks-reporter-with-killswitch "Build kbn_tp_sample_panel_action" yarn build;
|
||||
fi
|
||||
cd -;
|
|
@ -6,7 +6,7 @@ if [[ -z "$CODE_COVERAGE" ]]; then
|
|||
checks-reporter-with-killswitch "Functional tests / Group ${CI_GROUP}" yarn run grunt "run:functionalTests_ciGroup${CI_GROUP}";
|
||||
|
||||
if [ "$CI_GROUP" == "1" ]; then
|
||||
source test/scripts/jenkins_build_kbn_tp_sample_panel_action.sh
|
||||
source test/scripts/jenkins_build_kbn_sample_panel_action.sh
|
||||
yarn run grunt run:pluginFunctionalTestsRelease --from=source;
|
||||
yarn run grunt run:exampleFunctionalTestsRelease --from=source;
|
||||
yarn run grunt run:interpreterFunctionalTestsRelease;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue