Code cleanup part #1: move all the services and directive JS code in the app.js file into its own files
This commit is contained in:
parent
3cae6609a7
commit
9b87999c1c
97 changed files with 7076 additions and 6870 deletions
28
static/js/services/create-service.js
Normal file
28
static/js/services/create-service.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Service which exposes various methods for creating entities on the backend.
|
||||
*/
|
||||
angular.module('quay').factory('CreateService', ['ApiService', function(ApiService) {
|
||||
var createService = {};
|
||||
|
||||
createService.createRobotAccount = function(ApiService, is_org, orgname, name, callback) {
|
||||
ApiService.createRobot(is_org ? orgname : null, null, {'robot_shortname': name})
|
||||
.then(callback, ApiService.errorDisplay('Cannot create robot account'));
|
||||
};
|
||||
|
||||
createService.createOrganizationTeam = function(ApiService, orgname, teamname, callback) {
|
||||
var data = {
|
||||
'name': teamname,
|
||||
'role': 'member'
|
||||
};
|
||||
|
||||
var params = {
|
||||
'orgname': orgname,
|
||||
'teamname': teamname
|
||||
};
|
||||
|
||||
ApiService.updateOrganizationTeam(data, params)
|
||||
.then(callback, ApiService.errorDisplay('Cannot create team'));
|
||||
};
|
||||
|
||||
return createService;
|
||||
}]);
|
Reference in a new issue