Skip to content

Commit 34a8183

Browse files
markov00CAWilson94
authored andcommitted
[Vega] remove VEGA_DEBUG (elastic#234477)
This commit removes the VEGA_DEBUG variable from window object.
1 parent 6a49b55 commit 34a8183

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';
@@ -499,33 +498,6 @@ export class VegaBaseView {
499498
view,
500499
spec: vlspec || spec,
501500
});
502-
503-
if (window) {
504-
if (window.VEGA_DEBUG === undefined && console) {
505-
console.log('%cWelcome to Kibana Vega Plugin!', 'font-size: 16px; font-weight: bold;');
506-
console.log(
507-
'You can access the Vega view with VEGA_DEBUG. ' +
508-
'Learn more at https://vega.github.io/vega/docs/api/debugging/.'
509-
);
510-
}
511-
const debugObj = {};
512-
window.VEGA_DEBUG = debugObj;
513-
window.VEGA_DEBUG.VEGA_VERSION = vegaVersion;
514-
window.VEGA_DEBUG.VEGA_LITE_VERSION = vegaLiteVersion;
515-
window.VEGA_DEBUG.view = view;
516-
window.VEGA_DEBUG.vega_spec = spec;
517-
window.VEGA_DEBUG.vegalite_spec = vlspec;
518-
519-
// On dispose, clean up, but don't use undefined to prevent repeated debug statements
520-
this._addDestroyHandler(() => {
521-
if (debugObj === window.VEGA_DEBUG) {
522-
window.VEGA_DEBUG.view = null;
523-
window.VEGA_DEBUG.vega_spec = null;
524-
window.VEGA_DEBUG.vegalite_spec = null;
525-
window.VEGA_DEBUG = null;
526-
}
527-
});
528-
}
529501
}
530502

531503
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
@@ -84,9 +84,6 @@ describe('VegaVisualizations', () => {
8484
});
8585

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

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

0 commit comments

Comments
 (0)