Commit cbb9a63b by Ryan McKinley Committed by GitHub

Azure: query builder cleanup (#25956)

parent 3a9a4f4a
...@@ -931,11 +931,22 @@ describe('AzureMonitorDatasource', () => { ...@@ -931,11 +931,22 @@ describe('AzureMonitorDatasource', () => {
'Transactions' 'Transactions'
) )
.then((results: any) => { .then((results: any) => {
expect(results.dimensions.length).toEqual(4); expect(results.dimensions).toMatchInlineSnapshot(`
expect(results.dimensions[0].text).toEqual('None'); Array [
expect(results.dimensions[0].value).toEqual('None'); Object {
expect(results.dimensions[1].text).toEqual('Response type'); "text": "Response type",
expect(results.dimensions[1].value).toEqual('ResponseType'); "value": "ResponseType",
},
Object {
"text": "Geo type",
"value": "GeoType",
},
Object {
"text": "API name",
"value": "ApiName",
},
]
`);
}); });
}); });
......
...@@ -74,11 +74,14 @@ export default class AzureMonitorDatasource extends DataSourceWithBackend<AzureM ...@@ -74,11 +74,14 @@ export default class AzureMonitorDatasource extends DataSourceWithBackend<AzureM
const aggregation = templateSrv.replace(item.aggregation, scopedVars); const aggregation = templateSrv.replace(item.aggregation, scopedVars);
const top = templateSrv.replace(item.top || '', scopedVars); const top = templateSrv.replace(item.top || '', scopedVars);
const dimensionsFilters = item.dimensionFilters.map(f => { const dimensionsFilters = item.dimensionFilters
.filter(f => f.dimension && f.dimension !== 'None')
.map(f => {
const filter = templateSrv.replace(f.filter, scopedVars);
return { return {
dimension: templateSrv.replace(f.dimension, scopedVars), dimension: templateSrv.replace(f.dimension, scopedVars),
operator: f.operator || 'eq', operator: f.operator || 'eq',
filter: templateSrv.replace(f.filter, scopedVars), filter: filter || '*', // send * when empty
}; };
}); });
......
...@@ -92,10 +92,6 @@ export default class ResponseParser { ...@@ -92,10 +92,6 @@ export default class ResponseParser {
return dimensions; return dimensions;
} }
if (!metricData.isDimensionRequired) {
dimensions.push({ text: 'None', value: 'None' });
}
for (let i = 0; i < metricData.dimensions.length; i++) { for (let i = 0; i < metricData.dimensions.length; i++) {
const text = metricData.dimensions[i].localizedValue; const text = metricData.dimensions[i].localizedValue;
const value = metricData.dimensions[i].value; const value = metricData.dimensions[i].value;
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
> >
</gf-form-dropdown> </gf-form-dropdown>
</div> </div>
<div class="gf-form gf-form--grow aggregation-dropdown-wrapper"> <div class="gf-form">
<label class="gf-form-label query-keyword width-9">Aggregation</label> <label class="gf-form-label query-keyword width-9">Aggregation</label>
<div class="gf-form-select-wrapper gf-form-select-wrapper--caret-indent"> <div class="gf-form-select-wrapper gf-form-select-wrapper--caret-indent">
<select <select
...@@ -111,6 +111,9 @@ ...@@ -111,6 +111,9 @@
></select> ></select>
</div> </div>
</div> </div>
<div class="gf-form gf-form--grow">
<div class="gf-form-label gf-form-label--grow"></div>
</div>
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">
<div class="gf-form"> <div class="gf-form">
......
...@@ -533,7 +533,6 @@ export class AzureMonitorQueryCtrl extends QueryCtrl { ...@@ -533,7 +533,6 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
operator: 'eq', operator: 'eq',
filter: '', filter: '',
}); });
this.refresh();
} }
azureMonitorRemoveDimensionFilter(index: number) { azureMonitorRemoveDimensionFilter(index: number) {
......
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