Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

import moment from 'moment';
import dateMath from '@kbn/datemath';
import { loader, logger, Warn, version as vegaVersion, expressionFunction } from 'vega';
import { loader, logger, Warn, expressionFunction } from 'vega';
import { expressionInterpreter } from 'vega-interpreter';
import { version as vegaLiteVersion } from 'vega-lite';
import { Utils } from '../data_model/utils';
import { i18n } from '@kbn/i18n';
import { buildQueryFilter, compareFilters } from '@kbn/es-query';
Expand Down Expand Up @@ -499,33 +498,6 @@ export class VegaBaseView {
view,
spec: vlspec || spec,
});

if (window) {
if (window.VEGA_DEBUG === undefined && console) {
console.log('%cWelcome to Kibana Vega Plugin!', 'font-size: 16px; font-weight: bold;');
console.log(
'You can access the Vega view with VEGA_DEBUG. ' +
'Learn more at https://vega.github.io/vega/docs/api/debugging/.'
);
}
const debugObj = {};
window.VEGA_DEBUG = debugObj;
window.VEGA_DEBUG.VEGA_VERSION = vegaVersion;
window.VEGA_DEBUG.VEGA_LITE_VERSION = vegaLiteVersion;
window.VEGA_DEBUG.view = view;
window.VEGA_DEBUG.vega_spec = spec;
window.VEGA_DEBUG.vegalite_spec = vlspec;

// On dispose, clean up, but don't use undefined to prevent repeated debug statements
this._addDestroyHandler(() => {
if (debugObj === window.VEGA_DEBUG) {
window.VEGA_DEBUG.view = null;
window.VEGA_DEBUG.vega_spec = null;
window.VEGA_DEBUG.vegalite_spec = null;
window.VEGA_DEBUG = null;
}
});
}
}

destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ describe('VegaVisualizations', () => {
});

test('should show vegalite graph and update on resize (may fail in dev env)', async () => {
const mockedConsoleLog = jest.spyOn(console, 'log'); // mocked console.log to avoid messages in the console when running tests
mockedConsoleLog.mockImplementation(() => {}); // comment this line when console logging for debugging comment this line

let vegaVis: InstanceType<VegaVisType>;
try {
vegaVis = new VegaVisualization(domNode, jest.fn());
Expand Down Expand Up @@ -117,9 +114,6 @@ describe('VegaVisualizations', () => {
} finally {
vegaVis.destroy();
}
// eslint-disable-next-line no-console
expect(console.log).toBeCalledTimes(2);
mockedConsoleLog.mockRestore();
});

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