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
febe56b0
Commit
febe56b0
authored
Sep 18, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(timepicker): fixed zoomout
parent
f5e67228
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
public/app/features/dashboard/timepicker/timepicker.html
+1
-1
public/app/features/dashboard/timepicker/timepicker.ts
+17
-2
No files found.
public/app/features/dashboard/timepicker/timepicker.html
View file @
febe56b0
<ul
class=
"nav gf-timepicker-nav"
>
<li
class=
"grafana-menu-zoom-out"
>
<a
class=
'small'
ng-click=
'zoom(2)'
>
<a
class=
'small'
ng-click=
'
ctrl.
zoom(2)'
>
Zoom Out
</a>
</li>
...
...
public/app/features/dashboard/timepicker/timepicker.ts
View file @
febe56b0
...
...
@@ -31,7 +31,7 @@ export class TimePickerCtrl {
$scope
.
ctrl
=
this
;
$rootScope
.
onAppEvent
(
'refresh'
,
()
=>
this
.
init
(),
$scope
);
$rootScope
.
onAppEvent
(
'zoom-out'
,
()
=>
this
.
zoom
Out
(
),
$scope
);
$rootScope
.
onAppEvent
(
'zoom-out'
,
()
=>
this
.
zoom
(
2
),
$scope
);
this
.
init
();
}
...
...
@@ -50,7 +50,22 @@ export class TimePickerCtrl {
this
.
tooltip
+=
this
.
dashboard
.
formatDate
(
time
.
to
);
}
zoomOut
()
{
zoom
(
factor
)
{
var
range
=
this
.
timeSrv
.
timeRange
();
var
timespan
=
(
range
.
to
.
valueOf
()
-
range
.
from
.
valueOf
());
var
center
=
range
.
to
.
valueOf
()
-
timespan
/
2
;
var
to
=
(
center
+
(
timespan
*
factor
)
/
2
);
var
from
=
(
center
-
(
timespan
*
factor
)
/
2
);
if
(
to
>
Date
.
now
()
&&
range
.
to
<=
Date
.
now
())
{
var
offset
=
to
-
Date
.
now
();
from
=
from
-
offset
;
to
=
Date
.
now
();
}
this
.
timeSrv
.
setTime
({
from
:
moment
.
utc
(
from
),
to
:
moment
.
utc
(
to
)
});
}
openDropdown
()
{
...
...
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