Skip to content

Commit

Permalink
Enable ML embeddables in Canvas
Browse files Browse the repository at this point in the history
Fixed conditional

Restore ml embeddable options
  • Loading branch information
cqliu1 committed Oct 14, 2021
1 parent 1ec23f6 commit c1fd1d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ export const EditorMenu: FC<Props> = ({ addElement }) => {
const factories = embeddablesService
? Array.from(embeddablesService.getEmbeddableFactories()).filter(
({ type, isEditable, canCreateNew, isContainerType }) =>
isEditable() &&
!isContainerType &&
canCreateNew() &&
!['visualization', 'ml'].some((factoryType) => {
return type.includes(factoryType);
})
isEditable() && !isContainerType && canCreateNew() && type !== 'visualization'
)
: [];

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { PluginInitializerContext } from 'kibana/public';
import { CoreStart } from '../../../../src/core/public';
import { CanvasServices } from './services';
import { CanvasSetup, CanvasStart, CanvasStartDeps, CanvasPlugin } from './plugin';
export { CANVAS_APP } from '../common/lib/constants';

export { CanvasSetup, CanvasStart };

export interface WithKibanaProps {
kibana: {
services: CoreStart & CanvasStartDeps & { canvas: CanvasServices };
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"server": true,
"ui": true,
"requiredBundles": [
"canvas",
"esUiShared",
"kibanaUtils",
"kibanaReact",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '../../../../../../src/plugins/kibana_react/public';
import { getMlGlobalServices } from '../../application/app';
import { DashboardConstants } from '../../../../../../src/plugins/dashboard/public';
import { CANVAS_APP } from '../../../../../../x-pack/plugins/canvas/public';
import { JobId } from '../../../common/types/anomaly_detection_jobs';
import { JobSelectorFlyout } from './components/job_selector_flyout';

Expand Down Expand Up @@ -90,8 +91,8 @@ export async function resolveJobSelection(
}
); // Close the flyout when user navigates out of the dashboard plugin

currentAppId$.pipe(takeUntil(from(flyoutSession.onClose))).subscribe((appId) => {
if (appId !== DashboardConstants.DASHBOARDS_ID) {
currentAppId$.pipe(takeUntil(from(flyoutSession.onClose))).subscribe((appId = '') => {
if (![DashboardConstants.DASHBOARDS_ID, CANVAS_APP].includes(appId)) {
flyoutSession.close();
}
});
Expand Down

0 comments on commit c1fd1d7

Please sign in to comment.