Skip to content

Commit

Permalink
fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Dec 23, 2019
1 parent a92666c commit 2f0308c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class VegaBaseView {
this._$parentEl = $(opts.parentEl);
this._parser = opts.vegaParser;
this._serviceSettings = opts.serviceSettings;
this._queryfilter = opts.queryfilter;
this._filterManager = opts.filterManager;
this._timefilter = opts.timefilter;
this._findIndex = opts.findIndex;
this._view = null;
Expand Down Expand Up @@ -271,7 +271,7 @@ export class VegaBaseView {
async addFilterHandler(query, index) {
const indexId = await this._findIndex(index);
const filter = esFilters.buildQueryFilter(query, indexId);
this._queryfilter.addFilters(filter);
this._filterManager.addFilters(filter);
}

/**
Expand All @@ -288,15 +288,15 @@ export class VegaBaseView {
// this._queryfilter.removeFilter(filter);
$injector.get('$rootScope').$evalAsync(() => {
try {
this._queryfilter.removeFilter(filter);
this._filterManager.removeFilter(filter);
} catch (err) {
this.onError(err);
}
});
}

removeAllFiltersHandler() {
this._queryfilter.removeAll();
this._filterManager.removeAll();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const createVegaVisualization = ({ serviceSettings }) =>
this._vis = vis;

this.savedObjectsClient = getSavedObjects();
this.notifications = getNotifications();
this.dataPlugin = getData();
}

Expand Down Expand Up @@ -71,8 +70,10 @@ export const createVegaVisualization = ({ serviceSettings }) =>
* @returns {Promise<void>}
*/
async render(visData, visParams, status) {
const { toasts } = getNotifications();

if (!visData && !this._vegaView) {
this.notifications.toasts.addWarning(
toasts.addWarning(
i18n.translate('visTypeVega.visualization.unableToRenderWithoutDataWarningMessage', {
defaultMessage: 'Unable to render without data',
})
Expand All @@ -86,7 +87,7 @@ export const createVegaVisualization = ({ serviceSettings }) =>
if (this._vegaView) {
this._vegaView.onError(error);
} else {
this.notifications.toasts.addError(error, {
toasts.addError(error, {
title: i18n.translate('visTypeVega.visualization.renderErrorTitle', {
defaultMessage: 'Vega error',
}),
Expand All @@ -103,13 +104,13 @@ export const createVegaVisualization = ({ serviceSettings }) =>
this._vegaView = null;
}

const { filterManager: queryfilter } = this.dataPlugin.query;
const { filterManager } = this.dataPlugin.query;
const { timefilter } = this.dataPlugin.query.timefilter;
const vegaViewParams = {
parentEl: this._el,
vegaParser,
serviceSettings,
queryfilter,
filterManager,
timefilter,
findIndex: this.findIndex.bind(this),
};
Expand Down

0 comments on commit 2f0308c

Please sign in to comment.