Commit f5b63fc6 by Torkel Ödegaard

Merge branch 'master' into develop

parents 330a5c64 b47a4954
......@@ -14,18 +14,24 @@
* **Cloudwatch**: Show all available CloudWatch regions [#12308](https://github.com/grafana/grafana/issues/12308), thx [@mtanda](https://github.com/mtanda)
* **Cloudwatch**: AWS/Connect metrics and dimensions [#13970](https://github.com/grafana/grafana/pull/13970), thx [@zcoffy](https://github.com/zcoffy)
* **Postgres**: Add delta window function to postgres query builder [#13925](https://github.com/grafana/grafana/issues/13925), thx [svenklemm](https://github.com/svenklemm)
* **Elasticsearch**: Fix switching to/from es raw document metric query [#6367](https://github.com/grafana/grafana/issues/6367)
* **Elasticsearch**: Fix deprecation warning about terms aggregation order key in Elasticsearch 6.x [#11977](https://github.com/grafana/grafana/issues/11977)
* **Table**: Fix CSS alpha background-color applied twice in table cell with link [#13606](https://github.com/grafana/grafana/issues/13606), thx [@grisme](https://github.com/grisme)
* **Units**: New clock time format, to format ms or second values as for example `01h:59m`, [#13635](https://github.com/grafana/grafana/issues/13635), thx [@franciscocpg](https://github.com/franciscocpg)
* **Datasource Proxy**: Keep trailing slash for datasource proxy requests [#13326](https://github.com/grafana/grafana/pull/13326), thx [@ryantxu](https://github.com/ryantxu)
* **DingDing**: Can't receive DingDing alert when alert is triggered [#13723](https://github.com/grafana/grafana/issues/13723), thx [@Yukinoshita-Yukino](https://github.com/Yukinoshita-Yukino)
* **Internal metrics**: Renamed `grafana_info` to `grafana_build_info` and added branch, goversion and revision [#13876](https://github.com/grafana/grafana/pull/13876)
* **Alerting**: Increaste default duration for queries [#13945](https://github.com/grafana/grafana/pull/13945)
* **Table**: Fix CSS alpha background-color applied twice in table cell with link [#13606](https://github.com/grafana/grafana/issues/13606), thx [@grisme](https://github.com/grisme)
* **Alerting**: More options for the Slack Alert notifier [#13993](https://github.com/grafana/grafana/issues/13993), thx [@andreykaipov](https://github.com/andreykaipov)
* **Alerting**: Can't receive DingDing alert when alert is triggered [#13723](https://github.com/grafana/grafana/issues/13723), thx [@Yukinoshita-Yukino](https://github.com/Yukinoshita-Yukino)
* **Internal metrics**: Renamed `grafana_info` to `grafana_build_info` and added branch, goversion and revision [#13876](https://github.com/grafana/grafana/pull/13876)
* **Datasource Proxy**: Keep trailing slash for datasource proxy requests [#13326](https://github.com/grafana/grafana/pull/13326), thx [@ryantxu](https://github.com/ryantxu)
### Breaking changes
* Postgres/MySQL/MSSQL datasources now per default uses `max open connections` = `unlimited` (earlier 10), `max idle connections` = `2` (earlier 10) and `connection max lifetime` = `4` hours (earlier unlimited)
# 5.3.5 (unreleased)
* **Security**: Upgrade macaron session package to fix security issue. [#14043](https://github.com/grafana/grafana/pull/14043)
# 5.3.4 (2018-11-13)
* **Alerting**: Delete alerts when parent folder was deleted [#13322](https://github.com/grafana/grafana/issues/13322)
......
......@@ -94,6 +94,10 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
* Not kept in component state to prevent edit-render roundtrips.
*/
queryExpressions: string[];
/**
* Local ID cache to compare requested vs selected datasource
*/
requestedDatasourceId: string;
constructor(props) {
super(props);
......@@ -167,6 +171,9 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
const datasourceId = datasource.meta.id;
let datasourceError = null;
// Keep ID to track selection
this.requestedDatasourceId = datasourceId;
try {
const testResult = await datasource.testDatasource();
datasourceError = testResult.status === 'success' ? null : testResult.message;
......@@ -174,6 +181,11 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
datasourceError = (error && error.statusText) || 'Network error';
}
if (datasourceId !== this.requestedDatasourceId) {
// User already changed datasource again, discard results
return;
}
const historyKey = `grafana.explore.history.${datasourceId}`;
const history = store.getObject(historyKey, []);
......
......@@ -28,9 +28,13 @@ export class ElasticConfigCtrl {
];
indexPatternTypeChanged() {
const def = _.find(this.indexPatternTypes, {
value: this.current.jsonData.interval,
});
this.current.database = def.example || 'es-index-name';
if (!this.current.database ||
this.current.database.length === 0 ||
this.current.database.startsWith('[logstash-]')) {
const def = _.find(this.indexPatternTypes, {
value: this.current.jsonData.interval,
});
this.current.database = def.example || 'es-index-name';
}
}
}
......@@ -160,6 +160,12 @@ export class ElasticMetricAggCtrl {
$scope.agg.settings = {};
$scope.agg.meta = {};
$scope.showOptions = false;
// reset back to metric/group by query
if ($scope.target.bucketAggs.length === 0 && $scope.agg.type !== 'raw_document') {
$scope.target.bucketAggs = [queryDef.defaultBucketAgg()];
}
$scope.updatePipelineAggOptions();
$scope.onChange();
};
......
......@@ -181,8 +181,8 @@ export class ElasticQueryBuilder {
build(target, adhocFilters?, queryString?) {
// make sure query has defaults;
target.metrics = target.metrics || [{ type: 'count', id: '1' }];
target.bucketAggs = target.bucketAggs || [{ type: 'date_histogram', id: '2', settings: { interval: 'auto' } }];
target.metrics = target.metrics || [queryDef.defaultMetricAgg()];
target.bucketAggs = target.bucketAggs || [queryDef.defaultBucketAgg()];
target.timeField = this.timeField;
let i, nestedAggs, metric;
......
......@@ -17,6 +17,19 @@ export class ElasticQueryCtrl extends QueryCtrl {
super($scope, $injector);
this.esVersion = this.datasource.esVersion;
this.target = this.target || {};
this.target.metrics = this.target.metrics || [queryDef.defaultMetricAgg()];
this.target.bucketAggs = this.target.bucketAggs || [queryDef.defaultBucketAgg()];
if (this.target.bucketAggs.length === 0) {
const metric = this.target.metrics[0];
if (!metric || metric.type !== 'raw_document') {
this.target.bucketAggs = [queryDef.defaultBucketAgg()];
}
this.refresh();
}
this.queryUpdated();
}
......
......@@ -228,3 +228,11 @@ export function describeOrderBy(orderBy, target) {
return 'metric not found';
}
}
export function defaultMetricAgg() {
return { type: 'count', id: '1' };
}
export function defaultBucketAgg() {
return { type: 'date_histogram', id: '2', settings: { interval: 'auto' } };
}
......@@ -320,8 +320,11 @@
.ReactTable {
border: none;
}
.ReactTable .rt-table {
// Allow some space for the no-data text
min-height: 120px;
min-height: 90px;
}
.ReactTable .rt-thead.-header {
......@@ -350,6 +353,11 @@
.ReactTable .rt-tbody .rt-td:last-child {
border-right: none;
}
.ReactTable .-pagination {
border-top: none;
box-shadow: none;
margin-top: $panel-margin;
}
.ReactTable .-pagination .-btn {
color: $blue;
background: $list-item-bg;
......@@ -371,6 +379,10 @@
.ReactTable .rt-tr .rt-td:last-child {
text-align: right;
}
.ReactTable .rt-noData {
top: 60px;
z-index: inherit;
}
// React-component cascade fix: show "loading" even though item can expand
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment