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
447bc3a6
Commit
447bc3a6
authored
Jul 05, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'react-panels' of github.com:grafana/grafana into react-panels
parents
09ad8360
ab9e1b35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
11 deletions
+67
-11
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+2
-2
public/app/features/panel/DataPanel.tsx
+65
-9
No files found.
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
447bc3a6
...
...
@@ -9,13 +9,13 @@ import { PanelEditor } from './PanelEditor';
const
TITLE_HEIGHT
=
27
;
const
PANEL_BORDER
=
2
;
export
interface
P
anelChromeP
rops
{
export
interface
Props
{
panel
:
PanelModel
;
dashboard
:
DashboardModel
;
component
:
any
;
}
export
class
PanelChrome
extends
React
.
Component
<
P
anelChromeP
rops
,
any
>
{
export
class
PanelChrome
extends
React
.
Component
<
Props
,
any
>
{
constructor
(
props
)
{
super
(
props
);
...
...
public/app/features/panel/DataPanel.tsx
View file @
447bc3a6
import
React
,
{
Component
,
ComponentClass
}
from
'react'
;
import
_
from
'lodash'
;
export
interface
Props
{
export
interface
Outer
Props
{
type
:
string
;
queries
:
Query
[];
queries
:
any
[];
isVisible
:
boolean
;
}
interface
State
{
isLoading
:
boolean
;
timeSeries
:
TimeSeriesServerResponse
[];
export
interface
AddedProps
{
data
:
any
[];
}
export
interface
OriginalProps
{
data
:
TimeSeriesServerResponse
[];
interface
State
{
isLoading
:
boolean
;
data
:
any
[];
}
const
DataPanel
=
(
ComposedComponent
:
ComponentClass
<
OriginalProps
&
Props
>
)
=>
{
class
Wrapper
extends
Component
<
Props
,
State
>
{}
const
DataPanel
=
(
ComposedComponent
:
ComponentClass
<
AddedProps
&
OuterProps
>
)
=>
{
class
Wrapper
extends
Component
<
OuterProps
,
State
>
{
public
static
defaultProps
=
{
isVisible
:
true
,
};
constructor
(
props
:
OuterProps
)
{
super
(
props
);
this
.
state
=
{
isLoading
:
false
,
data
:
[],
};
}
public
componentDidMount
()
{
this
.
issueQueries
();
}
public
issueQueries
=
()
=>
{
const
{
queries
,
isVisible
}
=
this
.
props
;
if
(
!
isVisible
)
{
return
;
}
if
(
!
queries
.
length
)
{
this
.
setState
({
data
:
[{
message
:
'no queries'
}]
});
return
;
}
this
.
setState
({
isLoading
:
true
});
};
public
render
()
{
const
{
data
,
isLoading
}
=
this
.
state
;
if
(
!
data
.
length
)
{
return
(
<
div
className=
"no-data"
>
<
p
>
No Data
</
p
>
</
div
>
);
}
if
(
isLoading
)
{
return
(
<
div
className=
"loading"
>
<
p
>
Loading
</
p
>
</
div
>
);
}
return
<
ComposedComponent
{
...
this
.
props
}
data=
{
data
}
/>;
}
}
return
Wrapper
;
};
export
default
DataPanel
;
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