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
c09cd4ba
Commit
c09cd4ba
authored
Mar 01, 2017
by
jifwin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make load on scroll configurable and use debouce
parent
a3019a97
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
+13
-10
public/app/features/dashboard/model.ts
+2
-0
public/app/features/dashboard/partials/settings.html
+6
-0
public/app/features/panel/metrics_panel_ctrl.ts
+2
-1
public/app/features/panel/panel_directive.ts
+3
-9
No files found.
public/app/features/dashboard/model.ts
View file @
c09cd4ba
...
@@ -36,6 +36,7 @@ export class DashboardModel {
...
@@ -36,6 +36,7 @@ export class DashboardModel {
meta
:
any
;
meta
:
any
;
events
:
any
;
events
:
any
;
editMode
:
boolean
;
editMode
:
boolean
;
loadOnScroll
:
boolean
;
constructor
(
data
,
meta
?)
{
constructor
(
data
,
meta
?)
{
if
(
!
data
)
{
if
(
!
data
)
{
...
@@ -64,6 +65,7 @@ export class DashboardModel {
...
@@ -64,6 +65,7 @@ export class DashboardModel {
this
.
version
=
data
.
version
||
0
;
this
.
version
=
data
.
version
||
0
;
this
.
links
=
data
.
links
||
[];
this
.
links
=
data
.
links
||
[];
this
.
gnetId
=
data
.
gnetId
||
null
;
this
.
gnetId
=
data
.
gnetId
||
null
;
this
.
loadOnScroll
=
data
.
loadOnScroll
||
false
;
this
.
rows
=
[];
this
.
rows
=
[];
if
(
data
.
rows
)
{
if
(
data
.
rows
)
{
...
...
public/app/features/dashboard/partials/settings.html
View file @
c09cd4ba
...
@@ -61,6 +61,12 @@
...
@@ -61,6 +61,12 @@
checked=
"dashboard.hideControls"
checked=
"dashboard.hideControls"
label-class=
"width-11"
>
label-class=
"width-11"
>
</gf-form-switch>
</gf-form-switch>
<gf-form-switch
class=
"gf-form"
label=
"Load on scroll"
tooltip=
"Load panels as they become visible"
checked=
"dashboard.loadOnScroll"
label-class=
"width-11"
>
</gf-form-switch>
</div>
</div>
</div>
</div>
...
...
public/app/features/panel/metrics_panel_ctrl.ts
View file @
c09cd4ba
...
@@ -74,12 +74,13 @@ class MetricsPanelCtrl extends PanelCtrl {
...
@@ -74,12 +74,13 @@ class MetricsPanelCtrl extends PanelCtrl {
// ignore fetching data if another panel is in fullscreen
// ignore fetching data if another panel is in fullscreen
if
(
this
.
otherPanelInFullscreenMode
())
{
return
;
}
if
(
this
.
otherPanelInFullscreenMode
())
{
return
;
}
if
(
this
.
scope
.
ctrl
.
dashboard
.
loadOnScroll
)
{
if
(
!
this
.
scope
.
$$childHead
||
(
!
this
.
scope
.
$$childHead
.
isVisible
()
&&
!
this
.
isRenderGraph
()))
{
if
(
!
this
.
scope
.
$$childHead
||
(
!
this
.
scope
.
$$childHead
.
isVisible
()
&&
!
this
.
isRenderGraph
()))
{
this
.
scope
.
$$childHead
.
needsRefresh
=
true
;
this
.
scope
.
$$childHead
.
needsRefresh
=
true
;
return
;
return
;
}
}
this
.
scope
.
$$childHead
.
needsRefresh
=
false
;
this
.
scope
.
$$childHead
.
needsRefresh
=
false
;
}
// if we have snapshot data use that
// if we have snapshot data use that
if
(
this
.
panel
.
snapshotData
)
{
if
(
this
.
panel
.
snapshotData
)
{
...
...
public/app/features/panel/panel_directive.ts
View file @
c09cd4ba
...
@@ -184,7 +184,6 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
...
@@ -184,7 +184,6 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
}
}
});
});
var
getDataPromise
=
null
;
scope
.
needsRefresh
=
false
;
scope
.
needsRefresh
=
false
;
scope
.
isVisible
=
function
()
{
scope
.
isVisible
=
function
()
{
...
@@ -192,16 +191,11 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
...
@@ -192,16 +191,11 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
return
(
0
<
position
.
top
)
&&
(
position
.
top
<
window
.
innerHeight
);
return
(
0
<
position
.
top
)
&&
(
position
.
top
<
window
.
innerHeight
);
};
};
$document
.
bind
(
'scroll'
,
function
()
{
$document
.
bind
(
'scroll'
,
_
.
debounce
(
function
()
{
if
(
getDataPromise
)
{
if
(
scope
.
ctrl
.
dashboard
.
loadOnScroll
&&
scope
.
needsRefresh
)
{
$timeout
.
cancel
(
getDataPromise
);
}
if
(
scope
.
needsRefresh
)
{
getDataPromise
=
$timeout
(
function
()
{
scope
.
ctrl
.
refresh
();
scope
.
ctrl
.
refresh
();
},
250
);
}
}
});
}
,
250
)
);
}
}
};
};
});
});
...
...
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