From f260466c2ffd5357ac69234d31e505f54514d211 Mon Sep 17 00:00:00 2001 From: sainthkh Date: Thu, 26 Sep 2019 00:18:28 +0900 Subject: [PATCH] =?UTF-8?q?ui/render=5Fcomplete=20=F0=9F=91=89=20src/plugi?= =?UTF-8?q?ns/kibana=5Futils=20(#44743)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Moved ui/render_complete to kibana_utils. --- .../kibana/public/discover/directives/index.js | 2 ++ .../discover/doc_table/components/table_row.js | 2 +- .../kibana/public/discover/doc_table/doc_table.js | 2 +- src/legacy/ui/public/render_complete/directive.js | 2 +- src/legacy/ui/public/vis/vis.js | 1 + src/legacy/ui/public/vislib/lib/handler.js | 2 +- .../visualize/components/visualization_chart.tsx | 5 ++++- .../visualize/components/visualization_noresults.tsx | 2 +- .../components/visualization_requesterror.tsx | 2 +- .../visualize/loader/__tests__/visualize_loader.js | 12 ++++++------ .../visualize/loader/embedded_visualize_handler.ts | 2 +- src/plugins/kibana_utils/public/index.ts | 1 + .../kibana_utils}/public/render_complete/index.ts | 2 -- .../public/render_complete/render_complete_helper.ts | 0 14 files changed, 21 insertions(+), 16 deletions(-) rename src/{legacy/ui => plugins/kibana_utils}/public/render_complete/index.ts (98%) rename src/{legacy/ui => plugins/kibana_utils}/public/render_complete/render_complete_helper.ts (100%) diff --git a/src/legacy/core_plugins/kibana/public/discover/directives/index.js b/src/legacy/core_plugins/kibana/public/discover/directives/index.js index a6f0ead4f7365..dc834c02759e0 100644 --- a/src/legacy/core_plugins/kibana/public/discover/directives/index.js +++ b/src/legacy/core_plugins/kibana/public/discover/directives/index.js @@ -20,6 +20,8 @@ import 'ngreact'; import { wrapInI18nContext } from 'ui/i18n'; import { uiModules } from 'ui/modules'; +import '../../../../../ui/public/render_complete/directive'; + import { DiscoverNoResults } from './no_results'; import { DiscoverUninitialized } from './uninitialized'; import { DiscoverUnsupportedIndexPattern } from './unsupported_index_pattern'; diff --git a/src/legacy/core_plugins/kibana/public/discover/doc_table/components/table_row.js b/src/legacy/core_plugins/kibana/public/discover/doc_table/components/table_row.js index 1801c26eb8baf..19eec6c2fbc0a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/doc_table/components/table_row.js +++ b/src/legacy/core_plugins/kibana/public/discover/doc_table/components/table_row.js @@ -26,7 +26,7 @@ import openRowHtml from './table_row/open.html'; import detailsHtml from './table_row/details.html'; import { uiModules } from 'ui/modules'; import { disableFilter } from '@kbn/es-query'; -import { dispatchRenderComplete } from 'ui/render_complete'; +import { dispatchRenderComplete } from '../../../../../../../plugins/kibana_utils/public'; import cellTemplateHtml from '../components/table_row/cell.html'; import truncateByHeightTemplateHtml from '../components/table_row/truncate_by_height.html'; diff --git a/src/legacy/core_plugins/kibana/public/discover/doc_table/doc_table.js b/src/legacy/core_plugins/kibana/public/discover/doc_table/doc_table.js index c639ee8d80938..7f0046dbe0614 100644 --- a/src/legacy/core_plugins/kibana/public/discover/doc_table/doc_table.js +++ b/src/legacy/core_plugins/kibana/public/discover/doc_table/doc_table.js @@ -22,7 +22,7 @@ import html from './doc_table.html'; import './infinite_scroll'; import './components/table_header'; import './components/table_row'; -import { dispatchRenderComplete } from 'ui/render_complete'; +import { dispatchRenderComplete } from '../../../../../../plugins/kibana_utils/public'; import { uiModules } from 'ui/modules'; import './components/pager'; import './lib/pager'; diff --git a/src/legacy/ui/public/render_complete/directive.js b/src/legacy/ui/public/render_complete/directive.js index 34ccd40b1acd5..6bde2293898b6 100644 --- a/src/legacy/ui/public/render_complete/directive.js +++ b/src/legacy/ui/public/render_complete/directive.js @@ -18,7 +18,7 @@ */ import { uiModules } from '../modules'; -import { RenderCompleteHelper } from './render_complete_helper'; +import { RenderCompleteHelper } from '../../../../plugins/kibana_utils/public'; uiModules .get('kibana') diff --git a/src/legacy/ui/public/vis/vis.js b/src/legacy/ui/public/vis/vis.js index d137e136ebc29..c12c639a3e826 100644 --- a/src/legacy/ui/public/vis/vis.js +++ b/src/legacy/ui/public/vis/vis.js @@ -29,6 +29,7 @@ import { EventEmitter } from 'events'; import _ from 'lodash'; +import '../render_complete/directive'; import { VisTypesRegistryProvider } from '../registry/vis_types'; import { AggConfigs } from '../agg_types/agg_configs'; import { PersistedState } from '../persisted_state'; diff --git a/src/legacy/ui/public/vislib/lib/handler.js b/src/legacy/ui/public/vislib/lib/handler.js index 5c95113530904..0428076d8b18d 100644 --- a/src/legacy/ui/public/vislib/lib/handler.js +++ b/src/legacy/ui/public/vislib/lib/handler.js @@ -28,7 +28,7 @@ import { Alerts } from './alerts'; import { Axis } from './axis/axis'; import { ChartGrid as Grid } from './chart_grid'; import { visTypes as chartTypes } from '../visualizations/vis_types'; -import { dispatchRenderComplete } from '../../render_complete'; +import { dispatchRenderComplete } from '../../../../../plugins/kibana_utils/public'; const markdownIt = new MarkdownIt({ html: false, diff --git a/src/legacy/ui/public/visualize/components/visualization_chart.tsx b/src/legacy/ui/public/visualize/components/visualization_chart.tsx index ec6d66eb51e85..452a80863b796 100644 --- a/src/legacy/ui/public/visualize/components/visualization_chart.tsx +++ b/src/legacy/ui/public/visualize/components/visualization_chart.tsx @@ -22,7 +22,10 @@ import * as Rx from 'rxjs'; import { debounceTime, filter, share, switchMap, tap } from 'rxjs/operators'; import { PersistedState } from '../../persisted_state'; -import { dispatchRenderComplete, dispatchRenderStart } from '../../render_complete'; +import { + dispatchRenderComplete, + dispatchRenderStart, +} from '../../../../../plugins/kibana_utils/public'; import { ResizeChecker } from '../../resize_checker'; import { Vis, VisualizationController } from '../../vis'; import { getUpdateStatus } from '../../vis/update_status'; diff --git a/src/legacy/ui/public/visualize/components/visualization_noresults.tsx b/src/legacy/ui/public/visualize/components/visualization_noresults.tsx index eb0350ebe2c2f..8ba3f66ec4d86 100644 --- a/src/legacy/ui/public/visualize/components/visualization_noresults.tsx +++ b/src/legacy/ui/public/visualize/components/visualization_noresults.tsx @@ -19,7 +19,7 @@ import { EuiIcon, EuiSpacer, EuiText } from '@elastic/eui'; import React from 'react'; -import { dispatchRenderComplete } from '../../render_complete'; +import { dispatchRenderComplete } from '../../../../../plugins/kibana_utils/public'; interface VisualizationNoResultsProps { onInit?: () => void; diff --git a/src/legacy/ui/public/visualize/components/visualization_requesterror.tsx b/src/legacy/ui/public/visualize/components/visualization_requesterror.tsx index 51c117fab71ee..ebbe886b3650b 100644 --- a/src/legacy/ui/public/visualize/components/visualization_requesterror.tsx +++ b/src/legacy/ui/public/visualize/components/visualization_requesterror.tsx @@ -20,7 +20,7 @@ import { EuiIcon, EuiSpacer, EuiText } from '@elastic/eui'; import React from 'react'; import { SearchError } from 'ui/courier'; -import { dispatchRenderComplete } from '../../render_complete'; +import { dispatchRenderComplete } from '../../../../../plugins/kibana_utils/public'; interface VisualizationRequestErrorProps { onInit?: () => void; diff --git a/src/legacy/ui/public/visualize/loader/__tests__/visualize_loader.js b/src/legacy/ui/public/visualize/loader/__tests__/visualize_loader.js index 39785fe29c2a3..3fff184ffd199 100644 --- a/src/legacy/ui/public/visualize/loader/__tests__/visualize_loader.js +++ b/src/legacy/ui/public/visualize/loader/__tests__/visualize_loader.js @@ -32,7 +32,7 @@ import { VisProvider } from '../../../vis'; import { getVisualizeLoader } from '../visualize_loader'; import { EmbeddedVisualizeHandler } from '../embedded_visualize_handler'; import { Inspector } from '../../../inspector/inspector'; -import { dispatchRenderComplete } from '../../../render_complete'; +import { dispatchRenderComplete } from '../../../../../../plugins/kibana_utils/public'; import { PipelineDataLoader } from '../pipeline_data_loader'; import { PersistedState } from '../../../persisted_state'; import { DataAdapter, RequestAdapter } from '../../../inspector/adapters'; @@ -154,7 +154,7 @@ describe('visualize loader', () => { it('should render the visualize element', () => { const container = newContainer(); - loader.embedVisualizationWithSavedObject(container[0], createSavedObject(), { }); + loader.embedVisualizationWithSavedObject(container[0], createSavedObject(), {}); expect(container.find('[data-test-subj="visualizationLoader"]').length).to.be(1); }); @@ -162,7 +162,7 @@ describe('visualize loader', () => { const container = newContainer(); const savedObject = createSavedObject(); const paramsBefore = cloneDeep(vis.params); - loader.embedVisualizationWithSavedObject(container[0], savedObject, { }); + loader.embedVisualizationWithSavedObject(container[0], savedObject, {}); const paramsAfter = cloneDeep(vis.params); expect(paramsBefore).to.eql(paramsAfter); }); @@ -332,8 +332,8 @@ describe('visualize loader', () => { }); it('should allow adding custom inspector adapters via the custom key', () => { - const Foodapter = class {}; - const Bardapter = class {}; + const Foodapter = class { }; + const Bardapter = class { }; const savedObj = createSavedObject(); savedObj.vis.type.inspectorAdapters = { custom: { foo: Foodapter, bar: Bardapter } @@ -344,7 +344,7 @@ describe('visualize loader', () => { }); it('should not share adapter instances between vis instances', () => { - const Foodapter = class {}; + const Foodapter = class { }; const savedObj1 = createSavedObject(); const savedObj2 = createSavedObject(); savedObj1.vis.type.inspectorAdapters = { custom: { foo: Foodapter } }; diff --git a/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts b/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts index 8253ca86cca1c..119ec8a004239 100644 --- a/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts +++ b/src/legacy/ui/public/visualize/loader/embedded_visualize_handler.ts @@ -34,7 +34,7 @@ import { Inspector } from '../../inspector'; import { Adapters } from '../../inspector/types'; import { PersistedState } from '../../persisted_state'; import { IPrivate } from '../../private'; -import { RenderCompleteHelper } from '../../render_complete'; +import { RenderCompleteHelper } from '../../../../../plugins/kibana_utils/public'; import { AppState } from '../../state_management/app_state'; import { timefilter } from '../../timefilter'; import { Vis } from '../../vis'; diff --git a/src/plugins/kibana_utils/public/index.ts b/src/plugins/kibana_utils/public/index.ts index 96b5e7a03ffa0..ab609583f84ee 100644 --- a/src/plugins/kibana_utils/public/index.ts +++ b/src/plugins/kibana_utils/public/index.ts @@ -19,4 +19,5 @@ export * from './store'; export * from './parse'; +export * from './render_complete'; export * from './errors'; diff --git a/src/legacy/ui/public/render_complete/index.ts b/src/plugins/kibana_utils/public/render_complete/index.ts similarity index 98% rename from src/legacy/ui/public/render_complete/index.ts rename to src/plugins/kibana_utils/public/render_complete/index.ts index ea587e4f6abc8..ec86144f65a35 100644 --- a/src/legacy/ui/public/render_complete/index.ts +++ b/src/plugins/kibana_utils/public/render_complete/index.ts @@ -17,8 +17,6 @@ * under the License. */ -import './directive'; - const dispatchCustomEvent = (el: HTMLElement, eventName: string) => { // we're using the native events so that we aren't tied to the jQuery custom events, // otherwise we have to use jQuery(element).on(...) because jQuery's events sit on top diff --git a/src/legacy/ui/public/render_complete/render_complete_helper.ts b/src/plugins/kibana_utils/public/render_complete/render_complete_helper.ts similarity index 100% rename from src/legacy/ui/public/render_complete/render_complete_helper.ts rename to src/plugins/kibana_utils/public/render_complete/render_complete_helper.ts