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
6a1a9768
Commit
6a1a9768
authored
Jul 22, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed query service to querySrv, added query pinning
parent
e5ff7411
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
123 additions
and
66 deletions
+123
-66
js/filters.js
+14
-0
js/services.js
+21
-4
panels/bettermap/module.js
+3
-3
panels/fields/module.js
+1
-1
panels/histogram/module.js
+8
-8
panels/hits/module.js
+9
-9
panels/map/module.js
+2
-2
panels/pie/module.js
+6
-5
panels/query/meta.html
+10
-4
panels/query/module.html
+22
-9
panels/query/module.js
+8
-3
panels/table/module.js
+5
-5
panels/trends/module.html
+3
-2
panels/trends/module.js
+11
-11
No files found.
js/filters.js
View file @
6a1a9768
...
@@ -7,4 +7,17 @@ angular.module('kibana.filters', [])
...
@@ -7,4 +7,17 @@ angular.module('kibana.filters', [])
return
function
(
input
)
{
return
function
(
input
)
{
return
input
.
sort
();
return
input
.
sort
();
};
};
}).
filter
(
'pinnedQuery'
,
function
(
querySrv
)
{
return
function
(
items
,
pinned
)
{
var
ret
=
_
.
filter
(
querySrv
.
ids
,
function
(
id
){
var
v
=
querySrv
.
list
[
id
];
if
(
!
_
.
isUndefined
(
v
.
pin
)
&&
v
.
pin
===
true
&&
pinned
===
true
)
{
return
true
;
}
if
((
_
.
isUndefined
(
v
.
pin
)
||
v
.
pin
===
false
)
&&
pinned
===
false
)
{
return
true
;
}
});
});
return
ret
;
};
});
\ No newline at end of file
js/services.js
View file @
6a1a9768
...
@@ -193,7 +193,7 @@ angular.module('kibana.services', [])
...
@@ -193,7 +193,7 @@ angular.module('kibana.services', [])
};
};
})
})
.
service
(
'query
'
,
function
(
dashboard
)
{
.
service
(
'query
Srv'
,
function
(
dashboard
,
ejsResource
)
{
// Create an object to hold our service state on the dashboard
// Create an object to hold our service state on the dashboard
dashboard
.
current
.
services
.
query
=
dashboard
.
current
.
services
.
query
||
{};
dashboard
.
current
.
services
.
query
=
dashboard
.
current
.
services
.
query
||
{};
_
.
defaults
(
dashboard
.
current
.
services
.
query
,{
_
.
defaults
(
dashboard
.
current
.
services
.
query
,{
...
@@ -203,7 +203,9 @@ angular.module('kibana.services', [])
...
@@ -203,7 +203,9 @@ angular.module('kibana.services', [])
});
});
// For convenience
// For convenience
var
ejs
=
ejsResource
(
config
.
elasticsearch
);
var
_q
=
dashboard
.
current
.
services
.
query
;
var
_q
=
dashboard
.
current
.
services
.
query
;
this
.
colors
=
[
this
.
colors
=
[
"#7EB26D"
,
"#EAB839"
,
"#6ED0E0"
,
"#EF843C"
,
"#E24D42"
,
"#1F78C1"
,
"#BA43A9"
,
"#705DA0"
,
//1
"#7EB26D"
,
"#EAB839"
,
"#6ED0E0"
,
"#EF843C"
,
"#E24D42"
,
"#1F78C1"
,
"#BA43A9"
,
"#705DA0"
,
//1
"#508642"
,
"#CCA300"
,
"#447EBC"
,
"#C15C17"
,
"#890F02"
,
"#0A437C"
,
"#6D1F62"
,
"#584477"
,
//2
"#508642"
,
"#CCA300"
,
"#447EBC"
,
"#C15C17"
,
"#890F02"
,
"#0A437C"
,
"#6D1F62"
,
"#584477"
,
//2
...
@@ -243,6 +245,7 @@ angular.module('kibana.services', [])
...
@@ -243,6 +245,7 @@ angular.module('kibana.services', [])
query
:
'*'
,
query
:
'*'
,
alias
:
''
,
alias
:
''
,
color
:
colorAt
(
_id
),
color
:
colorAt
(
_id
),
pin
:
false
,
id
:
_id
,
id
:
_id
,
type
:
'lucene'
type
:
'lucene'
};
};
...
@@ -268,6 +271,20 @@ angular.module('kibana.services', [])
...
@@ -268,6 +271,20 @@ angular.module('kibana.services', [])
}
}
};
};
this
.
getEjsObj
=
function
(
id
)
{
return
self
.
toEjsObj
(
self
.
list
[
id
]);
};
this
.
toEjsObj
=
function
(
q
)
{
switch
(
q
.
type
)
{
case
'lucene'
:
return
ejs
.
QueryStringQuery
(
q
.
query
||
'*'
);
default
:
return
_
.
isUndefined
(
q
.
query
)
?
false
:
ejs
.
QueryStringQuery
(
q
.
query
||
'*'
);
}
};
this
.
findQuery
=
function
(
queryString
)
{
this
.
findQuery
=
function
(
queryString
)
{
return
_
.
findWhere
(
self
.
list
,{
query
:
queryString
});
return
_
.
findWhere
(
self
.
list
,{
query
:
queryString
});
};
};
...
@@ -485,7 +502,7 @@ angular.module('kibana.services', [])
...
@@ -485,7 +502,7 @@ angular.module('kibana.services', [])
// Store a reference to this
// Store a reference to this
var
self
=
this
;
var
self
=
this
;
var
filterSrv
,
query
;
var
filterSrv
,
query
Srv
;
this
.
current
=
{};
this
.
current
=
{};
this
.
last
=
{};
this
.
last
=
{};
...
@@ -574,11 +591,11 @@ angular.module('kibana.services', [])
...
@@ -574,11 +591,11 @@ angular.module('kibana.services', [])
self
.
current
=
_
.
clone
(
dashboard
);
self
.
current
=
_
.
clone
(
dashboard
);
// Ok, now that we've setup the current dashboard, we can inject our services
// Ok, now that we've setup the current dashboard, we can inject our services
query
=
$injector
.
get
(
'query
'
);
query
Srv
=
$injector
.
get
(
'querySrv
'
);
filterSrv
=
$injector
.
get
(
'filterSrv'
);
filterSrv
=
$injector
.
get
(
'filterSrv'
);
// Make sure these re-init
// Make sure these re-init
query
.
init
();
query
Srv
.
init
();
filterSrv
.
init
();
filterSrv
.
init
();
if
(
dashboard
.
index
.
interval
!==
'none'
&&
filterSrv
.
idsByType
(
'time'
).
length
===
0
)
{
if
(
dashboard
.
index
.
interval
!==
'none'
&&
filterSrv
.
idsByType
(
'time'
).
length
===
0
)
{
...
...
panels/bettermap/module.js
View file @
6a1a9768
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.bettermap'
,
[])
angular
.
module
(
'kibana.bettermap'
,
[])
.
controller
(
'bettermap'
,
function
(
$scope
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'bettermap'
,
function
(
$scope
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
@@ -67,8 +67,8 @@ angular.module('kibana.bettermap', [])
...
@@ -67,8 +67,8 @@ angular.module('kibana.bettermap', [])
var
_segment
=
_
.
isUndefined
(
segment
)
?
0
:
segment
;
var
_segment
=
_
.
isUndefined
(
segment
)
?
0
:
segment
;
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
_
.
each
(
query
.
list
,
function
(
q
)
{
_
.
each
(
query
Srv
.
list
,
function
(
q
)
{
boolQuery
=
boolQuery
.
should
(
$scope
.
ejs
.
QueryStringQuery
((
q
.
query
||
'*'
)
));
boolQuery
=
boolQuery
.
should
(
querySrv
.
toEjsObj
(
q
));
});
});
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
])
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
])
...
...
panels/fields/module.js
View file @
6a1a9768
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.fields'
,
[])
angular
.
module
(
'kibana.fields'
,
[])
.
controller
(
'fields'
,
function
(
$scope
,
eventBus
,
$timeout
,
dashboard
,
query
,
filterSrv
)
{
.
controller
(
'fields'
,
function
(
$scope
,
eventBus
,
$timeout
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
...
panels/histogram/module.js
View file @
6a1a9768
...
@@ -41,15 +41,15 @@
...
@@ -41,15 +41,15 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.histogram'
,
[])
angular
.
module
(
'kibana.histogram'
,
[])
.
controller
(
'histogram'
,
function
(
$scope
,
eventBus
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'histogram'
,
function
(
$scope
,
eventBus
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
status
:
"Stable"
,
status
:
"Stable"
,
group
:
"default"
,
group
:
"default"
,
query
:
[
{
query
:
"*"
,
label
:
"Query"
}
],
mode
:
'count'
,
mode
:
'count'
,
time_field
:
'@timestamp'
,
time_field
:
'@timestamp'
,
queries
:
[],
value_field
:
null
,
value_field
:
null
,
auto_int
:
true
,
auto_int
:
true
,
resolution
:
100
,
resolution
:
100
,
...
@@ -73,7 +73,7 @@ angular.module('kibana.histogram', [])
...
@@ -73,7 +73,7 @@ angular.module('kibana.histogram', [])
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
quer
ies
=
query
;
$scope
.
quer
ySrv
=
querySrv
;
$scope
.
$on
(
'refresh'
,
function
(){
$scope
.
$on
(
'refresh'
,
function
(){
$scope
.
get_data
();
$scope
.
get_data
();
...
@@ -103,9 +103,9 @@ angular.module('kibana.histogram', [])
...
@@ -103,9 +103,9 @@ angular.module('kibana.histogram', [])
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
]);
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
]);
// Build the query
// Build the query
_
.
each
(
$scope
.
queries
.
ids
,
function
(
id
)
{
_
.
each
(
querySrv
.
ids
,
function
(
id
)
{
var
query
=
$scope
.
ejs
.
FilteredQuery
(
var
query
=
$scope
.
ejs
.
FilteredQuery
(
$scope
.
ejs
.
QueryStringQuery
(
$scope
.
queries
.
list
[
id
].
query
||
'*'
),
querySrv
.
getEjsObj
(
id
),
filterSrv
.
getBoolFilter
(
filterSrv
.
ids
)
filterSrv
.
getBoolFilter
(
filterSrv
.
ids
)
);
);
...
@@ -151,13 +151,13 @@ angular.module('kibana.histogram', [])
...
@@ -151,13 +151,13 @@ angular.module('kibana.histogram', [])
// Make sure we're still on the same query/queries
// Make sure we're still on the same query/queries
if
(
$scope
.
query_id
===
query_id
&&
if
(
$scope
.
query_id
===
query_id
&&
_
.
intersection
(
facetIds
,
query
.
ids
).
length
===
query
.
ids
.
length
_
.
intersection
(
facetIds
,
query
Srv
.
ids
).
length
===
querySrv
.
ids
.
length
)
{
)
{
var
i
=
0
;
var
i
=
0
;
var
data
,
hits
;
var
data
,
hits
;
_
.
each
(
query
.
ids
,
function
(
id
)
{
_
.
each
(
query
Srv
.
ids
,
function
(
id
)
{
var
v
=
results
.
facets
[
id
];
var
v
=
results
.
facets
[
id
];
// Null values at each end of the time range ensure we see entire range
// Null values at each end of the time range ensure we see entire range
...
@@ -184,7 +184,7 @@ angular.module('kibana.histogram', [])
...
@@ -184,7 +184,7 @@ angular.module('kibana.histogram', [])
// Create the flot series object
// Create the flot series object
var
series
=
{
var
series
=
{
data
:
{
data
:
{
info
:
$scope
.
queries
.
list
[
id
],
info
:
querySrv
.
list
[
id
],
data
:
data
,
data
:
data
,
hits
:
hits
hits
:
hits
},
},
...
...
panels/hits/module.js
View file @
6a1a9768
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.hits'
,
[])
angular
.
module
(
'kibana.hits'
,
[])
.
controller
(
'hits'
,
function
(
$scope
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'hits'
,
function
(
$scope
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
@@ -62,9 +62,9 @@ angular.module('kibana.hits', [])
...
@@ -62,9 +62,9 @@ angular.module('kibana.hits', [])
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
]);
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
]);
// Build the question part of the query
// Build the question part of the query
_
.
each
(
query
.
ids
,
function
(
id
)
{
_
.
each
(
query
Srv
.
ids
,
function
(
id
)
{
var
_q
=
$scope
.
ejs
.
FilteredQuery
(
var
_q
=
$scope
.
ejs
.
FilteredQuery
(
$scope
.
ejs
.
QueryStringQuery
(
query
.
list
[
id
].
query
||
'*'
),
querySrv
.
getEjsObj
(
id
),
filterSrv
.
getBoolFilter
(
filterSrv
.
ids
));
filterSrv
.
getBoolFilter
(
filterSrv
.
ids
));
request
=
request
request
=
request
...
@@ -99,10 +99,10 @@ angular.module('kibana.hits', [])
...
@@ -99,10 +99,10 @@ angular.module('kibana.hits', [])
// Make sure we're still on the same query/queries
// Make sure we're still on the same query/queries
if
(
$scope
.
query_id
===
query_id
&&
if
(
$scope
.
query_id
===
query_id
&&
_
.
intersection
(
facetIds
,
query
.
ids
).
length
===
query
.
ids
.
length
_
.
intersection
(
facetIds
,
query
Srv
.
ids
).
length
===
querySrv
.
ids
.
length
)
{
)
{
var
i
=
0
;
var
i
=
0
;
_
.
each
(
query
.
ids
,
function
(
id
)
{
_
.
each
(
query
Srv
.
ids
,
function
(
id
)
{
var
v
=
results
.
facets
[
id
];
var
v
=
results
.
facets
[
id
];
var
hits
=
_
.
isUndefined
(
$scope
.
data
[
i
])
||
_segment
===
0
?
var
hits
=
_
.
isUndefined
(
$scope
.
data
[
i
])
||
_segment
===
0
?
v
.
count
:
$scope
.
data
[
i
].
hits
+
v
.
count
;
v
.
count
:
$scope
.
data
[
i
].
hits
+
v
.
count
;
...
@@ -110,7 +110,7 @@ angular.module('kibana.hits', [])
...
@@ -110,7 +110,7 @@ angular.module('kibana.hits', [])
// Create series
// Create series
$scope
.
data
[
i
]
=
{
$scope
.
data
[
i
]
=
{
info
:
query
.
list
[
id
],
info
:
query
Srv
.
list
[
id
],
id
:
id
,
id
:
id
,
hits
:
hits
,
hits
:
hits
,
data
:
[[
i
,
hits
]]
data
:
[[
i
,
hits
]]
...
@@ -144,7 +144,7 @@ angular.module('kibana.hits', [])
...
@@ -144,7 +144,7 @@ angular.module('kibana.hits', [])
$scope
.
get_data
();
$scope
.
get_data
();
}
}
}).
directive
(
'hitsChart'
,
function
(
query
)
{
}).
directive
(
'hitsChart'
,
function
(
query
Srv
)
{
return
{
return
{
restrict
:
'A'
,
restrict
:
'A'
,
link
:
function
(
scope
,
elem
,
attrs
,
ctrl
)
{
link
:
function
(
scope
,
elem
,
attrs
,
ctrl
)
{
...
@@ -195,7 +195,7 @@ angular.module('kibana.hits', [])
...
@@ -195,7 +195,7 @@ angular.module('kibana.hits', [])
color
:
"#eee"
,
color
:
"#eee"
,
hoverable
:
true
,
hoverable
:
true
,
},
},
colors
:
query
.
colors
colors
:
query
Srv
.
colors
});
});
}
}
if
(
scope
.
panel
.
chart
===
'pie'
)
{
if
(
scope
.
panel
.
chart
===
'pie'
)
{
...
@@ -227,7 +227,7 @@ angular.module('kibana.hits', [])
...
@@ -227,7 +227,7 @@ angular.module('kibana.hits', [])
},
},
//grid: { hoverable: true, clickable: true },
//grid: { hoverable: true, clickable: true },
grid
:
{
hoverable
:
true
,
clickable
:
true
},
grid
:
{
hoverable
:
true
,
clickable
:
true
},
colors
:
query
.
colors
colors
:
query
Srv
.
colors
});
});
}
}
...
...
panels/map/module.js
View file @
6a1a9768
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.map'
,
[])
angular
.
module
(
'kibana.map'
,
[])
.
controller
(
'map'
,
function
(
$scope
,
$rootScope
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'map'
,
function
(
$scope
,
$rootScope
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
@@ -62,7 +62,7 @@ angular.module('kibana.map', [])
...
@@ -62,7 +62,7 @@ angular.module('kibana.map', [])
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
);
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
);
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
_
.
each
(
query
.
list
,
function
(
q
)
{
_
.
each
(
query
Srv
.
list
,
function
(
q
)
{
boolQuery
=
boolQuery
.
should
(
$scope
.
ejs
.
QueryStringQuery
(
q
.
query
||
'*'
));
boolQuery
=
boolQuery
.
should
(
$scope
.
ejs
.
QueryStringQuery
(
q
.
query
||
'*'
));
});
});
...
...
panels/pie/module.js
View file @
6a1a9768
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.pie'
,
[])
angular
.
module
(
'kibana.pie'
,
[])
.
controller
(
'pie'
,
function
(
$scope
,
$rootScope
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'pie'
,
function
(
$scope
,
$rootScope
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
@@ -89,8 +89,8 @@ angular.module('kibana.pie', [])
...
@@ -89,8 +89,8 @@ angular.module('kibana.pie', [])
// This could probably be changed to a BoolFilter
// This could probably be changed to a BoolFilter
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
_
.
each
(
query
.
list
,
function
(
q
)
{
_
.
each
(
query
Srv
.
list
,
function
(
q
)
{
boolQuery
=
boolQuery
.
should
(
$scope
.
ejs
.
QueryStringQuery
(
q
.
query
||
'*'
));
boolQuery
=
boolQuery
.
should
(
querySrv
.
toEjsObj
(
q
));
});
});
var
results
;
var
results
;
...
@@ -162,7 +162,7 @@ angular.module('kibana.pie', [])
...
@@ -162,7 +162,7 @@ angular.module('kibana.pie', [])
};
};
})
})
.
directive
(
'pie'
,
function
(
query
,
filterSrv
,
dashboard
)
{
.
directive
(
'pie'
,
function
(
query
Srv
,
filterSrv
,
dashboard
)
{
return
{
return
{
restrict
:
'A'
,
restrict
:
'A'
,
link
:
function
(
scope
,
elem
,
attrs
)
{
link
:
function
(
scope
,
elem
,
attrs
)
{
...
@@ -239,7 +239,7 @@ angular.module('kibana.pie', [])
...
@@ -239,7 +239,7 @@ angular.module('kibana.pie', [])
clickable
:
true
clickable
:
true
},
},
legend
:
{
show
:
false
},
legend
:
{
show
:
false
},
colors
:
query
.
colors
colors
:
query
Srv
.
colors
};
};
// Populate element
// Populate element
...
@@ -248,6 +248,7 @@ angular.module('kibana.pie', [])
...
@@ -248,6 +248,7 @@ angular.module('kibana.pie', [])
scope
.
plot
=
$
.
plot
(
elem
,
scope
.
data
,
pie
);
scope
.
plot
=
$
.
plot
(
elem
,
scope
.
data
,
pie
);
});
});
}
}
}
}
function
tt
(
x
,
y
,
contents
)
{
function
tt
(
x
,
y
,
contents
)
{
...
...
panels/query/meta.html
View file @
6a1a9768
<div>
<div
class=
"panel-query-meta row-fluid"
style=
"width:170px"
>
<style>
<style>
.input-query-alias
{
.input-query-alias
{
margin-bottom
:
5px
!important
;
margin-bottom
:
5px
!important
;
}
}
.panel-query-meta
.pin
{
text-decoration
:
underline
;
}
</style>
</style>
<a
class=
"close"
ng-click=
"render();dismiss();"
href=
""
>
×
</a>
<a
class=
"close"
ng-click=
"render();dismiss();"
href=
""
>
×
</a>
<h6>
Query Alias
</h6>
<i
ng-click=
"toggle_pin(id);dismiss();"
class=
"small pointer icon-pushpin"
></i>
<span
class=
"strong small"
>
Query Alias
</span>
<form>
<form>
<input
class=
"input-medium input-query-alias"
type=
"text"
ng-model=
"quer
ies
.list[id].alias"
placeholder=
'Alias...'
/>
<input
class=
"input-medium input-query-alias"
type=
"text"
ng-model=
"quer
ySrv
.list[id].alias"
placeholder=
'Alias...'
/>
<div>
<div>
<i
ng-repeat=
"color in quer
ies.colors"
class=
"pointer"
ng-class=
"{'icon-circle-blank':queries.list[id].color == color,'icon-circle':queries.list[id].color != color}"
ng-style=
"{color:color}"
ng-click=
"queries
.list[id].color = color;render();"
>
</i>
<i
ng-repeat=
"color in quer
ySrv.colors"
class=
"pointer"
ng-class=
"{'icon-circle-blank':querySrv.list[id].color == color,'icon-circle':querySrv.list[id].color != color}"
ng-style=
"{color:color}"
ng-click=
"querySrv
.list[id].color = color;render();"
>
</i>
</div>
</div>
</form>
</form>
</div>
</div>
\ No newline at end of file
panels/query/module.html
View file @
6a1a9768
<kibana-panel
ng-controller=
'query'
ng-init=
"init()"
>
<kibana-panel
ng-controller=
'query'
ng-init=
"init()"
class=
"query-panel"
>
<style>
<style>
.short-query
{
.short-query
{
display
:
inline-block
;
display
:
inline-block
;
margin-
lef
t
:
10px
;
margin-
righ
t
:
10px
;
}
}
.begin-query
{
.begin-query
{
position
:
absolute
;
position
:
absolute
;
left
:
1
5
px
;
left
:
1
3
px
;
top
:
5px
;
top
:
5px
;
}
}
.end-query
{
.end-query
{
...
@@ -33,19 +33,31 @@
...
@@ -33,19 +33,31 @@
.form-search
:hover
.remove-query
{
.form-search
:hover
.remove-query
{
opacity
:
1
;
opacity
:
1
;
}
}
.query-panel
.pins
{
text-decoration
:
underline
;
}
.query-panel
.pinned
{
margin-right
:
5px
;
}
</style>
</style>
<label
class=
"small"
>
{{panel.label}}
</label>
<label
class=
"small"
>
{{panel.label}}
</label>
<div
ng-repeat=
"id in quer
ies.ids"
ng-class=
"{'short-query': queries
.ids.length>1}"
>
<div
ng-repeat=
"id in quer
ySrv.ids|pinnedQuery:false"
ng-class=
"{'short-query': querySrv
.ids.length>1}"
>
<form
class=
"form-search"
style=
"position:relative"
ng-submit=
"refresh()"
>
<form
class=
"form-search"
style=
"position:relative
;margin-bottom:5px;
"
ng-submit=
"refresh()"
>
<span
class=
"begin-query"
>
<span
class=
"begin-query"
>
<i
class=
"icon-circle pointer"
data-unique=
"1"
bs-popover=
"'panels/query/meta.html'"
data-placement=
"right"
ng-style=
"{color: quer
ies
.list[id].color}"
></i>
<i
class=
"icon-circle pointer"
data-unique=
"1"
bs-popover=
"'panels/query/meta.html'"
data-placement=
"right"
ng-style=
"{color: quer
ySrv
.list[id].color}"
></i>
<i
class=
"icon-remove-sign pointer remove-query"
ng-show=
"quer
ies.ids.length>1"
ng-click=
"queries
.remove(id);refresh()"
></i>
<i
class=
"icon-remove-sign pointer remove-query"
ng-show=
"quer
ySrv.ids.length>1"
ng-click=
"querySrv
.remove(id);refresh()"
></i>
</span>
</span>
<input
class=
"search-query panel-query"
ng-class=
"{'input-block-level': quer
ies.ids.length==1,'last-query': $last,'has-remove': queries.ids.length>1}"
bs-typeahead=
"panel.history"
data-min-length=
0
data-items=
100
type=
"text"
ng-model=
"queries
.list[id].query"
/>
<input
class=
"search-query panel-query"
ng-class=
"{'input-block-level': quer
ySrv.ids.length==1,'last-query': $last,'has-remove': querySrv.ids.length>1}"
bs-typeahead=
"panel.history"
data-min-length=
0
data-items=
100
type=
"text"
ng-model=
"querySrv
.list[id].query"
/>
<span
class=
"end-query"
>
<span
class=
"end-query"
>
<i
class=
"icon-search pointer"
ng-click=
"refresh()"
ng-show=
"$last"
></i>
<i
class=
"icon-search pointer"
ng-click=
"refresh()"
ng-show=
"$last"
></i>
<i
class=
"icon-plus pointer"
ng-click=
"quer
ies
.set({})"
ng-show=
"$last"
></i>
<i
class=
"icon-plus pointer"
ng-click=
"quer
ySrv
.set({})"
ng-show=
"$last"
></i>
</span>
</span>
</form>
</form>
</div>
</div>
<div>
<span
class=
"pointer"
ng-click=
"panel.pinned = !panel.pinned"
><small
class=
"pins"
>
Pinned
</small>
<i
ng-class=
"{'icon-caret-right':panel.pinned,'icon-caret-left':!panel.pinned}"
></i></span>
<span
ng-show=
"panel.pinned"
ng-repeat=
"id in querySrv.ids|pinnedQuery:true"
class=
"pinned badge"
>
<i
class=
"icon-circle pointer"
ng-style=
"{color: querySrv.list[id].color}"
data-unique=
"1"
bs-popover=
"'panels/query/meta.html'"
></i><span
bs-tooltip=
"querySrv.list[id].query"
>
{{querySrv.list[id].alias || querySrv.list[id].query}}
</span>
</span>
</div>
</kibana-panel>
</kibana-panel>
\ No newline at end of file
panels/query/module.js
View file @
6a1a9768
...
@@ -16,26 +16,27 @@
...
@@ -16,26 +16,27 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.query'
,
[])
angular
.
module
(
'kibana.query'
,
[])
.
controller
(
'query'
,
function
(
$scope
,
query
,
$rootScope
)
{
.
controller
(
'query'
,
function
(
$scope
,
query
Srv
,
$rootScope
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
status
:
"Experimental"
,
status
:
"Experimental"
,
label
:
"Search"
,
label
:
"Search"
,
query
:
"*"
,
query
:
"*"
,
pinned
:
true
,
group
:
"default"
,
group
:
"default"
,
history
:
[],
history
:
[],
remember
:
10
// max: 100, angular strap can't take a variable for items param
remember
:
10
// max: 100, angular strap can't take a variable for items param
};
};
_
.
defaults
(
$scope
.
panel
,
_d
);
_
.
defaults
(
$scope
.
panel
,
_d
);
$scope
.
quer
ies
=
query
;
$scope
.
quer
ySrv
=
querySrv
;
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
};
};
$scope
.
refresh
=
function
(
query
)
{
$scope
.
refresh
=
function
(
query
)
{
update_history
(
_
.
pluck
(
$scope
.
quer
ies
.
list
,
'query'
));
update_history
(
_
.
pluck
(
$scope
.
quer
ySrv
.
list
,
'query'
));
$rootScope
.
$broadcast
(
'refresh'
);
$rootScope
.
$broadcast
(
'refresh'
);
};
};
...
@@ -43,6 +44,10 @@ angular.module('kibana.query', [])
...
@@ -43,6 +44,10 @@ angular.module('kibana.query', [])
$rootScope
.
$broadcast
(
'render'
);
$rootScope
.
$broadcast
(
'render'
);
};
};
$scope
.
toggle_pin
=
function
(
id
)
{
querySrv
.
list
[
id
].
pin
=
querySrv
.
list
[
id
].
pin
?
false
:
true
;
};
var
update_history
=
function
(
query
)
{
var
update_history
=
function
(
query
)
{
if
(
$scope
.
panel
.
remember
>
0
)
{
if
(
$scope
.
panel
.
remember
>
0
)
{
$scope
.
panel
.
history
=
_
.
union
(
query
.
reverse
(),
$scope
.
panel
.
history
);
$scope
.
panel
.
history
=
_
.
union
(
query
.
reverse
(),
$scope
.
panel
.
history
);
...
...
panels/table/module.js
View file @
6a1a9768
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.table'
,
[])
angular
.
module
(
'kibana.table'
,
[])
.
controller
(
'table'
,
function
(
$rootScope
,
$scope
,
eventBus
,
fields
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'table'
,
function
(
$rootScope
,
$scope
,
eventBus
,
fields
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
@@ -69,7 +69,7 @@ angular.module('kibana.table', [])
...
@@ -69,7 +69,7 @@ angular.module('kibana.table', [])
$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
)
{
query
.
list
[
query
.
ids
[
0
]].
query
=
docs
.
query
;
query
Srv
.
list
[
querySrv
.
ids
[
0
]].
query
=
docs
.
query
;
$scope
.
data
=
docs
.
docs
;
$scope
.
data
=
docs
.
docs
;
});
});
};
};
...
@@ -139,8 +139,8 @@ angular.module('kibana.table', [])
...
@@ -139,8 +139,8 @@ angular.module('kibana.table', [])
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
]);
var
request
=
$scope
.
ejs
.
Request
().
indices
(
dashboard
.
indices
[
_segment
]);
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
var
boolQuery
=
$scope
.
ejs
.
BoolQuery
();
_
.
each
(
query
.
list
,
function
(
q
)
{
_
.
each
(
query
Srv
.
list
,
function
(
q
)
{
boolQuery
=
boolQuery
.
should
(
$scope
.
ejs
.
QueryStringQuery
(
q
.
query
||
'*'
));
boolQuery
=
boolQuery
.
should
(
querySrv
.
toEjsObj
(
q
));
});
});
request
=
request
.
query
(
request
=
request
.
query
(
...
@@ -250,7 +250,7 @@ angular.module('kibana.table', [])
...
@@ -250,7 +250,7 @@ angular.module('kibana.table', [])
});
});
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
"table_documents"
,
eventBus
.
broadcast
(
$scope
.
$id
,
$scope
.
panel
.
group
,
"table_documents"
,
{
{
query
:
query
.
list
[
query
.
ids
[
0
]].
query
,
query
:
query
Srv
.
list
[
querySrv
.
ids
[
0
]].
query
,
docs
:
_
.
pluck
(
$scope
.
data
,
'_source'
),
docs
:
_
.
pluck
(
$scope
.
data
,
'_source'
),
index
:
$scope
.
index
index
:
$scope
.
index
});
});
...
...
panels/trends/module.html
View file @
6a1a9768
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
<div
ng-style=
"panel.style"
style=
"line-height:{{panel.style['font-size']}};display:inline-block;padding-right: 5px;"
ng-repeat=
"query in trends"
>
<div
ng-style=
"panel.style"
style=
"line-height:{{panel.style['font-size']}};display:inline-block;padding-right: 5px;"
ng-repeat=
"query in trends"
>
<i
class=
"icon-circle"
style=
"color:{{query.info.color}}"
></i>
<i
class=
"icon-circle"
style=
"color:{{query.info.color}}"
></i>
<span
ng-class=
"{'text-success': query.hits.new >= query.hits.old, 'text-error': query.hits.old > query.hits.new}"
class=
'
strong'
>
<span
bs-tooltip=
"'Then: '+query.hits.old+', Now: '+query.hits.new"
ng-class=
"{'text-success': query.hits.new >= query.hits.old, 'text-error': query.hits.old > query.hits.new}"
class=
'pointer
strong'
>
<i
class=
'large'
ng-class=
"{'icon-caret-up': query.hits.new >= query.hits.old, 'icon-caret-down': query.hits.old > query.hits.new}"
></i>
{{query.percent}}%
<i
class=
'large'
ng-class=
"{'icon-caret-up': query.hits.new >= query.hits.old, 'icon-caret-down': query.hits.old > query.hits.new}"
></i>
{{query.percent}}%
</span>
</span>
<span
class=
"tiny
pointer light"
bs-tooltip=
"'Then: '+query.hits.old+', Now: '+query.hits.new
"
ng-show=
"query.info.alias != ''"
>
({{query.info.alias}})
</span>
<span
class=
"tiny
light
"
ng-show=
"query.info.alias != ''"
>
({{query.info.alias}})
</span>
<br
ng-show=
"panel.arrangement == 'vertical'"
>
<br
ng-show=
"panel.arrangement == 'vertical'"
>
</div>
</div>
</kibana-panel>
</kibana-panel>
\ No newline at end of file
panels/trends/module.js
View file @
6a1a9768
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'kibana.trends'
,
[])
angular
.
module
(
'kibana.trends'
,
[])
.
controller
(
'trends'
,
function
(
$scope
,
kbnIndex
,
query
,
dashboard
,
filterSrv
)
{
.
controller
(
'trends'
,
function
(
$scope
,
kbnIndex
,
query
Srv
,
dashboard
,
filterSrv
)
{
// Set and populate defaults
// Set and populate defaults
var
_d
=
{
var
_d
=
{
...
@@ -78,9 +78,9 @@ angular.module('kibana.trends', [])
...
@@ -78,9 +78,9 @@ angular.module('kibana.trends', [])
// Build the question part of the query
// Build the question part of the query
_
.
each
(
query
.
ids
,
function
(
id
)
{
_
.
each
(
query
Srv
.
ids
,
function
(
id
)
{
var
q
=
$scope
.
ejs
.
FilteredQuery
(
var
q
=
$scope
.
ejs
.
FilteredQuery
(
$scope
.
ejs
.
QueryStringQuery
(
query
.
list
[
id
].
query
||
'*'
),
querySrv
.
getEjsObj
(
id
),
filterSrv
.
getBoolFilter
(
_ids_without_time
).
must
(
filterSrv
.
getBoolFilter
(
_ids_without_time
).
must
(
$scope
.
ejs
.
RangeFilter
(
timeField
)
$scope
.
ejs
.
RangeFilter
(
timeField
)
.
from
(
$scope
.
time
.
from
)
.
from
(
$scope
.
time
.
from
)
...
@@ -93,10 +93,11 @@ angular.module('kibana.trends', [])
...
@@ -93,10 +93,11 @@ angular.module('kibana.trends', [])
).
size
(
0
);
).
size
(
0
);
});
});
// And again for the old time period
// And again for the old time period
_
.
each
(
query
.
ids
,
function
(
id
)
{
_
.
each
(
query
Srv
.
ids
,
function
(
id
)
{
var
q
=
$scope
.
ejs
.
FilteredQuery
(
var
q
=
$scope
.
ejs
.
FilteredQuery
(
$scope
.
ejs
.
QueryStringQuery
(
query
.
list
[
id
].
query
||
'*'
),
querySrv
.
getEjsObj
(
id
),
filterSrv
.
getBoolFilter
(
_ids_without_time
).
must
(
filterSrv
.
getBoolFilter
(
_ids_without_time
).
must
(
$scope
.
ejs
.
RangeFilter
(
timeField
)
$scope
.
ejs
.
RangeFilter
(
timeField
)
.
from
(
$scope
.
old_time
.
from
)
.
from
(
$scope
.
old_time
.
from
)
...
@@ -108,6 +109,7 @@ angular.module('kibana.trends', [])
...
@@ -108,6 +109,7 @@ angular.module('kibana.trends', [])
).
size
(
0
);
).
size
(
0
);
});
});
// TODO: Spy for trend panel
// TODO: Spy for trend panel
//$scope.populate_modal(request);
//$scope.populate_modal(request);
...
@@ -121,8 +123,7 @@ angular.module('kibana.trends', [])
...
@@ -121,8 +123,7 @@ angular.module('kibana.trends', [])
).
then
(
function
(
p
)
{
).
then
(
function
(
p
)
{
$scope
.
index
=
_
.
union
(
p
,
$scope
.
index
);
$scope
.
index
=
_
.
union
(
p
,
$scope
.
index
);
request
=
request
.
indices
(
$scope
.
index
[
_segment
]);
request
=
request
.
indices
(
$scope
.
index
[
_segment
]);
process_results
(
request
.
doSearch
());
process_results
(
request
.
doSearch
(),
_segment
,
query_id
);
});
});
}
else
{
}
else
{
process_results
(
request
.
indices
(
$scope
.
index
[
_segment
]).
doSearch
(),
_segment
,
query_id
);
process_results
(
request
.
indices
(
$scope
.
index
[
_segment
]).
doSearch
(),
_segment
,
query_id
);
...
@@ -133,7 +134,6 @@ angular.module('kibana.trends', [])
...
@@ -133,7 +134,6 @@ angular.module('kibana.trends', [])
// Populate scope when we have results
// Populate scope when we have results
var
process_results
=
function
(
results
,
_segment
,
query_id
)
{
var
process_results
=
function
(
results
,
_segment
,
query_id
)
{
results
.
then
(
function
(
results
)
{
results
.
then
(
function
(
results
)
{
$scope
.
panel
.
loading
=
false
;
$scope
.
panel
.
loading
=
false
;
if
(
_segment
===
0
)
{
if
(
_segment
===
0
)
{
$scope
.
hits
=
{};
$scope
.
hits
=
{};
...
@@ -152,10 +152,10 @@ angular.module('kibana.trends', [])
...
@@ -152,10 +152,10 @@ angular.module('kibana.trends', [])
// Make sure we're still on the same query/queries
// Make sure we're still on the same query/queries
if
(
$scope
.
query_id
===
query_id
&&
if
(
$scope
.
query_id
===
query_id
&&
_
.
intersection
(
facetIds
,
query
.
ids
).
length
===
query
.
ids
.
length
_
.
intersection
(
facetIds
,
query
Srv
.
ids
).
length
===
querySrv
.
ids
.
length
)
{
)
{
var
i
=
0
;
var
i
=
0
;
_
.
each
(
query
.
ids
,
function
(
id
)
{
_
.
each
(
query
Srv
.
ids
,
function
(
id
)
{
var
v
=
results
.
facets
[
id
];
var
v
=
results
.
facets
[
id
];
var
n
=
results
.
facets
[
id
].
count
;
var
n
=
results
.
facets
[
id
].
count
;
var
o
=
results
.
facets
[
'old_'
+
id
].
count
;
var
o
=
results
.
facets
[
'old_'
+
id
].
count
;
...
@@ -172,7 +172,7 @@ angular.module('kibana.trends', [])
...
@@ -172,7 +172,7 @@ angular.module('kibana.trends', [])
'?'
:
Math
.
round
(
percentage
(
hits
.
old
,
hits
.
new
)
*
100
)
/
100
;
'?'
:
Math
.
round
(
percentage
(
hits
.
old
,
hits
.
new
)
*
100
)
/
100
;
// Create series
// Create series
$scope
.
data
[
i
]
=
{
$scope
.
data
[
i
]
=
{
info
:
query
.
list
[
id
],
info
:
query
Srv
.
list
[
id
],
hits
:
{
hits
:
{
new
:
hits
.
new
,
new
:
hits
.
new
,
old
:
hits
.
old
old
:
hits
.
old
...
...
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