diff --git a/tsconfig.base.json b/tsconfig.base.json index c4a2d579dee9..1c0c40e18f99 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -281,6 +281,8 @@ "@kbn/third-party-lens-navigation-prompt-plugin/*": ["x-pack/examples/third_party_lens_navigation_prompt/*"], "@kbn/third-party-vis-lens-example-plugin": ["x-pack/examples/third_party_vis_lens_example"], "@kbn/third-party-vis-lens-example-plugin/*": ["x-pack/examples/third_party_vis_lens_example/*"], + "@kbn/triggers-actions-ui-example-plugin": ["x-pack/examples/triggers_actions_ui_example"], + "@kbn/triggers-actions-ui-example-plugin/*": ["x-pack/examples/triggers_actions_ui_example/*"], "@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/actions-plugin": ["x-pack/plugins/actions"], diff --git a/x-pack/examples/triggers_actions_ui_example/kibana.json b/x-pack/examples/triggers_actions_ui_example/kibana.json new file mode 100644 index 000000000000..0440d0520a53 --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/kibana.json @@ -0,0 +1,20 @@ +{ + "id": "triggersActionsUiExample", + "version": "0.0.1", + "kibanaVersion": "kibana", + "owner": { + "name": "Response Ops", + "githubTeam": "response-ops" + }, + "server": false, + "ui": true, + "requiredPlugins": [ + "triggersActionsUi", + "data", + "alerting", + "developerExamples", + "kibanaReact" + ], + "optionalPlugins": [], + "requiredBundles": [] +} diff --git a/x-pack/examples/triggers_actions_ui_example/public/application.tsx b/x-pack/examples/triggers_actions_ui_example/public/application.tsx new file mode 100644 index 000000000000..dea85d98b839 --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/public/application.tsx @@ -0,0 +1,150 @@ +/* + * 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 React from 'react'; +import ReactDOM from 'react-dom'; +import { BrowserRouter as Router, Route } from 'react-router-dom'; +import { EuiPage, EuiTitle, EuiText, EuiSpacer } from '@elastic/eui'; +import { AppMountParameters, CoreStart } from '@kbn/core/public'; +import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; +import { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { TriggersActionsUiExamplePublicStartDeps } from './plugin'; + +import { Page } from './components/page'; +import { Sidebar } from './components/sidebar'; + +import { RulesListSandbox } from './components/rules_list_sandbox'; +import { RulesListNotifyBadgeSandbox } from './components/rules_list_notify_badge_sandbox'; +import { RuleTagBadgeSandbox } from './components/rule_tag_badge_sandbox'; +import { RuleTagFilterSandbox } from './components/rule_tag_filter_sandbox'; +import { RuleEventLogListSandbox } from './components/rule_event_log_list_sandbox'; +import { RuleStatusDropdownSandbox } from './components/rule_status_dropdown_sandbox'; +import { RuleStatusFilterSandbox } from './components/rule_status_filter_sandbox'; + +export interface TriggersActionsUiExampleComponentParams { + http: CoreStart['http']; + basename: string; + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; + data: DataPublicPluginStart; +} + +const TriggersActionsUiExampleApp = ({ + basename, + triggersActionsUi, +}: TriggersActionsUiExampleComponentParams) => { + return ( + + + + ( + + +

Welcome to the Triggers Actions UI plugin example

+
+ + + This example plugin displays the shareable components in the Triggers Actions UI + plugin. It also serves as a sandbox to run functional tests to ensure the shareable + components are functioning correctly outside of their original plugin. + +
+ )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> +
+
+ ); +}; + +export const renderApp = ( + core: CoreStart, + deps: TriggersActionsUiExamplePublicStartDeps, + { appBasePath, element }: AppMountParameters +) => { + const { http } = core; + const { triggersActionsUi } = deps; + const { ruleTypeRegistry, actionTypeRegistry } = triggersActionsUi; + ReactDOM.render( + + + , + element + ); + + return () => ReactDOM.unmountComponentAtNode(element); +}; diff --git a/x-pack/examples/triggers_actions_ui_example/public/components/page.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/page.tsx new file mode 100644 index 000000000000..9b143624ec82 --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/public/components/page.tsx @@ -0,0 +1,66 @@ +/* + * 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 React from 'react'; +import { useHistory } from 'react-router-dom'; + +import { + EuiPageContent, + EuiPageContentBody, + EuiPageBody, + EuiPageHeader, + EuiPageHeaderSection, + EuiTitle, + EuiBreadcrumbs, + EuiSpacer, +} from '@elastic/eui'; + +interface PageProps { + title: string; + crumb?: string; + isHome?: boolean; +} + +export const Page: React.FC = (props) => { + const { title, crumb, isHome, children } = props; + + const history = useHistory(); + + const breadcrumbs: Array<{ + text: string; + onClick?: () => void; + }> = [ + { + text: crumb ?? title, + }, + ]; + if (!isHome) { + breadcrumbs.splice(0, 0, { + text: 'Home', + onClick: () => { + history.push(`/`); + }, + }); + } + + return ( + + + + +

{title}

+
+
+
+ + + + {children} + +
+ ); +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_event_log_list_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rule_event_log_list_sandbox.tsx similarity index 73% rename from x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_event_log_list_sandbox.tsx rename to x-pack/examples/triggers_actions_ui_example/public/components/rule_event_log_list_sandbox.tsx index ba45800e49bc..ade66375a9cf 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_event_log_list_sandbox.tsx +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rule_event_log_list_sandbox.tsx @@ -6,10 +6,14 @@ */ import React from 'react'; -import { getRuleEventLogListLazy } from '../../../common/get_rule_event_log_list'; +import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; -export const RuleEventLogListSandbox = () => { - const props: any = { +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} + +export const RuleEventLogListSandbox = ({ triggersActionsUi }: SandboxProps) => { + const componenProps: any = { rule: { id: 'test', }, @@ -40,5 +44,7 @@ export const RuleEventLogListSandbox = () => { }), }; - return
{getRuleEventLogListLazy(props)}
; + return ( +
{triggersActionsUi.getRuleEventLogList(componenProps)}
+ ); }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_status_dropdown_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rule_status_dropdown_sandbox.tsx similarity index 76% rename from x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_status_dropdown_sandbox.tsx rename to x-pack/examples/triggers_actions_ui_example/public/components/rule_status_dropdown_sandbox.tsx index 0cbbc8f0ee9f..b1b0644f5dc1 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_status_dropdown_sandbox.tsx +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rule_status_dropdown_sandbox.tsx @@ -5,16 +5,20 @@ * 2.0. */ -import React, { useState } from 'react'; +import { useState } from 'react'; import moment from 'moment'; -import { getRuleStatusDropdownLazy } from '../../../common/get_rule_status_dropdown'; +import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; -export const RuleStatusDropdownSandbox: React.FC<{}> = () => { +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} + +export const RuleStatusDropdownSandbox = ({ triggersActionsUi }: SandboxProps) => { const [enabled, setEnabled] = useState(true); const [isSnoozedUntil, setIsSnoozedUntil] = useState(null); const [muteAll, setMuteAll] = useState(false); - return getRuleStatusDropdownLazy({ + return triggersActionsUi.getRuleStatusDropdown({ rule: { enabled, isSnoozedUntil, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_status_filter_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rule_status_filter_sandbox.tsx similarity index 64% rename from x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_status_filter_sandbox.tsx rename to x-pack/examples/triggers_actions_ui_example/public/components/rule_status_filter_sandbox.tsx index 99ddd8daf16a..95c63ba290f5 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_status_filter_sandbox.tsx +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rule_status_filter_sandbox.tsx @@ -6,17 +6,23 @@ */ import React, { useState } from 'react'; -import { RuleStatusFilterProps } from '../../../types'; -import { getRuleStatusFilterLazy } from '../../../common/get_rule_status_filter'; +import { + TriggersAndActionsUIPublicPluginStart, + RuleStatusFilterProps, +} from '@kbn/triggers-actions-ui-plugin/public'; -export const RuleStatusFilterSandbox = () => { +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} + +export const RuleStatusFilterSandbox = ({ triggersActionsUi }: SandboxProps) => { const [selectedStatuses, setSelectedStatuses] = useState< RuleStatusFilterProps['selectedStatuses'] >([]); return (
- {getRuleStatusFilterLazy({ + {triggersActionsUi.getRuleStatusFilter({ selectedStatuses, onChange: setSelectedStatuses, })} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_tag_badge_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rule_tag_badge_sandbox.tsx similarity index 71% rename from x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_tag_badge_sandbox.tsx rename to x-pack/examples/triggers_actions_ui_example/public/components/rule_tag_badge_sandbox.tsx index 097fb00969d2..378a7478f762 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_tag_badge_sandbox.tsx +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rule_tag_badge_sandbox.tsx @@ -12,16 +12,20 @@ */ import React, { useState } from 'react'; -import { getRuleTagBadgeLazy } from '../../../common/get_rule_tag_badge'; +import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; + +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} const tags = ['tag1', 'tag2', 'tag3', 'tag4']; -export const RuleTagBadgeSandbox = () => { +export const RuleTagBadgeSandbox = ({ triggersActionsUi }: SandboxProps) => { const [isOpen, setIsOpen] = useState(false); return (
- {getRuleTagBadgeLazy({ + {triggersActionsUi.getRuleTagBadge({ isOpen, tags, onClick: () => setIsOpen(true), diff --git a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_tag_filter_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rule_tag_filter_sandbox.tsx similarity index 68% rename from x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_tag_filter_sandbox.tsx rename to x-pack/examples/triggers_actions_ui_example/public/components/rule_tag_filter_sandbox.tsx index 58603fdb8f17..4601333db643 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rule_tag_filter_sandbox.tsx +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rule_tag_filter_sandbox.tsx @@ -6,14 +6,18 @@ */ import React, { useState } from 'react'; import { EuiSpacer } from '@elastic/eui'; -import { getRuleTagFilterLazy } from '../../../common/get_rule_tag_filter'; +import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; -export const RuleTagFilterSandbox = () => { +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} + +export const RuleTagFilterSandbox = ({ triggersActionsUi }: SandboxProps) => { const [selectedTags, setSelectedTags] = useState([]); return (
- {getRuleTagFilterLazy({ + {triggersActionsUi.getRuleTagFilter({ tags: ['tag1', 'tag2', 'tag3', 'tag4'], selectedTags, onChange: setSelectedTags, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rules_list_notify_badge_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rules_list_notify_badge_sandbox.tsx similarity index 82% rename from x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rules_list_notify_badge_sandbox.tsx rename to x-pack/examples/triggers_actions_ui_example/public/components/rules_list_notify_badge_sandbox.tsx index ab28366aa8b4..86f929853dc8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/internal/shareable_components_sandbox/rules_list_notify_badge_sandbox.tsx +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rules_list_notify_badge_sandbox.tsx @@ -6,8 +6,14 @@ */ import React, { useState } from 'react'; -import { RuleTableItem } from '../../../types'; -import { getRulesListNotifyBadgeLazy } from '../../../common/get_rules_list_notify_badge'; +import { + TriggersAndActionsUIPublicPluginStart, + RuleTableItem, +} from '@kbn/triggers-actions-ui-plugin/public'; + +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} const mockRule: RuleTableItem = { id: '1', @@ -41,13 +47,13 @@ const mockRule: RuleTableItem = { enabledInLicense: true, }; -export const RulesListNotifyBadgeSandbox = () => { +export const RulesListNotifyBadgeSandbox = ({ triggersActionsUi }: SandboxProps) => { const [isOpen, setIsOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); return (
- {getRulesListNotifyBadgeLazy({ + {triggersActionsUi.getRulesListNotifyBadge({ rule: mockRule, isOpen, isLoading, diff --git a/x-pack/examples/triggers_actions_ui_example/public/components/rules_list_sandbox.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/rules_list_sandbox.tsx new file mode 100644 index 000000000000..b1d5ee467788 --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/public/components/rules_list_sandbox.tsx @@ -0,0 +1,20 @@ +/* + * 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 React from 'react'; +import { TriggersAndActionsUIPublicPluginStart } from '@kbn/triggers-actions-ui-plugin/public'; + +interface SandboxProps { + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; +} + +const style = { + flex: 1, +}; + +export const RulesListSandbox = ({ triggersActionsUi }: SandboxProps) => { + return
{triggersActionsUi.getRulesList({})}
; +}; diff --git a/x-pack/examples/triggers_actions_ui_example/public/components/sidebar.tsx b/x-pack/examples/triggers_actions_ui_example/public/components/sidebar.tsx new file mode 100644 index 000000000000..908cba88001a --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/public/components/sidebar.tsx @@ -0,0 +1,68 @@ +/* + * 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 React from 'react'; +import { useHistory } from 'react-router-dom'; +import { EuiPageSideBar, EuiSideNav } from '@elastic/eui'; + +export const Sidebar = () => { + const history = useHistory(); + return ( + + history.push('/'), + }, + { + id: 'rules_list', + name: 'Rules List', + onClick: () => history.push(`/rules_list`), + }, + { + id: 'rules_list_notify_badge', + name: 'Rules List Notify Badge', + onClick: () => history.push(`/rules_list_notify_badge`), + }, + { + id: 'rule_tag_badge', + name: 'Rule Tag Badge', + onClick: () => history.push(`/rule_tag_badge`), + }, + { + id: 'rule_tag_filter', + name: 'Rule Tag Filter', + onClick: () => history.push(`/rule_tag_filter`), + }, + { + id: 'rule_event_log_list', + name: 'Run History List', + onClick: () => history.push(`/rule_event_log_list`), + }, + { + id: 'rule_status_dropdown', + name: 'Rule Status Dropdown', + onClick: () => history.push(`/rule_status_dropdown`), + }, + { + id: 'rule_status_filter', + name: 'Rule Status Filter', + onClick: () => history.push(`/rule_status_filter`), + }, + ], + }, + ]} + /> + + ); +}; diff --git a/x-pack/examples/triggers_actions_ui_example/public/index.ts b/x-pack/examples/triggers_actions_ui_example/public/index.ts new file mode 100644 index 000000000000..d7f0620e7a4d --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/public/index.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { TriggersActionsUiExamplePlugin } from './plugin'; + +export const plugin = () => new TriggersActionsUiExamplePlugin(); diff --git a/x-pack/examples/triggers_actions_ui_example/public/plugin.tsx b/x-pack/examples/triggers_actions_ui_example/public/plugin.tsx new file mode 100644 index 000000000000..15bee6d23795 --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/public/plugin.tsx @@ -0,0 +1,59 @@ +/* + * 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 { Plugin, CoreSetup, AppMountParameters, AppNavLinkStatus } from '@kbn/core/public'; +import { PluginSetupContract as AlertingSetup } from '@kbn/alerting-plugin/public'; +import { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public'; + +import { + TriggersAndActionsUIPublicPluginSetup, + TriggersAndActionsUIPublicPluginStart, +} from '@kbn/triggers-actions-ui-plugin/public'; + +export interface TriggersActionsUiExamplePublicSetupDeps { + alerting: AlertingSetup; + triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; + developerExamples: DeveloperExamplesSetup; +} + +export interface TriggersActionsUiExamplePublicStartDeps { + alerting: AlertingSetup; + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; + data: DataPublicPluginStart; +} + +export class TriggersActionsUiExamplePlugin + implements Plugin +{ + public setup( + core: CoreSetup, + setup: TriggersActionsUiExamplePublicSetupDeps + ) { + const { developerExamples } = setup; + + core.application.register({ + id: 'triggersActionsUiExample', + title: 'Triggers Actions UI Example', + navLinkStatus: AppNavLinkStatus.hidden, + async mount(params: AppMountParameters) { + const [coreStart, devStart] = await core.getStartServices(); + const { renderApp } = await import('./application'); + return renderApp(coreStart, devStart, params); + }, + }); + + developerExamples.register({ + appId: 'triggersActionsUiExample', + title: 'Shared Reusable Alerting Components', + description: + 'Sandbox for shared reusable alerting components (triggers actions UI shareable components)', + }); + } + public start() {} + public stop() {} +} diff --git a/x-pack/examples/triggers_actions_ui_example/tsconfig.json b/x-pack/examples/triggers_actions_ui_example/tsconfig.json new file mode 100644 index 000000000000..f9a5d7110d7c --- /dev/null +++ b/x-pack/examples/triggers_actions_ui_example/tsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./target/types" + }, + "include": [ + "index.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../../typings/**/*", + ], + "exclude": [], + "references": [ + { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, + { "path": "../../plugins/alerting/tsconfig.json" }, + { "path": "../../plugins/triggers_actions_ui/tsconfig.json" }, + { "path": "../../../examples/developer_examples/tsconfig.json" }, + ] +} diff --git a/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts b/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts index 3265469bea64..8c7e5a500bf0 100644 --- a/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts +++ b/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts @@ -14,7 +14,6 @@ export type ExperimentalFeatures = typeof allowedExperimentalValues; export const allowedExperimentalValues = Object.freeze({ rulesListDatagrid: true, internalAlertsTable: false, - internalShareableComponentsSandbox: false, ruleTagFilter: true, ruleStatusFilter: true, rulesDetailLogs: true, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx index e63999edf31a..770a939620b9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/app.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/app.tsx @@ -73,7 +73,7 @@ export const renderApp = (deps: TriggersAndActionsUiServices) => { export const App = ({ deps }: { deps: TriggersAndActionsUiServices }) => { const { dataViews, uiSettings, theme$ } = deps; - const sections: Section[] = ['rules', 'connectors', 'alerts', '__components_sandbox']; + const sections: Section[] = ['rules', 'connectors', 'alerts']; const isDarkMode = useObservable(uiSettings.get$('theme:darkMode')); const sectionsRegex = sections.join('|'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts b/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts index a416eb18b5a5..a65aac10d756 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts @@ -13,14 +13,13 @@ export { } from '@kbn/alerting-plugin/common'; export { BASE_ACTION_API_PATH, INTERNAL_BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common'; -export type Section = 'connectors' | 'rules' | 'alerts' | '__components_sandbox'; +export type Section = 'connectors' | 'rules' | 'alerts'; export const routeToHome = `/`; export const routeToConnectors = `/connectors`; export const routeToRules = `/rules`; export const routeToRuleDetails = `/rule/:ruleId`; export const routeToInternalAlerts = `/alerts`; -export const routeToInternalShareableComponentsSandbox = '/__components_sandbox'; export const legacyRouteToRules = `/alerts`; export const legacyRouteToRuleDetails = `/alert/:alertId`; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/home.tsx b/x-pack/plugins/triggers_actions_ui/public/application/home.tsx index 802e3178b155..9110ebe1f51c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/home.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/home.tsx @@ -11,13 +11,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { EuiSpacer, EuiButtonEmpty, EuiPageHeader } from '@elastic/eui'; import { getIsExperimentalFeatureEnabled } from '../common/get_experimental_features'; -import { - Section, - routeToConnectors, - routeToRules, - routeToInternalAlerts, - routeToInternalShareableComponentsSandbox, -} from './constants'; +import { Section, routeToConnectors, routeToRules, routeToInternalAlerts } from './constants'; import { getAlertingSectionBreadcrumb } from './lib/breadcrumb'; import { getCurrentDocTitle } from './lib/doc_title'; import { hasShowActionsCapability } from './lib/capabilities'; @@ -32,9 +26,6 @@ const ActionsConnectorsList = lazy( ); const RulesList = lazy(() => import('./sections/rules_list/components/rules_list')); const AlertsPage = lazy(() => import('./sections/alerts_table/alerts_page')); -const InternalShareableComponentsSandbox = lazy( - () => import('./internal/shareable_components_sandbox/shareable_components_sandbox') -); export interface MatchParams { section: Section; @@ -54,9 +45,6 @@ export const TriggersActionsUIHome: React.FunctionComponent - {isInternalShareableComponentsSandboxEnabled && ( - - )} {isInternalAlertsTableEnabled ? ( = () => { - return ( - <> - - - - - - - - - ); -}; - -// eslint-disable-next-line import/no-default-export -export { InternalShareableComponentsSandbox as default }; diff --git a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx index a59a25c62a8e..18e2f240dac2 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx @@ -20,7 +20,6 @@ describe('getIsExperimentalFeatureEnabled', () => { rulesDetailLogs: true, ruleTagFilter: true, ruleStatusFilter: true, - internalShareableComponentsSandbox: true, }, }); @@ -36,10 +35,6 @@ describe('getIsExperimentalFeatureEnabled', () => { expect(result).toEqual(true); - result = getIsExperimentalFeatureEnabled('internalShareableComponentsSandbox'); - - expect(result).toEqual(true); - result = getIsExperimentalFeatureEnabled('ruleTagFilter'); expect(result).toEqual(true); diff --git a/x-pack/plugins/triggers_actions_ui/public/index.ts b/x-pack/plugins/triggers_actions_ui/public/index.ts index 47a0d7b98167..ae5cf94b0a0d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/index.ts @@ -16,7 +16,9 @@ export type { Rule, RuleType, RuleTypeModel, + RuleStatusFilterProps, RuleStatus, + RuleTableItem, ActionType, ActionTypeRegistryContract, RuleTypeRegistryContract, diff --git a/x-pack/test/examples/config.ts b/x-pack/test/examples/config.ts index fe01c4ecf0e4..3f6c1c920aca 100644 --- a/x-pack/test/examples/config.ts +++ b/x-pack/test/examples/config.ts @@ -39,6 +39,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('./embedded_lens'), require.resolve('./reporting_examples'), require.resolve('./screenshotting'), + require.resolve('./triggers_actions_ui_examples'), ], kbnTestServer: { diff --git a/x-pack/test/examples/triggers_actions_ui_examples/index.ts b/x-pack/test/examples/triggers_actions_ui_examples/index.ts new file mode 100644 index 000000000000..299b9c06c715 --- /dev/null +++ b/x-pack/test/examples/triggers_actions_ui_examples/index.ts @@ -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 '../../../../test/functional/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default ({ loadTestFile, getService }: FtrProviderContext) => { + describe('Triggers Actions UI Example', function () { + loadTestFile(require.resolve('./rule_status_dropdown')); + loadTestFile(require.resolve('./rule_tag_filter')); + loadTestFile(require.resolve('./rule_status_filter')); + loadTestFile(require.resolve('./rule_tag_badge')); + loadTestFile(require.resolve('./rule_event_log_list')); + loadTestFile(require.resolve('./rules_list')); + }); +}; diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_event_log_list.ts b/x-pack/test/examples/triggers_actions_ui_examples/rule_event_log_list.ts similarity index 77% rename from x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_event_log_list.ts rename to x-pack/test/examples/triggers_actions_ui_examples/rule_event_log_list.ts index 003e7c24545f..2a2832e21aa7 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_event_log_list.ts +++ b/x-pack/test/examples/triggers_actions_ui_examples/rule_event_log_list.ts @@ -6,20 +6,18 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../../test/functional/ftr_provider_context'; +// eslint-disable-next-line import/no-default-export export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'triggersActionsUI', 'header']); + const PageObjects = getPageObjects(['common']); const esArchiver = getService('esArchiver'); describe('Rule event log list', function () { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); - await PageObjects.common.navigateToUrlWithBrowserHistory( - 'triggersActions', - '/__components_sandbox' - ); + await PageObjects.common.navigateToApp('triggersActionsUiExample/rule_event_log_list'); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_status_dropdown.ts b/x-pack/test/examples/triggers_actions_ui_examples/rule_status_dropdown.ts similarity index 84% rename from x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_status_dropdown.ts rename to x-pack/test/examples/triggers_actions_ui_examples/rule_status_dropdown.ts index b594d88a2568..9cbf5556260e 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_status_dropdown.ts +++ b/x-pack/test/examples/triggers_actions_ui_examples/rule_status_dropdown.ts @@ -6,22 +6,18 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../../test/functional/ftr_provider_context'; +// eslint-disable-next-line import/no-default-export export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'triggersActionsUI', 'header']); - // const retry = getService('retry'); + const PageObjects = getPageObjects(['common']); const esArchiver = getService('esArchiver'); - // const find = getService('find'); describe('Rule status dropdown', function () { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); - await PageObjects.common.navigateToUrlWithBrowserHistory( - 'triggersActions', - '/__components_sandbox' - ); + await PageObjects.common.navigateToApp('triggersActionsUiExample/rule_status_dropdown'); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_status_filter.ts b/x-pack/test/examples/triggers_actions_ui_examples/rule_status_filter.ts similarity index 82% rename from x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_status_filter.ts rename to x-pack/test/examples/triggers_actions_ui_examples/rule_status_filter.ts index 591aee70f375..9129dcf2e857 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_status_filter.ts +++ b/x-pack/test/examples/triggers_actions_ui_examples/rule_status_filter.ts @@ -6,21 +6,18 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../../test/functional/ftr_provider_context'; +// eslint-disable-next-line import/no-default-export export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'triggersActionsUI', 'header']); + const PageObjects = getPageObjects(['common']); const esArchiver = getService('esArchiver'); - // FLAKY: https://github.com/elastic/kibana/issues/132736 - describe.skip('Rule status filter', () => { + describe('Rule status filter', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); - await PageObjects.common.navigateToUrlWithBrowserHistory( - 'triggersActions', - '/__components_sandbox' - ); + await PageObjects.common.navigateToApp('triggersActionsUiExample/rule_status_filter'); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_tag_badge.ts b/x-pack/test/examples/triggers_actions_ui_examples/rule_tag_badge.ts similarity index 77% rename from x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_tag_badge.ts rename to x-pack/test/examples/triggers_actions_ui_examples/rule_tag_badge.ts index a5fd0aaef412..81fef57bcca6 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_tag_badge.ts +++ b/x-pack/test/examples/triggers_actions_ui_examples/rule_tag_badge.ts @@ -6,21 +6,18 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../../test/functional/ftr_provider_context'; +// eslint-disable-next-line import/no-default-export export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'triggersActionsUI', 'header']); + const PageObjects = getPageObjects(['common']); const esArchiver = getService('esArchiver'); - // Failing: See https://github.com/elastic/kibana/issues/132739 - describe.skip('Rule tag badge', () => { + describe('Rule tag badge', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); - await PageObjects.common.navigateToUrlWithBrowserHistory( - 'triggersActions', - '/__components_sandbox' - ); + await PageObjects.common.navigateToApp('triggersActionsUiExample/rule_tag_badge'); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_tag_filter.ts b/x-pack/test/examples/triggers_actions_ui_examples/rule_tag_filter.ts similarity index 77% rename from x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_tag_filter.ts rename to x-pack/test/examples/triggers_actions_ui_examples/rule_tag_filter.ts index 15ea8fc30262..0deac0165310 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rule_tag_filter.ts +++ b/x-pack/test/examples/triggers_actions_ui_examples/rule_tag_filter.ts @@ -6,20 +6,18 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../../test/functional/ftr_provider_context'; +// eslint-disable-next-line import/no-default-export export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'triggersActionsUI', 'header']); + const PageObjects = getPageObjects(['common']); const esArchiver = getService('esArchiver'); describe('Rule tag filter', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); - await PageObjects.common.navigateToUrlWithBrowserHistory( - 'triggersActions', - '/__components_sandbox' - ); + await PageObjects.common.navigateToApp('triggersActionsUiExample/rule_tag_filter'); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list.ts b/x-pack/test/examples/triggers_actions_ui_examples/rules_list.ts similarity index 77% rename from x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list.ts rename to x-pack/test/examples/triggers_actions_ui_examples/rules_list.ts index 30baba0caaa0..e9952892174d 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list.ts +++ b/x-pack/test/examples/triggers_actions_ui_examples/rules_list.ts @@ -6,20 +6,18 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import { FtrProviderContext } from '../../../../test/functional/ftr_provider_context'; +// eslint-disable-next-line import/no-default-export export default ({ getPageObjects, getService }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['common', 'triggersActionsUI', 'header']); + const PageObjects = getPageObjects(['common']); const esArchiver = getService('esArchiver'); describe('Rules list', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts'); - await PageObjects.common.navigateToUrlWithBrowserHistory( - 'triggersActions', - '/__components_sandbox' - ); + await PageObjects.common.navigateToApp('triggersActionsUiExample/rules_list'); }); after(async () => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/index.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/index.ts index 832cf6c7a907..33e6c239d322 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/index.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/index.ts @@ -15,11 +15,5 @@ export default ({ loadTestFile, getService }: FtrProviderContext) => { loadTestFile(require.resolve('./details')); loadTestFile(require.resolve('./connectors')); loadTestFile(require.resolve('./alerts_table')); - loadTestFile(require.resolve('./rule_status_dropdown')); - loadTestFile(require.resolve('./rule_tag_filter')); - loadTestFile(require.resolve('./rule_status_filter')); - loadTestFile(require.resolve('./rule_tag_badge')); - loadTestFile(require.resolve('./rule_event_log_list')); - loadTestFile(require.resolve('./rules_list')); }); }; diff --git a/x-pack/test/functional_with_es_ssl/config.ts b/x-pack/test/functional_with_es_ssl/config.ts index 4ff76dbed91e..1d7e93593161 100644 --- a/x-pack/test/functional_with_es_ssl/config.ts +++ b/x-pack/test/functional_with_es_ssl/config.ts @@ -76,7 +76,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { `--plugin-path=${join(__dirname, 'fixtures', 'plugins', 'cases')}`, `--xpack.trigger_actions_ui.enableExperimental=${JSON.stringify([ 'internalAlertsTable', - 'internalShareableComponentsSandbox', 'ruleTagFilter', 'ruleStatusFilter', ])}`,