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
86408301
Commit
86408301
authored
Feb 20, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added close button, related fields to micropanel
parent
985099e9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
52 additions
and
58 deletions
+52
-58
common/css/main.css
+0
-4
common/lib/shared.js
+15
-37
panels/dashcontrol/load.html
+1
-0
panels/dashcontrol/save.html
+1
-1
panels/fields/micropanel.html
+5
-4
panels/fields/module.html
+3
-2
panels/fields/module.js
+18
-3
panels/hits/editor.html
+1
-1
panels/stringquery/module.html
+5
-2
panels/table/module.js
+3
-4
No files found.
common/css/main.css
View file @
86408301
...
@@ -6,10 +6,6 @@
...
@@ -6,10 +6,6 @@
color
:
#000
;
color
:
#000
;
}
}
#upload
{
display
:
inline-block
;
}
.odd
{
.odd
{
background-color
:
#f9f9f9
;
background-color
:
#f9f9f9
;
}
}
...
...
common/lib/shared.js
View file @
86408301
...
@@ -30,18 +30,6 @@ function has_field(obj,field) {
...
@@ -30,18 +30,6 @@ function has_field(obj,field) {
}
}
}
}
// Retuns a sorted array with duplicates removed
function
array_unique
(
arr
)
{
var
sorted_arr
=
arr
.
sort
();
var
results
=
[];
for
(
var
i
=
0
;
i
<=
arr
.
length
-
1
;
i
++
)
{
if
(
sorted_arr
[
i
+
1
]
!=
sorted_arr
[
i
])
{
results
.
push
(
sorted_arr
[
i
]);
}
}
return
results
}
function
get_objids_with_field
(
json
,
field
)
{
function
get_objids_with_field
(
json
,
field
)
{
var
objid_array
=
[];
var
objid_array
=
[];
for
(
hit
in
json
.
hits
.
hits
)
{
for
(
hit
in
json
.
hits
.
hits
)
{
...
@@ -75,15 +63,14 @@ function get_objids_with_field_value(json,field,value) {
...
@@ -75,15 +63,14 @@ function get_objids_with_field_value(json,field,value) {
return
objid_array
;
return
objid_array
;
}
}
function
get_related_fields
(
json
,
field
)
{
function
get_related_fields
(
docs
,
field
)
{
var
field_array
=
[]
var
field_array
=
[]
for
(
hit
in
json
.
hits
.
hits
)
{
_
.
each
(
docs
,
function
(
doc
)
{
var
obj_fields
=
get_object_fields
(
json
.
hits
.
hits
[
hit
])
var
keys
=
_
.
keys
(
doc
)
if
(
_
.
inArray
(
obj_fields
,
field
)
>=
0
)
{
if
(
_
.
contains
(
keys
,
field
))
field_array
.
push
.
apply
(
field_array
,
obj_fields
);
field_array
=
field_array
.
concat
(
keys
)
}
})
}
var
counts
=
_
.
countBy
(
_
.
without
(
field_array
,
field
),
function
(
field
){
return
field
;});
var
counts
=
count_values_in_array
(
field_array
);
return
counts
;
return
counts
;
}
}
...
@@ -100,7 +87,8 @@ function recurse_field_dots(object,field) {
...
@@ -100,7 +87,8 @@ function recurse_field_dots(object,field) {
return
value
;
return
value
;
}
}
// Probably useless now
// Probably useless now, leaving for cases where you might not want
// a flat dot notated data structure
function
get_field_value
(
object
,
field
,
opt
)
{
function
get_field_value
(
object
,
field
,
opt
)
{
var
value
=
recurse_field_dots
(
object
[
'_source'
],
field
);
var
value
=
recurse_field_dots
(
object
[
'_source'
],
field
);
...
@@ -130,23 +118,13 @@ function get_field_value(object,field,opt) {
...
@@ -130,23 +118,13 @@ function get_field_value(object,field,opt) {
return
(
value
!=
null
)
?
value
.
toString
()
:
''
;
return
(
value
!=
null
)
?
value
.
toString
()
:
''
;
}
}
// Returns a big flat array of all values for a field
function
get_all_values_for_field
(
docs
,
field
)
{
var
field_array
=
[];
_
.
each
(
docs
,
function
(
doc
,
k
)
{
var
value
=
doc
[
field
]
||
""
if
(
typeof
value
===
'object'
&&
value
!=
null
)
{
field_array
.
push
.
apply
(
field_array
,
value
);
}
else
{
field_array
.
push
(
value
);
}
})
return
field_array
;
}
function
top_field_values
(
docs
,
field
,
count
)
{
function
top_field_values
(
docs
,
field
,
count
)
{
var
counts
=
_
.
countBy
(
get_all_values_for_field
(
docs
,
field
),
function
(
field
){
return
field
;});
var
counts
=
_
.
countBy
(
_
.
pluck
(
docs
,
field
),
function
(
field
){
return
_
.
pairs
(
counts
).
sort
(
function
(
a
,
b
)
{
return
a
[
1
]
-
b
[
1
]}).
reverse
().
slice
(
0
,
count
)
return
_
.
isUndefined
(
field
)
?
''
:
field
;
});
return
_
.
pairs
(
counts
).
sort
(
function
(
a
,
b
)
{
return
a
[
1
]
-
b
[
1
]
}).
reverse
().
slice
(
0
,
count
)
}
}
function
add_to_query
(
original
,
field
,
value
)
{
function
add_to_query
(
original
,
field
,
value
)
{
...
...
panels/dashcontrol/load.html
View file @
86408301
<div>
<div>
<a
class=
"close"
ng-click=
"dismiss()"
href=
""
>
×
</a>
<div
ng-show=
'panel.load.local'
>
<div
ng-show=
'panel.load.local'
>
<h5>
Local File
</h5>
<h5>
Local File
</h5>
<form>
<form>
...
...
panels/dashcontrol/save.html
View file @
86408301
<div>
<div>
<a
class=
"close"
ng-click=
"dismiss()"
href=
""
>
×
</a>
<div
ng-show=
"panel.save.default || panel.save.local"
>
<div
ng-show=
"panel.save.default || panel.save.local"
>
<h5>
Locally
</h5>
<h5>
Locally
</h5>
<form>
<form>
...
...
panels/fields/micropanel.html
View file @
86408301
<a
class=
"close"
ng-click=
"dismiss()"
href=
""
>
×
</a>
<a
class=
"close"
ng-click=
"dismiss()"
href=
""
>
×
</a>
<h4>
<h4>
Micro Analysis of {{micropanel.field}}
Micro Analysis of {{micropanel.field}}
<i
class=
"pointer icon-search"
ng-click=
"build_search('_exists_',micropanel.field);dismiss();"
></i>
<i
class=
"pointer icon-search"
ng-click=
"build_search('_exists_',micropanel.field);dismiss();"
></i>
<i
class=
"pointer icon-ban-circle"
ng-click=
"build_search('_missing_',micropanel.field);dismiss();"
></i>
<i
class=
"pointer icon-ban-circle"
ng-click=
"build_search('_missing_',micropanel.field);dismiss();"
></i>
<br><small>
{{micropanel.count}} events on this page
</small>
</h4>
</h4>
<table
style=
"width:500px"
class=
'table table-bordered table-striped table-condensed'
>
<table
style=
"width:500px"
class=
'table table-bordered table-striped table-condensed'
>
<thead>
<thead>
...
@@ -21,4 +21,5 @@
...
@@ -21,4 +21,5 @@
<td>
{{field[1]}}
</td>
<td>
{{field[1]}}
</td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
\ No newline at end of file
<span
ng-repeat=
'(field,count) in micropanel.related'
><a
ng-click=
"toggle_field(field)"
>
{{field}}
</a>
({{Math.round((count / micropanel.count) * 100)}}%),
</span>
\ No newline at end of file
panels/fields/module.html
View file @
86408301
<kibana-panel
ng-controller=
'fields'
>
<kibana-panel
ng-controller=
'fields'
>
<ul
class=
"unstyled"
style=
"height:{{row.height}};overflow-y:auto;overflow-x:hidden;"
>
<ul
class=
"unstyled"
style=
"height:{{row.height}};overflow-y:auto;overflow-x:hidden;"
ng-class=
"{'inline': panel.arrange == 'horizontal'}"
>
<li
ng-style=
"panel.style"
ng-repeat=
"field in fields"
>
<li
ng-style=
"panel.style"
ng-repeat=
"field in fields"
>
<i
class=
"pointer"
ng-class=
"{'icon-check': _.indexOf(active,field)>-1,'icon-check-empty': _.indexOf(active,field)<0}"
ng-click=
"toggle_field(field)"
></i>
<i
class=
"pointer"
ng-class=
"{'icon-check': _.indexOf(active,field)>-1,'icon-check-empty': _.indexOf(active,field)<0}"
ng-click=
"toggle_field(field)"
></i>
<a
data-unique=
"1"
bs-popover=
"'panels/fields/micropanel.html'"
ng-click=
"toggle_micropanel(field)"
ng-class=
"{label: _.indexOf(active,field)>-1}"
>
{{field}}
</a>
<a
data-unique=
"1"
bs-popover=
"'panels/fields/micropanel.html'"
data-placement=
"{{panel.micropanel_position}}"
ng-click=
"toggle_micropanel(field)"
ng-class=
"{label: _.indexOf(active,field)>-1}"
>
{{field}}
</a>
</li>
</li>
</ul>
</ul>
</kibana-panel>
</kibana-panel>
\ No newline at end of file
panels/fields/module.js
View file @
86408301
angular
.
module
(
'kibana.fields'
,
[])
angular
.
module
(
'kibana.fields'
,
[])
.
controller
(
'fields'
,
function
(
$scope
,
eventBus
)
{
.
controller
(
'fields'
,
function
(
$scope
,
eventBus
,
$timeout
)
{
var
_id
=
_
.
uniqueId
();
var
_id
=
_
.
uniqueId
();
...
@@ -7,14 +7,17 @@ angular.module('kibana.fields', [])
...
@@ -7,14 +7,17 @@ angular.module('kibana.fields', [])
var
_d
=
{
var
_d
=
{
group
:
"default"
,
group
:
"default"
,
style
:
{},
style
:
{},
arrange
:
'vertical'
,
micropanel_position
:
'right'
,
}
}
_
.
defaults
(
$scope
.
panel
,
_d
);
_
.
defaults
(
$scope
.
panel
,
_d
);
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
Math
=
Math
;
$scope
.
fields
=
[];
$scope
.
fields
=
[];
eventBus
.
register
(
$scope
,
'fields'
,
function
(
event
,
fields
)
{
eventBus
.
register
(
$scope
,
'fields'
,
function
(
event
,
fields
)
{
$scope
.
panel
.
sort
=
_
.
clone
(
fields
.
sort
);
$scope
.
panel
.
sort
=
_
.
clone
(
fields
.
sort
);
$scope
.
fields
=
_
.
union
(
fields
.
all
,
$scope
.
fields
);
$scope
.
fields
=
fields
.
all
,
$scope
.
active
=
_
.
clone
(
fields
.
active
);
$scope
.
active
=
_
.
clone
(
fields
.
active
);
});
});
eventBus
.
register
(
$scope
,
'table_documents'
,
function
(
event
,
docs
)
{
eventBus
.
register
(
$scope
,
'table_documents'
,
function
(
event
,
docs
)
{
...
@@ -23,10 +26,22 @@ angular.module('kibana.fields', [])
...
@@ -23,10 +26,22 @@ angular.module('kibana.fields', [])
});
});
}
}
$scope
.
reload_list
=
function
()
{
var
temp
=
_
.
clone
(
$scope
.
fields
);
$scope
.
fields
=
[]
$timeout
(
function
(){
$scope
.
fields
=
temp
;
},
10
)
}
$scope
.
toggle_micropanel
=
function
(
field
)
{
$scope
.
toggle_micropanel
=
function
(
field
)
{
$scope
.
micropanel
=
{
$scope
.
micropanel
=
{
field
:
field
,
field
:
field
,
values
:
top_field_values
(
$scope
.
docs
,
field
,
10
)
values
:
top_field_values
(
$scope
.
docs
,
field
,
10
),
related
:
get_related_fields
(
$scope
.
docs
,
field
),
count
:
_
.
countBy
(
$scope
.
docs
,
function
(
doc
){
return
_
.
contains
(
_
.
keys
(
doc
),
field
)})[
'true'
],
}
}
}
}
...
...
panels/hits/editor.html
View file @
86408301
<div
class=
"row-fluid"
ng-controller=
"hits"
>
<div
class=
"row-fluid"
>
<div
class=
"span9"
>
<div
class=
"span9"
>
<form
class=
"input-append"
>
<form
class=
"input-append"
>
<h6>
Query
</h6>
<h6>
Query
</h6>
...
...
panels/stringquery/module.html
View file @
86408301
<kibana-panel
ng-controller=
'stringquery'
>
<kibana-panel
ng-controller=
'stringquery'
>
<form
class=
"input-append"
style=
"margin-bottom:0px; width:100%; white-space:nowrap;"
>
<form
class=
"input-append"
style=
"margin-bottom:0px; width:100%; white-space:nowrap;"
>
<label><small>
{{panel.label}}
</small></label>
<label><small>
{{panel.label}}
</small></label>
<input
type=
"text"
ng-model=
"panel.query"
style=
"width:90%"
>
<input
type=
"text"
ng-model=
"panel.query"
style=
"width:85%"
>
<button
type=
"submit"
class=
"btn"
ng-click=
"send_query(panel.query)"
><i
class=
"icon-search"
></i></button>
<button
type=
"submit"
class=
"btn btn-info"
ng-click=
"send_query(panel.query)"
><i
class=
"icon-search"
></i></button>
<button
type=
"submit"
class=
"btn btn-danger"
ng-click=
"panel.query='';send_query(panel.query)"
><i
class=
"icon-ban-circle"
></i></button>
</form>
</form>
</kibana-panel>
</kibana-panel>
\ No newline at end of file
panels/table/module.js
View file @
86408301
...
@@ -102,10 +102,9 @@ angular.module('kibana.table', [])
...
@@ -102,10 +102,9 @@ angular.module('kibana.table', [])
}
}
$scope
.
panel
.
error
=
false
;
$scope
.
panel
.
error
=
false
;
$scope
.
hits
=
results
.
hits
.
total
;
$scope
.
hits
=
results
.
hits
.
total
;
$scope
.
data
=
[]
$scope
.
data
=
_
.
map
(
results
.
hits
.
hits
,
function
(
hit
)
{
_
.
each
(
results
.
hits
.
hits
,
function
(
v
,
k
)
{
return
flatten_json
(
hit
[
'_source'
]);
$scope
.
data
.
push
(
flatten_json
(
v
[
'_source'
]))
});
})
$scope
.
all_fields
=
get_all_fields
(
results
);
$scope
.
all_fields
=
get_all_fields
(
results
);
broadcast_results
();
broadcast_results
();
...
...
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