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
2e53450a
Commit
2e53450a
authored
Dec 26, 2013
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed more unused kibana services
parent
f68c55e3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2 additions
and
211 deletions
+2
-211
src/app/controllers/dash.js
+1
-3
src/app/services/all.js
+0
-2
src/app/services/dashboard.js
+1
-1
src/app/services/fields.js
+0
-103
src/app/services/kbnIndex.js
+0
-102
No files found.
src/app/controllers/dash.js
View file @
2e53450a
...
@@ -29,7 +29,7 @@ function (angular, config, _) {
...
@@ -29,7 +29,7 @@ function (angular, config, _) {
var
module
=
angular
.
module
(
'kibana.controllers'
);
var
module
=
angular
.
module
(
'kibana.controllers'
);
module
.
controller
(
'DashCtrl'
,
function
(
module
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$route
,
ejsResource
,
fields
,
dashboard
,
alertSrv
,
panelMove
,
esVersion
,
keyboardManager
)
{
$scope
,
$rootScope
,
$route
,
ejsResource
,
dashboard
,
alertSrv
,
panelMove
,
esVersion
,
keyboardManager
)
{
$scope
.
requiredElasticSearchVersion
=
">=0.90.3"
;
$scope
.
requiredElasticSearchVersion
=
">=0.90.3"
;
...
@@ -56,8 +56,6 @@ function (angular, config, _) {
...
@@ -56,8 +56,6 @@ function (angular, config, _) {
// Clear existing alerts
// Clear existing alerts
alertSrv
.
clearAll
();
alertSrv
.
clearAll
();
// Provide a global list of all seen fields
$scope
.
fields
=
fields
;
$scope
.
reset_row
();
$scope
.
reset_row
();
$scope
.
ejs
=
ejsResource
(
config
.
elasticsearch
);
$scope
.
ejs
=
ejsResource
(
config
.
elasticsearch
);
...
...
src/app/services/all.js
View file @
2e53450a
define
([
define
([
'./alertSrv'
,
'./alertSrv'
,
'./dashboard'
,
'./dashboard'
,
'./fields'
,
'./filterSrv'
,
'./filterSrv'
,
'./kbnIndex'
,
'./timer'
,
'./timer'
,
'./panelMove'
,
'./panelMove'
,
'./esVersion'
,
'./esVersion'
,
...
...
src/app/services/dashboard.js
View file @
2e53450a
...
@@ -15,7 +15,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
...
@@ -15,7 +15,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
module
.
service
(
'dashboard'
,
function
(
module
.
service
(
'dashboard'
,
function
(
$routeParams
,
$http
,
$rootScope
,
$injector
,
$location
,
$timeout
,
$routeParams
,
$http
,
$rootScope
,
$injector
,
$location
,
$timeout
,
ejsResource
,
timer
,
kbnIndex
,
alertSrv
ejsResource
,
timer
,
alertSrv
)
{
)
{
// A hash of defaults to use when loading a dashboard
// A hash of defaults to use when loading a dashboard
...
...
src/app/services/fields.js
deleted
100644 → 0
View file @
f68c55e3
define
([
'angular'
,
'underscore'
,
'config'
],
function
(
angular
,
_
,
config
)
{
'use strict'
;
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'fields'
,
function
(
dashboard
,
$rootScope
,
$http
,
alertSrv
)
{
// Save a reference to this
var
self
=
this
;
this
.
list
=
[
'_type'
];
this
.
indices
=
[];
// Stop tracking the full mapping, too expensive, instead we only remember the index names
// we've already seen.
//
$rootScope
.
$watch
(
function
(){
return
dashboard
.
indices
;},
function
(
n
)
{
if
(
!
_
.
isUndefined
(
n
)
&&
n
.
length
&&
dashboard
.
current
.
index
.
warm_fields
)
{
// Only get the mapping for indices we don't know it for
var
indices
=
_
.
difference
(
n
,
_
.
keys
(
self
.
indices
));
// Only get the mapping if there are new indices
if
(
indices
.
length
>
0
)
{
self
.
map
(
indices
).
then
(
function
(
result
)
{
self
.
indices
=
_
.
union
(
self
.
indices
,
_
.
keys
(
result
));
self
.
list
=
mapFields
(
result
);
});
}
}
});
var
mapFields
=
function
(
m
)
{
var
fields
=
[];
_
.
each
(
m
,
function
(
types
)
{
_
.
each
(
types
,
function
(
type
)
{
fields
=
_
.
without
(
_
.
union
(
fields
,
_
.
keys
(
type
)),
'_all'
,
'_source'
);
});
});
return
fields
;
};
this
.
map
=
function
(
indices
)
{
var
request
=
$http
({
url
:
config
.
elasticsearch
+
"/"
+
indices
.
join
(
','
)
+
"/_mapping"
,
method
:
"GET"
}).
error
(
function
(
data
,
status
)
{
if
(
status
===
0
)
{
alertSrv
.
set
(
'Error'
,
"Could not contact Elasticsearch at "
+
config
.
elasticsearch
+
". Please ensure that Elasticsearch is reachable from your system."
,
'error'
);
}
else
{
alertSrv
.
set
(
'Error'
,
"No index found at "
+
config
.
elasticsearch
+
"/"
+
indices
.
join
(
','
)
+
"/_mapping. Please create at least one index."
+
"If you're using a proxy ensure it is configured correctly."
,
'error'
);
}
});
// Flatten the mapping of each index into dot notated keys.
return
request
.
then
(
function
(
p
)
{
var
mapping
=
{};
_
.
each
(
p
.
data
,
function
(
type
,
index
)
{
mapping
[
index
]
=
{};
_
.
each
(
type
,
function
(
fields
,
typename
)
{
mapping
[
index
][
typename
]
=
flatten
(
fields
);
});
});
return
mapping
;
});
};
var
flatten
=
function
(
obj
,
prefix
)
{
var
propName
=
(
prefix
)
?
prefix
:
''
,
dot
=
(
prefix
)
?
'.'
:
''
,
ret
=
{};
for
(
var
attr
in
obj
){
if
(
attr
===
'dynamic_templates'
||
attr
===
'_default_'
)
{
continue
;
}
// For now only support multi field on the top level
// and if there is a default field set.
if
(
obj
[
attr
][
'type'
]
===
'multi_field'
)
{
ret
[
attr
]
=
obj
[
attr
][
'fields'
][
attr
]
||
obj
[
attr
];
var
keys
=
_
.
without
(
_
.
keys
(
obj
[
attr
][
'fields'
]),
attr
);
for
(
var
key
in
keys
)
{
ret
[
attr
+
'.'
+
keys
[
key
]]
=
obj
[
attr
][
'fields'
][
keys
[
key
]];
}
}
else
if
(
attr
===
'properties'
)
{
_
.
extend
(
ret
,
flatten
(
obj
[
attr
],
propName
));
}
else
if
(
typeof
obj
[
attr
]
===
'object'
){
_
.
extend
(
ret
,
flatten
(
obj
[
attr
],
propName
+
dot
+
attr
));
}
else
{
ret
[
propName
]
=
obj
;
}
}
return
ret
;
};
});
});
\ No newline at end of file
src/app/services/kbnIndex.js
deleted
100644 → 0
View file @
f68c55e3
define
([
'angular'
,
'underscore'
,
'config'
,
'moment'
],
function
(
angular
,
_
,
config
,
moment
)
{
'use strict'
;
var
module
=
angular
.
module
(
'kibana.services'
);
module
.
service
(
'kbnIndex'
,
function
(
$http
,
alertSrv
)
{
// returns a promise containing an array of all indices matching the index
// pattern that exist in a given range
this
.
indices
=
function
(
from
,
to
,
pattern
,
interval
)
{
var
possible
=
[];
_
.
each
(
expand_range
(
fake_utc
(
from
),
fake_utc
(
to
),
interval
),
function
(
d
){
possible
.
push
(
d
.
format
(
pattern
));
});
return
all_indices
().
then
(
function
(
p
)
{
var
indices
=
_
.
intersection
(
possible
,
p
);
indices
.
reverse
();
return
indices
;
});
};
// returns a promise containing an array of all indices in an elasticsearch
// cluster
function
all_indices
()
{
var
something
=
$http
({
url
:
config
.
elasticsearch
+
"/_aliases"
,
method
:
"GET"
}).
error
(
function
(
data
,
status
)
{
if
(
status
===
0
)
{
alertSrv
.
set
(
'Error'
,
"Could not contact Elasticsearch at "
+
config
.
elasticsearch
+
". Please ensure that Elasticsearch is reachable from your system."
,
'error'
);
}
else
{
alertSrv
.
set
(
'Error'
,
"Could not reach "
+
config
.
elasticsearch
+
"/_aliases. If you"
+
" are using a proxy, ensure it is configured correctly"
,
'error'
);
}
});
return
something
.
then
(
function
(
p
)
{
var
indices
=
[];
_
.
each
(
p
.
data
,
function
(
v
,
k
)
{
indices
.
push
(
k
);
// Also add the aliases. Could be expensive on systems with a lot of them
_
.
each
(
v
.
aliases
,
function
(
v
,
k
)
{
indices
.
push
(
k
);
});
});
return
indices
;
});
}
// this is stupid, but there is otherwise no good way to ensure that when
// I extract the date from an object that I get the UTC date. Stupid js.
// I die a little inside every time I call this function.
// Update: I just read this again. I died a little more inside.
// Update2: More death.
function
fake_utc
(
date
)
{
date
=
moment
(
date
).
clone
().
toDate
();
return
moment
(
new
Date
(
date
.
getTime
()
+
date
.
getTimezoneOffset
()
*
60000
));
}
// Create an array of date objects by a given interval
function
expand_range
(
start
,
end
,
interval
)
{
if
(
_
.
contains
([
'hour'
,
'day'
,
'week'
,
'month'
,
'year'
],
interval
))
{
var
range
;
start
=
moment
(
start
).
clone
();
range
=
[];
while
(
start
.
isBefore
(
end
))
{
range
.
push
(
start
.
clone
());
switch
(
interval
)
{
case
'hour'
:
start
.
add
(
'hours'
,
1
);
break
;
case
'day'
:
start
.
add
(
'days'
,
1
);
break
;
case
'week'
:
start
.
add
(
'weeks'
,
1
);
break
;
case
'month'
:
start
.
add
(
'months'
,
1
);
break
;
case
'year'
:
start
.
add
(
'years'
,
1
);
break
;
}
}
range
.
push
(
moment
(
end
).
clone
());
return
range
;
}
else
{
return
false
;
}
}
});
});
\ No newline at end of file
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