Skip to content

Commit 758f8ed

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/platform/plugins/private/vis_types/vega/public/vega_view/vega_base_view.js
1 parent 0af3f40 commit 758f8ed

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

529501
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
@@ -82,9 +82,6 @@ describe('VegaVisualizations', () => {
8282
});
8383

8484
test('should show vegalite graph and update on resize (may fail in dev env)', async () => {
85-
const mockedConsoleLog = jest.spyOn(console, 'log'); // mocked console.log to avoid messages in the console when running tests
86-
mockedConsoleLog.mockImplementation(() => {}); // comment this line when console logging for debugging comment this line
87-
8885
let vegaVis: InstanceType<VegaVisType>;
8986
try {
9087
vegaVis = new VegaVisualization(domNode, jest.fn());
@@ -114,9 +111,6 @@ describe('VegaVisualizations', () => {
114111
} finally {
115112
vegaVis.destroy();
116113
}
117-
// eslint-disable-next-line no-console
118-
expect(console.log).toBeCalledTimes(2);
119-
mockedConsoleLog.mockRestore();
120114
});
121115

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

0 commit comments

Comments
 (0)