Skip to content

Commit 79d2535

Browse files
authored
[8.18] [Vega] remove VEGA_DEBUG (#234477) (#236426)
# Backport This will backport the following commits from `main` to `8.18`: - [[Vega] remove VEGA_DEBUG (#234477)](#234477) <!--- Backport version: 10.0.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Marco Vettorello","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-09-17T11:51:01Z","message":"[Vega] remove VEGA_DEBUG (#234477)\n\nThis commit removes the VEGA_DEBUG variable from window object.","sha":"03f47de4412ec686ef5a09e035949639776c6489","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Vega","Team:Visualizations","release_note:skip","backport:all-open","v9.2.0","v9.1.4","v9.0.7","v8.19.4"],"title":"[Vega] remove VEGA_DEBUG","number":234477,"url":"https://github.com/elastic/kibana/pull/234477","mergeCommit":{"message":"[Vega] remove VEGA_DEBUG (#234477)\n\nThis commit removes the VEGA_DEBUG variable from window object.","sha":"03f47de4412ec686ef5a09e035949639776c6489"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/234477","number":234477,"mergeCommit":{"message":"[Vega] remove VEGA_DEBUG (#234477)\n\nThis commit removes the VEGA_DEBUG variable from window object.","sha":"03f47de4412ec686ef5a09e035949639776c6489"}},{"branch":"9.1","label":"v9.1.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/235353","number":235353,"state":"MERGED","mergeCommit":{"sha":"3f77c7e51c9910198d2041c2b655ec7db96c33e4","message":"[9.1] [Vega] remove VEGA_DEBUG (#234477) (#235353)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.1`:\n- [[Vega] remove VEGA_DEBUG\n(#234477)](https://github.com/elastic/kibana/pull/234477)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Marco Vettorello <[email protected]>"}},{"branch":"9.0","label":"v9.0.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/235352","number":235352,"state":"MERGED","mergeCommit":{"sha":"d940f7267527ae279e00154f35f427d1c30d9526","message":"[9.0] [Vega] remove VEGA_DEBUG (#234477) (#235352)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.0`:\n- [[Vega] remove VEGA_DEBUG\n(#234477)](https://github.com/elastic/kibana/pull/234477)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Marco Vettorello <[email protected]>"}},{"branch":"8.19","label":"v8.19.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/235351","number":235351,"state":"MERGED","mergeCommit":{"sha":"48e544d25bc6a940f17ff321cd4601e86bb9f180","message":"[8.19] [Vega] remove VEGA_DEBUG (#234477) (#235351)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.19`:\n- [[Vega] remove VEGA_DEBUG\n(#234477)](https://github.com/elastic/kibana/pull/234477)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Marco Vettorello <[email protected]>"}}]}] BACKPORT-->
1 parent 4820204 commit 79d2535

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)