mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Reporting] Post URL: track layoutID in state
This commit is contained in:
parent
53a60b9f0f
commit
b87d5687d7
2 changed files with 16 additions and 4 deletions
|
@ -19,6 +19,7 @@ import { reportingClient } from '../lib/reporting_client';
|
|||
|
||||
interface Props {
|
||||
reportType: string;
|
||||
layoutId: string;
|
||||
objectId?: string;
|
||||
objectType: string;
|
||||
getJobParams: () => any;
|
||||
|
@ -31,6 +32,7 @@ interface Props {
|
|||
interface State {
|
||||
isStale: boolean;
|
||||
absoluteUrl: string;
|
||||
layoutId: string;
|
||||
}
|
||||
|
||||
class ReportingPanelContentUi extends Component<Props, State> {
|
||||
|
@ -42,6 +44,7 @@ class ReportingPanelContentUi extends Component<Props, State> {
|
|||
this.state = {
|
||||
isStale: false,
|
||||
absoluteUrl: '',
|
||||
layoutId: '',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -54,12 +57,18 @@ class ReportingPanelContentUi extends Component<Props, State> {
|
|||
|
||||
public componentDidMount() {
|
||||
this.mounted = true;
|
||||
this.setAbsoluteReportGenerationUrl();
|
||||
|
||||
window.addEventListener('hashchange', this.markAsStale, false);
|
||||
window.addEventListener('resize', this.setAbsoluteReportGenerationUrl);
|
||||
}
|
||||
|
||||
public getDerivedStateFromProps(newProps: Props) {
|
||||
if (newProps.layoutId !== this.state.layoutId) {
|
||||
this.setAbsoluteReportGenerationUrl(); // changes state.absoluteUrl
|
||||
}
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public render() {
|
||||
if (this.isNotSaved() || this.props.isDirty || this.state.isStale) {
|
||||
return (
|
||||
|
|
|
@ -11,6 +11,7 @@ import { ReportingPanelContent } from './reporting_panel_content';
|
|||
|
||||
interface Props {
|
||||
reportType: string;
|
||||
layoutId: string;
|
||||
objectId?: string;
|
||||
objectType: string;
|
||||
getJobParams: () => any;
|
||||
|
@ -35,6 +36,7 @@ export class ScreenCapturePanelContent extends Component<Props, State> {
|
|||
return (
|
||||
<ReportingPanelContent
|
||||
reportType={this.props.reportType}
|
||||
layoutId={this.getLayout().id}
|
||||
objectType={this.props.objectType}
|
||||
objectId={this.props.objectId}
|
||||
getJobParams={this.getJobParams}
|
||||
|
@ -103,8 +105,9 @@ export class ScreenCapturePanelContent extends Component<Props, State> {
|
|||
};
|
||||
|
||||
private getJobParams = () => {
|
||||
const jobParams = this.props.getJobParams();
|
||||
jobParams.layout = this.getLayout();
|
||||
return jobParams;
|
||||
return {
|
||||
...this.props.getJobParams(),
|
||||
layout: this.getLayout(),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue