From d6ff16fe725eb3bfc8b376f612ce0d94cf2df651 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Wed, 24 Oct 2018 11:25:49 +0200 Subject: [PATCH] Explore: fix graph resize on window resize - resize HOC wrapper only resized first child which in case of large graphs was the warning button - moved warning button inside the panel parent --- public/app/features/explore/Graph.tsx | 12 +- .../explore/__snapshots__/Graph.test.tsx.snap | 1792 ++++++++--------- 2 files changed, 898 insertions(+), 906 deletions(-) diff --git a/public/app/features/explore/Graph.tsx b/public/app/features/explore/Graph.tsx index 65dac2953e2..d57f8d49a43 100644 --- a/public/app/features/explore/Graph.tsx +++ b/public/app/features/explore/Graph.tsx @@ -168,7 +168,8 @@ export class Graph extends PureComponent { const data = this.getGraphData(); return ( - <> +
+ {loading &&
} {this.props.data && this.props.data.length > MAX_NUMBER_OF_TIME_SERIES && !this.state.showAllTimeSeries && ( @@ -180,12 +181,9 @@ export class Graph extends PureComponent { }`}
)} -
- {loading &&
} -
- -
- +
+ +
); } } diff --git a/public/app/features/explore/__snapshots__/Graph.test.tsx.snap b/public/app/features/explore/__snapshots__/Graph.test.tsx.snap index 243fccb2e5f..fd2010a76d3 100644 --- a/public/app/features/explore/__snapshots__/Graph.test.tsx.snap +++ b/public/app/features/explore/__snapshots__/Graph.test.tsx.snap @@ -1,468 +1,468 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Render should render component 1`] = ` - +
-
+ - -
- + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/label/:name/values", + "instance": "localhost:9090", + "job": "prometheus", + "le": "3", + }, + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/label/:name/values", + "instance": "localhost:9090", + "job": "prometheus", + "le": "60", + }, + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/label/:name/values", + "instance": "localhost:9090", + "job": "prometheus", + "le": "8", + }, + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "+Inf", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "0.1", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "0.4", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "1", + }, + "values": Array [ + Array [ + 1537847900, + "953", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "120", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "20", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "3", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "60", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "8", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + ] + } + /> +
`; exports[`Render should render component with disclaimer 1`] = ` - +
@@ -478,504 +478,498 @@ exports[`Render should render component with disclaimer 1`] = `
-
+ - -
- + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/label/:name/values", + "instance": "localhost:9090", + "job": "prometheus", + "le": "60", + }, + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/label/:name/values", + "instance": "localhost:9090", + "job": "prometheus", + "le": "8", + }, + "values": Array [ + Array [ + 1537858100, + "16", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "+Inf", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "0.1", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "0.4", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "1", + }, + "values": Array [ + Array [ + 1537847900, + "953", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "120", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "20", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "3", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "60", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/metrics", + "instance": "localhost:9090", + "job": "prometheus", + "le": "8", + }, + "values": Array [ + Array [ + 1537858060, + "1195", + ], + Array [ + 1537858080, + "1195", + ], + Array [ + 1537858100, + "1195", + ], + ], + }, + Object { + "metric": Object { + "__name__": "prometheus_http_request_duration_seconds_bucket", + "handler": "/query", + "instance": "localhost:9090", + "job": "prometheus", + "le": "+Inf", + }, + "values": Array [ + Array [ + 1537858100, + "55", + ], + Array [ + 1537861960, + "1", + ], + Array [ + 1537861980, + "1", + ], + ], + }, + ] + } + /> +
`; exports[`Render should show query return no time series 1`] = ` - +
-
- -
- + } + /> + +
`;