Skip to content

Commit 0c7f525

Browse files
committed
[Vega] remove VEGA_DEBUG (elastic#234477)
This commit removes the VEGA_DEBUG variable from window object. (cherry picked from commit 03f47de)
1 parent 6881932 commit 0c7f525

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

src/platform/plugins/private/vis_types/vega/public/vega_view/vega_base_view.js

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
import moment from 'moment';
1111
import dateMath from '@kbn/datemath';
12-
import { loader, logger, Warn, version as vegaVersion, expressionFunction } from 'vega';
12+
import { loader, logger, Warn, expressionFunction } from 'vega';
1313
import { expressionInterpreter } from 'vega-interpreter';
14-
import { version as vegaLiteVersion } from 'vega-lite';
1514
import { Utils } from '../data_model/utils';
1615
import { i18n } from '@kbn/i18n';
1716
import { buildQueryFilter, compareFilters } from '@kbn/es-query';
@@ -494,33 +493,6 @@ export class VegaBaseView {
494493
view,
495494
spec: vlspec || spec,
496495
});
497-
498-
if (window) {
499-
if (window.VEGA_DEBUG === undefined && console) {
500-
console.log('%cWelcome to Kibana Vega Plugin!', 'font-size: 16px; font-weight: bold;');
501-
console.log(
502-
'You can access the Vega view with VEGA_DEBUG. ' +
503-
'Learn more at https://vega.github.io/vega/docs/api/debugging/.'
504-
);
505-
}
506-
const debugObj = {};
507-
window.VEGA_DEBUG = debugObj;
508-
window.VEGA_DEBUG.VEGA_VERSION = vegaVersion;
509-
window.VEGA_DEBUG.VEGA_LITE_VERSION = vegaLiteVersion;
510-
window.VEGA_DEBUG.view = view;
511-
window.VEGA_DEBUG.vega_spec = spec;
512-
window.VEGA_DEBUG.vegalite_spec = vlspec;
513-
514-
// On dispose, clean up, but don't use undefined to prevent repeated debug statements
515-
this._addDestroyHandler(() => {
516-
if (debugObj === window.VEGA_DEBUG) {
517-
window.VEGA_DEBUG.view = null;
518-
window.VEGA_DEBUG.vega_spec = null;
519-
window.VEGA_DEBUG.vegalite_spec = null;
520-
window.VEGA_DEBUG = null;
521-
}
522-
});
523-
}
524496
}
525497

526498
destroy() {

src/platform/plugins/private/vis_types/vega/public/vega_visualization.test.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ describe('VegaVisualizations', () => {
8383
});
8484

8585
test('should show vegalite graph and update on resize (may fail in dev env)', async () => {
86-
const mockedConsoleLog = jest.spyOn(console, 'log'); // mocked console.log to avoid messages in the console when running tests
87-
mockedConsoleLog.mockImplementation(() => {}); // comment this line when console logging for debugging comment this line
88-
8986
let vegaVis: InstanceType<VegaVisType>;
9087
try {
9188
vegaVis = new VegaVisualization(domNode, jest.fn());
@@ -116,9 +113,6 @@ describe('VegaVisualizations', () => {
116113
} finally {
117114
vegaVis.destroy();
118115
}
119-
// eslint-disable-next-line no-console
120-
expect(console.log).toBeCalledTimes(2);
121-
mockedConsoleLog.mockRestore();
122116
});
123117

124118
test('should show vega graph (may fail in dev env)', async () => {

0 commit comments

Comments
 (0)