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
bd6e2d6c
Commit
bd6e2d6c
authored
Nov 21, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into external-plugins
parents
df0bc7bb
9d1906d3
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
123 additions
and
26 deletions
+123
-26
CHANGELOG.md
+1
-0
docs/sources/reference/http_api.md
+6
-3
public/app/panels/table/controller.ts
+1
-1
public/app/panels/table/editor.html
+1
-1
public/app/panels/table/editor.ts
+2
-1
public/app/panels/table/module.ts
+2
-7
public/app/panels/table/renderer.ts
+3
-2
public/app/panels/table/transformers.ts
+1
-1
public/app/plugins/datasource/elasticsearch/datasource.js
+1
-5
public/app/plugins/datasource/elasticsearch/elastic_response.js
+59
-3
public/app/plugins/datasource/elasticsearch/query_builder.js
+1
-2
public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts
+45
-0
No files found.
CHANGELOG.md
View file @
bd6e2d6c
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
*
**dashboard**
: fix for collapse row by clicking on row title, fixes
[
#3065
](
https://github.com/grafana/grafana/issues/3065
)
*
**dashboard**
: fix for collapse row by clicking on row title, fixes
[
#3065
](
https://github.com/grafana/grafana/issues/3065
)
*
**influxdb**
: fix for relative time ranges
`last x months`
and
`last x years`
, fixes
[
#3067
](
https://github.com/grafana/grafana/issues/3067
)
*
**influxdb**
: fix for relative time ranges
`last x months`
and
`last x years`
, fixes
[
#3067
](
https://github.com/grafana/grafana/issues/3067
)
*
**graph**
: layout fix for color picker when right side legend was enabled, fixes
[
#3093
](
https://github.com/grafana/grafana/issues/3093
)
*
**graph**
: layout fix for color picker when right side legend was enabled, fixes
[
#3093
](
https://github.com/grafana/grafana/issues/3093
)
*
**elasticsearch**
: disabling elastic query (via eye) caused error, fixes
[
#3300
](
https://github.com/grafana/grafana/issues/3300
)
# 2.5 (2015-10-28)
# 2.5 (2015-10-28)
...
...
docs/sources/reference/http_api.md
View file @
bd6e2d6c
...
@@ -774,6 +774,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
...
@@ -774,6 +774,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
HTTP/1.1 200
HTTP/1.1 200
Content-Type: application/json
Content-Type: application/json
[
[
{
{
"id": 1,
"id": 1,
...
@@ -833,6 +834,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
...
@@ -833,6 +834,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
"login":"user",
"login":"user",
"theme":"light"
"theme":"light"
}
}
**Example Response**
:
**Example Response**
:
HTTP/1.1 200
HTTP/1.1 200
...
@@ -906,16 +908,17 @@ Changes the password for the user
...
@@ -906,16 +908,17 @@ Changes the password for the user
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
{
"password": ""new_password"
"oldPassword": "old_password",
"newPassword": "new_password",
"confirmNew": "confirm_new_password"
}
}
**Example Response**
:
**Example Response**
:
HTTP/1.1 200
HTTP/1.1 200
Content-Type: application/json
Content-Type: application/json
{"message":"User password updat
ed"}
{"message":"User password chang
ed"}
### Switch user context
### Switch user context
...
...
public/app/panels/table/controller.ts
View file @
bd6e2d6c
...
@@ -27,7 +27,7 @@ export class TablePanelCtrl {
...
@@ -27,7 +27,7 @@ export class TablePanelCtrl {
var
panelDefaults
=
{
var
panelDefaults
=
{
targets
:
[{}],
targets
:
[{}],
transform
:
'timeseries_to_rows'
,
transform
:
'timeseries_to_rows'
,
pageSize
:
50
,
pageSize
:
null
,
showHeader
:
true
,
showHeader
:
true
,
styles
:
[
styles
:
[
{
{
...
...
public/app/panels/table/editor.html
View file @
bd6e2d6c
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
Pagination (Page size)
Pagination (Page size)
</li>
</li>
<li>
<li>
<input
type=
"number"
class=
"input-small tight-form-input"
placeholder=
"
5
0"
<input
type=
"number"
class=
"input-small tight-form-input"
placeholder=
"
10
0"
empty-to-null
ng-model=
"panel.pageSize"
ng-change=
"render()"
ng-model-onblur
>
empty-to-null
ng-model=
"panel.pageSize"
ng-change=
"render()"
ng-model-onblur
>
</li>
</li>
<li
class=
"tight-form-item"
>
<li
class=
"tight-form-item"
>
...
...
public/app/panels/table/editor.ts
View file @
bd6e2d6c
...
@@ -38,7 +38,7 @@ export function tablePanelEditor() {
...
@@ -38,7 +38,7 @@ export function tablePanelEditor() {
scope
.
updateColumnsMenu
=
function
(
data
)
{
scope
.
updateColumnsMenu
=
function
(
data
)
{
scope
.
columnsMenu
=
transformers
[
scope
.
panel
.
transform
].
getColumns
(
data
);
scope
.
columnsMenu
=
transformers
[
scope
.
panel
.
transform
].
getColumns
(
data
);
scope
.
showColumnOptions
=
scope
.
columnsMenu
.
length
>
0
;
scope
.
showColumnOptions
=
true
;
};
};
scope
.
$on
(
'render'
,
function
(
event
,
table
,
rawData
)
{
scope
.
$on
(
'render'
,
function
(
event
,
table
,
rawData
)
{
...
@@ -51,6 +51,7 @@ export function tablePanelEditor() {
...
@@ -51,6 +51,7 @@ export function tablePanelEditor() {
};
};
scope
.
transformChanged
=
function
()
{
scope
.
transformChanged
=
function
()
{
scope
.
panel
.
columns
=
[];
scope
.
updateColumnsMenu
();
scope
.
updateColumnsMenu
();
scope
.
render
();
scope
.
render
();
};
};
...
...
public/app/panels/table/module.ts
View file @
bd6e2d6c
...
@@ -45,7 +45,8 @@ export function tablePanel() {
...
@@ -45,7 +45,8 @@ export function tablePanel() {
function
appendPaginationControls
(
footerElem
)
{
function
appendPaginationControls
(
footerElem
)
{
footerElem
.
empty
();
footerElem
.
empty
();
var
pageCount
=
Math
.
ceil
(
data
.
rows
.
length
/
panel
.
pageSize
);
var
pageSize
=
panel
.
pageSize
||
100
;
var
pageCount
=
Math
.
ceil
(
data
.
rows
.
length
/
pageSize
);
if
(
pageCount
===
1
)
{
if
(
pageCount
===
1
)
{
return
;
return
;
}
}
...
@@ -55,18 +56,12 @@ export function tablePanel() {
...
@@ -55,18 +56,12 @@ export function tablePanel() {
var
paginationList
=
$
(
'<ul></ul>'
);
var
paginationList
=
$
(
'<ul></ul>'
);
// var prevLink = $('<li><a class="table-panel-page-link pointer">«</a></li>');
// paginationList.append(prevLink);
for
(
var
i
=
startPage
;
i
<
endPage
;
i
++
)
{
for
(
var
i
=
startPage
;
i
<
endPage
;
i
++
)
{
var
activeClass
=
i
===
scope
.
pageIndex
?
'active'
:
''
;
var
activeClass
=
i
===
scope
.
pageIndex
?
'active'
:
''
;
var
pageLinkElem
=
$
(
'<li><a class="table-panel-page-link pointer '
+
activeClass
+
'">'
+
(
i
+
1
)
+
'</a></li>'
);
var
pageLinkElem
=
$
(
'<li><a class="table-panel-page-link pointer '
+
activeClass
+
'">'
+
(
i
+
1
)
+
'</a></li>'
);
paginationList
.
append
(
pageLinkElem
);
paginationList
.
append
(
pageLinkElem
);
}
}
// var nextLink = $('<li><a href="#">»</a></li>');
// paginationList.append(nextLink);
footerElem
.
append
(
paginationList
);
footerElem
.
append
(
paginationList
);
}
}
...
...
public/app/panels/table/renderer.ts
View file @
bd6e2d6c
...
@@ -119,8 +119,9 @@ export class TableRenderer {
...
@@ -119,8 +119,9 @@ export class TableRenderer {
}
}
render
(
page
)
{
render
(
page
)
{
let
startPos
=
page
*
this
.
panel
.
pageSize
;
let
pageSize
=
this
.
panel
.
pageSize
||
100
;
let
endPos
=
Math
.
min
(
startPos
+
this
.
panel
.
pageSize
,
this
.
table
.
rows
.
length
);
let
startPos
=
page
*
pageSize
;
let
endPos
=
Math
.
min
(
startPos
+
pageSize
,
this
.
table
.
rows
.
length
);
var
html
=
""
;
var
html
=
""
;
for
(
var
y
=
startPos
;
y
<
endPos
;
y
++
)
{
for
(
var
y
=
startPos
;
y
<
endPos
;
y
++
)
{
...
...
public/app/panels/table/transformers.ts
View file @
bd6e2d6c
...
@@ -145,7 +145,7 @@ transformers['json'] = {
...
@@ -145,7 +145,7 @@ transformers['json'] = {
var
names
:
any
=
{};
var
names
:
any
=
{};
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
var
series
=
data
[
i
];
var
series
=
data
[
i
];
if
(
series
.
type
=
==
'docs'
)
{
if
(
series
.
type
!
==
'docs'
)
{
continue
;
continue
;
}
}
...
...
public/app/plugins/datasource/elasticsearch/datasource.js
View file @
bd6e2d6c
...
@@ -163,11 +163,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
...
@@ -163,11 +163,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
var
payload
=
""
;
var
payload
=
""
;
var
target
;
var
target
;
var
sentTargets
=
[];
var
sentTargets
=
[];
var
headerAdded
=
false
;
for
(
var
i
=
0
;
i
<
options
.
targets
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
options
.
targets
.
length
;
i
++
)
{
target
=
options
.
targets
[
i
];
target
=
options
.
targets
[
i
];
if
(
target
.
hide
)
{
return
;}
if
(
target
.
hide
)
{
continue
;}
var
queryObj
=
this
.
queryBuilder
.
build
(
target
);
var
queryObj
=
this
.
queryBuilder
.
build
(
target
);
var
esQuery
=
angular
.
toJson
(
queryObj
);
var
esQuery
=
angular
.
toJson
(
queryObj
);
...
@@ -176,12 +175,9 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
...
@@ -176,12 +175,9 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
luceneQuery
=
luceneQuery
.
substr
(
1
,
luceneQuery
.
length
-
2
);
luceneQuery
=
luceneQuery
.
substr
(
1
,
luceneQuery
.
length
-
2
);
esQuery
=
esQuery
.
replace
(
"$lucene_query"
,
luceneQuery
);
esQuery
=
esQuery
.
replace
(
"$lucene_query"
,
luceneQuery
);
if
(
!
headerAdded
)
{
var
searchType
=
queryObj
.
size
===
0
?
'count'
:
'query_then_fetch'
;
var
searchType
=
queryObj
.
size
===
0
?
'count'
:
'query_then_fetch'
;
var
header
=
this
.
getQueryHeader
(
searchType
,
options
.
range
.
from
,
options
.
range
.
to
);
var
header
=
this
.
getQueryHeader
(
searchType
,
options
.
range
.
from
,
options
.
range
.
to
);
payload
+=
header
+
'
\
n'
;
payload
+=
header
+
'
\
n'
;
headerAdded
=
true
;
}
payload
+=
esQuery
+
'
\
n'
;
payload
+=
esQuery
+
'
\
n'
;
sentTargets
.
push
(
target
);
sentTargets
.
push
(
target
);
...
...
public/app/plugins/datasource/elasticsearch/elastic_response.js
View file @
bd6e2d6c
...
@@ -86,21 +86,72 @@ function (_, queryDef) {
...
@@ -86,21 +86,72 @@ function (_, queryDef) {
}
}
};
};
ElasticResponse
.
prototype
.
processAggregationDocs
=
function
(
esAgg
,
aggDef
,
target
,
docs
,
props
)
{
var
metric
,
y
,
i
,
bucket
,
metricName
,
doc
;
for
(
i
=
0
;
i
<
esAgg
.
buckets
.
length
;
i
++
)
{
bucket
=
esAgg
.
buckets
[
i
];
doc
=
_
.
defaults
({},
props
);
doc
[
aggDef
.
field
]
=
bucket
.
key
;
for
(
y
=
0
;
y
<
target
.
metrics
.
length
;
y
++
)
{
metric
=
target
.
metrics
[
y
];
switch
(
metric
.
type
)
{
case
"count"
:
{
metricName
=
this
.
_getMetricName
(
metric
.
type
);
doc
[
metricName
]
=
bucket
.
doc_count
;
break
;
}
case
'extended_stats'
:
{
for
(
var
statName
in
metric
.
meta
)
{
if
(
!
metric
.
meta
[
statName
])
{
continue
;
}
var
stats
=
bucket
[
metric
.
id
];
// add stats that are in nested obj to top level obj
stats
.
std_deviation_bounds_upper
=
stats
.
std_deviation_bounds
.
upper
;
stats
.
std_deviation_bounds_lower
=
stats
.
std_deviation_bounds
.
lower
;
metricName
=
this
.
_getMetricName
(
statName
);
doc
[
metricName
]
=
stats
[
statName
];
}
break
;
}
default
:
{
metricName
=
this
.
_getMetricName
(
metric
.
type
);
doc
[
metricName
]
=
bucket
[
metric
.
id
].
value
;
break
;
}
}
}
docs
.
push
(
doc
);
}
};
// This is quite complex
// This is quite complex
// neeed to recurise down the nested buckets to build series
// neeed to recurise down the nested buckets to build series
ElasticResponse
.
prototype
.
processBuckets
=
function
(
aggs
,
target
,
seriesList
,
props
)
{
ElasticResponse
.
prototype
.
processBuckets
=
function
(
aggs
,
target
,
seriesList
,
docs
,
props
,
depth
)
{
var
bucket
,
aggDef
,
esAgg
,
aggId
;
var
bucket
,
aggDef
,
esAgg
,
aggId
;
var
maxDepth
=
target
.
bucketAggs
.
length
-
1
;
for
(
aggId
in
aggs
)
{
for
(
aggId
in
aggs
)
{
aggDef
=
_
.
findWhere
(
target
.
bucketAggs
,
{
id
:
aggId
});
aggDef
=
_
.
findWhere
(
target
.
bucketAggs
,
{
id
:
aggId
});
esAgg
=
aggs
[
aggId
];
esAgg
=
aggs
[
aggId
];
if
(
!
aggDef
)
{
if
(
!
aggDef
)
{
continue
;
continue
;
}
}
if
(
depth
===
maxDepth
)
{
if
(
aggDef
.
type
===
'date_histogram'
)
{
if
(
aggDef
.
type
===
'date_histogram'
)
{
this
.
processMetrics
(
esAgg
,
target
,
seriesList
,
props
);
this
.
processMetrics
(
esAgg
,
target
,
seriesList
,
props
);
}
else
{
}
else
{
this
.
processAggregationDocs
(
esAgg
,
aggDef
,
target
,
docs
,
props
);
}
}
else
{
for
(
var
nameIndex
in
esAgg
.
buckets
)
{
for
(
var
nameIndex
in
esAgg
.
buckets
)
{
bucket
=
esAgg
.
buckets
[
nameIndex
];
bucket
=
esAgg
.
buckets
[
nameIndex
];
props
=
_
.
clone
(
props
);
props
=
_
.
clone
(
props
);
...
@@ -109,7 +160,7 @@ function (_, queryDef) {
...
@@ -109,7 +160,7 @@ function (_, queryDef) {
}
else
{
}
else
{
props
[
"filter"
]
=
nameIndex
;
props
[
"filter"
]
=
nameIndex
;
}
}
this
.
processBuckets
(
bucket
,
target
,
seriesList
,
props
);
this
.
processBuckets
(
bucket
,
target
,
seriesList
,
docs
,
props
,
depth
+
1
);
}
}
}
}
}
}
...
@@ -217,13 +268,18 @@ function (_, queryDef) {
...
@@ -217,13 +268,18 @@ function (_, queryDef) {
var
aggregations
=
response
.
aggregations
;
var
aggregations
=
response
.
aggregations
;
var
target
=
this
.
targets
[
i
];
var
target
=
this
.
targets
[
i
];
var
tmpSeriesList
=
[];
var
tmpSeriesList
=
[];
var
docs
=
[];
this
.
processBuckets
(
aggregations
,
target
,
tmpSeriesList
,
{}
);
this
.
processBuckets
(
aggregations
,
target
,
tmpSeriesList
,
docs
,
{},
0
);
this
.
nameSeries
(
tmpSeriesList
,
target
);
this
.
nameSeries
(
tmpSeriesList
,
target
);
for
(
var
y
=
0
;
y
<
tmpSeriesList
.
length
;
y
++
)
{
for
(
var
y
=
0
;
y
<
tmpSeriesList
.
length
;
y
++
)
{
seriesList
.
push
(
tmpSeriesList
[
y
]);
seriesList
.
push
(
tmpSeriesList
[
y
]);
}
}
if
(
seriesList
.
length
===
0
&&
docs
.
length
>
0
)
{
seriesList
.
push
({
target
:
'docs'
,
type
:
'docs'
,
datapoints
:
docs
});
}
}
}
}
}
...
...
public/app/plugins/datasource/elasticsearch/query_builder.js
View file @
bd6e2d6c
...
@@ -10,7 +10,7 @@ function (angular) {
...
@@ -10,7 +10,7 @@ function (angular) {
ElasticQueryBuilder
.
prototype
.
getRangeFilter
=
function
()
{
ElasticQueryBuilder
.
prototype
.
getRangeFilter
=
function
()
{
var
filter
=
{};
var
filter
=
{};
filter
[
this
.
timeField
]
=
{
"gte"
:
"$timeFrom"
,
"lte"
:
"$timeTo"
,
"format"
:
"epoch_millis"
};
filter
[
this
.
timeField
]
=
{
"gte"
:
"$timeFrom"
,
"lte"
:
"$timeTo"
};
return
filter
;
return
filter
;
};
};
...
@@ -127,7 +127,6 @@ function (angular) {
...
@@ -127,7 +127,6 @@ function (angular) {
"interval"
:
this
.
getInterval
(
aggDef
),
"interval"
:
this
.
getInterval
(
aggDef
),
"field"
:
this
.
timeField
,
"field"
:
this
.
timeField
,
"min_doc_count"
:
0
,
"min_doc_count"
:
0
,
"format"
:
"epoch_millis"
,
"extended_bounds"
:
{
"min"
:
"$timeFrom"
,
"max"
:
"$timeTo"
}
"extended_bounds"
:
{
"min"
:
"$timeFrom"
,
"max"
:
"$timeTo"
}
};
};
break
;
break
;
...
...
public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts
View file @
bd6e2d6c
...
@@ -411,6 +411,51 @@ describe('ElasticResponse', function() {
...
@@ -411,6 +411,51 @@ describe('ElasticResponse', function() {
});
});
});
});
describe
(
'No group by time'
,
function
()
{
beforeEach
(
function
()
{
targets
=
[{
refId
:
'A'
,
metrics
:
[{
type
:
'avg'
,
id
:
'1'
},
{
type
:
'count'
}],
bucketAggs
:
[{
id
:
'2'
,
type
:
'terms'
,
field
:
'host'
}],
}];
response
=
{
responses
:
[{
aggregations
:
{
"2"
:
{
buckets
:
[
{
"1"
:
{
value
:
1000
},
key
:
"server-1"
,
doc_count
:
369
,
},
{
"1"
:
{
value
:
2000
},
key
:
"server-2"
,
doc_count
:
200
,
},
]
}
}
}]
};
result
=
new
ElasticResponse
(
targets
,
response
).
getTimeSeries
();
});
it
.
only
(
'should return table'
,
function
()
{
expect
(
result
.
data
.
length
).
to
.
be
(
1
);
expect
(
result
.
data
[
0
].
type
).
to
.
be
(
'docs'
);
expect
(
result
.
data
[
0
].
datapoints
.
length
).
to
.
be
(
2
);
expect
(
result
.
data
[
0
].
datapoints
[
0
].
host
).
to
.
be
(
"server-1"
);
expect
(
result
.
data
[
0
].
datapoints
[
0
].
Average
).
to
.
be
(
1000
);
expect
(
result
.
data
[
0
].
datapoints
[
0
].
Count
).
to
.
be
(
369
);
expect
(
result
.
data
[
0
].
datapoints
[
1
].
host
).
to
.
be
(
"server-2"
);
expect
(
result
.
data
[
0
].
datapoints
[
1
].
Average
).
to
.
be
(
2000
);
});
});
describe
(
'Raw documents query'
,
function
()
{
describe
(
'Raw documents query'
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
targets
=
[{
refId
:
'A'
,
metrics
:
[{
type
:
'raw_document'
,
id
:
'1'
}],
bucketAggs
:
[]
}];
targets
=
[{
refId
:
'A'
,
metrics
:
[{
type
:
'raw_document'
,
id
:
'1'
}],
bucketAggs
:
[]
}];
...
...
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