mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fixed the Add Metric button
This commit is contained in:
parent
b8e9755583
commit
b411de4e95
2 changed files with 5 additions and 14 deletions
|
@ -87,7 +87,8 @@
|
|||
</tr>
|
||||
</table>
|
||||
<form class="form-inline">
|
||||
<button class="btn btn-success" ng-click="needs_refresh(); addMetric()">Add Metric</button>
|
||||
<!-- Not a big fan of this ng-click -->
|
||||
<button class="btn btn-success" ng-click="needs_refresh(); panel.metrics.push(metricDefaults({})); metricEditor.index = panel.metrics.length-1">Add Metric</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -163,7 +163,7 @@ define([
|
|||
}
|
||||
};
|
||||
|
||||
var metricDefaults = function (m) {
|
||||
$scope.metricDefaults = function (m) {
|
||||
if (_.isUndefined($scope.modeInfo[$scope.panel.mode])) {
|
||||
return [];
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ define([
|
|||
|
||||
|
||||
$scope.panel.metrics = _.map($scope.panel.metrics, function (m) {
|
||||
return metricDefaults(m);
|
||||
return $scope.metricDefaults(m);
|
||||
});
|
||||
|
||||
$scope.$watch('panel.mode', function (m) {
|
||||
|
@ -198,7 +198,7 @@ define([
|
|||
$scope.panel.display_field = $scope.modeInfo[m].defaults.display_field;
|
||||
$scope.panel.persistent_field = $scope.modeInfo[m].defaults.persistent_field;
|
||||
$scope.panel.metrics = _.map($scope.modeInfo[m].defaults.metrics, function (m) {
|
||||
return metricDefaults(m);
|
||||
return $scope.metricDefaults(m);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -710,16 +710,6 @@ define([
|
|||
|
||||
};
|
||||
|
||||
$scope.addMetric = function (metric) {
|
||||
metric = metric || {};
|
||||
metric = metricDefaults(metric);
|
||||
$scope.panel.metrics.push(metric);
|
||||
if (!metric.field) {
|
||||
// no field defined, got into edit mode..
|
||||
$scope.metricEditor.index = $scope.panel.metrics.length - 1;
|
||||
}
|
||||
};
|
||||
|
||||
// This is expensive, it would be better to populate a scope object
|
||||
$scope.addMetricOptions = function (m) {
|
||||
if (_.isUndefined($scope.modeInfo[m])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue