mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
datasource: testdata - add predicatable csv wave scenario (#18183)
This commit is contained in:
@@ -180,4 +180,32 @@
|
||||
ng-model-onblur />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Predictable CSV Wave Scenario Options Form -->
|
||||
<div class="gf-form-inline" ng-if="ctrl.scenario.id === 'predictable_csv_wave'">
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label query-keyword width-7">
|
||||
Step
|
||||
<info-popover mode="right-normal">The number of seconds between datapoints.</info-popover>
|
||||
</label>
|
||||
<input type="number"
|
||||
class="gf-form-input width-5"
|
||||
placeholder="60"
|
||||
ng-model="ctrl.target.csvWave.timeStep"
|
||||
ng-change="ctrl.refresh()"
|
||||
ng-model-onblur />
|
||||
</div>
|
||||
<div class="gf-form gf-form--grow">
|
||||
<label class="gf-form-label query-keyword width-10">
|
||||
CSV Values
|
||||
<info-popover mode="right-normal">Comma separated values. Each value may be an int, float, or null and must not be empty. Whitespace and trailing commas are removed.</info-popover>
|
||||
</label>
|
||||
<input type="string"
|
||||
class="gf-form-input gf-form-label--grow"
|
||||
placeholder="1,2,3,2"
|
||||
ng-model="ctrl.target.csvWave.valuesCSV"
|
||||
ng-change="ctrl.refresh()"
|
||||
ng-model-onblur />
|
||||
</div>
|
||||
</div>
|
||||
</query-editor-row>
|
||||
|
||||
@@ -13,6 +13,11 @@ export const defaultPulse: any = {
|
||||
offValue: 1,
|
||||
};
|
||||
|
||||
export const defaultCSVWave: any = {
|
||||
timeStep: 60,
|
||||
valuesCSV: '0,0,2,2,1,1',
|
||||
};
|
||||
|
||||
export class TestDataQueryCtrl extends QueryCtrl {
|
||||
static templateUrl = 'partials/query.editor.html';
|
||||
|
||||
@@ -89,6 +94,12 @@ export class TestDataQueryCtrl extends QueryCtrl {
|
||||
delete this.target.pulseWave;
|
||||
}
|
||||
|
||||
if (this.target.scenarioId === 'predictable_csv_wave') {
|
||||
this.target.csvWave = _.defaults(this.target.csvWave || {}, defaultCSVWave);
|
||||
} else {
|
||||
delete this.target.csvWave;
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user