mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TestData: attach labels to series results (#18653)
This commit is contained in:
@@ -14,7 +14,19 @@
|
||||
<label class="gf-form-label query-keyword">Alias</label>
|
||||
<input type="text" class="gf-form-input max-width-7" placeholder="optional" ng-model="ctrl.target.alias" ng-change="ctrl.refresh()" ng-model-onblur>
|
||||
</div>
|
||||
<div class="gf-form gf-form--grow">
|
||||
<div ng-if="ctrl.showLabels" class="gf-form gf-form--grow">
|
||||
<label class="gf-form-label query-keyword">
|
||||
Labels
|
||||
<info-popover mode="right-normal">
|
||||
Set labels using a key=value syntax:<br/>
|
||||
{key="value", key2="value"}<br/>
|
||||
key="value", key2="value"<br/>
|
||||
key=value, key2=value<br/>
|
||||
</info-popover>
|
||||
</label>
|
||||
<input type="text" class="gf-form-input gf-form--grow" placeholder='key=value, key2=value2' ng-model="ctrl.target.labels" ng-change="ctrl.refresh()" ng-model-onblur>
|
||||
</div>
|
||||
<div ng-if="!ctrl.showLabels" class="gf-form gf-form--grow">
|
||||
<div class="gf-form-label gf-form-label--grow"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,8 @@ export const defaultCSVWave: any = {
|
||||
valuesCSV: '0,0,2,2,1,1',
|
||||
};
|
||||
|
||||
const showLabelsFor = ['random_walk', 'predictable_pulse', 'predictable_csv_wave'];
|
||||
|
||||
export class TestDataQueryCtrl extends QueryCtrl {
|
||||
static templateUrl = 'partials/query.editor.html';
|
||||
|
||||
@@ -27,6 +29,8 @@ export class TestDataQueryCtrl extends QueryCtrl {
|
||||
newPointTime: any;
|
||||
selectedPoint: any;
|
||||
|
||||
showLabels = false;
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope: any, $injector: any) {
|
||||
super($scope, $injector);
|
||||
@@ -35,6 +39,7 @@ export class TestDataQueryCtrl extends QueryCtrl {
|
||||
this.scenarioList = [];
|
||||
this.newPointTime = dateTime();
|
||||
this.selectedPoint = { text: 'Select point', value: null };
|
||||
this.showLabels = showLabelsFor.includes(this.target.scenarioId);
|
||||
}
|
||||
|
||||
getPoints() {
|
||||
@@ -75,6 +80,7 @@ export class TestDataQueryCtrl extends QueryCtrl {
|
||||
scenarioChanged() {
|
||||
this.scenario = _.find(this.scenarioList, { id: this.target.scenarioId });
|
||||
this.target.stringInput = this.scenario.stringInput;
|
||||
this.showLabels = showLabelsFor.includes(this.target.scenarioId);
|
||||
|
||||
if (this.target.scenarioId === 'manual_entry') {
|
||||
this.target.points = this.target.points || [];
|
||||
|
||||
Reference in New Issue
Block a user