Add TODO comments to migrate scope vars to the controller.

This commit is contained in:
CJ Cenizal 2016-12-21 11:11:26 -08:00
parent 94ea28559c
commit c2a164d18a

View file

@ -22,6 +22,7 @@ uiModules.get('apps/management')
controller: function ($scope, $injector, $q, AppState, es) {
const notify = new Notifier({ location: 'Saved Objects' });
// TODO: Migrate all scope variables to the controller.
const $state = $scope.state = new AppState();
$scope.currentTab = null;
$scope.selectedItems = [];
@ -63,6 +64,7 @@ uiModules.get('apps/management')
return getData(this.advancedFilter);
};
// TODO: Migrate all scope methods to the controller.
$scope.toggleAll = function () {
if ($scope.selectedItems.length === $scope.currentTab.data.length) {
$scope.selectedItems.length = 0;
@ -71,6 +73,7 @@ uiModules.get('apps/management')
}
};
// TODO: Migrate all scope methods to the controller.
$scope.toggleItem = function (item) {
const i = $scope.selectedItems.indexOf(item);
if (i >= 0) {
@ -80,10 +83,12 @@ uiModules.get('apps/management')
}
};
// TODO: Migrate all scope methods to the controller.
$scope.open = function (item) {
kbnUrl.change(item.url.substr(1));
};
// TODO: Migrate all scope methods to the controller.
$scope.edit = function (service, item) {
const params = {
service: service.serviceName,
@ -93,6 +98,7 @@ uiModules.get('apps/management')
kbnUrl.change('/management/kibana/objects/{{ service }}/{{ id }}', params);
};
// TODO: Migrate all scope methods to the controller.
$scope.bulkDelete = function () {
$scope.currentTab.service.delete(pluck($scope.selectedItems, 'id'))
.then(refreshData)
@ -102,11 +108,13 @@ uiModules.get('apps/management')
.catch(error => notify.error(error));
};
// TODO: Migrate all scope methods to the controller.
$scope.bulkExport = function () {
const objs = $scope.selectedItems.map(partialRight(extend, { type: $scope.currentTab.type }));
retrieveAndExportDocs(objs);
};
// TODO: Migrate all scope methods to the controller.
$scope.exportAll = () => Promise
.map($scope.services, service => service.service
.scanAll('')
@ -136,6 +144,7 @@ uiModules.get('apps/management')
saveAs(blob, 'export.json');
}
// TODO: Migrate all scope methods to the controller.
$scope.importAll = function (fileContents) {
let docs;
try {
@ -163,6 +172,7 @@ uiModules.get('apps/management')
});
}
// TODO: Migrate all scope methods to the controller.
$scope.changeTab = function (tab) {
$scope.currentTab = tab;
$scope.selectedItems.length = 0;