Skip to content

Commit 3f77c7e

Browse files
[9.1] [Vega] remove VEGA_DEBUG (#234477) (#235353)
# Backport This will backport the following commits from `main` to `9.1`: - [[Vega] remove VEGA_DEBUG (#234477)](#234477) <!--- Backport version: 9.6.6 --> ### 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"],"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"}}]}] BACKPORT--> Co-authored-by: Marco Vettorello <[email protected]>
1 parent 7458bb6 commit 3f77c7e

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
@@ -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)