mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Add: Counter option to count resultset row count.
This commit is contained in:
parent
f9da6ddcdd
commit
3864f11694
@ -2,13 +2,13 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-6">Counter Value Column Name</label>
|
||||
<div class="col-lg-6">
|
||||
<select ng-options="name for name in queryResult.getColumnNames()" ng-model="visualization.options.counterColName" class="form-control"></select>
|
||||
<select ng-options="name for name in queryResult.getColumnNames()" ng-model="visualization.options.counterColName" class="form-control" ng-disabled="visualization.options.countRow"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-6">Counter Value Row Number</label>
|
||||
<div class="col-lg-6">
|
||||
<input type="number" ng-model="visualization.options.rowNumber" min="1" class="form-control">
|
||||
<input type="number" ng-model="visualization.options.rowNumber" min="1" class="form-control" ng-disabled="visualization.options.countRow">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -25,4 +25,10 @@
|
||||
<input type="number" ng-model="visualization.options.targetRowNumber" min="1" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-6">
|
||||
<input type="checkbox" ng-model="visualization.options.countRow">
|
||||
<i class="input-helper"></i> Count Rows
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -14,10 +14,11 @@ function CounterRenderer() {
|
||||
const counterColName = $scope.visualization.options.counterColName;
|
||||
const targetColName = $scope.visualization.options.targetColName;
|
||||
|
||||
if (counterColName) {
|
||||
if ($scope.visualization.options.countRow) {
|
||||
$scope.counterValue = queryData.length;
|
||||
} else if (counterColName) {
|
||||
$scope.counterValue = queryData[rowNumber][counterColName];
|
||||
}
|
||||
|
||||
if (targetColName) {
|
||||
$scope.targetValue = queryData[targetRowNumber][targetColName];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user