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
81bbc5bb
Commit
81bbc5bb
authored
Dec 02, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #744 from rashidkpc/master
Remove idQueue from services
parents
e73ea482
3fe94734
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
67 deletions
+34
-67
src/app/components/kbn.js
+20
-0
src/app/dashboards/blank.json
+0
-11
src/app/dashboards/default.json
+0
-11
src/app/dashboards/guided.json
+0
-11
src/app/dashboards/logstash.json
+0
-6
src/app/dashboards/noted.json
+0
-11
src/app/services/filterSrv.js
+7
-8
src/app/services/querySrv.js
+7
-9
No files found.
src/app/components/kbn.js
View file @
81bbc5bb
...
@@ -479,6 +479,26 @@ function($, _, moment) {
...
@@ -479,6 +479,26 @@ function($, _, moment) {
});
});
};
};
// Find the smallest missing number in an array
kbn
.
smallestMissing
=
function
(
arr
,
start
,
end
)
{
start
=
start
||
0
;
end
=
end
||
arr
.
length
-
1
;
if
(
start
>
end
)
{
return
end
+
1
;
}
if
(
start
!==
arr
[
start
])
{
return
start
;
}
var
middle
=
Math
.
floor
((
start
+
end
)
/
2
);
if
(
arr
[
middle
]
>
middle
)
{
return
kbn
.
smallestMissing
(
arr
,
start
,
middle
);
}
else
{
return
kbn
.
smallestMissing
(
arr
,
middle
+
1
,
end
);
}
};
kbn
.
byteFormat
=
function
(
size
,
decimals
)
{
kbn
.
byteFormat
=
function
(
size
,
decimals
)
{
var
ext
,
steps
=
0
;
var
ext
,
steps
=
0
;
decimals
=
decimals
||
2
;
decimals
=
decimals
||
2
;
...
...
src/app/dashboards/blank.json
View file @
81bbc5bb
...
@@ -2,12 +2,6 @@
...
@@ -2,12 +2,6 @@
"title"
:
"New Dashboard"
,
"title"
:
"New Dashboard"
,
"services"
:
{
"services"
:
{
"query"
:
{
"query"
:
{
"idQueue"
:
[
1
,
2
,
3
,
4
],
"list"
:
{
"list"
:
{
"0"
:
{
"0"
:
{
"query"
:
"*"
,
"query"
:
"*"
,
...
@@ -21,11 +15,6 @@
...
@@ -21,11 +15,6 @@
]
]
},
},
"filter"
:
{
"filter"
:
{
"idQueue"
:
[
0
,
1
,
2
],
"list"
:
{},
"list"
:
{},
"ids"
:
[]
"ids"
:
[]
}
}
...
...
src/app/dashboards/default.json
View file @
81bbc5bb
...
@@ -2,12 +2,6 @@
...
@@ -2,12 +2,6 @@
"title"
:
"Introduction"
,
"title"
:
"Introduction"
,
"services"
:
{
"services"
:
{
"query"
:
{
"query"
:
{
"idQueue"
:
[
1
,
2
,
3
,
4
],
"list"
:
{
"list"
:
{
"0"
:
{
"0"
:
{
"query"
:
"*"
,
"query"
:
"*"
,
...
@@ -23,11 +17,6 @@
...
@@ -23,11 +17,6 @@
]
]
},
},
"filter"
:
{
"filter"
:
{
"idQueue"
:
[
0
,
1
,
2
],
"list"
:
{},
"list"
:
{},
"ids"
:
[]
"ids"
:
[]
}
}
...
...
src/app/dashboards/guided.json
View file @
81bbc5bb
...
@@ -2,12 +2,6 @@
...
@@ -2,12 +2,6 @@
"title"
:
"Your Basic Dashboard"
,
"title"
:
"Your Basic Dashboard"
,
"services"
:
{
"services"
:
{
"query"
:
{
"query"
:
{
"idQueue"
:
[
1
,
2
,
3
,
4
],
"list"
:
{
"list"
:
{
"0"
:
{
"0"
:
{
"query"
:
"*"
,
"query"
:
"*"
,
...
@@ -23,11 +17,6 @@
...
@@ -23,11 +17,6 @@
]
]
},
},
"filter"
:
{
"filter"
:
{
"idQueue"
:
[
0
,
1
,
2
],
"list"
:
{},
"list"
:
{},
"ids"
:
[]
"ids"
:
[]
}
}
...
...
src/app/dashboards/logstash.json
View file @
81bbc5bb
...
@@ -2,9 +2,6 @@
...
@@ -2,9 +2,6 @@
"title"
:
"Logstash Search"
,
"title"
:
"Logstash Search"
,
"services"
:
{
"services"
:
{
"query"
:
{
"query"
:
{
"idQueue"
:
[
1
],
"list"
:
{
"list"
:
{
"0"
:
{
"0"
:
{
"query"
:
"{{ARGS.query || '*'}}"
,
"query"
:
"{{ARGS.query || '*'}}"
,
...
@@ -20,9 +17,6 @@
...
@@ -20,9 +17,6 @@
]
]
},
},
"filter"
:
{
"filter"
:
{
"idQueue"
:
[
1
],
"list"
:
{
"list"
:
{
"0"
:
{
"0"
:
{
"type"
:
"time"
,
"type"
:
"time"
,
...
...
src/app/dashboards/noted.json
View file @
81bbc5bb
...
@@ -2,12 +2,6 @@
...
@@ -2,12 +2,6 @@
"title"
:
"A few notes"
,
"title"
:
"A few notes"
,
"services"
:
{
"services"
:
{
"query"
:
{
"query"
:
{
"idQueue"
:
[
1
,
2
,
3
,
4
],
"list"
:
{
"list"
:
{
"0"
:
{
"0"
:
{
"query"
:
"*"
,
"query"
:
"*"
,
...
@@ -23,11 +17,6 @@
...
@@ -23,11 +17,6 @@
]
]
},
},
"filter"
:
{
"filter"
:
{
"idQueue"
:
[
0
,
1
,
2
],
"list"
:
{},
"list"
:
{},
"ids"
:
[]
"ids"
:
[]
}
}
...
...
src/app/services/filterSrv.js
View file @
81bbc5bb
...
@@ -14,14 +14,12 @@ define([
...
@@ -14,14 +14,12 @@ define([
// Defaults for it
// Defaults for it
var
_d
=
{
var
_d
=
{
idQueue
:
[],
list
:
{},
list
:
{},
ids
:
[]
ids
:
[]
};
};
// For convenience
// For convenience
var
ejs
=
ejsResource
(
config
.
elasticsearch
);
var
ejs
=
ejsResource
(
config
.
elasticsearch
);
var
_f
=
dashboard
.
current
.
services
.
filter
;
// Save a reference to this
// Save a reference to this
var
self
=
this
;
var
self
=
this
;
...
@@ -34,7 +32,6 @@ define([
...
@@ -34,7 +32,6 @@ define([
// Accessors
// Accessors
self
.
list
=
dashboard
.
current
.
services
.
filter
.
list
;
self
.
list
=
dashboard
.
current
.
services
.
filter
.
list
;
self
.
ids
=
dashboard
.
current
.
services
.
filter
.
ids
;
self
.
ids
=
dashboard
.
current
.
services
.
filter
.
ids
;
_f
=
dashboard
.
current
.
services
.
filter
;
_
.
each
(
self
.
list
,
function
(
f
)
{
_
.
each
(
self
.
list
,
function
(
f
)
{
self
.
set
(
f
,
f
.
id
,
true
);
self
.
set
(
f
,
f
.
id
,
true
);
...
@@ -97,8 +94,6 @@ define([
...
@@ -97,8 +94,6 @@ define([
delete
self
.
list
[
id
];
delete
self
.
list
[
id
];
// This must happen on the full path also since _.without returns a copy
// This must happen on the full path also since _.without returns a copy
self
.
ids
=
dashboard
.
current
.
services
.
filter
.
ids
=
_
.
without
(
self
.
ids
,
id
);
self
.
ids
=
dashboard
.
current
.
services
.
filter
.
ids
=
_
.
without
(
self
.
ids
,
id
);
_f
.
idQueue
.
unshift
(
id
);
_f
.
idQueue
.
sort
(
function
(
v
,
k
){
return
v
-
k
;});
_r
=
true
;
_r
=
true
;
}
else
{
}
else
{
_r
=
false
;
_r
=
false
;
...
@@ -230,10 +225,14 @@ define([
...
@@ -230,10 +225,14 @@ define([
};
};
var
nextId
=
function
()
{
var
nextId
=
function
()
{
if
(
_f
.
idQueue
.
length
>
0
)
{
var
idCount
=
dashboard
.
current
.
services
.
filter
.
ids
.
length
;
return
_f
.
idQueue
.
shift
();
if
(
idCount
>
0
)
{
// Make a sorted copy of the ids array
var
ids
=
_
.
clone
(
dashboard
.
current
.
services
.
filter
.
ids
).
sort
();
return
kbn
.
smallestMissing
(
ids
);
}
else
{
}
else
{
return
self
.
ids
.
length
;
// No ids currently in list
return
0
;
}
}
};
};
...
...
src/app/services/querySrv.js
View file @
81bbc5bb
...
@@ -14,7 +14,6 @@ function (angular, _, config, kbn) {
...
@@ -14,7 +14,6 @@ function (angular, _, config, kbn) {
// 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
,{
idQueue
:
[],
list
:
{},
list
:
{},
ids
:
[],
ids
:
[],
});
});
...
@@ -31,7 +30,6 @@ function (angular, _, config, kbn) {
...
@@ -31,7 +30,6 @@ function (angular, _, config, kbn) {
// For convenience
// For convenience
var
ejs
=
ejsResource
(
config
.
elasticsearch
);
var
ejs
=
ejsResource
(
config
.
elasticsearch
);
var
_q
=
dashboard
.
current
.
services
.
query
;
// Holds all actual queries, including all resolved abstract queries
// Holds all actual queries, including all resolved abstract queries
var
resolvedQueries
=
[];
var
resolvedQueries
=
[];
...
@@ -176,10 +174,6 @@ function (angular, _, config, kbn) {
...
@@ -176,10 +174,6 @@ function (angular, _, config, kbn) {
delete
self
.
list
[
id
];
delete
self
.
list
[
id
];
// This must happen on the full path also since _.without returns a copy
// This must happen on the full path also since _.without returns a copy
self
.
ids
=
dashboard
.
current
.
services
.
query
.
ids
=
_
.
without
(
self
.
ids
,
id
);
self
.
ids
=
dashboard
.
current
.
services
.
query
.
ids
=
_
.
without
(
self
.
ids
,
id
);
_q
.
idQueue
.
unshift
(
id
);
_q
.
idQueue
.
sort
(
function
(
v
,
k
){
return
v
-
k
;
});
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -246,10 +240,14 @@ function (angular, _, config, kbn) {
...
@@ -246,10 +240,14 @@ function (angular, _, config, kbn) {
};
};
var
nextId
=
function
()
{
var
nextId
=
function
()
{
if
(
_q
.
idQueue
.
length
>
0
)
{
var
idCount
=
dashboard
.
current
.
services
.
query
.
ids
.
length
;
return
_q
.
idQueue
.
shift
();
if
(
idCount
>
0
)
{
// Make a sorted copy of the ids array
var
ids
=
_
.
clone
(
dashboard
.
current
.
services
.
query
.
ids
).
sort
();
return
kbn
.
smallestMissing
(
ids
);
}
else
{
}
else
{
return
self
.
ids
.
length
;
// No ids currently in list
return
0
;
}
}
};
};
...
...
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