diff options
Diffstat (limited to 'moon_gui/static/app/services')
20 files changed, 0 insertions, 2355 deletions
diff --git a/moon_gui/static/app/services/gui/alert.service.js b/moon_gui/static/app/services/gui/alert.service.js deleted file mode 100755 index 8435eab1..00000000 --- a/moon_gui/static/app/services/gui/alert.service.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('alertService', alertService); - - alertService.$inject = [ 'toaster']; - - function alertService( toaster) { - - var service = {}; - - service.alertError = alertError; - service.alertSuccess = alertSuccess; - service.alertInfo = alertInfo; - - return service; - - function alertError(msg){ - toaster.pop('error', null, msg, 5000); - } - - function alertSuccess(msg){ - toaster.pop('success', null, msg, 5000); - } - - function alertInfo(msg){ - toaster.pop('note', null, msg, 5000); - } - - } - -})(); diff --git a/moon_gui/static/app/services/gui/browser.service.js b/moon_gui/static/app/services/gui/browser.service.js deleted file mode 100755 index 88c693a8..00000000 --- a/moon_gui/static/app/services/gui/browser.service.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('browserService', browserService); - - function browserService() { - - var service = {}; - - service.sayWho = sayWho; - - return service; - - function sayWho() { - - var ua= navigator.userAgent, tem, - - M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - - if(/trident/i.test(M[1])){ - tem= /\brv[ :]+(\d+)/g.exec(ua) || []; - return 'IE '+(tem[1] || ''); - } - - if(M[1]=== 'Chrome'){ - tem= ua.match(/\bOPR\/(\d+)/); - if(tem!= null){ return 'Opera '+tem[1];} - } - - M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; - - if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]); - - return M.join(' '); - - }; - - }; - -})(); diff --git a/moon_gui/static/app/services/gui/form.service.js b/moon_gui/static/app/services/gui/form.service.js deleted file mode 100755 index e436593c..00000000 --- a/moon_gui/static/app/services/gui/form.service.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('formService', formService); - - function formService() { - - var service = {}; - - service.isInvalid = isInvalid; - service.checkFieldsValidity = checkFieldsValidity; - - return service; - - function isInvalid(form) { - return form.$invalid; - } - - function checkFieldsValidity(form) { - - var validationErrorKeys = _.keys(form.$error); - - _(validationErrorKeys).each(function(anErrorKey) { - - var formFields = _.values(form.$error[anErrorKey]); - - _(formFields).each(function(aFormField) { - - aFormField.$dirty = true; - aFormField.$setValidity(anErrorKey, false); - - }); - - }); - - } - - } - -})(); diff --git a/moon_gui/static/app/services/gui/menu.service.js b/moon_gui/static/app/services/gui/menu.service.js deleted file mode 100755 index fd90a2fa..00000000 --- a/moon_gui/static/app/services/gui/menu.service.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('menuService', menuService); - - menuService.$inject = ['$state']; - - function menuService($state) { - - var service = {}; - - service.isProjectTabActive = isProjectTabActive; - service.isPDPTabActive = isPDPTabActive; - service.isPolicyTabActive = isPolicyTabActive; - service.isLogsTabActive = isLogsTabActive; - service.isModelTabActive = isModelTabActive; - - return service; - - function isProjectTabActive() { - return $state.includes('moon.project'); - } - - function isPDPTabActive() { - return $state.includes('moon.pdp'); - } - - function isPolicyTabActive(){ - return $state.includes('moon.policy'); - } - - function isLogsTabActive(){ - return $state.includes('moon.logs'); - } - - function isModelTabActive(){ - return $state.includes('moon.model'); - } - - } - -})(); diff --git a/moon_gui/static/app/services/gui/security.pipeline.service.js b/moon_gui/static/app/services/gui/security.pipeline.service.js deleted file mode 100755 index 3831e487..00000000 --- a/moon_gui/static/app/services/gui/security.pipeline.service.js +++ /dev/null @@ -1,29 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('securityPipelineService', securityPipelineService); - - securityPipelineService.$inject = ['SECURITY_PIPELINE_CST','policyService']; - - function securityPipelineService(SECURITY_PIPELINE_CST, policyService) { - var service = {}; - - service.findAll = findAll; - - return service; - - function findAll(type){ - switch(type){ - case SECURITY_PIPELINE_CST.TYPE.POLICY : - return policyService.findAll(); - default : - return policyService.findAll(); - } - - } - } - -})(); diff --git a/moon_gui/static/app/services/gui/util.service.js b/moon_gui/static/app/services/gui/util.service.js deleted file mode 100755 index 7274244a..00000000 --- a/moon_gui/static/app/services/gui/util.service.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('utilService', utilService); - - utilService.$inject = []; - - function utilService() { - - return { - - - /** - * Transforms an answer from server and return an array of objects instead the @param data - - * @param data object : { - * 'typeOfTheRreturnedObject' : { - * 'idObject1' : {....}, - * 'idObject2' : {....} - * } - * } - * @param typeOfObject - * @returns {Array} - */ - transform : function(data, typeOfObject){ - - var result = []; - - _.each(data[typeOfObject],function(item, key){ - item.id = key; - result.push(item); - }); - - return result; - }, - - /** - * same as transform but with only one object - * @param data - * @param typeOfObject the first elem of the dictonnary - */ - transformOne : function(data, typeOfObject){ - - var result = []; - - _.each(data[typeOfObject], function (item, key) { - item.id = key; - result.push(item); - }); - - return result[0]; - - } - - }; - - } - -})(); diff --git a/moon_gui/static/app/services/gui/version.service.js b/moon_gui/static/app/services/gui/version.service.js deleted file mode 100755 index 5f9f2786..00000000 --- a/moon_gui/static/app/services/gui/version.service.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('versionService', versionService); - - versionService.$inject = ['$resource']; - - function versionService($resource) { - - return { - - version: $resource('version.json', {}, { - get: {method: 'GET', isArray: false} - }) - - }; - - } - -})(); diff --git a/moon_gui/static/app/services/moon/model/model.service.js b/moon_gui/static/app/services/moon/model/model.service.js deleted file mode 100755 index a676fc1a..00000000 --- a/moon_gui/static/app/services/moon/model/model.service.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('modelService', modelService); - - modelService.$inject = ['$resource', 'REST_URI', 'metaRuleService', 'utilService']; - - function modelService($resource, REST_URI, metaRuleService, utilService) { - - return { - - data: $resource(REST_URI.MODELS + ':model_id', {}, { - get: {method: 'GET'}, - query: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: {method: 'PATCH'} - }), - - findAll: function () { - - return this.data.query().$promise.then(function (data) { - - return utilService.transform(data, 'models'); - - }); - - }, - - - findAllWithCallBack : function (callback){ - - return this.data.query().$promise.then(function (data) { - - callback( utilService.transform(data, 'models')); - - }); - - }, - - findOneWithCallback : function(modelId, callback){ - - return this.data.get({model_id: modelId}).$promise.then(function (data) { - - callback(utilService.transformOne(data, 'models')); - - }); - - }, - - findOneWithMetaRules: function (modelId) { - - return this.data.get({model_id: modelId}).$promise.then(function (data) { - - var res = utilService.transformOne(data, 'models'); - - if(res.meta_rules.length > 0){ - - metaRuleService.findSomeWithMetaData(res.meta_rules).then(function(metaRules){ - - res.meta_rules_values = metaRules; - res.id = modelId; - - return res; - - }); - - }else{ - - res.meta_rules_values = []; - res.id = modelId; - - } - - return res; - - }); - - }, - - delete: function (model, callbackSuccess, callbackError ) { - - delete model.meta_rules_values; - - this.data.remove({model_id: model.id}, model, callbackSuccess, callbackError); - - }, - - update: function (model, callbackSuccess, callbackError) { - - delete model.meta_rules_values; - this.data.update({model_id: model.id}, model, callbackSuccess, callbackError); - - } - - } - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/pdp.service.js b/moon_gui/static/app/services/moon/pdp.service.js deleted file mode 100755 index 822f7414..00000000 --- a/moon_gui/static/app/services/moon/pdp.service.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * service allowing the client to interact with pdp - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('pdpService', pdpService); - - pdpService.$inject = ['$q', '$resource','REST_URI', 'utilService']; - - function pdpService($q, $resource, REST_URI, utilService) { - - return { - - data: { - - pdp: $resource(REST_URI.PDP + ':pdp_id', {}, { - query: { method: 'GET', isArray: false }, - get: { method: 'GET', isArray: false }, - create: { method: 'POST' }, - update: { method:'PATCH'}, - remove: { method: 'DELETE' } - }) - - }, - - findAll: function() { - - return this.data.pdp.query().$promise.then(function (data) { - - return utilService.transform(data, 'pdps'); - - }); - - }, - - findAllWithCallBack : function (callback){ - - return this.data.pdp.query().$promise.then(function (data) { - - callback( utilService.transform(data, 'pdps')); - - }); - - }, - - findOne: function(id) { - - return this.data.pdp.get({pdp_id: id}).$promise.then(function (data) { - - return utilService.transformOne(data, 'pdps'); - - }); - - }, - - unMap: function(pdp, callbackSuccess, callbackError){ - - pdp.keystone_project_id = null; - - if(_.has(pdp, 'project')){ - delete pdp.project; - } - - this.data.pdp.update({pdp_id: pdp.id}, pdp, callbackSuccess, callbackError); - - }, - - map: function(pdp, projectId, callbackSuccess, callbackError){ - - pdp.keystone_project_id = projectId; - - this.data.pdp.update({pdp_id: pdp.id}, pdp, callbackSuccess, callbackError); - }, - - update: function (pdp, callbackSuccess, callbackError) { - - this.data.pdp.update({pdp_id: pdp.id}, pdp, callbackSuccess, callbackError); - - }, - - mapPdpsToProjects : mapPdpsToProjects, - - mapPdpsToProject : mapPdpsToProject - - }; - - /** - * Will assign each project to it related pdp - * @param projects a list of Project, a new attribute pdp will be add, if the related pdp is existing in @param pdps - * @param pdps a list of Pdp - */ - function mapPdpsToProjects(projects, pdps){ - - _.each(projects, function(project){ - - return mapPdpsToProject(project, pdps); - - }); - } - - function mapPdpsToProject(project, pdps){ - - if (_.isNull(project.keystone_project_id)){ - return false; - } - - var index = _.findIndex(pdps, function(pdp){ - return project.id === pdp.keystone_project_id; - }); - - if(index === -1){ - return false; - } - - project.pdp = pdps[index]; - - return true; - } - - } - -})(); diff --git a/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js b/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js deleted file mode 100755 index ca138b45..00000000 --- a/moon_gui/static/app/services/moon/policy/parameters/assignements.service.js +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('assignmentsService', assignmentsService); - - assignmentsService.$inject = ['$resource', 'REST_URI', 'utilService']; - - function assignmentsService($resource, REST_URI, utilService) { - - var data = { - - subject: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/subject_assignments/:perimeter_id/:category_id/:data_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }, - - - object: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/object_assignments/:perimeter_id/:category_id/:data_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }, - - action: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/action_assignments/:perimeter_id/:category_id/:data_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - } - - }; - - return { - - subject : { - - delete: function (policyId, perimeterId, categoryId, dataId, callbackSuccess, callbackError ) { - - data.subject.policy.remove({policy_id: policyId, perimeter_id: perimeterId, category_id: categoryId, data_id: dataId}, {}, callbackSuccess, callbackError); - - }, - - add:function (subject, policyId, callbackSuccess, callbackError ) { - - data.subject.policy.create({policy_id: policyId}, subject, callbackSuccess, callbackError); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.subject.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data, 'subject_assignments')); - - }); - - } - }, - - object : { - - - delete: function (policyId, perimeterId, categoryId, dataId, callbackSuccess, callbackError ) { - - data.object.policy.remove({policy_id: policyId, perimeter_id: perimeterId, category_id: categoryId, data_id: dataId}, {}, callbackSuccess, callbackError); - - }, - - add:function (object, policyId, callbackSuccess, callbackError ) { - - data.object.policy.create({policy_id: policyId}, object, callbackSuccess, callbackError); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.object.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data, 'object_assignments')); - - }); - - } - }, - - action : { - - delete: function (policyId, perimeterId, categoryId, dataId, callbackSuccess, callbackError ) { - - data.action.policy.remove({policy_id: policyId, perimeter_id: perimeterId, category_id: categoryId, data_id: dataId}, {}, callbackSuccess, callbackError); - - }, - - add:function (action, policyId, callbackSuccess, callbackError ) { - - data.action.policy.create({policy_id: policyId}, action, callbackSuccess, callbackError); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.action.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data, 'action_assignments')); - - }); - - } - } - - }; - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/policy/parameters/data.service.js b/moon_gui/static/app/services/moon/policy/parameters/data.service.js deleted file mode 100755 index 1bbd3b24..00000000 --- a/moon_gui/static/app/services/moon/policy/parameters/data.service.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('dataService', dataService); - - dataService.$inject = ['$resource', 'REST_URI', 'utilService']; - - function dataService($resource, REST_URI, utilService) { - - var data = { - - subject: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/subject_data/:subject_id/:category_id/:data_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }, - - object: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/object_data/:object_id/:category_id/:data_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }, - - action: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/action_data/:action_id/:category_id/:data_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - } - - }; - - return { - - subject : { - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.subject.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data['subject_data'][0], 'data')); - - }); - - }, - - findAllFromCategoriesWithCallback: function(policyId, categoryId, callback){ - - data.subject.policy.get({policy_id: policyId, category_id: categoryId}).$promise.then(function(data) { - - if(data['subject_data'][0]) { - - callback(utilService.transform(data['subject_data'][0], 'data')); - - }else{ - - callback([]) - - } - - }); - - }, - - delete: function (subject, policyId, categoryId, callbackSuccess, callbackError ) { - - data.subject.policy.remove({policy_id: policyId, category_id: categoryId, data_id: subject.id}, subject, callbackSuccess, callbackError); - - }, - - add: function (subject, policyId, categoryId, callbackSuccess, callbackError ) { - - data.subject.policy.create({policy_id: policyId, category_id: categoryId}, subject, callbackSuccess, callbackError); - - }, - - data: { - - findOne: function(policyId, subjectId, dataId, callback){ - - data.subject.policy.get({policy_id: policyId, subject_id: subjectId, data_id : dataId}).$promise.then(function(data) { - - if(data['subject_data'][0]){ - - callback(utilService.transformOne(data['subject_data'][0], 'data')); - - }else{ - - callback({ }); - - } - - }); - - } - } - }, - - object : { - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.object.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data['object_data'][0], 'data')); - - }); - - }, - - findAllFromCategoriesWithCallback: function(policyId, categoryId, callback){ - - data.object.policy.get({policy_id: policyId, category_id: categoryId}).$promise.then(function(data) { - - if(data['object_data'][0]) { - - callback(utilService.transform(data['object_data'][0], 'data')); - - }else{ - - callback([]) - - } - - }); - - }, - - delete: function (object, policyId, categoryId, callbackSuccess, callbackError ) { - - data.object.policy.remove({policy_id: policyId, category_id: categoryId, data_id: object.id}, object, callbackSuccess, callbackError); - - }, - - add:function (object, policyId, categoryId, callbackSuccess, callbackError ) { - - data.object.policy.create({policy_id: policyId, category_id: categoryId}, object, callbackSuccess, callbackError); - - }, - - data: { - - findOne: function(policyId, objectId, dataId, callback){ - - data.object.policy.get({policy_id: policyId, object_id: objectId, data_id : dataId}).$promise.then(function(data) { - - if(data['object_data'][0]){ - - callback(utilService.transformOne(data['object_data'][0], 'data')); - - }else{ - - callback({ }); - - } - - }); - - } - } - }, - - action : { - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.action.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data['action_data'][0], 'data')); - - }); - - }, - - findAllFromCategoriesWithCallback: function(policyId, categoryId, callback){ - - data.action.policy.get({policy_id: policyId, category_id: categoryId}).$promise.then(function(data) { - - if(data['action_data'][0]) { - - callback(utilService.transform(data['action_data'][0], 'data')); - - }else{ - - callback([]) - - } - - }); - - }, - - delete: function (action, policyId, categoryId, callbackSuccess, callbackError ) { - - data.action.policy.remove({policy_id: policyId, category_id: categoryId, data_id: action.id}, action, callbackSuccess, callbackError); - - }, - - add:function (action, policyId, categoryId, callbackSuccess, callbackError ) { - - data.action.policy.create({policy_id: policyId, category_id: categoryId}, action, callbackSuccess, callbackError); - - }, - - - data: { - - findOne: function(policyId, actionId, dataId, callback){ - - data.action.policy.get({policy_id: policyId, action_id: actionId, data_id : dataId}).$promise.then(function(data) { - - if(data['action_data'][0]){ - - callback(utilService.transformOne(data['action_data'][0], 'data')); - - }else{ - - callback({ }); - - } - - }); - - } - } - } - - }; - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js b/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js deleted file mode 100755 index 42e7288a..00000000 --- a/moon_gui/static/app/services/moon/policy/parameters/perimeter.service.js +++ /dev/null @@ -1,460 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('perimeterService', perimeterService); - - perimeterService.$inject = ['$resource', 'REST_URI', '$q', 'utilService']; - - function perimeterService($resource, REST_URI, $q, utilService) { - - var data = { - - subject: { - - perimeter: $resource(REST_URI.PERIMETERS.subject + ':subject_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: { method: 'PATCH' } - }), - - policy: $resource(REST_URI.POLICIES + ':policy_id/subjects/:subject_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: { method: 'PATCH' } - }) - - }, - - object: { - - perimeter: $resource(REST_URI.PERIMETERS.object + ':object_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: { method: 'PATCH' } - }), - - policy: $resource(REST_URI.POLICIES + ':policy_id/objects/:object_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: { method: 'PATCH' } - }) - - }, - - action: { - - perimeter: $resource(REST_URI.PERIMETERS.action + ':action_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: { method: 'PATCH' } - }), - - policy: $resource(REST_URI.POLICIES + ':policy_id/actions/:action_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'}, - update: { method: 'PATCH' } - }) - - } - - }; - - return { - - subject : { - - findOne: function(subjectId, callback){ - - data.subject.perimeter.get({subject_id: subjectId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'subjects')); - - }); - - }, - - findOneReturningPromise: function (subjectId){ - - return data.subject.perimeter.get({subject_id: subjectId}).$promise; - - }, - - findSome: function(subjectListId) { - - var _self = this; - - if(subjectListId.length === 0){ - return []; - } - - var promises = _(subjectListId).map( function(subjectId) { - - return _self.findOneReturningPromise(subjectId); - - }); - - return $q.all(promises).then( function(result) { - - return _(result).map( function(resource) { - - return utilService.transformOne(resource, 'subjects'); - - }); - - }); - - }, - - unMapPerimeterFromPolicy: function(policyId, subjectId, callbackSuccess, callbackError ){ - - data.subject.policy.remove({policy_id: policyId, subject_id: subjectId}, {}, callbackSuccess, callbackError); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.subject.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data, 'subjects')); - - }); - - }, - - findOneFromPolicyWithCallback: function(policyId, subjectId, callback){ - - data.subject.policy.get({policy_id: policyId, subject_id: subjectId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'subjects')); - - }); - - }, - - findAll: function(){ - - return data.subject.perimeter.get().$promise.then(function(data) { - - return utilService.transform(data, 'subjects'); - - }); - }, - - findAllWithCallback: function(callback){ - - return data.subject.perimeter.get().$promise.then(function(data) { - - callback(utilService.transform(data, 'subjects')); - - }); - - }, - - delete: function (subject, callbackSuccess, callbackError ) { - - data.subject.perimeter.remove({subject_id: subject.id}, subject, callbackSuccess, callbackError); - - }, - - add: function (subject, callbackSuccess, callbackError ) { - - data.subject.perimeter.create({}, subject, callbackSuccess, callbackError); - - }, - - update: function(subject, callbackSuccess, callbackError){ - - data.subject.perimeter.update({subject_id: subject.id}, subject, callbackSuccess, callbackError); - - } - }, - - object : { - - findOne: function(objectId, callback){ - - data.object.perimeter.get({object_id: objectId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'objects')); - - }); - - }, - - findOneReturningPromise: function(objectId){ - - return data.object.perimeter.get({object_id: objectId}).$promise; - - }, - - findSome: function(objectListId) { - - - var _self = this; - - if(objectListId.length === 0){ - return []; - } - - var promises = _(objectListId).map( function(objectId) { - - return _self.findOneReturningPromise(objectId); - - }); - - return $q.all(promises).then( function(result) { - - return _(result).map( function(resource) { - - return utilService.transformOne(resource, 'objects'); - - }); - - }); - - }, - - unMapPerimeterFromPolicy: function(policyId, objectId, callbackSuccess, callbackError ){ - - data.object.policy.remove({policy_id: policyId, object_id: objectId}, {}, callbackSuccess, callbackError); - - }, - - findSomeWithCallback: function(objectListId, callback){ - - var _self = this; - - if(objectListId.length === 0){ - callback([]); - } - - var promises = _(objectListId).map( function(subjectId) { - - return _self.findOneReturningPromise(subjectId); - - }); - - $q.all(promises).then( function(result) { - - callback( _(result).map( function(resource) { - - return utilService.transformOne(resource, 'objects'); - - })); - - }); - - }, - - findAll : function(){ - - return data.object.perimeter.get().$promise.then(function(data) { - - return utilService.transform(data, 'objects'); - - }); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.object.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data, 'objects')); - - }); - - }, - - findOneFromPolicyWithCallback: function(policyId, objectId, callback){ - - - data.object.policy.get({policy_id: policyId, object_id: objectId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'objects')); - - }); - - }, - - findAllWithCallback: function(callback){ - - return data.object.perimeter.get().$promise.then(function(data) { - - callback(utilService.transform(data, 'objects')); - - }); - - }, - - delete: function (object, callbackSuccess, callbackError ) { - - data.object.perimeter.remove({object_id: object.id}, object, callbackSuccess, callbackError); - - }, - - add:function (object, callbackSuccess, callbackError ) { - - data.object.perimeter.create({}, object, callbackSuccess, callbackError); - - }, - - update: function(object, callbackSuccess, callbackError){ - - data.object.perimeter.update({object_id: object.id}, object, callbackSuccess, callbackError); - - } - }, - - action : { - - findOne: function(actionId, callback){ - - data.action.perimeter.get({actionId: actionId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'actions')); - - }); - - }, - - findOneReturningPromise: function(actionId){ - - return data.action.perimeter.get({actionId: actionId}).$promise; - - }, - - findSome: function(actionListId) { - - var _self = this; - - if(actionListId.length === 0){ - return []; - } - - var promises = _(actionListId).map( function(actionId) { - - return _self.findOneReturningPromise(actionId); - - }); - - return $q.all(promises).then( function(result) { - - return _(result).map( function(resource) { - - return utilService.transformOne(resource, 'actions'); - - }); - - }); - - }, - - unMapPerimeterFromPolicy: function(policyId, actionId, callbackSuccess, callbackError){ - - data.action.policy.remove({policy_id: policyId, action_id: actionId}, {}, callbackSuccess, callbackError); - - }, - - findSomeWithCallback: function(actionListId, callback){ - - var _self = this; - - if(actionListId.length === 0){ - callback([]); - } - - var promises = _(actionListId).map( function(subjectId) { - - return _self.findOneReturningPromise(subjectId); - - }); - - $q.all(promises).then( function(result) { - - callback( _(result).map( function(resource) { - - return utilService.transformOne(resource, 'actions'); - - })); - - }); - - }, - - findAll : function(){ - - return data.action.perimeter.get().$promise.then(function(data) { - - return utilService.transform(data, 'actions'); - - }); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - data.action.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(utilService.transform(data, 'actions')); - - }); - - }, - - findOneFromPolicyWithCallback: function(policyId, actionId, callback){ - - data.action.policy.get({policy_id: policyId, action_id: actionId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'actions')); - - }); - - }, - - findAllWithCallback: function(callback){ - - return data.action.perimeter.get().$promise.then(function(data) { - - callback(utilService.transform(data, 'actions')); - - }); - - }, - - delete: function (action, callbackSuccess, callbackError ) { - - data.action.perimeter.remove({action_id: action.id}, action, callbackSuccess, callbackError); - - }, - - add:function (action, callbackSuccess, callbackError ) { - - data.action.perimeter.create({}, action, callbackSuccess, callbackError); - - }, - - update: function(action, callbackSuccess, callbackError){ - - data.action.perimeter.update({action_id: action.id}, action, callbackSuccess, callbackError); - - } - } - - }; - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/policy/parameters/rule.service.js b/moon_gui/static/app/services/moon/policy/parameters/rule.service.js deleted file mode 100644 index b1a350ae..00000000 --- a/moon_gui/static/app/services/moon/policy/parameters/rule.service.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('ruleService', ruleService); - - ruleService.$inject = ['$resource', 'REST_URI', 'utilService']; - - function ruleService($resource, REST_URI, utilService) { - - return { - - data: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/rules/:rule_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - this.data.policy.get({policy_id: policyId}).$promise.then(function(data) { - - console.log('ruleService - findAllFromPolicyWithCallback()'); - console.log(data); - - var array = data['rules']; - - console.log(JSON.stringify(array)); - callback(utilService.transform(array, 'rules')); - - }); - - } - - - } - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/policy/parameters/rules.service.js b/moon_gui/static/app/services/moon/policy/parameters/rules.service.js deleted file mode 100755 index 76b24011..00000000 --- a/moon_gui/static/app/services/moon/policy/parameters/rules.service.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('rulesService', rulesService); - - rulesService.$inject = ['$resource', 'REST_URI', 'utilService']; - - function rulesService($resource, REST_URI, utilService) { - - return { - - data: { - - policy: $resource(REST_URI.POLICIES + ':policy_id/rules/:rule_id', {}, { - get: {method: 'GET'}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }, - - add: function (rules, policyId, callbackSuccess, callbackError ) { - - this.data.policy.create({policy_id: policyId}, rules, callbackSuccess, callbackError); - - }, - - delete: function (ruleId, policyId, callbackSuccess, callbackError ) { - - this.data.policy.remove({policy_id: policyId, rule_id: ruleId}, {}, callbackSuccess, callbackError); - - }, - - findAllFromPolicyWithCallback: function(policyId, callback){ - - this.data.policy.get({policy_id: policyId}).$promise.then(function(data) { - - callback(data.rules.rules); - //callback(utilService.transform(data['rules'], 'rules')); - - }); - - } - - - } - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/policy/policy.service.js b/moon_gui/static/app/services/moon/policy/policy.service.js deleted file mode 100755 index 5ad31421..00000000 --- a/moon_gui/static/app/services/moon/policy/policy.service.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Service providing access to the tenants - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('policyService', policyService); - - policyService.$inject = ['$resource', 'REST_URI', 'utilService', '$q']; - - function policyService($resource, REST_URI, utilService, $q) { - - return { - - data: { - - policy: $resource(REST_URI.POLICIES + ':policy_id', {}, { - query: {method: 'GET'}, - create: { method: 'POST' }, - update: { method: 'PATCH' }, - remove: { method: 'DELETE' } - }) - - }, - - findAll: function () { - - return this.data.policy.query().$promise.then(function (data) { - - return utilService.transform(data, 'policies'); - - }); - - }, - - findAllWithCallback: function (callback) { - - return this.data.policy.query().$promise.then(function (data) { - - callback(utilService.transform(data, 'policies')); - - }); - - }, - - findOneReturningPromise: function(policyId){ - - return this.data.policy.get({policy_id: policyId}).$promise; - - }, - - findSomeWithCallback: function(policyListId, callback){ - - var _self = this; - - if(policyListId.length === 0){ - callback([]); - } - - var promises = _(policyListId).map( function(policyId) { - - return _self.findOneReturningPromise(policyId); - - }); - - $q.all(promises).then( function(result) { - - callback( _(result).map( function(resource) { - - return utilService.transformOne(resource, 'policies'); - - })); - - }); - - }, - - findOne: function (policyId) { - - return this.data.policy.get({policy_id: policyId}).$promise.then(function (data) { - - return utilService.transformOne(data, 'policies'); - - }); - - }, - - update: function (policy, callbackSuccess, callbackError) { - - this.data.policy.update({policy_id: policy.id}, policy, callbackSuccess, callbackError); - - }, - - delete: function (policy, callbackSuccess, callbackError ) { - - this.data.policy.remove({policy_id: policy.id}, policy, callbackSuccess, callbackError); - - } - - } - } - -})(); diff --git a/moon_gui/static/app/services/moon/rule/metadata.service.js b/moon_gui/static/app/services/moon/rule/metadata.service.js deleted file mode 100755 index 8c68b2ef..00000000 --- a/moon_gui/static/app/services/moon/rule/metadata.service.js +++ /dev/null @@ -1,354 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('metaDataService', metaDataService); - - metaDataService.$inject = ['$resource', 'REST_URI', '$q', 'utilService']; - - function metaDataService($resource, REST_URI, $q, utilService) { - - var data = { - - subject: $resource(REST_URI.METADATA.subject + ':subject_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }), - - - object: $resource(REST_URI.METADATA.object + ':object_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }), - - action: $resource(REST_URI.METADATA.action + ':action_id', {}, { - get: {method: 'GET', isArray: false}, - create: {method: 'POST'}, - remove: {method: 'DELETE'} - }) - - }; - - return { - - subject : { - - findOne: function(subjectId, callback){ - - data.subject.get({subject_id: subjectId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'subject_categories')); - - }); - - }, - - findOneReturningPromise: function (subjectId){ - - return data.subject.get({subject_id: subjectId}).$promise; - - }, - - findSome: function(subjectListId) { - - var _self = this; - - if(subjectListId.length === 0){ - return []; - } - - var promises = _(subjectListId).map( function(subjectId) { - - return _self.findOneReturningPromise(subjectId); - - }); - - return $q.all(promises).then( function(result) { - - return _(result).map( function(resource) { - - return utilService.transformOne(resource, 'subject_categories'); - - }); - - }); - - }, - - findSomeWithCallback: function(subjectListId, callback){ - - var _self = this; - - if(subjectListId.length === 0){ - callback([]); - } - - var promises = _(subjectListId).map( function(subjectId) { - - return _self.findOneReturningPromise(subjectId); - - }); - - $q.all(promises).then( function(result) { - - callback( _(result).map( function(resource) { - - return utilService.transformOne(resource, 'subject_categories'); - - })); - - }); - - }, - - findAll: function(){ - - return data.subject.get().$promise.then(function(data) { - - return utilService.transform(data, 'subject_categories'); - - }); - }, - - findAllWithCallback: function(callback){ - - return data.subject.get().$promise.then(function(data) { - - callback(utilService.transform(data, 'subject_categories')); - - }); - - }, - - delete: function (subject, callbackSuccess, callbackError ) { - - data.subject.remove({subject_id: subject.id}, subject, callbackSuccess, callbackError); - - }, - - add: function (subject, callbackSuccess, callbackError ) { - - data.subject.create({}, subject, callbackSuccess, callbackError); - - } - }, - - object : { - - findOne: function(objectId, callback){ - - data.object.get({object_id: objectId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'object_categories')); - - }) - - }, - - findOneReturningPromise: function(objectId){ - - return data.object.get({object_id: objectId}).$promise; - - }, - - findSome: function(objectListId) { - - - var _self = this; - - if(objectListId.length === 0){ - return []; - } - - var promises = _(objectListId).map( function(objectId) { - - return _self.findOneReturningPromise(objectId); - - }); - - return $q.all(promises).then( function(result) { - - return _(result).map( function(resource) { - - return utilService.transformOne(resource, 'object_categories'); - - }); - - }); - - }, - - findSomeWithCallback: function(objectListId, callback){ - - var _self = this; - - if(objectListId.length === 0){ - callback([]); - } - - var promises = _(objectListId).map( function(objectId) { - - return _self.findOneReturningPromise(objectId); - - }); - - $q.all(promises).then( function(result) { - - callback( _(result).map( function(resource) { - - return utilService.transformOne(resource, 'object_categories'); - - })); - - }); - - }, - - findAll : function(){ - - return data.object.get().$promise.then(function(data) { - - return utilService.transform(data, 'object_categories'); - - }); - - }, - - findAllWithCallback: function(callback){ - - return data.object.get().$promise.then(function(data) { - - callback(utilService.transform(data, 'object_categories')); - - }); - - }, - - delete: function (object, callbackSuccess, callbackError ) { - - data.object.remove({object_id: object.id}, object, callbackSuccess, callbackError); - - }, - - add:function (object, callbackSuccess, callbackError ) { - - data.object.create({}, object, callbackSuccess, callbackError); - - } - }, - - action : { - - findOne: function(actionId, callback){ - - data.action.get({action_id: actionId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'action_categories')); - - }) - - }, - - findOneReturningPromise: function(actionId){ - - return data.action.get({action_id: actionId}).$promise; - - }, - - findSome: function(actionListId) { - - var _self = this; - - if(actionListId.length === 0){ - return []; - } - - var promises = _(actionListId).map( function(actionId) { - - return _self.findOneReturningPromise(actionId); - - }); - - return $q.all(promises).then( function(result) { - - return _(result).map( function(resource) { - - return utilService.transformOne(resource, 'action_categories'); - - }); - - }); - - }, - - findSomeWithCallback: function(actionListId, callback){ - - var _self = this; - - if(actionListId.length === 0){ - callback([]); - } - - var promises = _(actionListId).map( function(actionId) { - - return _self.findOneReturningPromise(actionId); - - }); - - $q.all(promises).then( function(result) { - - callback( _(result).map( function(resource) { - - return utilService.transformOne(resource, 'action_categories'); - - })); - - }); - - }, - - findAll : function(){ - - return data.action.get().$promise.then(function(data) { - - return utilService.transform(data, 'action_categories'); - - }); - - }, - - findAllWithCallback: function(callback){ - - return data.action.get().$promise.then(function(data) { - - callback(utilService.transform(data, 'action_categories')); - - }); - - }, - - delete: function (action, callbackSuccess, callbackError ) { - - data.action.remove({action_id: action.id}, action, callbackSuccess, callbackError); - - }, - - add:function (action, callbackSuccess, callbackError ) { - - data.action.create({}, action, callbackSuccess, callbackError); - - } - } - - }; - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/moon/rule/metarule.service.js b/moon_gui/static/app/services/moon/rule/metarule.service.js deleted file mode 100755 index 05167849..00000000 --- a/moon_gui/static/app/services/moon/rule/metarule.service.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('metaRuleService', metaRuleService); - - metaRuleService.$inject = ['$resource', 'REST_URI', 'metaDataService', '$q', 'utilService']; - - function metaRuleService($resource, REST_URI, metaDataService, $q, utilService) { - - return { - - data: $resource(REST_URI.METARULES + ':metarule_id', {}, { - query: {method: 'GET' }, - get: {method: 'GET', isArray: false}, - update: {method: 'PATCH'}, - create: { method: 'POST' }, - remove: { method: 'DELETE' } - }), - - - findAll: function () { - - return this.data.query().$promise.then(function (data) { - - return utilService.transform(data, 'meta_rules'); - - }); - - }, - - findAllWithCallback : function (callback) { - - this.data.query().$promise.then(function (data) { - - callback(utilService.transform(data, 'meta_rules')); - - }); - - }, - - findSomeWithMetaData : function(metaRuleListId){ - - var _self = this; - - if(metaRuleListId.length === 0){ - return []; - } - - var promises = _(metaRuleListId).map(function(objectId) { - - return _self.findOneReturningPromise(objectId); - - }); - - return $q.all(promises).then(function(result) { - - return _(result).map(function(resource) { - - var metaRule = utilService.transformOne(resource, 'meta_rules'); - - metaRule = _self.findMetaDataFromMetaRule(metaRule); - - return metaRule; - - }); - - }); - - - }, - - findSomeWithCallback : function(metaRuleListId, callback){ - - var _self = this; - - if(metaRuleListId.length === 0){ - return callback([]); - } - - var promises = _(metaRuleListId).map(function(objectId) { - - return _self.findOneReturningPromise(objectId); - - }); - - return $q.all(promises).then(function(result) { - - callback( _(result).map(function(resource) { - - return utilService.transformOne(resource, 'meta_rules'); - - })); - - }); - - - }, - - findOneReturningPromise: function(metaRuleId){ - - return this.data.get({metarule_id: metaRuleId}).$promise; - - }, - - findOne : function(metaRuleId){ - - return this.data.get({metarule_id: metaRuleId}).$promise.then(function(data) { - - return utilService.transformOne(data, 'meta_rules'); - - }); - - }, - - findOneWithCallback: function(metaRuleId, callback){ - - this.data.get({metarule_id: metaRuleId}).$promise.then(function(data) { - - callback(utilService.transformOne(data, 'meta_rules')); - - }); - - }, - - findOneWithMetaData: function(metaRuleId){ - - var _self = this; - - return this.data.get({metarule_id: metaRuleId}).$promise.then(function(data) { - - var metaRule = utilService.transformOne(data, 'meta_rules'); - - metaRule = _self.findMetaDataFromMetaRule(metaRule); - - return metaRule; - - }); - - }, - - findMetaDataFromMetaRule : function (metaRule){ - - if(metaRule.subject_categories.length > 0){ - - metaDataService.subject.findSome(metaRule.subject_categories).then(function(categories){ - metaRule.subject_categories_values = categories; - }); - - }else{ - - metaRule.subject_categories_values = []; - - } - - if(metaRule.object_categories.length > 0){ - - metaDataService.object.findSome(metaRule.object_categories).then(function(categories){ - metaRule.object_categories_values = categories; - }); - - }else{ - - metaRule.object_categories_values = []; - - } - - if(metaRule.action_categories.length > 0){ - - metaDataService.action.findSome(metaRule.action_categories).then(function(categories){ - metaRule.action_categories_values = categories; - }); - - - }else{ - - metaRule.action_categories_values = []; - - } - - return metaRule; - }, - - delete: function (metaRule, callbackSuccess, callbackError ) { - - this.data.remove({metarule_id: metaRule.id}, metaRule, callbackSuccess, callbackError); - - }, - - update: function(metaRule, callbackSuccess, callbackError){ - - delete metaRule.subject_categories_values; - delete metaRule.object_categories_values; - delete metaRule.action_categories_values; - - this.data.update({metarule_id: metaRule.id}, metaRule, callbackSuccess, callbackError); - - } - }; - - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/partner/authentication.service.js b/moon_gui/static/app/services/partner/authentication.service.js deleted file mode 100755 index b6d3f36d..00000000 --- a/moon_gui/static/app/services/partner/authentication.service.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @author Samy Abdallah - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('authenticationService', authenticationService); - - authenticationService.$inject = ['$resource', 'REST_URI', '$sessionStorage', '$http', '$location']; - - function authenticationService($resource, REST_URI, $sessionStorage, $http, $location) { - - return { - data: $resource(REST_URI.KEYSTONE + 'auth/tokens', {}, { - login: { method: 'POST' , - /** - * Transform Response is needed to add headers into the response object - * @param data - * @param headersGetter - * @returns {{}} - */ - transformResponse : function (data, headersGetter) { - var response = {}; - response.data = angular.fromJson(data) ; - response.headers = headersGetter(); - return response; - } - }, - logout: { method: 'DELETE' } - }), - - /** - * - * @param credentials object : {username : '', password : ''} - * @param callbackSuccess - * @param callbackError - * @constructor - */ - Login : function (credentials, callbackSuccess, callbackError){ - var requestData = { - auth:{ - identity:{ - methods:[ - 'password' - ], - password:{ - user:{ - name: credentials.username, - domain:{ - name:'Default' - }, - password: credentials.password - } - } - }, - scope: { - project: { - name:'admin', - domain:{ - name:'Default' - } - } - } - } - }; - this.data.login({}, requestData, function (response){ - $sessionStorage.currentUser = response.data; - $sessionStorage.currentUser.connectionToken = response.headers['x-subject-token']; - SetTokenHeader(response.headers['x-subject-token']); - callbackSuccess(); - }, callbackError); - }, - IsConnected : IsConnected, - SetTokenHeader : SetTokenHeader, - GetTokenHeader : GetTokenHeader, - GetUser : GetUser, - Logout : Logout - }; - - function IsConnected(){ - return _.has($sessionStorage, 'currentUser'); - } - - function Logout(){ - delete $sessionStorage.currentUser; - $http.defaults.headers.common['X-Auth-Token'] = ''; - $location.path('/'); - } - - function GetUser(){ - return $sessionStorage.currentUser; - } - - function GetTokenHeader(){ - return $sessionStorage.currentUser.connectionToken; - } - - function SetTokenHeader(token){ - $http.defaults.headers.common['X-Auth-Token'] = token; - } - } -})();
\ No newline at end of file diff --git a/moon_gui/static/app/services/partner/nova.service.js b/moon_gui/static/app/services/partner/nova.service.js deleted file mode 100755 index 38e2a0fc..00000000 --- a/moon_gui/static/app/services/partner/nova.service.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('novaService', novaService); - - novaService.$inject = ['$resource']; - - function novaService($resource) { - - return { - - data: { - - image: $resource('./pip/nova/images', {}, { - query: {method: 'GET', isArray: false} - }), - - flavor: $resource('./pip/nova/flavors', {}, { - query: {method: 'GET', isArray: false} - }) - - } - - }; - - } - -})(); diff --git a/moon_gui/static/app/services/partner/project.service.js b/moon_gui/static/app/services/partner/project.service.js deleted file mode 100755 index 4ec27f2e..00000000 --- a/moon_gui/static/app/services/partner/project.service.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Service providing access to the tenants - * @author arnaud marhin<arnaud.marhin@orange.com> - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .factory('projectService', projectService); - - projectService.$inject = [ '$resource' , 'REST_URI' ]; - - function projectService( $resource, REST_URI) { - - return { - - data: { - - projects: $resource(REST_URI.KEYSTONE + 'projects/:project_id', {}, { - query: {method: 'GET', isArray: false}, - get: { method: 'GET', isArray: false }, - create: { method: 'POST' }, - remove: { method: 'DELETE' } - }) - - }, - - findOne: function(project_id, callback){ - - return this.data.projects.get({project_id: project_id}).$promise.then(function(data) { - - callback(data.project); - - }); - - }, - - findAll: function() { - - return this.data.projects.query().$promise.then(function(listProjects) { - - var result = []; - - _.each(listProjects['projects'], function(item){ - result.push(item); - }); - - return result; - }); - - } - - }; - - } - -})(); |