mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
* chore(project): install prettier and lint-staged * chore(project): apply prettier to html too * chore(project): git ignore eslintcache * chore(project): add a comment about format script * chore(prettier): update printWidth * chore(prettier): remove useTabs option * chore(prettier): add HTML validation * refactor(prettier): fix closing tags * feat(prettier): define angular parser for html templates * style(prettier): run prettier on codebase Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
angular.module('portainer.azure').controller('AzureContainerInstancesController', [
|
|
'$scope',
|
|
'$state',
|
|
'AzureService',
|
|
'Notifications',
|
|
function ($scope, $state, AzureService, Notifications) {
|
|
function initView() {
|
|
AzureService.subscriptions()
|
|
.then(function success(data) {
|
|
var subscriptions = data;
|
|
return AzureService.containerGroups(subscriptions);
|
|
})
|
|
.then(function success(data) {
|
|
$scope.containerGroups = AzureService.aggregate(data);
|
|
})
|
|
.catch(function error(err) {
|
|
Notifications.error('Failure', err, 'Unable to load container groups');
|
|
});
|
|
}
|
|
|
|
$scope.deleteAction = function (selectedItems) {
|
|
var actionCount = selectedItems.length;
|
|
angular.forEach(selectedItems, function (item) {
|
|
AzureService.deleteContainerGroup(item.Id)
|
|
.then(function success() {
|
|
Notifications.success('Container group successfully removed', item.Name);
|
|
var index = $scope.containerGroups.indexOf(item);
|
|
$scope.containerGroups.splice(index, 1);
|
|
})
|
|
.catch(function error(err) {
|
|
Notifications.error('Failure', err, 'Unable to remove container group');
|
|
})
|
|
.finally(function final() {
|
|
--actionCount;
|
|
if (actionCount === 0) {
|
|
$state.reload();
|
|
}
|
|
});
|
|
});
|
|
};
|
|
|
|
initView();
|
|
},
|
|
]);
|