mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Use fat arrow function instead of self var in _objects.js. Add 'areAllRowsChecked' controller method.
This commit is contained in:
parent
0f32b83747
commit
fd29dbb445
2 changed files with 11 additions and 6 deletions
|
@ -116,7 +116,7 @@
|
|||
<input
|
||||
type="checkbox"
|
||||
class="kuiCheckBox"
|
||||
ng-checked="currentTab.data.length > 0 && selectedItems.length == currentTab.data.length"
|
||||
ng-checked="managementObjectsController.areAllRowsChecked()"
|
||||
ng-click="toggleAll()"
|
||||
>
|
||||
</th>
|
||||
|
|
|
@ -20,13 +20,19 @@ uiModules.get('apps/management')
|
|||
restrict: 'E',
|
||||
controllerAs: 'managementObjectsController',
|
||||
controller: function ($scope, $injector, $q, AppState, es) {
|
||||
const self = this;
|
||||
const notify = new Notifier({ location: 'Saved Objects' });
|
||||
|
||||
const $state = $scope.state = new AppState();
|
||||
$scope.currentTab = null;
|
||||
$scope.selectedItems = [];
|
||||
|
||||
this.areAllRowsChecked = function areAllRowsChecked() {
|
||||
if ($scope.currentTab.data.length === 0) {
|
||||
return false;
|
||||
}
|
||||
return $scope.selectedItems.length === $scope.currentTab.data.length;
|
||||
};
|
||||
|
||||
const getData = function (filter) {
|
||||
const services = registry.all().map(function (obj) {
|
||||
const service = $injector.get(obj.service);
|
||||
|
@ -53,6 +59,9 @@ uiModules.get('apps/management')
|
|||
});
|
||||
};
|
||||
|
||||
const refreshData = () => {
|
||||
return getData(this.advancedFilter);
|
||||
};
|
||||
|
||||
$scope.toggleAll = function () {
|
||||
if ($scope.selectedItems.length === $scope.currentTab.data.length) {
|
||||
|
@ -154,10 +163,6 @@ uiModules.get('apps/management')
|
|||
});
|
||||
}
|
||||
|
||||
function refreshData() {
|
||||
return getData(self.advancedFilter);
|
||||
}
|
||||
|
||||
$scope.changeTab = function (tab) {
|
||||
$scope.currentTab = tab;
|
||||
$scope.selectedItems.length = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue