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
421cd5e3
Commit
421cd5e3
authored
Jul 29, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #265 from pheaver/topic/derivequeries
improvements to derivequeries
parents
5631d8f0
20b0bb0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
panels/derivequeries/editor.html
+4
-1
panels/derivequeries/module.js
+16
-2
No files found.
panels/derivequeries/editor.html
View file @
421cd5e3
...
...
@@ -12,9 +12,12 @@
<label
class=
"small"
>
Query Mode
</label>
<select
style=
"width:80%"
ng-change=
"set_refresh(true)"
ng-model=
'panel.mode'
ng-options=
"f for f in ['terms only','AND', 'OR']"
></select>
</div>
<div
class=
"span
5
"
>
<div
class=
"span
4
"
>
<label
class=
"small"
>
Exclude Terms(s) (comma seperated)
</label>
<input
array-join
type=
"text"
style=
"width:90%"
ng-change=
"set_refresh(true)"
ng-model=
'panel.exclude'
></input>
</div>
<div
class=
"span1"
>
<label
class=
"small"
>
Rest
</label><input
type=
"checkbox"
ng-model=
"panel.rest"
ng-checked=
"panel.rest"
ng-change=
"set_refresh(true)"
>
</div>
</div>
</div>
panels/derivequeries/module.js
View file @
421cd5e3
...
...
@@ -8,6 +8,7 @@
* label :: The label to stick over the field
* query :: A string to use as a filter for the terms facet
* field :: the field to facet on
* rest :: include a filter that matches all other terms,
* size :: how many queries to generate
* fields :: a list of fields known to us
* query_mode :: how to create query
...
...
@@ -37,6 +38,7 @@ angular.module('kibana.derivequeries', [])
field
:
'_type'
,
fields
:
[],
spyable
:
true
,
rest
:
false
,
size
:
5
,
mode
:
'terms only'
,
exclude
:
[],
...
...
@@ -89,16 +91,28 @@ angular.module('kibana.derivequeries', [])
suffix
=
' OR ('
+
$scope
.
panel
.
query
+
')'
;
}
var
ids
=
[];
_
.
each
(
results
.
facets
.
query
.
terms
,
function
(
v
)
{
var
terms
=
results
.
facets
.
query
.
terms
;
var
others
=
[];
_
.
each
(
terms
,
function
(
v
)
{
var
_q
=
$scope
.
panel
.
field
+
':"'
+
v
.
term
+
'"'
+
suffix
;
// if it isn't in the list, remove it
var
_iq
=
querySrv
.
findQuery
(
_q
);
if
(
!
_iq
)
{
ids
.
push
(
querySrv
.
set
({
query
:
_q
}));
ids
.
push
(
querySrv
.
set
({
alias
:
v
.
term
,
query
:
_q
}));
}
else
{
ids
.
push
(
_iq
.
id
);
}
others
.
push
(
"NOT ("
+
_q
+
")"
);
});
if
(
$scope
.
panel
.
rest
)
{
var
_other_q
=
others
.
join
(
' AND '
);
var
_iq
=
querySrv
.
findQuery
(
_other_q
);
if
(
!
_iq
)
{
ids
.
push
(
querySrv
.
set
({
alias
:
'other'
,
query
:
_other_q
}));
}
else
{
ids
.
push
(
_iq
.
id
);
}
}
_
.
each
(
_
.
difference
(
$scope
.
panel
.
ids
,
ids
),
function
(
id
){
querySrv
.
remove
(
id
);
});
...
...
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