From ee0f2276380c1dc9972b554990715bc8ae330283 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Mon, 18 Nov 2019 13:20:20 +0000 Subject: [PATCH] fix(graphiql): solve vertical scrolling issue --- postgraphiql/src/components/PostGraphiQL.js | 93 ++++++++++++-------- postgraphiql/src/components/postgraphiql.css | 35 +++++++- 2 files changed, 85 insertions(+), 43 deletions(-) diff --git a/postgraphiql/src/components/PostGraphiQL.js b/postgraphiql/src/components/PostGraphiQL.js index f31cc4b38a..321293202b 100644 --- a/postgraphiql/src/components/PostGraphiQL.js +++ b/postgraphiql/src/components/PostGraphiQL.js @@ -642,7 +642,13 @@ class PostGraphiQL extends React.PureComponent { return ; } else { return ( -
+
{this.state.explainResult && this.state.explainResult.length ? ( -
-

Explain: analysis of executed queries

+
{this.state.explainResult.map(res => (
-
-                          {formatSQL(res.query)}
-                        
-
+                        

+ Result from SQL{' '} + + EXPLAIN + {' '} + on executed query: +

+
                           {res.plan}
                         
+

Executed SQL query:

+
+                          {formatSQL(res.query)}
+                        
))}

@@ -723,38 +736,40 @@ class PostGraphiQL extends React.PureComponent {


) : null} - PostGraphile:{' '} - - Documentation - {' '} - |{' '} - - Examples - {' '} - |{' '} - - Sponsor - {' '} - |{' '} - - Support - +
+ PostGraphile:{' '} + + Documentation + {' '} + |{' '} + + Examples + {' '} + |{' '} + + Sponsor + {' '} + |{' '} + + Support + +
diff --git a/postgraphiql/src/components/postgraphiql.css b/postgraphiql/src/components/postgraphiql.css index dc293ca298..6c68fbea47 100644 --- a/postgraphiql/src/components/postgraphiql.css +++ b/postgraphiql/src/components/postgraphiql.css @@ -37,19 +37,36 @@ margin: 0; } -.resultWrap .footer { - max-height: 50%; +.resultWrap .result-window { + flex: 1 1 100%; +} + +.explain-mode .resultWrap .footer { + flex: 1 1 100%; + position: relative; +} + +.explain-mode .postgraphile-footer { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; overflow: auto; + overflow-x: hidden; } .postgraphile-footer { line-height: 30px; - overflow: hidden; - display: block; align-items: center; padding: 0 0 0 1rem; white-space: nowrap; text-overflow: ellipsis; + max-height: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + justify-content: space-between; } .postgraphile-footer a { text-decoration: none; @@ -61,6 +78,16 @@ line-height: 1.1em; background-color: rgba(0, 0, 0, 0.1); } + +.explain-plan, +.explain-sql { + max-height: 8.8em; /* line-height is 1.1em */ + overflow: auto; +} +.explain-plan { + max-height: 13.2em; /* line-height is 1.1em */ +} + .resultWrap { width: 5rem; }