mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Revert "correctly passing saved filters and query to all response handlers (#32749)"
This reverts commit ac6137af26
.
This commit is contained in:
parent
2eb70952c2
commit
e939addaed
6 changed files with 26 additions and 88 deletions
|
@ -71,7 +71,7 @@ export const kibanaContext = () => ({
|
|||
}
|
||||
|
||||
if (context.filters) {
|
||||
filters = filters.concat(context.filters).filter(f => !f.meta.disabled);
|
||||
filters = filters.concat(context.filters);
|
||||
}
|
||||
|
||||
const timeRange = args.timeRange ? JSON.parse(args.timeRange) : context.timeRange;
|
||||
|
|
|
@ -70,23 +70,17 @@ export class VisualizeDataLoader {
|
|||
// add necessary params to vis object (dimensions, bucket, metric, etc)
|
||||
const visParams = getVisParams(this.vis, { timeRange: params.timeRange });
|
||||
|
||||
const filters = params.filters || [];
|
||||
const savedFilters = params.searchSource.getField('filter') || [];
|
||||
|
||||
const query = params.query || params.searchSource.getField('query');
|
||||
|
||||
// searchSource is only there for courier request handler
|
||||
const requestHandlerResponse = await this.requestHandler({
|
||||
partialRows: this.vis.params.partialRows || this.vis.type.requiresPartialRows,
|
||||
metricsAtAllLevels: this.vis.isHierarchical(),
|
||||
visParams,
|
||||
...params,
|
||||
query,
|
||||
filters: filters.concat(savedFilters).filter(f => !f.meta.disabled),
|
||||
filters: params.filters ? params.filters.filter(filter => !filter.meta.disabled) : undefined,
|
||||
});
|
||||
|
||||
// No need to call the response handler when there have been no data nor has there been changes
|
||||
// in the vis-state (response handler does not depend on uiState)
|
||||
// No need to call the response handler when there have been no data nor has been there changes
|
||||
// in the vis-state (response handler does not depend on uiStat
|
||||
const canSkipResponseHandler =
|
||||
this.previousRequestHandlerResponse &&
|
||||
this.previousRequestHandlerResponse === requestHandlerResponse &&
|
||||
|
|
|
@ -20,13 +20,9 @@
|
|||
import expect from 'expect.js';
|
||||
|
||||
export default function ({ getService, getPageObjects }) {
|
||||
const PageObjects = getPageObjects(['common', 'header', 'timePicker', 'visualize']);
|
||||
const filterBar = getService('filterBar');
|
||||
const inspector = getService('inspector');
|
||||
const log = getService('log');
|
||||
|
||||
const fromTime = '2015-09-19 06:31:44.000';
|
||||
const toTime = '2015-09-23 18:31:44.000';
|
||||
const inspector = getService('inspector');
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'header']);
|
||||
|
||||
describe('visualize app', () => {
|
||||
before(async () => {
|
||||
|
@ -37,46 +33,28 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
|
||||
describe('vega chart', () => {
|
||||
describe('initial render', () => {
|
||||
it('should not have inspector enabled', async function () {
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
it.skip('should have some initial vega spec text', async function () {
|
||||
const vegaSpec = await PageObjects.visualize.getVegaSpec();
|
||||
expect(vegaSpec).to.contain('{').and.to.contain('data');
|
||||
expect(vegaSpec.length).to.be.above(500);
|
||||
});
|
||||
|
||||
it('should have view and control containers', async function () {
|
||||
const view = await PageObjects.visualize.getVegaViewContainer();
|
||||
expect(view).to.be.ok();
|
||||
const size = await view.getSize();
|
||||
expect(size).to.have.property('width').and.to.have.property('height');
|
||||
expect(size.width).to.be.above(0);
|
||||
expect(size.height).to.be.above(0);
|
||||
|
||||
const controls = await PageObjects.visualize.getVegaControlContainer();
|
||||
expect(controls).to.be.ok();
|
||||
});
|
||||
it('should not have inspector enabled', async function () {
|
||||
await inspector.expectIsNotEnabled();
|
||||
});
|
||||
|
||||
describe('with filters', () => {
|
||||
before(async () => {
|
||||
log.debug('setAbsoluteRange');
|
||||
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await filterBar.removeAllFilters();
|
||||
});
|
||||
|
||||
it('should render different data in response to filter change', async function () {
|
||||
await PageObjects.visualize.expectVisToMatchScreenshot('vega_chart');
|
||||
await filterBar.addFilter('@tags.raw', 'is', 'error');
|
||||
await PageObjects.visualize.expectVisToMatchScreenshot('vega_chart_filtered');
|
||||
});
|
||||
it.skip('should have some initial vega spec text', async function () {
|
||||
const vegaSpec = await PageObjects.visualize.getVegaSpec();
|
||||
expect(vegaSpec).to.contain('{').and.to.contain('data');
|
||||
expect(vegaSpec.length).to.be.above(500);
|
||||
});
|
||||
|
||||
it('should have view and control containers', async function () {
|
||||
const view = await PageObjects.visualize.getVegaViewContainer();
|
||||
expect(view).to.be.ok();
|
||||
const size = await view.getSize();
|
||||
expect(size).to.have.property('width').and.to.have.property('height');
|
||||
expect(size.width).to.be.above(0);
|
||||
expect(size.height).to.be.above(0);
|
||||
|
||||
const controls = await PageObjects.visualize.getVegaControlContainer();
|
||||
expect(controls).to.be.ok();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import { VisualizeConstants } from '../../../src/legacy/core_plugins/kibana/publ
|
|||
import Bluebird from 'bluebird';
|
||||
import expect from 'expect.js';
|
||||
|
||||
export function VisualizePageProvider({ getService, getPageObjects, updateBaselines }) {
|
||||
export function VisualizePageProvider({ getService, getPageObjects }) {
|
||||
const browser = getService('browser');
|
||||
const config = getService('config');
|
||||
const testSubjects = getService('testSubjects');
|
||||
|
@ -29,7 +29,6 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
|
|||
const find = getService('find');
|
||||
const log = getService('log');
|
||||
const inspector = getService('inspector');
|
||||
const screenshot = getService('screenshots');
|
||||
const table = getService('table');
|
||||
const globalNav = getService('globalNav');
|
||||
const PageObjects = getPageObjects(['common', 'header']);
|
||||
|
@ -824,39 +823,6 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
|
|||
return $('.y > g > text').toArray().map(tick => $(tick).text().trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes chrome and takes a small screenshot of a vis to compare against a baseline.
|
||||
* @param {string} name The name of the baseline image.
|
||||
* @param {object} opts Options object.
|
||||
* @param {number} opts.threshold Threshold for allowed variance when comparing images.
|
||||
*/
|
||||
async expectVisToMatchScreenshot(name, opts = { threshold: 0.05 }) {
|
||||
log.debug(`expectVisToMatchScreenshot(${name})`);
|
||||
|
||||
// Collapse sidebar and inject some CSS to hide the nav so we have a focused screenshot
|
||||
await this.clickEditorSidebarCollapse();
|
||||
await this.waitForVisualizationRenderingStabilized();
|
||||
await browser.execute(`
|
||||
var el = document.createElement('style');
|
||||
el.id = '__data-test-style';
|
||||
el.innerHTML = '[data-test-subj="headerGlobalNav"] { display: none; } ';
|
||||
el.innerHTML += '[data-test-subj="top-nav"] { display: none; } ';
|
||||
el.innerHTML += '[data-test-subj="experimentalVisInfo"] { display: none; } ';
|
||||
document.body.appendChild(el);
|
||||
`);
|
||||
|
||||
const percentDifference = await screenshot.compareAgainstBaseline(name, updateBaselines);
|
||||
|
||||
// Reset the chart to its original state
|
||||
await browser.execute(`
|
||||
var el = document.getElementById('__data-test-style');
|
||||
document.body.removeChild(el);
|
||||
`);
|
||||
await this.clickEditorSidebarCollapse();
|
||||
await this.waitForVisualizationRenderingStabilized();
|
||||
expect(percentDifference).to.be.lessThan(opts.threshold);
|
||||
}
|
||||
|
||||
/*
|
||||
** This method gets the chart data and scales it based on chart height and label.
|
||||
** Returns an array of height values
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
Loading…
Add table
Add a link
Reference in a new issue