Skip to content

Commit a960dae

Browse files
maryia-lapataelasticmachinespalger
authored
[NP] Vega migration (#63849) (#64426)
* Vega migartion * Move mocha tests to legacy * Fix TS * Update .i18nrc.json * Move mocks to vis_type_vega * Fix issue with babel and vega deps * Update mocha test * Mock services * Update vega_request_handler.ts * don't parse vega-lib/build/vega.js Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: spalger <spalger@users.noreply.github.com>
1 parent 8bad56c commit a960dae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+72
-194
lines changed

.i18nrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"visTypeTable": "src/plugins/vis_type_table",
5252
"visTypeTagCloud": "src/plugins/vis_type_tagcloud",
5353
"visTypeTimeseries": ["src/legacy/core_plugins/vis_type_timeseries", "src/plugins/vis_type_timeseries"],
54-
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
54+
"visTypeVega": "src/plugins/vis_type_vega",
5555
"visTypeVislib": "src/legacy/core_plugins/vis_type_vislib",
5656
"visTypeXy": "src/legacy/core_plugins/vis_type_xy",
5757
"visualizations": "src/plugins/visualizations",

packages/kbn-optimizer/src/worker/webpack.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
136136

137137
module: {
138138
// no parse rules for a few known large packages which have no require() statements
139+
// or which have require() statements that should be ignored because the file is
140+
// already bundled with all its necessary depedencies
139141
noParse: [
140142
/[\///]node_modules[\///]elasticsearch-browser[\///]/,
141-
/[\///]node_modules[\///]lodash[\///]index\.js/,
143+
/[\///]node_modules[\///]lodash[\///]index\.js$/,
144+
/[\///]node_modules[\///]vega-lib[\///]build[\///]vega\.js$/,
142145
],
143146

144147
rules: [

src/legacy/core_plugins/vis_type_vega/public/__tests__/vega_visualization.js renamed to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vega/vega_visualization.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import Bluebird from 'bluebird';
2121
import expect from '@kbn/expect';
2222
import ngMock from 'ng_mock';
2323
import $ from 'jquery';
24-
import { createVegaVisualization } from '../vega_visualization';
24+
// Will be replaced with new path when tests are moved
25+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
26+
import { createVegaVisualization } from '../../../../../../plugins/vis_type_vega/public/vega_visualization';
2527
import { ImageComparator } from 'test_utils/image_comparator';
2628

2729
import vegaliteGraph from '!!raw-loader!./vegalite_graph.hjson';
@@ -35,24 +37,34 @@ import vegaTooltipGraph from '!!raw-loader!./vega_tooltip_test.hjson';
3537

3638
import vegaMapGraph from '!!raw-loader!./vega_map_test.hjson';
3739
import vegaMapImage256 from './vega_map_image_256.png';
40+
// Will be replaced with new path when tests are moved
41+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
42+
import { VegaParser } from '../../../../../../plugins/vis_type_vega/public/data_model/vega_parser';
43+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
44+
import { SearchCache } from '../../../../../../plugins/vis_type_vega/public/data_model/search_cache';
3845

39-
import { VegaParser } from '../data_model/vega_parser';
40-
import { SearchCache } from '../data_model/search_cache';
41-
42-
import { createVegaTypeDefinition } from '../vega_type';
46+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
47+
import { createVegaTypeDefinition } from '../../../../../../plugins/vis_type_vega/public/vega_type';
4348
// TODO This is an integration test and thus requires a running platform. When moving to the new platform,
4449
// this test has to be migrated to the newly created integration test environment.
4550
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
4651
import { npStart } from 'ui/new_platform';
4752
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
48-
import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type';
53+
import { BaseVisType } from '../../../../../../plugins/visualizations/public/vis_types/base_vis_type';
4954
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
50-
import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis';
51-
import { setInjectedVars } from '../services';
55+
import { ExprVis } from '../../../../../../plugins/visualizations/public/expressions/vis';
56+
57+
import {
58+
setInjectedVars,
59+
setData,
60+
setSavedObjects,
61+
setNotifications,
62+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
63+
} from '../../../../../../plugins/vis_type_vega/public/services';
5264
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
53-
import { setInjectedVarFunc } from '../../../../../plugins/maps_legacy/public/kibana_services';
65+
import { setInjectedVarFunc } from '../../../../../../plugins/maps_legacy/public/kibana_services';
5466
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
55-
import { ServiceSettings } from '../../../../../plugins/maps_legacy/public/map/service_settings';
67+
import { ServiceSettings } from '../../../../../../plugins/maps_legacy/public/map/service_settings';
5668

5769
const THRESHOLD = 0.1;
5870
const PIXEL_DIFF = 30;
@@ -70,6 +82,9 @@ describe('VegaVisualizations', () => {
7082
enableExternalUrls: true,
7183
esShardTimeout: 10000,
7284
});
85+
setData(npStart.plugins.data);
86+
setSavedObjects(npStart.core.savedObjects);
87+
setNotifications(npStart.core.notifications);
7388

7489
beforeEach(ngMock.module('kibana'));
7590
beforeEach(
@@ -111,9 +126,6 @@ describe('VegaVisualizations', () => {
111126
timefilter: {},
112127
},
113128
},
114-
__LEGACY: {
115-
esClient: npStart.plugins.data.search.__LEGACY.esClient,
116-
},
117129
},
118130
},
119131
};

0 commit comments

Comments
 (0)