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
85bfed67
Commit
85bfed67
authored
Dec 09, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce mapping storage overhead
parent
8a5a9748
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
src/app/services/fields.js
+9
-10
No files found.
src/app/services/fields.js
View file @
85bfed67
...
...
@@ -13,23 +13,22 @@ function (angular, _, config) {
var
self
=
this
;
this
.
list
=
[
'_type'
];
this
.
mapping
=
{};
this
.
fullMapping
=
{};
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
.
fullMapping
));
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
.
fullMapping
=
_
.
extend
(
self
.
fullMapping
,
result
);
self
.
list
=
mapFields
(
self
.
fullMapping
);
self
.
indices
=
_
.
union
(
self
.
indices
,
_
.
keys
(
result
)
);
self
.
list
=
mapFields
(
result
);
});
// Otherwise just use the cached mapping
}
else
{
// This is inefficient, should not need to reprocess?
self
.
list
=
mapFields
(
_
.
pick
(
self
.
fullMapping
,
n
));
}
}
});
...
...
@@ -37,8 +36,8 @@ function (angular, _, config) {
var
mapFields
=
function
(
m
)
{
var
fields
=
[];
_
.
each
(
m
,
function
(
types
)
{
_
.
each
(
types
,
function
(
v
)
{
fields
=
_
.
without
(
_
.
union
(
fields
,
_
.
keys
(
v
)),
'_all'
,
'_source'
);
_
.
each
(
types
,
function
(
type
)
{
fields
=
_
.
without
(
_
.
union
(
fields
,
_
.
keys
(
type
)),
'_all'
,
'_source'
);
});
});
return
fields
;
...
...
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