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
859c3996
Commit
859c3996
authored
Sep 04, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Namespace kibana url parameters
parent
0280626a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
21 deletions
+24
-21
dashboards/logstash.js
+18
-15
js/app.js
+2
-2
js/services.js
+4
-4
No files found.
dashboards/logstash.js
View file @
859c3996
...
...
@@ -18,14 +18,17 @@
*
*/
var
dashboard
,
ARGS
,
queries
,
_d_timespan
;
'use strict'
;
// Setup some variables
var
dashboard
,
queries
,
_d_timespan
;
// All url parameters are available via the ARGS object
var
ARGS
;
// Set a default timespan if one isn't specified
_d_timespan
=
'1h'
;
// arguments[0] contains a hash of the URL parameters, make it shorter
ARGS
=
arguments
[
0
];
// Intialize a skeleton with nothing but a rows array and service object
dashboard
=
{
rows
:
[],
...
...
@@ -40,7 +43,7 @@ if(!_.isUndefined(ARGS.index)) {
dashboard
.
index
=
{
default
:
ARGS
.
index
,
interval
:
'none'
}
}
;
}
else
{
// Don't fail to default
dashboard
.
failover
=
false
;
...
...
@@ -48,7 +51,7 @@ if(!_.isUndefined(ARGS.index)) {
default
:
ARGS
.
index
||
'ADD_A_TIME_FILTER'
,
pattern
:
ARGS
.
pattern
||
'[logstash-]YYYY.MM.DD'
,
interval
:
ARGS
.
interval
||
'day'
}
}
;
}
// In this dashboard we let users pass queries as comma seperated list to the query parameter.
...
...
@@ -59,7 +62,7 @@ if(!_.isUndefined(ARGS.query)) {
queries
=
_
.
object
(
_
.
map
(
ARGS
.
query
.
split
(
ARGS
.
split
||
','
),
function
(
v
,
k
)
{
return
[
k
,{
query
:
v
,
id
:
parseInt
(
k
),
id
:
parseInt
(
k
,
10
),
alias
:
v
}];
}));
...
...
@@ -70,14 +73,14 @@ if(!_.isUndefined(ARGS.query)) {
query
:
'*'
,
id
:
0
}
}
}
;
}
// Now populate the query service with our objects
dashboard
.
services
.
query
=
{
list
:
queries
,
ids
:
_
.
map
(
_
.
keys
(
queries
),
function
(
v
){
return
parseInt
(
v
);})
}
ids
:
_
.
map
(
_
.
keys
(
queries
),
function
(
v
){
return
parseInt
(
v
,
10
);})
}
;
// Lets also add a default time filter, the value of which can be specified by the user
// This isn't strictly needed, but it gets rid of the info alert about the missing time filter
...
...
@@ -93,7 +96,7 @@ dashboard.services.filter = {
}
},
ids
:
[
0
]
}
}
;
// Ok, lets make some rows. The Filters row is collapsed by default
dashboard
.
rows
=
[
...
...
@@ -138,7 +141,7 @@ dashboard.rows[1].panels = [
{
type
:
'Query'
}
]
]
;
// Add a filtering panel to the 3rd row
...
...
@@ -146,7 +149,7 @@ dashboard.rows[2].panels = [
{
type
:
'filtering'
}
]
]
;
// And a histogram that allows the user to specify the interval and time field
dashboard
.
rows
[
3
].
panels
=
[
...
...
@@ -155,7 +158,7 @@ dashboard.rows[3].panels = [
time_field
:
ARGS
.
timefield
||
"@timestamp"
,
auto_int
:
true
}
]
]
;
// And a table row where you can specify field and sort order
dashboard
.
rows
[
4
].
panels
=
[
...
...
@@ -165,7 +168,7 @@ dashboard.rows[4].panels = [
sort
:
!
_
.
isUndefined
(
ARGS
.
sort
)
?
ARGS
.
sort
.
split
(
','
)
:
[
ARGS
.
timefield
||
'@timestamp'
,
'desc'
],
overflow
:
'expand'
}
]
]
;
// Now return the object and we're good!
return
dashboard
;
js/app.js
View file @
859c3996
...
...
@@ -48,10 +48,10 @@ labjs.wait(function(){
.
when
(
'/dashboard'
,
{
templateUrl
:
'partials/dashboard.html'
,
})
.
when
(
'/dashboard/:
type/:i
d'
,
{
.
when
(
'/dashboard/:
kbnType/:kbnI
d'
,
{
templateUrl
:
'partials/dashboard.html'
,
})
.
when
(
'/dashboard/:
type/:i
d/:params'
,
{
.
when
(
'/dashboard/:
kbnType/:kbnI
d/:params'
,
{
templateUrl
:
'partials/dashboard.html'
})
.
otherwise
({
...
...
js/services.js
View file @
859c3996
...
...
@@ -606,9 +606,9 @@ angular.module('kibana.services', [])
var
route
=
function
()
{
// Is there a dashboard type and id in the URL?
if
(
!
(
_
.
isUndefined
(
$routeParams
.
type
))
&&
!
(
_
.
isUndefined
(
$routeParams
.
i
d
)))
{
var
_type
=
$routeParams
.
t
ype
;
var
_id
=
$routeParams
.
i
d
;
if
(
!
(
_
.
isUndefined
(
$routeParams
.
kbnType
))
&&
!
(
_
.
isUndefined
(
$routeParams
.
kbnI
d
)))
{
var
_type
=
$routeParams
.
kbnT
ype
;
var
_id
=
$routeParams
.
kbnI
d
;
switch
(
_type
)
{
case
(
'elasticsearch'
):
...
...
@@ -827,7 +827,7 @@ angular.module('kibana.services', [])
method
:
"GET"
,
transformResponse
:
function
(
response
)
{
/*jshint -W054 */
var
_f
=
new
Function
(
response
);
var
_f
=
new
Function
(
"ARGS"
,
response
);
return
_f
(
$routeParams
);
}
}).
then
(
function
(
result
)
{
...
...
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