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
4deca04e
Commit
4deca04e
authored
Jul 15, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #220 from rashidkpc/master
Fix for trend panel and stacked bars on default dashboard
parents
fdb34928
2d542aed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
10 deletions
+32
-10
dashboards/default.json
+2
-3
panels/trends/module.js
+30
-7
No files found.
dashboards/default.json
View file @
4deca04e
...
...
@@ -188,7 +188,7 @@
"spyable"
:
true
,
"zoomlinks"
:
true
,
"bars"
:
true
,
"stack"
:
fals
e
,
"stack"
:
tru
e
,
"points"
:
false
,
"lines"
:
false
,
"legend"
:
true
,
...
...
@@ -266,4 +266,4 @@
"pattern"
:
"[logstash-]YYYY.MM.DD"
,
"default"
:
"logstash-*"
}
}
\ No newline at end of file
}
panels/trends/module.js
View file @
4deca04e
...
...
@@ -48,9 +48,22 @@ angular.module('kibana.trends', [])
if
(
dashboard
.
indices
.
length
==
0
)
{
return
}
else
{
$scope
.
index
=
dashboard
.
indices
$scope
.
index
=
segment
>
0
?
$scope
.
index
:
dashboard
.
indices
;
}
// Determine a time field
var
timeField
=
_
.
uniq
(
_
.
pluck
(
filterSrv
.
getByType
(
'time'
),
'field'
))
if
(
timeField
.
length
>
1
)
{
$scope
.
panel
.
error
=
"Time field must be consistent amongst time filters"
return
}
else
if
(
timeField
.
length
==
0
)
{
$scope
.
panel
.
error
=
"A time filter must exist for this panel to function"
return
}
else
{
timeField
=
timeField
[
0
]
}
$scope
.
time
=
filterSrv
.
timeRange
(
'min'
);
$scope
.
old_time
=
{
from
:
new
Date
(
$scope
.
time
.
from
.
getTime
()
-
interval_to_seconds
(
$scope
.
panel
.
ago
)
*
1000
),
to
:
new
Date
(
$scope
.
time
.
to
.
getTime
()
-
interval_to_seconds
(
$scope
.
panel
.
ago
)
*
1000
)
...
...
@@ -58,12 +71,18 @@ angular.module('kibana.trends', [])
var
_segment
=
_
.
isUndefined
(
segment
)
?
0
:
segment
var
request
=
$scope
.
ejs
.
Request
();
var
_ids_without_time
=
_
.
difference
(
filterSrv
.
ids
,
filterSrv
.
idsByType
(
'time'
))
// Build the question part of the query
_
.
each
(
query
.
ids
,
function
(
id
)
{
var
q
=
$scope
.
ejs
.
FilteredQuery
(
ejs
.
QueryStringQuery
(
query
.
list
[
id
].
query
||
'*'
),
filterSrv
.
getBoolFilter
(
filterSrv
.
ids
))
filterSrv
.
getBoolFilter
(
_ids_without_time
).
must
(
ejs
.
RangeFilter
(
timeField
)
.
from
(
$scope
.
time
.
from
)
.
to
(
$scope
.
time
.
to
)
))
request
=
request
.
facet
(
$scope
.
ejs
.
QueryFacet
(
id
)
...
...
@@ -75,9 +94,11 @@ angular.module('kibana.trends', [])
_
.
each
(
query
.
ids
,
function
(
id
)
{
var
q
=
$scope
.
ejs
.
FilteredQuery
(
ejs
.
QueryStringQuery
(
query
.
list
[
id
].
query
||
'*'
),
ejs
.
RangeFilter
(
$scope
.
time
.
field
)
filterSrv
.
getBoolFilter
(
_ids_without_time
).
must
(
ejs
.
RangeFilter
(
timeField
)
.
from
(
$scope
.
old_time
.
from
)
.
to
(
$scope
.
old_time
.
to
))
.
to
(
$scope
.
old_time
.
to
)
))
request
=
request
.
facet
(
$scope
.
ejs
.
QueryFacet
(
"old_"
+
id
)
.
query
(
q
)
...
...
@@ -92,11 +113,13 @@ angular.module('kibana.trends', [])
kbnIndex
.
indices
(
$scope
.
old_time
.
from
,
$scope
.
old_time
.
to
,
$scope
.
time
.
pattern
,
$scope
.
time
.
interval
dashboard
.
current
.
index
.
pattern
,
dashboard
.
current
.
index
.
interval
).
then
(
function
(
p
)
{
$scope
.
index
=
_
.
union
(
p
,
$scope
.
index
);
process_results
(
request
.
indices
(
$scope
.
index
[
_segment
]).
doSearch
());
request
=
request
.
indices
(
$scope
.
index
[
_segment
])
process_results
(
request
.
doSearch
());
});
}
else
{
process_results
(
request
.
indices
(
$scope
.
index
[
_segment
]).
doSearch
());
...
...
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