create @kbn/ui-actions-browser package (#149202)

## Summary

Partially addresses https://github.com/elastic/kibana/issues/147757

Sets up Ui Actions package and starts moving services from the plugin to
the package.

- [x] Setup `@kbn/ui-actions` package.
- [ ] Move code components to the package
  - [x] Types
  - [ ] Triggers
  - [ ] Actions
  - [ ] `UiActionsService`
- [x] Make `ui_actions` plugin use the new package.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Vadim Kibana 2023-01-19 18:28:07 +01:00 committed by GitHub
parent c5faa31faf
commit ebb61a5089
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 84 additions and 9 deletions

1
.github/CODEOWNERS vendored
View file

@ -1017,6 +1017,7 @@ packages/kbn-tooling-log @elastic/kibana-operations
packages/kbn-ts-projects @elastic/kibana-operations
packages/kbn-ts-type-check-cli @elastic/kibana-operations
packages/kbn-typed-react-router-config @elastic/apm-ui
packages/kbn-ui-actions-browser @elastic/appex-sharedux
packages/kbn-ui-framework @elastic/kibana-design
packages/kbn-ui-shared-deps-npm @elastic/kibana-operations
packages/kbn-ui-shared-deps-src @elastic/kibana-operations

View file

@ -447,6 +447,7 @@
"@kbn/timelion-grammar": "link:packages/kbn-timelion-grammar",
"@kbn/tinymath": "link:packages/kbn-tinymath",
"@kbn/typed-react-router-config": "link:packages/kbn-typed-react-router-config",
"@kbn/ui-actions-browser": "link:packages/kbn-ui-actions-browser",
"@kbn/ui-framework": "link:packages/kbn-ui-framework",
"@kbn/ui-shared-deps-npm": "link:packages/kbn-ui-shared-deps-npm",
"@kbn/ui-shared-deps-src": "link:packages/kbn-ui-shared-deps-src",

View file

@ -30,14 +30,16 @@ instead be:
"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"
```
then run `yarn kbn bootstrap` from the plugin directory.
## Creating a new package
Create a new sub-folder. The name of the folder should mirror the `name` in the
package's `package.json`. E.g. if the name is `@kbn/i18n` the folder name
should be `kbn-i18n`.
Run the following command from the root of the Kibana repo:
```
node scripts/generate package @kbn/<PACKAGE_NAME> --web --owner @elastic/<TEAM_NAME>
```
All new packages should use the `@kbn` namespace, and should be marked with
`"private": true`.
## Unit tests for a package

View file

@ -0,0 +1,3 @@
# @kbn/ui-actions-browser
Empty package generated by @kbn/generate

View file

@ -0,0 +1,9 @@
/*
* 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 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 or the Server
* Side Public License, v 1.
*/
export * from './src';

View file

@ -0,0 +1,13 @@
/*
* 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 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 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-ui-actions-browser'],
};

View file

@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/ui-actions-browser",
"owner": "@elastic/appex-sharedux"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/ui-actions-browser",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -0,0 +1,9 @@
/*
* 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 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 or the Server
* Side Public License, v 1.
*/
export * from './types';

View file

@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": []
}

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import type { Presentable } from '../util/presentable';
import type { Presentable } from '@kbn/ui-actions-browser';
import type { Trigger } from '../triggers';
/**

View file

@ -7,8 +7,8 @@
*/
import * as React from 'react';
import { Presentable, PresentableGrouping } from '@kbn/ui-actions-browser';
import { Action, ActionDefinition, ActionMenuItemProps } from './action';
import { Presentable, PresentableGrouping } from '../util/presentable';
/**
* @internal

View file

@ -9,7 +9,7 @@
import { EuiContextMenuPanelDescriptor } from '@elastic/eui';
import { buildContextMenuForActions } from './build_eui_context_menu_panels';
import { Action, createAction } from '../actions';
import { PresentableGrouping } from '../util';
import { PresentableGrouping } from '@kbn/ui-actions-browser';
const createTestAction = ({
type,

View file

@ -22,7 +22,7 @@ export { buildContextMenuForActions } from './context_menu';
export type {
Presentable as UiActionsPresentable,
PresentableGrouping as UiActionsPresentableGrouping,
} from './util';
} from '@kbn/ui-actions-browser';
export type { Trigger, RowClickContext } from './triggers';
export {
VISUALIZE_FIELD_TRIGGER,

View file

@ -14,6 +14,7 @@
"@kbn/i18n",
"@kbn/es-query",
"@kbn/ui-theme",
"@kbn/ui-actions-browser",
],
"exclude": [
"target/**/*",

View file

@ -1218,6 +1218,8 @@
"@kbn/ts-type-check-cli/*": ["packages/kbn-ts-type-check-cli/*"],
"@kbn/typed-react-router-config": ["packages/kbn-typed-react-router-config"],
"@kbn/typed-react-router-config/*": ["packages/kbn-typed-react-router-config/*"],
"@kbn/ui-actions-browser": ["packages/kbn-ui-actions-browser"],
"@kbn/ui-actions-browser/*": ["packages/kbn-ui-actions-browser/*"],
"@kbn/ui-actions-enhanced-examples-plugin": ["x-pack/examples/ui_actions_enhanced_examples"],
"@kbn/ui-actions-enhanced-examples-plugin/*": ["x-pack/examples/ui_actions_enhanced_examples/*"],
"@kbn/ui-actions-enhanced-plugin": ["src/plugins/ui_actions_enhanced"],

View file

@ -4277,6 +4277,10 @@
version "0.0.0"
uid ""
"@kbn/ui-actions-browser@link:packages/kbn-ui-actions-browser":
version "0.0.0"
uid ""
"@kbn/ui-framework@link:packages/kbn-ui-framework":
version "0.0.0"
uid ""