Fixing buttons in Discover view

This commit is contained in:
Manuel Albarral 2017-09-13 20:16:28 +02:00
parent 4bb8da154b
commit a6dcb635a4
2 changed files with 24 additions and 8 deletions

View File

@ -55,6 +55,7 @@ import { SavedObjectsClientProvider } from 'ui/saved_objects';
import { savedSearchProvider } from 'plugins/kibana/discover/saved_searches/saved_search_register';
import { getDefaultQuery } from 'ui/parse_query';
import { IndexPatternsFieldListProvider } from 'ui/index_patterns/_field_list';
import { fieldCalculator } from 'plugins/kibana/discover/components/field_chooser/lib/field_calculator';
SavedObjectRegistryProvider.register(savedSearchProvider);
@ -93,6 +94,16 @@ var app = require('ui/modules').get('app/wazuh', [])
require('ui/modules').get('app/wazuh', []).controller('discoverW', function($scope, config, courier, $route, $window, Notifier,
AppState, timefilter, Promise, Private, kbnUrl, $location, savedSearches, appState, $rootScope, getAppState) {
$scope.$watch(function () {
console.log($('a.kuiButton.kuiButton--primary.kuiButton--small.kuiButton--fullWidth.kuiVerticalRhythmSmall').length);
return $('a.kuiButton.kuiButton--primary.kuiButton--small.kuiButton--fullWidth.kuiVerticalRhythmSmall').length;
}, function() {
document.querySelectorAll('.kuiButton.kuiButton--primary.kuiButton--small.kuiButton--fullWidth.kuiVerticalRhythmSmall').forEach(function(elem){
//elem.attr('ng-href') = elem.attr('ng-href').replace('/wazuh#', '/kibana#');
console.log(elem.getAttribute("ng-href").value);
});
});
const FieldList = Private(IndexPatternsFieldListProvider);
$scope.cluster_info = appState.getClusterInfo();
$scope.cluster_filter = "cluster.name: " + $scope.cluster_info.cluster;
@ -117,6 +128,7 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function($sco
$scope.addColumn = function addColumn(columnName) {
$scope.indexPattern.popularizeField(columnName, 1);
columnActions.addColumn($scope.state.columns, columnName);
$scope.columns = $scope.state.columns;
};
$scope.chrome.getVisible = function() {
return true;
@ -551,15 +563,18 @@ require('ui/modules').get('app/wazuh', []).controller('discoverW', function($sco
$scope.addColumn = function addColumn(columnName) {
$scope.indexPattern.popularizeField(columnName, 1);
columnActions.addColumn($scope.state.columns, columnName);
$scope.columns = $scope.state.columns;
};
$scope.removeColumn = function removeColumn(columnName) {
$scope.indexPattern.popularizeField(columnName, 1);
columnActions.removeColumn($scope.state.columns, columnName);
$scope.columns = $scope.state.columns;
};
$scope.moveColumn = function moveColumn(columnName, newIndex) {
columnActions.moveColumn($scope.state.columns, columnName, newIndex);
$scope.columns = $scope.state.columns;
};
$scope.toTop = function () {
@ -849,12 +864,13 @@ $scope.selectedIndexPattern = $scope.indexPatternList.find(
visualizeUrl: field.visualizable ? getVisualizeUrl(field) : null,
},
fieldCalculator.getFieldValueCounts({
hits: $scope.hits,
hits: $scope.rows,
field: field,
count: 5,
grouped: false
}),
);
console.log($scope);
_.each(field.details.buckets, function (bucket) {
bucket.display = field.format.convert(bucket.value);
});

View File

@ -110,9 +110,9 @@
<discover-field
ng-repeat="field in fields.raw|filter:{display:true}"
field="field"
on-add-field="onAddField"
on-add-field="addColumn"
on-add-filter="onAddFilter"
on-remove-field="onRemoveField"
on-remove-field="removeColumn"
on-show-details="computeDetails"
>
</discover-field>
@ -205,9 +205,9 @@
<discover-field
ng-repeat="field in popularFields | filter:filter.isFieldFiltered"
field="field"
on-add-field="onAddField"
on-add-field="addColumn"
on-add-filter="onAddFilter"
on-remove-field="onRemoveField"
on-remove-field="removeColumn"
on-show-details="computeDetails"
>
</discover-field>
@ -219,9 +219,9 @@
<discover-field
ng-repeat="field in unpopularFields | filter:filter.isFieldFiltered"
field="field"
on-add-field="onAddField"
on-add-field="addColumn"
on-add-filter="onAddFilter"
on-remove-field="onRemoveField"
on-remove-field="removeColumn"
on-show-details="computeDetails"
>
</discover-field>