mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fix error with reporting urls generated prior to 6.2 (when there was no layout parameter) (#23508) (#23595)
* removed passing of ID in to creation of layout and added a new test without a layout param * renamed test constant so it reflects what we are testing and added comment * Recommended Changes * removed */ from end of line
This commit is contained in:
parent
ea221a4efb
commit
73cc697177
5 changed files with 29 additions and 7 deletions
|
@ -14,11 +14,11 @@ interface LayoutParams {
|
|||
dimensions: Size;
|
||||
}
|
||||
|
||||
export function createLayout(server: KbnServer, layoutParams: LayoutParams): Layout {
|
||||
export function createLayout(server: KbnServer, layoutParams?: LayoutParams): Layout {
|
||||
if (layoutParams && layoutParams.id === LayoutTypes.PRESERVE_LAYOUT) {
|
||||
return new PreserveLayout(layoutParams.id, layoutParams.dimensions);
|
||||
return new PreserveLayout(layoutParams.dimensions);
|
||||
}
|
||||
|
||||
// this is the default because some jobs won't have anything specified
|
||||
return new PrintLayout(server, layoutParams.id);
|
||||
return new PrintLayout(server);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
import path from 'path';
|
||||
import { Size } from '../../../../../types';
|
||||
import { LayoutTypes } from '../../../common/constants';
|
||||
import { Layout, PageSizeParams } from './layout';
|
||||
|
||||
// We use a zoom of two to bump up the resolution of the screenshot a bit.
|
||||
|
@ -25,8 +26,8 @@ export class PreserveLayout extends Layout {
|
|||
private readonly scaledHeight: number;
|
||||
private readonly scaledWidth: number;
|
||||
|
||||
constructor(id: string, size: Size) {
|
||||
super(id);
|
||||
constructor(size: Size) {
|
||||
super(LayoutTypes.PRESERVE_LAYOUT);
|
||||
this.height = size.height;
|
||||
this.width = size.width;
|
||||
this.scaledHeight = size.height * ZOOM;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
import path from 'path';
|
||||
import { EvaluateOptions, KbnServer, Size } from '../../../../../types';
|
||||
import { LayoutTypes } from '../../../common/constants';
|
||||
import { Layout } from './layout';
|
||||
import { CaptureConfig } from './types';
|
||||
|
||||
|
@ -25,8 +26,8 @@ export class PrintLayout extends Layout {
|
|||
|
||||
private captureConfig: CaptureConfig;
|
||||
|
||||
constructor(server: KbnServer, id: string) {
|
||||
super(id);
|
||||
constructor(server: KbnServer) {
|
||||
super(LayoutTypes.PRINT);
|
||||
this.captureConfig = server.config().get('xpack.reporting.capture');
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,21 @@ export default function ({ getService }) {
|
|||
const usageAPI = getService('usageAPI');
|
||||
|
||||
describe('BWC report generation urls', () => {
|
||||
describe('Pre 6_2', () => {
|
||||
before(async () => {
|
||||
await reportingAPI.deleteAllReportingIndexes();
|
||||
});
|
||||
|
||||
// The URL being tested was captured from release 6.4 and then the layout section was removed to test structure before
|
||||
// preserve_layout was introduced. See https://github.com/elastic/kibana/issues/23414
|
||||
it('job posted successfully', async () => {
|
||||
const path = await reportingAPI.postJob(GenerationUrls.PDF_PRINT_DASHBOARD_PRE_6_2);
|
||||
await reportingAPI.waitForJobToFinish(path);
|
||||
const stats = await usageAPI.getUsageStats();
|
||||
reportingAPI.expectCompletedReportCount(stats, 1);
|
||||
}).timeout(500000);
|
||||
});
|
||||
|
||||
describe('6_2', () => {
|
||||
before(async () => {
|
||||
await reportingAPI.deleteAllReportingIndexes();
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
// These all have the domain name portion stripped out. The api infrastructure assumes it when we post to it anyhow.
|
||||
|
||||
/* eslint-disable max-len */
|
||||
|
||||
// The URL below was captured from release 6.4 and then the layout section was removed to test structure before
|
||||
// preserve_layout was introduced. See https://github.com/elastic/kibana/issues/23414
|
||||
export const PDF_PRINT_DASHBOARD_PRE_6_2 = '/api/reporting/generate/printablePdf?jobParams=(browserTimezone:America%2FNew_York,objectType:dashboard,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fdashboard%2F2ae34a60-3dd4-11e8-b2b9-5d5dc1715159%3F_g%3D(refreshInterval:(pause:!!t,value:0),time:(from:!%27Mon%2BApr%2B09%2B2018%2B17:56:08%2BGMT-0400!%27,mode:absolute,to:!%27Wed%2BApr%2B11%2B2018%2B17:56:08%2BGMT-0400!%27))%26_a%3D(description:!%27!%27,filters:!!(),fullScreenMode:!!f,options:(darkTheme:!!f,hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(),gridData:(h:15,i:!%271!%27,w:24,x:0,y:0),id:!%27145ced90-3dcb-11e8-8660-4d65aa086b3c!%27,panelIndex:!%271!%27,type:visualization,version:!%276.3.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%272!%27,w:24,x:24,y:0),id:e2023110-3dcb-11e8-8660-4d65aa086b3c,panelIndex:!%272!%27,type:visualization,version:!%276.3.0!%27)),query:(language:lucene,query:!%27!%27),timeRestore:!!f,title:!%27couple%2Bpanels!%27,viewMode:view)%27),title:%27couple%20panels%27)';
|
||||
|
||||
export const PDF_PRINT_DASHBOARD_6_3 = '/api/reporting/generate/printablePdf?jobParams=(browserTimezone:America%2FNew_York,layout:(id:print),objectType:dashboard,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fdashboard%2F2ae34a60-3dd4-11e8-b2b9-5d5dc1715159%3F_g%3D(refreshInterval:(display:Off,pause:!!f,value:0),time:(from:!%27Mon%2BApr%2B09%2B2018%2B17:56:08%2BGMT-0400!%27,mode:absolute,to:!%27Wed%2BApr%2B11%2B2018%2B17:56:08%2BGMT-0400!%27))%26_a%3D(description:!%27!%27,filters:!!(),fullScreenMode:!!f,options:(darkTheme:!!f,hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(),gridData:(h:15,i:!%271!%27,w:24,x:0,y:0),id:!%27145ced90-3dcb-11e8-8660-4d65aa086b3c!%27,panelIndex:!%271!%27,type:visualization,version:!%276.3.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%272!%27,w:24,x:24,y:0),id:e2023110-3dcb-11e8-8660-4d65aa086b3c,panelIndex:!%272!%27,type:visualization,version:!%276.3.0!%27)),query:(language:lucene,query:!%27!%27),timeRestore:!!f,title:!%27couple%2Bpanels!%27,viewMode:view)%27),title:%27couple%20panels%27)';
|
||||
export const PDF_PRESERVE_DASHBOARD_FILTER_6_3 = '/api/reporting/generate/printablePdf?jobParams=(browserTimezone:America%2FNew_York,layout:(dimensions:(height:439,width:1362),id:preserve_layout),objectType:dashboard,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fdashboard%2F61c58ad0-3dd3-11e8-b2b9-5d5dc1715159%3F_g%3D(refreshInterval:(display:Off,pause:!!f,value:0),time:(from:!%27Mon%2BApr%2B09%2B2018%2B17:56:08%2BGMT-0400!%27,mode:absolute,to:!%27Wed%2BApr%2B11%2B2018%2B17:56:08%2BGMT-0400!%27))%26_a%3D(description:!%27!%27,filters:!!((!%27$state!%27:(store:appState),meta:(alias:!!n,disabled:!!f,index:a0f483a0-3dc9-11e8-8660-4d65aa086b3c,key:animal,negate:!!f,params:(query:dog,type:phrase),type:phrase,value:dog),query:(match:(animal:(query:dog,type:phrase))))),fullScreenMode:!!f,options:(darkTheme:!!f,hidePanelTitles:!!f,useMargins:!!t),panels:!!((embeddableConfig:(),gridData:(h:15,i:!%271!%27,w:24,x:0,y:0),id:!%2750643b60-3dd3-11e8-b2b9-5d5dc1715159!%27,panelIndex:!%271!%27,type:visualization,version:!%276.3.0!%27),(embeddableConfig:(),gridData:(h:15,i:!%272!%27,w:24,x:24,y:0),id:a16d1990-3dca-11e8-8660-4d65aa086b3c,panelIndex:!%272!%27,type:search,version:!%276.3.0!%27)),query:(language:lucene,query:!%27!%27),timeRestore:!!t,title:!%27dashboard%2Bwith%2Bfilter!%27,viewMode:view)%27),title:%27dashboard%20with%20filter%27)';
|
||||
export const PDF_PRESERVE_PIE_VISUALIZATION_6_3 = '/api/reporting/generate/printablePdf?jobParams=(browserTimezone:America%2FNew_York,layout:(dimensions:(height:441,width:1002),id:preserve_layout),objectType:visualization,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fvisualize%2Fedit%2F3fe22200-3dcb-11e8-8660-4d65aa086b3c%3F_g%3D(refreshInterval:(display:Off,pause:!!f,value:0),time:(from:!%27Mon%2BApr%2B09%2B2018%2B17:56:08%2BGMT-0400!%27,mode:absolute,to:!%27Wed%2BApr%2B11%2B2018%2B17:56:08%2BGMT-0400!%27))%26_a%3D(filters:!!(),linked:!!f,query:(language:lucene,query:!%27!%27),uiState:(),vis:(aggs:!!((enabled:!!t,id:!%271!%27,params:(),schema:metric,type:count),(enabled:!!t,id:!%272!%27,params:(field:bytes,missingBucket:!!f,missingBucketLabel:Missing,order:desc,orderBy:!%271!%27,otherBucket:!!f,otherBucketLabel:Other,size:5),schema:segment,type:terms)),params:(addLegend:!!t,addTooltip:!!t,isDonut:!!t,labels:(last_level:!!t,show:!!f,truncate:100,values:!!t),legendPosition:right,type:pie),title:!%27Rendering%2BTest:%2Bpie!%27,type:pie))%27),title:%27Rendering%20Test:%20pie%27)';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue