mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Added a protection against typos in fields. Remove drop down from add metric for now. Added trash iconf for deleting metrics. Added proper refresh hooks upon editor changes.
This commit is contained in:
parent
95aa138100
commit
9a9328db12
2 changed files with 34 additions and 18 deletions
|
@ -8,17 +8,17 @@
|
|||
<div class="section" ng-show="panel.mode == 'nodes'">
|
||||
<div class="editor-option">
|
||||
<label class="small">Persistent id field <tip>choose a field that does not change on node restart</tip></label>
|
||||
<input type="text" bs-typeahead="fields.list" class="input-large" ng-model="panel.persistent_field"/>
|
||||
<input type="text" bs-typeahead="fields.list" ng-change="set_refresh(true)" class="input-large" ng-model="panel.persistent_field"/>
|
||||
</div>
|
||||
<div class="editor-option">
|
||||
<label class="small">Display field <tip>will be used as the name of each row</tip></label>
|
||||
<input type="text" bs-typeahead="fields.list" class="input-large" ng-model="panel.display_field"/>
|
||||
<input type="text" bs-typeahead="fields.list" class="input-large" ng-change="set_refresh(true)" ng-model="panel.display_field"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" ng-show="panel.mode == 'indices'">
|
||||
<div class="editor-option">
|
||||
<label class="small">Show hidden indices <tip>indices whose name starts with a dot (`.`) are considered hidden</tip></label>
|
||||
<input type="checkbox" ng-model="panel.show_hidden"/>
|
||||
<input type="checkbox" ng-model="panel.show_hidden" ng-change="set_refresh(true)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
|
||||
<td ng-show="metricEditor.index != $index">
|
||||
<i ng-show="metricEditor.index < 0" ng-click="metricEditor.index=$index" class="pointer icon-edit"></i></td>
|
||||
<i ng-show="metricEditor.index < 0" ng-click="set_refresh(true); metricEditor.index=$index;" class="pointer icon-edit"></i></td>
|
||||
<td ng-show="metricEditor.index != $index">
|
||||
<i ng-show="metricEditor.index < 0 && !$first" ng-click="_.move(panel.metrics,$index,$index-1)" class="pointer icon-arrow-up"></i>
|
||||
</td>
|
||||
|
@ -72,20 +72,13 @@
|
|||
<i class="pointer icon-check" ng-click="metricEditor.index=-1"></i>
|
||||
</td>
|
||||
<td ng-show="metricEditor.index == $index">
|
||||
<i ng-click="deleteMetric($index); metricEditor.index = -1;" class="pointer icon-remove"></i>
|
||||
<i ng-click="deleteMetric($index); metricEditor.index = -1;" class="pointer icon-trash"></i>
|
||||
<td ng-show="metricEditor.index == $index">
|
||||
<i class="icon"></i></td>
|
||||
</tr>
|
||||
</table>
|
||||
<form class="form-inline">
|
||||
<select ng-model="metricEditor.add">
|
||||
<option ng-repeat="metric in addMetricOptions(panel.mode)"
|
||||
value="{{metric.field}}">
|
||||
{{metric.name}}
|
||||
</option>
|
||||
</select>
|
||||
<button class="btn btn-success" ng-click="addMetric(metricEditor.add);metricEditor.add=undefined" ng-disabled="metricEditor.add === undefined">
|
||||
Add Metric</button>
|
||||
<button class="btn btn-success" ng-click="set_refresh(true); addMetric()">Add Metric</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -75,7 +75,7 @@ define([
|
|||
type: "lower_bound"
|
||||
},
|
||||
scale: 1024 * 1024 * 1024
|
||||
},
|
||||
}
|
||||
/* Dropping this until we have error handling for fields that don't exist
|
||||
{
|
||||
// allow people to add a new, not-predefined metric.
|
||||
|
@ -228,7 +228,7 @@ define([
|
|||
$scope.ejs.TermQuery($scope.panel.persistent_field, persistentId)
|
||||
)
|
||||
);
|
||||
rowRequest.size(1).fields([ $scope.panel.display_field, $scope.panel.persistent_field]);
|
||||
rowRequest.size(1).fields(_.unique([ $scope.panel.display_field, $scope.panel.persistent_field]));
|
||||
rowRequest.sort("@timestamp", "desc");
|
||||
mrequest.requests(rowRequest);
|
||||
});
|
||||
|
@ -318,11 +318,16 @@ define([
|
|||
};
|
||||
|
||||
var normalizeFacetResults = function (facets, rows, metrics) {
|
||||
facets = facets || {}; // deal better with no data.
|
||||
_.each(metrics, function (m) {
|
||||
_.each(_.pluck(rows, 'id'), function (id) {
|
||||
var summary_key = id + "_" + m.field;
|
||||
var history_key = id + "_" + m.field + "_history";
|
||||
var summary = facets[summary_key];
|
||||
if (!summary) {
|
||||
// no data for this chart.
|
||||
return;
|
||||
}
|
||||
var series_data = _.pluck(facets[history_key].entries, m.derivative ? 'min' : 'mean');
|
||||
var series_time = _.pluck(facets[history_key].entries, 'time');
|
||||
|
||||
|
@ -457,10 +462,16 @@ define([
|
|||
_.each($scope.panel.metrics, function (metric) {
|
||||
$scope.warnLevels._global_[metric.field] = 0;
|
||||
_.each(_.pluck($scope.rows, 'id'), function (id) {
|
||||
var num, level;
|
||||
num = $scope.data[id + '_' + metric.field].mean;
|
||||
level = $scope.alertLevel(metric, num);
|
||||
var num, level, summary;
|
||||
|
||||
$scope.warnLevels[id] = $scope.warnLevels[id] || {};
|
||||
|
||||
summary = $scope.data[id + '_' + metric.field];
|
||||
if (!summary) {
|
||||
return; // no data
|
||||
}
|
||||
num = summary.mean;
|
||||
level = $scope.alertLevel(metric, num);
|
||||
$scope.warnLevels[id][metric.field] = level;
|
||||
if (level > $scope.warnLevels._global_[metric.field]) {
|
||||
$scope.warnLevels._global_[metric.field] = level;
|
||||
|
@ -530,6 +541,7 @@ define([
|
|||
};
|
||||
|
||||
$scope.addMetric = function (metric) {
|
||||
metric = metric || {};
|
||||
metric = metricDefaults(metric);
|
||||
$scope.panel.metrics.push(metric);
|
||||
if (!metric.field) {
|
||||
|
@ -559,6 +571,17 @@ define([
|
|||
$scope.panel.metrics = _.without($scope.panel.metrics, $scope.panel.metrics[index]);
|
||||
};
|
||||
|
||||
$scope.set_refresh = function (state) {
|
||||
$scope.refresh = state;
|
||||
};
|
||||
|
||||
$scope.close_edit = function () {
|
||||
if ($scope.refresh) {
|
||||
$scope.get_rows();
|
||||
}
|
||||
$scope.refresh = false;
|
||||
$scope.$emit('render');
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue