Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
8c65430e
Unverified
Commit
8c65430e
authored
Feb 07, 2019
by
Torkel Ödegaard
Committed by
GitHub
Feb 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15251 from grafana/14822-use-autosizer
Remove react-sizeme and use AutoSizer
parents
6caae916
c47c2528
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
15 deletions
+17
-15
public/app/features/explore/Explore.tsx
+1
-1
public/app/features/explore/Graph.test.tsx
+1
-0
public/app/features/explore/Graph.tsx
+7
-8
public/app/features/explore/GraphContainer.tsx
+4
-2
public/app/features/explore/Logs.tsx
+1
-1
public/app/features/explore/__snapshots__/Graph.test.tsx.snap
+3
-3
No files found.
public/app/features/explore/Explore.tsx
View file @
8c65430e
...
...
@@ -211,7 +211,7 @@ export class Explore extends React.PureComponent<ExploreProps> {
{
showingStartPage
&&
<
StartPage
onClickExample=
{
this
.
onClickExample
}
/>
}
{
!
showingStartPage
&&
(
<>
{
supportsGraph
&&
!
supportsLogs
&&
<
GraphContainer
exploreId=
{
exploreId
}
/>
}
{
supportsGraph
&&
!
supportsLogs
&&
<
GraphContainer
width=
{
width
}
exploreId=
{
exploreId
}
/>
}
{
supportsTable
&&
<
TableContainer
exploreId=
{
exploreId
}
onClickCell=
{
this
.
onClickLabel
}
/>
}
{
supportsLogs
&&
(
<
LogsContainer
...
...
public/app/features/explore/Graph.test.tsx
View file @
8c65430e
...
...
@@ -5,6 +5,7 @@ import { mockData } from './__mocks__/mockData';
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
=
{
size
:
{
width
:
10
,
height
:
20
},
data
:
mockData
().
slice
(
0
,
19
),
range
:
{
from
:
'now-6h'
,
to
:
'now'
},
...
propOverrides
,
...
...
public/app/features/explore/Graph.tsx
View file @
8c65430e
import
$
from
'jquery'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
moment
from
'moment'
;
import
{
withSize
}
from
'react-sizeme'
;
import
'vendor/flot/jquery.flot'
;
import
'vendor/flot/jquery.flot.time'
;
...
...
@@ -76,11 +75,11 @@ const FLOT_OPTIONS = {
interface
GraphProps
{
data
:
any
[];
height
?:
string
;
// e.g., '200px'
height
?:
number
;
width
?:
number
;
id
?:
string
;
range
:
RawTimeRange
;
split
?:
boolean
;
size
?:
{
width
:
number
;
height
:
number
};
userOptions
?:
any
;
onChangeTime
?:
(
range
:
RawTimeRange
)
=>
void
;
onToggleSeries
?:
(
alias
:
string
,
hiddenSeries
:
Set
<
string
>
)
=>
void
;
...
...
@@ -122,7 +121,7 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
prevProps
.
range
!==
this
.
props
.
range
||
prevProps
.
split
!==
this
.
props
.
split
||
prevProps
.
height
!==
this
.
props
.
height
||
(
prevProps
.
size
&&
prevProps
.
size
.
width
!==
this
.
props
.
size
.
width
)
||
prevProps
.
width
!==
this
.
props
.
width
||
!
equal
(
prevState
.
hiddenSeries
,
this
.
state
.
hiddenSeries
)
)
{
this
.
draw
();
...
...
@@ -144,8 +143,8 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
};
getDynamicOptions
()
{
const
{
range
,
size
}
=
this
.
props
;
const
ticks
=
(
size
.
width
||
0
)
/
100
;
const
{
range
,
width
}
=
this
.
props
;
const
ticks
=
(
width
||
0
)
/
100
;
let
{
from
,
to
}
=
range
;
if
(
!
moment
.
isMoment
(
from
))
{
from
=
dateMath
.
parse
(
from
,
false
);
...
...
@@ -237,7 +236,7 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
}
render
()
{
const
{
height
=
'100px'
,
id
=
'graph'
}
=
this
.
props
;
const
{
height
=
100
,
id
=
'graph'
}
=
this
.
props
;
const
{
hiddenSeries
}
=
this
.
state
;
const
data
=
this
.
getGraphData
();
...
...
@@ -261,4 +260,4 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
}
}
export
default
withSize
()(
Graph
)
;
export
default
Graph
;
public/app/features/explore/GraphContainer.tsx
View file @
8c65430e
...
...
@@ -20,6 +20,7 @@ interface GraphContainerProps {
split
:
boolean
;
toggleGraph
:
typeof
toggleGraph
;
changeTime
:
typeof
changeTime
;
width
:
number
;
}
export
class
GraphContainer
extends
PureComponent
<
GraphContainerProps
>
{
...
...
@@ -32,8 +33,8 @@ export class GraphContainer extends PureComponent<GraphContainerProps> {
};
render
()
{
const
{
exploreId
,
graphResult
,
loading
,
showingGraph
,
showingTable
,
range
,
split
}
=
this
.
props
;
const
graphHeight
=
showingGraph
&&
showingTable
?
'200px'
:
'400px'
;
const
{
exploreId
,
graphResult
,
loading
,
showingGraph
,
showingTable
,
range
,
split
,
width
}
=
this
.
props
;
const
graphHeight
=
showingGraph
&&
showingTable
?
200
:
400
;
if
(
!
graphResult
)
{
return
null
;
...
...
@@ -48,6 +49,7 @@ export class GraphContainer extends PureComponent<GraphContainerProps> {
onChangeTime=
{
this
.
onChangeTime
}
range=
{
range
}
split=
{
split
}
width=
{
width
}
/>
</
Panel
>
);
...
...
public/app/features/explore/Logs.tsx
View file @
8c65430e
...
...
@@ -214,7 +214,7 @@ export default class Logs extends PureComponent<Props, State> {
<
div
className=
"logs-panel-graph"
>
<
Graph
data=
{
timeSeries
}
height=
"100px"
height=
{
100
}
range=
{
range
}
id=
{
`explore-logs-graph-${exploreId}`
}
onChangeTime=
{
this
.
props
.
onChangeTime
}
...
...
public/app/features/explore/__snapshots__/Graph.test.tsx.snap
View file @
8c65430e
...
...
@@ -7,7 +7,7 @@ exports[`Render should render component 1`] = `
id="graph"
style={
Object {
"height":
"100px"
,
"height":
100
,
}
}
/>
...
...
@@ -480,7 +480,7 @@ exports[`Render should render component with disclaimer 1`] = `
id="graph"
style={
Object {
"height":
"100px"
,
"height":
100
,
}
}
/>
...
...
@@ -962,7 +962,7 @@ exports[`Render should show query return no time series 1`] = `
id="graph"
style={
Object {
"height":
"100px"
,
"height":
100
,
}
}
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment