mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59: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>
29 lines
869 B
JavaScript
29 lines
869 B
JavaScript
import { ResourceGroupViewModel } from '../models/resource_group';
|
|
|
|
angular.module('portainer.azure').factory('ResourceGroupService', [
|
|
'$q',
|
|
'ResourceGroup',
|
|
function ResourceGroupServiceFactory($q, ResourceGroup) {
|
|
'use strict';
|
|
var service = {};
|
|
|
|
service.resourceGroups = function (subscriptionId) {
|
|
var deferred = $q.defer();
|
|
|
|
ResourceGroup.query({ subscriptionId: subscriptionId })
|
|
.$promise.then(function success(data) {
|
|
var resourceGroups = data.value.map(function (item) {
|
|
return new ResourceGroupViewModel(item, subscriptionId);
|
|
});
|
|
deferred.resolve(resourceGroups);
|
|
})
|
|
.catch(function error(err) {
|
|
deferred.reject({ msg: 'Unable to retrieve resource groups', err: err });
|
|
});
|
|
|
|
return deferred.promise;
|
|
};
|
|
|
|
return service;
|
|
},
|
|
]);
|