From f5e351af8b7ebd72800502b65aa7e6f741c08106 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Tue, 15 May 2018 17:07:38 +0200 Subject: [PATCH] Explore split view * button to bring a up a duplicate explore area to compare * side by side rendering of two explore components * right component has close button * left component has page title --- public/app/containers/Explore/Explore.tsx | 54 +++++++++++++++++++---- public/app/containers/Explore/Graph.tsx | 1 + public/app/containers/Explore/Wrapper.tsx | 33 ++++++++++++++ public/app/routes/routes.ts | 3 +- public/sass/pages/_explore.scss | 48 ++++++++++++++++---- 5 files changed, 121 insertions(+), 18 deletions(-) create mode 100644 public/app/containers/Explore/Wrapper.tsx diff --git a/public/app/containers/Explore/Explore.tsx b/public/app/containers/Explore/Explore.tsx index cf8cb41a593..deebe84f2c8 100644 --- a/public/app/containers/Explore/Explore.tsx +++ b/public/app/containers/Explore/Explore.tsx @@ -80,6 +80,7 @@ export class Explore extends React.Component { showingGraph: true, showingTable: true, tableResult: null, + ...props.initialState, }; } @@ -126,10 +127,24 @@ export class Explore extends React.Component { this.setState({ range }, () => this.handleSubmit()); }; + handleClickCloseSplit = () => { + const { onChangeSplit } = this.props; + if (onChangeSplit) { + onChangeSplit(false); + } + }; + handleClickGraphButton = () => { this.setState(state => ({ showingGraph: !state.showingGraph })); }; + handleClickSplit = () => { + const { onChangeSplit } = this.props; + if (onChangeSplit) { + onChangeSplit(true, this.state); + } + }; + handleClickTableButton = () => { this.setState(state => ({ showingTable: !state.showingTable })); }; @@ -211,6 +226,7 @@ export class Explore extends React.Component { }; render() { + const { position, split } = this.props; const { datasource, datasourceError, @@ -230,16 +246,32 @@ export class Explore extends React.Component { const graphHeight = showingBoth ? '200px' : '400px'; const graphButtonActive = showingBoth || showingGraph ? 'active' : ''; const tableButtonActive = showingBoth || showingTable ? 'active' : ''; + const exploreClass = split ? 'explore explore-split' : 'explore'; return ( -
+
- + {position === 'left' ? ( + + ) : ( +
+ +
+ )}
+ {position === 'left' && !split ? ( +
+ +
+ ) : null}