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
906f3a3c
Commit
906f3a3c
authored
May 13, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added statistical modes to histogram panel
parent
45c9bb8f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
22 deletions
+53
-22
js/controllers.js
+3
-1
panels/dashcontrol/module.js
+4
-3
panels/fields/module.js
+1
-0
panels/histogram/editor.html
+17
-2
panels/histogram/module.html
+1
-1
panels/histogram/module.js
+17
-9
panels/stringquery/editor.html
+1
-1
panels/table/module.js
+9
-5
No files found.
js/controllers.js
View file @
906f3a3c
...
@@ -9,6 +9,7 @@ angular.module('kibana.controllers', [])
...
@@ -9,6 +9,7 @@ angular.module('kibana.controllers', [])
title
:
""
,
title
:
""
,
editable
:
true
,
editable
:
true
,
rows
:
[],
rows
:
[],
last
:
null
}
}
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
...
@@ -24,7 +25,8 @@ angular.module('kibana.controllers', [])
...
@@ -24,7 +25,8 @@ angular.module('kibana.controllers', [])
// Load dashboard by event
// Load dashboard by event
eventBus
.
register
(
$scope
,
'dashboard'
,
function
(
event
,
dashboard
){
eventBus
.
register
(
$scope
,
'dashboard'
,
function
(
event
,
dashboard
){
$scope
.
dashboards
=
dashboard
;
$scope
.
dashboards
=
dashboard
.
dashboard
;
$scope
.
dashboards
.
last
=
dashboard
.
last
;
_
.
defaults
(
$scope
.
dashboards
,
_d
)
_
.
defaults
(
$scope
.
dashboards
,
_d
)
})
})
...
...
panels/dashcontrol/module.js
View file @
906f3a3c
...
@@ -271,8 +271,10 @@ angular.module('kibana.dashcontrol', [])
...
@@ -271,8 +271,10 @@ angular.module('kibana.dashcontrol', [])
$scope
.
dash_load
=
function
(
dashboard
)
{
$scope
.
dash_load
=
function
(
dashboard
)
{
if
(
!
_
.
isObject
(
dashboard
))
if
(
!
_
.
isObject
(
dashboard
))
dashboard
=
JSON
.
parse
(
dashboard
)
dashboard
=
JSON
.
parse
(
dashboard
)
eventBus
.
broadcast
(
$scope
.
$id
,
'ALL'
,
'dashboard'
,{
eventBus
.
broadcast
(
$scope
.
$id
,
'ALL'
,
'dashboard'
,
dashboard
)
dashboard
:
dashboard
,
last
:
$scope
.
dashboards
})
timer
.
cancel_all
();
timer
.
cancel_all
();
}
}
...
@@ -287,7 +289,6 @@ angular.module('kibana.dashcontrol', [])
...
@@ -287,7 +289,6 @@ angular.module('kibana.dashcontrol', [])
else
else
return
false
return
false
}
}
})
})
.
directive
(
'dashUpload'
,
function
(
timer
,
eventBus
){
.
directive
(
'dashUpload'
,
function
(
timer
,
eventBus
){
return
{
return
{
...
...
panels/fields/module.js
View file @
906f3a3c
...
@@ -40,6 +40,7 @@ angular.module('kibana.fields', [])
...
@@ -40,6 +40,7 @@ angular.module('kibana.fields', [])
eventBus
.
register
(
$scope
,
'table_documents'
,
function
(
event
,
docs
)
{
eventBus
.
register
(
$scope
,
'table_documents'
,
function
(
event
,
docs
)
{
$scope
.
panel
.
query
=
docs
.
query
;
$scope
.
panel
.
query
=
docs
.
query
;
$scope
.
docs
=
docs
.
docs
;
$scope
.
docs
=
docs
.
docs
;
$scope
.
index
=
docs
.
index
;
});
});
eventBus
.
register
(
$scope
,
"get_fields"
,
function
(
event
,
id
)
{
eventBus
.
register
(
$scope
,
"get_fields"
,
function
(
event
,
id
)
{
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
"selected_fields"
,
$scope
.
active
);
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
"selected_fields"
,
$scope
.
active
);
...
...
panels/histogram/editor.html
View file @
906f3a3c
<div>
<div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span3"
>
<div
class=
"span3"
>
<label
class=
"small"
>
Mode
</label>
<select
ng-change=
"set_refresh(true)"
class=
"input-small"
ng-model=
"panel.mode"
ng-options=
"f for f in ['count','min','mean','max','total']"
></select>
</div>
<div
class=
"span3"
>
<label
class=
"small"
>
Field
</label>
<form>
<input
ng-change=
"set_refresh(true)"
placeholder=
"Start typing"
bs-typeahead=
"fields.list"
type=
"text"
class=
"input-small"
ng-model=
"panel.value_field"
>
</form>
</div>
<div
class=
"span5"
ng-show=
"panel.mode != 'count'"
>
<label
class=
"small"
>
Note
</label><small>
In
<strong>
{{panel.mode}}
</strong>
mode the configured field
<strong>
must
</strong>
be a numeric type
</small>
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"span3"
>
<form
style=
"margin-bottom: 0px"
>
<form
style=
"margin-bottom: 0px"
>
<
h6>
Label
</h6
>
<
label
class=
"small"
>
Label
</label
>
<input
type=
"text"
placeholder=
"New Label"
style=
"width:70%"
ng-model=
"newlabel"
>
<input
type=
"text"
placeholder=
"New Label"
style=
"width:70%"
ng-model=
"newlabel"
>
</form>
</form>
</div>
</div>
<div
class=
"span8"
>
<div
class=
"span8"
>
<label
class=
"small"
>
Query
</label>
<form
class=
"input-append"
style=
"margin-bottom: 0px"
>
<form
class=
"input-append"
style=
"margin-bottom: 0px"
>
<h6>
Query
</h6>
<input
type=
"text"
placeholder=
"New Query"
style=
"width:80%"
ng-model=
"newquery"
>
<input
type=
"text"
placeholder=
"New Query"
style=
"width:80%"
ng-model=
"newquery"
>
<button
class=
"btn"
ng-click=
"add_query(newlabel,newquery);newlabel='';newquery=''"
><i
class=
"icon-plus"
></i></button>
<button
class=
"btn"
ng-click=
"add_query(newlabel,newquery);newlabel='';newquery=''"
><i
class=
"icon-plus"
></i></button>
</form>
</form>
...
...
panels/histogram/module.html
View file @
906f3a3c
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<div
style=
"display:inline-block;background:{{series.color}};height:10px;width:10px;border-radius:5px;"
></div>
<div
style=
"display:inline-block;background:{{series.color}};height:10px;width:10px;border-radius:5px;"
></div>
<div
class=
'small'
style=
'display:inline-block'
>
{{series.label}} ({{series.hits}})
</div>
<div
class=
'small'
style=
'display:inline-block'
>
{{series.label}} ({{series.hits}})
</div>
</span>
</span>
<span
ng-show=
"panel.legend"
class=
"small"
>
per
<strong>
{{panel.interval}}
</strong>
| (
<strong>
{{hits}}
</strong>
total
)
</span>
<span
ng-show=
"panel.legend"
class=
"small"
>
<span
ng-show=
"panel.value_field && panel.mode != 'count'"
>
{{panel.value_field}}
</span>
{{panel.mode}} per
<strong>
{{panel.interval}}
</strong>
| (
<strong>
{{hits}}
</strong>
hits
)
</span>
</div>
</div>
<center><img
ng-show=
'panel.loading && _.isUndefined(data)'
src=
"common/img/load_big.gif"
></center>
<center><img
ng-show=
'panel.loading && _.isUndefined(data)'
src=
"common/img/load_big.gif"
></center>
<div
histogram-chart
params=
"{{panel}}"
style=
"height:{{panel.height || row.height}};position:relative"
></div>
<div
histogram-chart
params=
"{{panel}}"
style=
"height:{{panel.height || row.height}};position:relative"
></div>
...
...
panels/histogram/module.js
View file @
906f3a3c
...
@@ -45,6 +45,8 @@ angular.module('kibana.histogram', [])
...
@@ -45,6 +45,8 @@ angular.module('kibana.histogram', [])
var
_d
=
{
var
_d
=
{
group
:
"default"
,
group
:
"default"
,
query
:
[
{
query
:
"*"
,
label
:
"Query"
}
],
query
:
[
{
query
:
"*"
,
label
:
"Query"
}
],
mode
:
'count'
,
value_field
:
null
,
auto_int
:
true
,
auto_int
:
true
,
interval
:
'5m'
,
interval
:
'5m'
,
fill
:
3
,
fill
:
3
,
...
@@ -124,12 +126,20 @@ angular.module('kibana.histogram', [])
...
@@ -124,12 +126,20 @@ angular.module('kibana.histogram', [])
// Build the facet part, injecting the query in as a facet filter
// Build the facet part, injecting the query in as a facet filter
_
.
each
(
queries
,
function
(
v
)
{
_
.
each
(
queries
,
function
(
v
)
{
request
=
request
.
facet
(
$scope
.
ejs
.
DateHistogramFacet
(
"chart"
+
_
.
indexOf
(
queries
,
v
))
var
facet
=
$scope
.
ejs
.
DateHistogramFacet
(
"chart"
+
_
.
indexOf
(
queries
,
v
))
.
field
(
$scope
.
time
.
field
)
.
interval
(
$scope
.
panel
.
interval
)
if
(
$scope
.
panel
.
mode
===
'count'
)
{
.
facetFilter
(
$scope
.
ejs
.
QueryFilter
(
v
))
facet
=
facet
.
field
(
$scope
.
time
.
field
)
).
size
(
0
)
}
else
{
if
(
_
.
isNull
(
$scope
.
panel
.
value_field
))
{
$scope
.
panel
.
error
=
"In "
+
$scope
.
panel
.
mode
+
" mode a field must be specified"
;
return
}
facet
=
facet
.
keyField
(
$scope
.
time
.
field
).
valueField
(
$scope
.
panel
.
value_field
)
}
facet
=
facet
.
interval
(
$scope
.
panel
.
interval
).
facetFilter
(
$scope
.
ejs
.
QueryFilter
(
v
))
request
=
request
.
facet
(
facet
).
size
(
0
)
})
})
// Populate the inspector panel
// Populate the inspector panel
...
@@ -171,14 +181,12 @@ angular.module('kibana.histogram', [])
...
@@ -171,14 +181,12 @@ angular.module('kibana.histogram', [])
// Assemble segments
// Assemble segments
var
segment_data
=
[];
var
segment_data
=
[];
_
.
each
(
v
.
entries
,
function
(
v
,
k
)
{
_
.
each
(
v
.
entries
,
function
(
v
,
k
)
{
segment_data
.
push
([
v
[
'time'
],
v
[
'count'
]])
segment_data
.
push
([
v
[
'time'
],
v
[
$scope
.
panel
.
mode
]])
hits
+=
v
[
'count'
];
// The series level hits counter
hits
+=
v
[
'count'
];
// The series level hits counter
$scope
.
hits
+=
v
[
'count'
];
// Entire dataset level hits counter
$scope
.
hits
+=
v
[
'count'
];
// Entire dataset level hits counter
});
});
data
.
splice
.
apply
(
data
,[
1
,
0
].
concat
(
segment_data
))
// Join histogram data
data
.
splice
.
apply
(
data
,[
1
,
0
].
concat
(
segment_data
))
// Join histogram data
// Create the flot series object
// Create the flot series object
var
series
=
{
var
series
=
{
data
:
{
data
:
{
...
...
panels/stringquery/editor.html
View file @
906f3a3c
<div>
<div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<div
class=
"span2"
>
<label
class=
"small"
>
Mul
it
-query
</label><input
type=
"checkbox"
ng-change=
"set_multi(panel.multi) "
ng-model=
"panel.multi"
ng-checked=
"panel.multi"
>
<label
class=
"small"
>
Mul
ti
-query
</label><input
type=
"checkbox"
ng-change=
"set_multi(panel.multi) "
ng-model=
"panel.multi"
ng-checked=
"panel.multi"
>
</div>
</div>
<div
class=
"span3"
ng-show=
"panel.multi"
>
<div
class=
"span3"
ng-show=
"panel.multi"
>
<label
class=
"small"
>
Arrangement
</label>
<label
class=
"small"
>
Arrangement
</label>
...
...
panels/table/module.js
View file @
906f3a3c
...
@@ -70,10 +70,10 @@ angular.module('kibana.table', [])
...
@@ -70,10 +70,10 @@ angular.module('kibana.table', [])
eventBus
.
register
(
$scope
,
'selected_fields'
,
function
(
event
,
fields
)
{
eventBus
.
register
(
$scope
,
'selected_fields'
,
function
(
event
,
fields
)
{
$scope
.
panel
.
fields
=
_
.
clone
(
fields
)
$scope
.
panel
.
fields
=
_
.
clone
(
fields
)
});
});
eventBus
.
register
(
$scope
,
'table_documents'
,
function
(
event
,
docs
)
{
eventBus
.
register
(
$scope
,
'table_documents'
,
function
(
event
,
docs
)
{
$scope
.
panel
.
query
=
docs
.
query
;
$scope
.
panel
.
query
=
docs
.
query
;
$scope
.
data
=
docs
.
docs
;
$scope
.
data
=
docs
.
docs
;
});
});
}
}
$scope
.
set_sort
=
function
(
field
)
{
$scope
.
set_sort
=
function
(
field
)
{
...
@@ -220,7 +220,11 @@ angular.module('kibana.table', [])
...
@@ -220,7 +220,11 @@ angular.module('kibana.table', [])
active
:
$scope
.
panel
.
fields
active
:
$scope
.
panel
.
fields
});
});
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
"table_documents"
,
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
"table_documents"
,
{
query
:
$scope
.
panel
.
query
,
docs
:
$scope
.
data
});
{
query
:
$scope
.
panel
.
query
,
docs
:
$scope
.
data
,
index
:
$scope
.
index
});
}
}
function
set_time
(
time
)
{
function
set_time
(
time
)
{
...
...
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