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
6a42b95d
Commit
6a42b95d
authored
Mar 23, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(panels): panel refactorings
parent
cb49e11e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
13 deletions
+23
-13
public/app/features/panel/metrics_panel_ctrl.ts
+1
-1
public/app/plugins/panel/graph/module.ts
+3
-2
public/app/plugins/panel/singlestat/module.ts
+10
-4
public/app/plugins/panel/table/module.ts
+9
-6
No files found.
public/app/features/panel/metrics_panel_ctrl.ts
View file @
6a42b95d
...
...
@@ -60,7 +60,7 @@ class MetricsPanelCtrl extends PanelCtrl {
// if we have snapshot data use that
if
(
this
.
panel
.
snapshotData
)
{
this
.
updateTimeRange
();
this
.
events
.
emit
(
'
load-snapshot
'
,
this
.
panel
.
snapshotData
);
this
.
events
.
emit
(
'
data-snapshot-load
'
,
this
.
panel
.
snapshotData
);
return
;
}
...
...
public/app/plugins/panel/graph/module.ts
View file @
6a42b95d
...
...
@@ -109,6 +109,7 @@ class GraphCtrl extends MetricsPanelCtrl {
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
this
.
events
.
on
(
'data-snapshot-load'
,
this
.
onDataSnapshotLoad
.
bind
(
this
));
}
initEditMode
()
{
...
...
@@ -150,9 +151,9 @@ class GraphCtrl extends MetricsPanelCtrl {
this
.
publishAppEvent
(
'zoom-out'
,
evt
);
}
loadSnapshot
(
snapshotData
)
{
onDataSnapshotLoad
(
snapshotData
)
{
this
.
annotationsPromise
=
this
.
annotationsSrv
.
getAnnotations
(
this
.
dashboard
);
this
.
dataHandler
(
snapshotD
ata
);
this
.
onDataReceived
(
snapshotData
.
d
ata
);
}
onDataError
(
err
)
{
...
...
public/app/plugins/panel/singlestat/module.ts
View file @
6a42b95d
...
...
@@ -56,6 +56,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
this
.
events
.
on
(
'data-snapshot-load'
,
this
.
onDataSnapshotLoad
.
bind
(
this
));
}
initEditMode
()
{
...
...
@@ -71,9 +72,8 @@ class SingleStatCtrl extends MetricsPanelCtrl {
this
.
render
();
}
loadSnapshot
(
snapshotData
)
{
// give element time to get attached and get dimensions
this
.
$timeout
(()
=>
this
.
dataHandler
(
snapshotData
),
50
);
onDataSnapshotLoad
(
snapshotData
)
{
this
.
onDataReceived
(
snapshotData
.
data
);
}
onDataError
(
err
)
{
...
...
@@ -284,8 +284,14 @@ class SingleStatCtrl extends MetricsPanelCtrl {
function
addSparkline
()
{
var
width
=
elem
.
width
()
+
20
;
var
height
=
ctrl
.
height
;
if
(
width
<
30
)
{
// element has not gotten it's width yet
// delay sparkline render
setTimeout
(
addSparkline
,
30
);
return
;
}
var
height
=
ctrl
.
height
;
var
plotCanvas
=
$
(
'<div></div>'
);
var
plotCss
:
any
=
{};
plotCss
.
position
=
'absolute'
;
...
...
public/app/plugins/panel/table/module.ts
View file @
6a42b95d
...
...
@@ -60,6 +60,7 @@ class TablePanelCtrl extends MetricsPanelCtrl {
this
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
));
this
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
));
this
.
events
.
on
(
'data-snapshot-load'
,
this
.
onDataSnapshotLoad
.
bind
(
this
));
}
initEditMode
()
{
...
...
@@ -86,6 +87,10 @@ class TablePanelCtrl extends MetricsPanelCtrl {
return
super
.
issueQueries
(
datasource
);
}
onDataSnapshotLoad
(
data
)
{
this
.
onDataReceived
(
data
.
data
);
}
onDataError
(
err
)
{
this
.
dataRaw
=
[];
this
.
render
();
...
...
@@ -141,15 +146,13 @@ class TablePanelCtrl extends MetricsPanelCtrl {
var
formaters
=
[];
function
getTableHeight
()
{
var
panelHeight
=
ctrl
.
height
||
ctrl
.
panel
.
height
||
ctrl
.
row
.
height
;
if
(
_
.
isString
(
panelHeight
))
{
panelHeight
=
parseInt
(
panelHeight
.
replace
(
'px'
,
''
),
10
);
}
var
panelHeight
=
ctrl
.
height
;
if
(
pageCount
>
1
)
{
panelHeight
-=
2
8
;
panelHeight
-=
2
6
;
}
return
(
panelHeight
-
60
)
+
'px'
;
return
(
panelHeight
-
31
)
+
'px'
;
}
function
appendTableRows
(
tbodyElem
)
{
...
...
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