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
55467e26
Commit
55467e26
authored
Dec 29, 2013
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added shortcut to zoom out (ctrl+z)
parent
ebf1db75
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
60 deletions
+45
-60
src/app/controllers/all.js
+0
-1
src/app/controllers/dash.js
+4
-0
src/app/controllers/dashLoader.js
+34
-1
src/app/controllers/zoom.js
+0
-46
src/app/directives/kibanaPanel.js
+2
-2
src/app/panels/graphite/module.js
+4
-9
src/app/partials/dashLoader.html
+1
-1
No files found.
src/app/controllers/all.js
View file @
55467e26
...
...
@@ -3,7 +3,6 @@ define([
'./dashLoader'
,
'./row'
,
'./pulldown'
,
'./zoom'
,
'./search'
,
'./metricKeys'
,
'./graphiteTarget'
...
...
src/app/controllers/dash.js
View file @
55467e26
...
...
@@ -91,6 +91,10 @@ function (angular, $, config, _) {
dashboard
.
refresh
();
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'ctrl+z'
,
function
(
evt
)
{
$rootScope
.
$emit
(
'zoom-out'
,
evt
);
},
{
inputDisabled
:
true
});
keyboardManager
.
bind
(
'esc'
,
function
()
{
var
popups
=
$
(
'.popover.in'
);
if
(
popups
.
length
>
0
)
{
...
...
src/app/controllers/dashLoader.js
View file @
55467e26
...
...
@@ -7,7 +7,7 @@ function (angular, _) {
var
module
=
angular
.
module
(
'kibana.controllers'
);
module
.
controller
(
'dashLoader'
,
function
(
$scope
,
$rootScope
,
$http
,
timer
,
dashboard
,
alertSrv
,
$location
)
{
module
.
controller
(
'dashLoader'
,
function
(
$scope
,
$rootScope
,
$http
,
dashboard
,
alertSrv
,
$location
,
filterSrv
)
{
$scope
.
loader
=
dashboard
.
current
.
loader
;
$scope
.
init
=
function
()
{
...
...
@@ -18,6 +18,10 @@ function (angular, _) {
$rootScope
.
$on
(
'save-dashboard'
,
function
()
{
$scope
.
elasticsearch_save
(
'dashboard'
,
false
);
});
$rootScope
.
$on
(
'zoom-out'
,
function
()
{
$scope
.
zoom
(
2
);
});
};
$scope
.
showDropdown
=
function
(
type
)
{
...
...
@@ -131,6 +135,35 @@ function (angular, _) {
});
};
// function $scope.zoom
// factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan
$scope
.
zoom
=
function
(
factor
)
{
var
_range
=
filterSrv
.
timeRange
(
'last'
);
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 we're not already looking into the future, don't.
if
(
_to
>
Date
.
now
()
&&
_range
.
to
<
Date
.
now
())
{
var
_offset
=
_to
-
Date
.
now
();
_from
=
_from
-
_offset
;
_to
=
Date
.
now
();
}
if
(
factor
>
1
)
{
filterSrv
.
removeByType
(
'time'
);
}
filterSrv
.
set
({
type
:
'time'
,
from
:
moment
.
utc
(
_from
).
toDate
(),
to
:
moment
.
utc
(
_to
).
toDate
(),
field
:
"@timestamp"
});
};
});
});
src/app/controllers/zoom.js
deleted
100644 → 0
View file @
ebf1db75
define
([
'angular'
,
'app'
,
'underscore'
,
'moment'
,
],
function
(
angular
,
app
,
_
,
moment
)
{
'use strict'
;
var
module
=
angular
.
module
(
'kibana.controllers'
);
module
.
controller
(
'ZoomCtrl'
,
function
(
$scope
,
filterSrv
)
{
// function $scope.zoom
// factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan
$scope
.
zoom
=
function
(
factor
)
{
var
_range
=
filterSrv
.
timeRange
(
'last'
);
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 we're not already looking into the future, don't.
if
(
_to
>
Date
.
now
()
&&
_range
.
to
<
Date
.
now
())
{
var
_offset
=
_to
-
Date
.
now
();
_from
=
_from
-
_offset
;
_to
=
Date
.
now
();
}
if
(
factor
>
1
)
{
filterSrv
.
removeByType
(
'time'
);
}
filterSrv
.
set
({
type
:
'time'
,
from
:
moment
.
utc
(
_from
).
toDate
(),
to
:
moment
.
utc
(
_to
).
toDate
(),
field
:
"@timestamp"
});
};
});
});
\ No newline at end of file
src/app/directives/kibanaPanel.js
View file @
55467e26
...
...
@@ -55,11 +55,11 @@ function (angular) {
'{{panel.title}}'
+
'</span>'
+
'<ul class="dropdown-menu" role="menu">'
+
'<li ng-repeat="item in panelMenuItems"><a ng-click="item.action();">{{item.text}}</a></li>'
+
'<li ng-repeat="item in panelMe
ta.me
nuItems"><a ng-click="item.action();">{{item.text}}</a></li>'
+
'</ul>'
+
'</span>'
+
'<span ng-if="!panelMenuItems" class="row-button row-text panel-title pointer" ng-show="panel.title">'
+
'<span ng-if="!panelMe
ta.me
nuItems" class="row-button row-text panel-title pointer" ng-show="panel.title">'
+
'{{panel.title}}'
+
'</span>'
+
...
...
src/app/panels/graphite/module.js
View file @
55467e26
...
...
@@ -56,9 +56,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
],
menuItems
:
[
{
text
:
'View fullscreen'
,
action
:
$scope
.
toggleFullscreen
},
{
text
:
'Edit'
,
action
:
$scope
.
openConfigureModal
},
{
text
:
'Duplicate'
,
action
:
$scope
.
duplicate
}
{
text
:
'View fullscreen'
,
action
:
function
()
{
$scope
.
toggleFullscreen
();
}},
{
text
:
'Edit'
,
action
:
function
()
{
$scope
.
openConfigureModal
();
}},
{
text
:
'Duplicate'
,
action
:
function
()
{
$scope
.
duplicate
();
}},
{
text
:
'Remove'
,
action
:
function
()
{
$scope
.
remove_panel_from_row
(
$scope
.
row
,
$scope
.
panel
);
}}
],
status
:
"Unstable"
,
...
...
@@ -212,12 +213,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope
.
init
=
function
()
{
$scope
.
panelMenuItems
=
[
{
text
:
'View fullscreen'
,
action
:
$scope
.
toggleFullscreen
},
{
text
:
'Edit'
,
action
:
$scope
.
openConfigureModal
},
{
text
:
'Duplicate'
,
action
:
$scope
.
duplicate
}
];
// Hide view options by default
$scope
.
options
=
false
;
$scope
.
editor
=
{
index
:
1
};
...
...
src/app/partials/dashLoader.html
View file @
55467e26
...
...
@@ -5,7 +5,7 @@
</style>
<li>
<a
class=
'small'
ng-c
ontroller=
"ZoomCtrl"
ng-c
lick=
'zoom(2)'
>
<a
class=
'small'
ng-click=
'zoom(2)'
>
Zoom Out
</a>
</li>
...
...
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