Skip to content

Commit 103ceb6

Browse files
committed
[Vega] remove VEGA_DEBUG (elastic#234477)
This commit removes the VEGA_DEBUG variable from window object. (cherry picked from commit 03f47de) # Conflicts: # src/plugins/vis_types/vega/public/vega_view/vega_base_view.js # src/plugins/vis_types/vega/public/vega_visualization.test.js
1 parent 70c8e8d commit 103ceb6

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
import $ from 'jquery';
1010
import moment from 'moment';
1111
import dateMath from '@elastic/datemath';
12-
import { scheme, loader, logger, Warn, version as vegaVersion, expressionFunction } from 'vega';
12+
import { scheme, 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 { euiPaletteColorBlind } from '@elastic/eui';
1716
import { i18n } from '@kbn/i18n';
@@ -467,30 +466,6 @@ export class VegaBaseView {
467466
view,
468467
spec: vlspec || spec,
469468
});
470-
471-
if (window) {
472-
if (window.VEGA_DEBUG === undefined && console) {
473-
console.log('%cWelcome to Kibana Vega Plugin!', 'font-size: 16px; font-weight: bold;');
474-
console.log(
475-
'You can access the Vega view with VEGA_DEBUG. ' +
476-
'Learn more at https://vega.github.io/vega/docs/api/debugging/.'
477-
);
478-
}
479-
const debugObj = {};
480-
window.VEGA_DEBUG = debugObj;
481-
window.VEGA_DEBUG.VEGA_VERSION = vegaVersion;
482-
window.VEGA_DEBUG.VEGA_LITE_VERSION = vegaLiteVersion;
483-
window.VEGA_DEBUG.view = view;
484-
window.VEGA_DEBUG.vega_spec = spec;
485-
window.VEGA_DEBUG.vegalite_spec = vlspec;
486-
487-
// On dispose, clean up, but don't use undefined to prevent repeated debug statements
488-
this._addDestroyHandler(() => {
489-
if (debugObj === window.VEGA_DEBUG) {
490-
window.VEGA_DEBUG = null;
491-
}
492-
});
493-
}
494469
}
495470

496471
destroy() {

src/plugins/vis_types/vega/public/vega_visualization.test.js

Lines changed: 0 additions & 5 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;
9087
try {
9188
vegaVis = new VegaVisualization(domNode, jest.fn());
@@ -115,8 +112,6 @@ describe('VegaVisualizations', () => {
115112
} finally {
116113
vegaVis.destroy();
117114
}
118-
expect(console.log).toBeCalledTimes(2);
119-
mockedConsoleLog.mockRestore();
120115
});
121116

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

0 commit comments

Comments
 (0)