Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
qorus
grafana
Commits
291dd9bd
Commit
291dd9bd
authored
Mar 01, 2014
by
Torkel Ödegaard
Browse files
absolute time ranges (zoom in) works with influxdb
parent
549eeeb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/panels/graphite/module.js
View file @
291dd9bd
...
...
@@ -207,8 +207,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope
.
datasources
=
datasourceSrv
.
listOptions
();
$scope
.
datasourceChanged
();
$scope
.
get_data
();
};
$scope
.
datasourceChanged
=
function
()
{
...
...
@@ -225,12 +223,13 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope
.
updateTimeRange
=
function
()
{
$scope
.
range
=
filterSrv
.
timeRange
();
$scope
.
rangeUnparsed
=
filterSrv
.
timeRange
(
false
);
$scope
.
resolution
=
(
$
(
window
).
width
()
/
(
$scope
.
panel
.
span
/
12
))
/
2
;
$scope
.
interval
=
'
10m
'
;
if
(
$scope
.
range
)
{
$scope
.
interval
=
kbn
.
secondsToHms
(
kbn
.
calculate_interval
(
$scope
.
range
.
from
,
$scope
.
range
.
to
,
$scope
.
panel
.
resolution
,
0
)
/
1000
kbn
.
calculate_interval
(
$scope
.
range
.
from
,
$scope
.
range
.
to
,
$scope
.
resolution
,
0
)
/
1000
);
}
};
...
...
@@ -247,7 +246,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
interval
:
$scope
.
interval
,
targets
:
$scope
.
panel
.
targets
,
format
:
$scope
.
panel
.
renderer
===
'
png
'
?
'
png
'
:
'
json
'
,
maxDataPoints
:
$scope
.
panel
.
span
*
50
,
maxDataPoints
:
$scope
.
resolution
,
datasource
:
$scope
.
panel
.
datasource
};
...
...
src/app/partials/influxdb/editor.html
View file @
291dd9bd
...
...
@@ -46,7 +46,7 @@
<ul
class=
"grafana-segment-list"
role=
"menu"
>
<li>
<a
class=
"grafana-target-segment"
>
F
rom series
f
rom series
</a>
</li>
<li>
...
...
@@ -59,7 +59,7 @@
</li>
<li>
<a
class=
"grafana-target-segment"
>
S
elect
s
elect
</a>
</li>
<li>
...
...
@@ -72,7 +72,7 @@
</li>
<li>
<a
class=
"grafana-target-segment"
>
F
unction
f
unction
</a>
</li>
<li>
...
...
@@ -88,5 +88,5 @@
</div>
<div
class=
"editor-row"
style=
"margin-top: 20px"
ng-show=
"editor.index == 1"
>
<button
class=
"btn btn-success pull-right"
ng-click=
"add_target(panel.target)"
>
Add
target
</button>
<button
class=
"btn btn-success pull-right"
ng-click=
"add_target(panel.target)"
>
Add
query
</button>
</div>
\ No newline at end of file
src/app/services/influxdb/influxdbDatasource.js
View file @
291dd9bd
...
...
@@ -86,7 +86,27 @@ function (angular, _) {
};
function
getTimeFilter
(
options
)
{
return
"
time > now() - 6h
"
;
var
from
=
options
.
range
.
from
;
var
until
=
options
.
range
.
to
;
if
(
_
.
isString
(
from
))
{
return
'
time > now() -
'
+
from
.
substring
(
4
);
}
else
{
from
=
to_utc_epoch_seconds
(
from
);
}
if
(
until
===
'
now
'
)
{
return
'
time >
'
+
from
;
}
else
{
until
=
to_utc_epoch_seconds
(
until
);
return
'
time >
'
+
from
+
'
and time <
'
+
until
;
}
}
function
to_utc_epoch_seconds
(
date
)
{
return
(
date
.
getTime
()
/
1000
).
toFixed
(
0
)
+
'
s
'
;
}
...
...
Write
Preview
Supports
Markdown
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