diff options
Diffstat (limited to 'd2ice.att.io/app/services')
-rwxr-xr-x | d2ice.att.io/app/services/cache.service.js | 89 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/checklist.service.js | 213 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/cms.service.js | 162 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/dtsite.service.js | 100 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/feedback.service.js | 63 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/localstorage.service.js | 63 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/sessionStorage.service.js | 65 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/status.service.js | 87 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/steps.service.js | 162 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/toast.service.js | 92 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/users.service.js | 322 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/vf.service.js | 403 | ||||
-rwxr-xr-x | d2ice.att.io/app/services/vfc.service.js | 99 |
13 files changed, 1920 insertions, 0 deletions
diff --git a/d2ice.att.io/app/services/cache.service.js b/d2ice.att.io/app/services/cache.service.js new file mode 100755 index 00000000..6897e785 --- /dev/null +++ b/d2ice.att.io/app/services/cache.service.js @@ -0,0 +1,89 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular + .module('ice.services.cacheService', []) + .service('cacheService', function () { + + var data = {}; + + this.get = function (key) { + return data[key]; + }; + + this.delete = function (key) { + return data[key] = undefined; + }; + + this.deleteAll = function () { + return data = {}; + }; + + this.set = function (key, value) { + if (data[key] === undefined) { + data[key] = value; + } else { + data[key] = $.extend({}, value, data[key]); + } + }; + + this.toString = function() { + return data; + }; + + }) + + .factory('pageService', function () { + var page = ''; + return { + getPage: function () { + return page; + }, + setPage: function (new_page) { + page = new_page; + } + }; + }); + + + +})(); diff --git a/d2ice.att.io/app/services/checklist.service.js b/d2ice.att.io/app/services/checklist.service.js new file mode 100755 index 00000000..c2aae9ee --- /dev/null +++ b/d2ice.att.io/app/services/checklist.service.js @@ -0,0 +1,213 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + var current_checklist; + + angular.module('ice.services.checklist', []) + + .factory('checklistService', ['$rootScope', '$http', '$q', 'cacheService', '$log', + function ($rootScope,$http, $q, cacheService, $log) { + + var urls = cacheService.get("configuration").urls; + + var vm = this; + + this.setState = function (clUuid, postData) { + var deferred = $q.defer(); + $http.put(urls.checklist.state.put.replace('@cl_uuid',clUuid) ,postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.createChecklist = function (engUuid, postData) { + var deferred = $q.defer(); + $http.post(urls.checklist.createChecklist.replace("@engUuid", engUuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getDataForCreateChecklist = function (engUuid) { + var deferred = $q.defer(); + $http.get(urls.checklist.getDataForChecklist.replace('@engUuid',engUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getChecklist = function (checklistUuid) { + var deferred = $q.defer(); + $http.get(urls.checklist.getChecklist.replace('@checklistUuid',checklistUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.putDataForChecklist = function (checklist_uuid,putData) { + var deferred = $q.defer(); + $http.put(urls.checklist.putDataForChecklist.replace('@checklist_uuid',checklist_uuid),putData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + this.putChecklistDecision = function (decisionUuid, putData) { + var deferred = $q.defer(); + $http.put(urls.checklist.checklistDecision.replace('@decisionUuid',decisionUuid),putData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.createAuditlogChecklist = function (checklist_uuid, postData) { + var deferred = $q.defer(); + $http.post(urls.checklist.createAuditlogChecklist.replace('@checklist_uuid',checklist_uuid),postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.createAuditlogDecisionChecklist = function (decision_uuid,postData) { + var deferred = $q.defer(); + $http.post(urls.checklist.createAuditlogDecisionChecklist.replace('@decision_uuid',decision_uuid),postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + + this.setChecklistExitEntity = function(checklist_data) { + current_checklist = checklist_data; + $log.debug("set checklist"); + } + + + this.callChecklistExit = function(page_view) { + if (current_checklist != undefined && page_view == 'checklist') { + + var modal_type = 'set_state'; + angular.forEach(current_checklist.data.checklistDecisions, function (section,key) { + angular.forEach(section.decisions, function (decision,key) { + if (decision['view_value'] != 'approved' && decision['view_value'] != 'not_relevant' || decision['view_value'] == '') { + modal_type = 'next_step'; + } + }); + }); + if (modal_type == 'next_step') + this.openNextSteps(); + else if (modal_type == 'set_state') + this.openSetState(); + } + } + + this.getChecklistTemplates = function () { + var deferred = $q.defer(); + $http.get(urls.checklist.getChecklistTemplates). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getChecklistTemplate = function (templateUuid) { + var deferred = $q.defer(); + $http.get(urls.checklist.getChecklistTemplate.replace('@templateUuid', templateUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.saveChecklistTemplate = function (putData) { + var deferred = $q.defer(); + $http.put(urls.checklist.saveChecklistTemplate, putData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + return this; + + }]); + +})(); diff --git a/d2ice.att.io/app/services/cms.service.js b/d2ice.att.io/app/services/cms.service.js new file mode 100755 index 00000000..15a3ac32 --- /dev/null +++ b/d2ice.att.io/app/services/cms.service.js @@ -0,0 +1,162 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +/** + * Created by almog on 17/01/2017. + */ +(function () { + 'use strict'; + + angular.module('ice.services.cms', []) + .service('cmsService', ['$http', '$q', 'cacheService', 'localStorageService', '$uibModal', '$rootScope', '$log', cmsService]); + + function cmsService($http, $q, cacheService, localStorageService, $uibModal, $rootScope, $log) { + var urls = cacheService.get("configuration").urls; + var lastAnnouncementStorageKey = 'lastAnnouncement'; + var lastAnnouncementMessage; + + this.getPosts = function(limit, fromLastDays, categories) { + var deferred = $q.defer(); + var categoriesParam = categories && categories instanceof Array ? categories.join() : ''; + + $http.get(urls.cms.posts.get.replace('@limit',limit).replace('@offset',0).replace('@fromLastDays',fromLastDays).replace('@category',categoriesParam)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getLastAnnouncementPost = function() { + var deferred = $q.defer(); + var limit = 1; + + $http.get(urls.cms.posts.get.replace('@limit', limit).replace('@offset',0).replace('@fromLastDays','').replace('@category','Announcement')). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.setAnnouncementToast = function() { + var openCMSPostModal = function() { + $uibModal.open({ + templateUrl: 'main/modals/cms-post-modal/cms-post-modal.html', + controller: 'cmsPostModalController', + controllerAs: 'vm', + size: 'cms-post-read-more', + resolve: { + post: function () { + return undefined; + } + } + }); + }; + + this.getLastAnnouncementPost() + .then(function(response) { + if(response && response.data && response.data.length === 1) { + var lastAnnouncement = localStorageService.getJson(lastAnnouncementStorageKey); + if(!lastAnnouncement || lastAnnouncement.id != response.data[0].id || !lastAnnouncement.closed) { + localStorageService.setJson(lastAnnouncementStorageKey, {"id": response.data[0].id, "closed": false}); + var toastMessage = "<b>Important announcement</b>: <i>" + response.data[0].title + ".</i>"; + lastAnnouncementMessage = {message: toastMessage, readMore: openCMSPostModal, type: 'warning', show: true, displayFor: 'all', publishDate: response.data[0].publish_date}; + $rootScope.showAnnouncement = !$rootScope.showAnnouncement; + } + } + }) + .catch(function(error) { + $log.error(error); + }); + }; + + this.getAnnouncement = function() { + return lastAnnouncementMessage; + }; + + this.getPages = function(title) { + var deferred = $q.defer(); + + if(!title) { title = ''; } + $http.get(urls.cms.pages.get.replace('@title',title)) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getPage = function(id) { + var deferred = $q.defer(); + + $http.get(urls.cms.pages.getById.replace('@id',id)) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.searchPages = function(keyword) { + var deferred = $q.defer(); + + $http.get(urls.cms.pages.search.replace('@keyword',keyword)) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + } + }; +})(); diff --git a/d2ice.att.io/app/services/dtsite.service.js b/d2ice.att.io/app/services/dtsite.service.js new file mode 100755 index 00000000..26fca386 --- /dev/null +++ b/d2ice.att.io/app/services/dtsite.service.js @@ -0,0 +1,100 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.dtsite', []) + + .service('dtsiteService', ['$http', '$q', 'cacheService', function ($http, $q, cacheService) { + + var urls = cacheService.get("configuration").urls; + + + this.getVFSites = function (vfUuid) { + var deferred = $q.defer(); + $http.get(urls.dtsite.getVFSites.replace('@vfUuid',vfUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.get = function () { + var deferred = $q.defer(); + $http.get(urls.dtsite.get). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.delete = function (vfUuid, dtsUuid) { + var deferred = $q.defer(); + $http.delete(urls.dtsite.delete.replace('@vfUuid',vfUuid).replace('@dtsUuid',dtsUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.add = function (postData) { + var deferred = $q.defer(); + $http.post(urls.dtsite.add ,postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + }]); + +})(); diff --git a/d2ice.att.io/app/services/feedback.service.js b/d2ice.att.io/app/services/feedback.service.js new file mode 100755 index 00000000..4d8e8ae7 --- /dev/null +++ b/d2ice.att.io/app/services/feedback.service.js @@ -0,0 +1,63 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.feedback', []) + + .service('feedbackService', ['$http', '$q', 'cacheService', function ($http, $q, cacheService) { + + var urls = cacheService.get("configuration").urls; + + this.add = function ( postData) { + var deferred = $q.defer(); + $http.post(urls.feedback.add.replace(), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + }]); + +})();
\ No newline at end of file diff --git a/d2ice.att.io/app/services/localstorage.service.js b/d2ice.att.io/app/services/localstorage.service.js new file mode 100755 index 00000000..f17d8009 --- /dev/null +++ b/d2ice.att.io/app/services/localstorage.service.js @@ -0,0 +1,63 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +'use strict'; + +angular.module('ice.services.localStorage', []) + + .service('localStorageService', function ($window) { + + this.setJson = function (key, val) { + $window.localStorage && $window.localStorage.setItem(key, JSON.stringify(val)); + return this; + }; + + this.getJson = function (key) { + var val = $window.localStorage && $window.localStorage.getItem(key); + var returnVal; + try { + returnVal = val ? JSON.parse(val) : undefined; + } catch(err){} + return returnVal; + }; + + this.delete = function (key) { + return $window.localStorage && $window.localStorage.removeItem(key); + }; + + }); diff --git a/d2ice.att.io/app/services/sessionStorage.service.js b/d2ice.att.io/app/services/sessionStorage.service.js new file mode 100755 index 00000000..da3a91de --- /dev/null +++ b/d2ice.att.io/app/services/sessionStorage.service.js @@ -0,0 +1,65 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + 'use strict'; + + angular.module('ice.services.sessionStorage', []) + .service('sessionStorageService', ['$window', sessionStorageService]); + + function sessionStorageService($window) { + this.setJson = function (key, val) { + $window.sessionStorage && $window.sessionStorage.setItem(key, JSON.stringify(val)); + return this; + }; + + this.getJson = function (key) { + var val = $window.sessionStorage && $window.sessionStorage.getItem(key); + var returnVal; + try { + returnVal = val ? JSON.parse(val) : undefined; + } catch (err) { + } + return returnVal; + }; + + this.delete = function (key) { + return $window.sessionStorage && $window.sessionStorage.removeItem(key); + }; + } +})(); diff --git a/d2ice.att.io/app/services/status.service.js b/d2ice.att.io/app/services/status.service.js new file mode 100755 index 00000000..985b1898 --- /dev/null +++ b/d2ice.att.io/app/services/status.service.js @@ -0,0 +1,87 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.status', []) + + .service('statusService', ['$http', '$q', 'cacheService', function ($http, $q, cacheService) { + + var urls = cacheService.get("configuration").urls; + + this.get = function (engagement) { + var deferred = $q.defer(); + $http.get(urls.status.get.replace('@engagement',engagement)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.update = function (engagement, postData) { + var deferred = $q.defer(); + $http.put(urls.status.update.replace('@engagement',engagement), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.add = function (engagement, postData) { + var deferred = $q.defer(); + $http.post(urls.status.update.replace('@engagement',engagement), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + }]); + +})();
\ No newline at end of file diff --git a/d2ice.att.io/app/services/steps.service.js b/d2ice.att.io/app/services/steps.service.js new file mode 100755 index 00000000..eef4dc99 --- /dev/null +++ b/d2ice.att.io/app/services/steps.service.js @@ -0,0 +1,162 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.steps', []) + + .service('stepsService', ['$http', '$q', 'cacheService', function ($http, $q, cacheService) { + + var urls = cacheService.get("configuration").urls; + + this.getByUser = function() { + var deferred = $q.defer(); + + $http.get(urls.steps.getByUser) + .success(function(data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.get = function (engagement, progress) { + var deferred = $q.defer(); + $http.get(urls.steps.get.replace('@engagement',engagement).replace('@progress',progress)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.update = function (stepUuid, postData) { + var deferred = $q.defer(); + $http.put(urls.steps.update.replace('@stepUuid',stepUuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.delete = function (stepUuid) { + var deferred = $q.defer(); + $http.delete(urls.steps.delete.replace('@stepUuid',stepUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.add = function (engagement, postData) { + var deferred = $q.defer(); + $http.post(urls.steps.add.replace('@engagement',engagement), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.edit = function (engagement_uuid, nextstep_uuid,postData) { + var deferred = $q.defer(); + $http.put(urls.steps.edit.replace('@stepUuid',nextstep_uuid).replace('@engUuid',engagement_uuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.order_next_steps = function (engagement_uuid, postData) { + var deferred = $q.defer(); + $http.put(urls.steps.order_next_steps.replace('@engUuid',engagement_uuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.createNextStep = function (checklist_uuid, engUuid, postData) { + var deferred = $q.defer(); + $http.post(urls.steps.createNextStep.replace('@engUuid',engUuid),postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.createChecklistNextStep = function (checklist_uuid, engUuid, postData) { + var deferred = $q.defer(); + $http.post(urls.steps.createChecklistNextStep.replace('@checkListUuid',checklist_uuid).replace('@engUuid',engUuid),postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + + }]); + +})(); diff --git a/d2ice.att.io/app/services/toast.service.js b/d2ice.att.io/app/services/toast.service.js new file mode 100755 index 00000000..15c2e12a --- /dev/null +++ b/d2ice.att.io/app/services/toast.service.js @@ -0,0 +1,92 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + 'use strict'; + + angular.module('ice.services.toast', []) + .service('toastService', ['$rootScope', function ($rootScope) { + var message; + var messageType; + var sticky; + var showMessage = false; + var readMore; + var displayFor = 'all'; + + var setToast = function(incomingMessage, incomingType, options) { + if (incomingMessage && incomingMessage.detail != undefined) + incomingMessage = incomingMessage.detail + if(incomingMessage && incomingType) { + message = incomingMessage; + messageType = incomingType; + sticky = options && options.sticky ? options.sticky : false; + readMore = options && options.readMoreCallback ? options.readMoreCallback : undefined; + displayFor = options && options.displayFor ? options.displayFor : 'all'; + showMessage = true; + $rootScope.showToast = true; + } else { + throw "You must provide both message an type in order to set new message toast" + } + }; + + var clearToast = function() { + message = undefined; + messageType = undefined; + showMessage = false; + displayFor = 'all'; + $rootScope.showToast = false; + }; + + var getToast = function() { + return { + "message": message, + "type": messageType, + "show": showMessage, + "sticky": sticky, + "readMore": readMore, + "displayFor": displayFor + }; + }; + + return { + setToast: setToast, + clearToast: clearToast, + getToast: getToast + }; + }]); +})(); diff --git a/d2ice.att.io/app/services/users.service.js b/d2ice.att.io/app/services/users.service.js new file mode 100755 index 00000000..7d8afcc7 --- /dev/null +++ b/d2ice.att.io/app/services/users.service.js @@ -0,0 +1,322 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.users', []) + .service('usersService', ['$http', '$q', 'cacheService','iceConstants', 'localStorageService', '$state', + 'sessionStorageService', '_', '$log', userService]); + + function userService ($http, $q, cacheService, iceConstants, localStorageService, $state, sessionStorageService, + _, $log) { + var urls = cacheService.get("configuration").urls; + var userDataSessionStorageKey = 'user'; + var userData = sessionStorageService.getJson(userDataSessionStorageKey); + + this.isEngagementEL = function(engagement_team) { + var found_uuid = _.find(engagement_team, {'uuid': userData.uuid}); + if (found_uuid == undefined) + return false; + if (userData && userData.role.name === iceConstants.roles.el) + return true; + return false; + } + + this.isUserInRole = function(role) { + return userData && userData.role && userData.role.name === role; + } + + this.isReviewer = function(user, reviewer_uuid) { + return user && reviewer_uuid && user.uuid == reviewer_uuid; + } + + this.isPeerReviewer = function(user, peer_reviewer_uuid) { + return user && peer_reviewer_uuid && user.uuid == peer_reviewer_uuid; + } + + this.isAdmin = function(user) { + return user && user.role && user.role.name === iceConstants.roles.admin; + }; + + this.updatePassword = function (userUuid, postData) { + var deferred = $q.defer(); + $http.put(urls.auth.updatePassword, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.sendResetPwdInstructions = function (postData) { + var deferred = $q.defer(); + $http.post(urls.auth.sendResetPwdInstructions, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.login = function (postData, t) { + var deferred = $q.defer(); + $http.post(urls.auth.login.replace("/@t", t), postData). + success(function (data, status, headers, config) { + userData = data; + delete userData.password; + userData.jwtToken = data.token; + sessionStorageService.setJson(userDataSessionStorageKey, userData); + + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.register = function (postData) { + var deferred = $q.defer(); + $http.post(urls.auth.register, postData). + success(function (data, status, headers, config) { + userData = data; + userData.jwtToken = data.token; + sessionStorageService.setJson(userDataSessionStorageKey, userData); + + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.addVendorContact = function (postData) { + var deferred = $q.defer(); + $http.post(urls.auth.addVendorContact, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.resendActivationMail = function (user_uuid) { + var deferred = $q.defer(); + $http.get(urls.auth.resendActivationMail.replace("@user_uuid", user_uuid), {skipAuth: true}). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getNotifications = function (userUuid) { + var deferred = $q.defer(); + $http.get(urls.notifications.getNotifications). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.resetNotificationNum = function (userUuid) { + var deferred = $q.defer(); + $http.put(urls.notifications.resetNotificationNum). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.notificationsDelete = function (uuid) { + var deferred = $q.defer(); + $http.delete(urls.notifications.notificationsDelete.replace("@uuid", uuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getNotificationsDescription = function (userUuid,offset,limit) { + var deferred = $q.defer(); + $http.get(urls.notifications.getNotificationsDescription.replace("@userUuid", userUuid).replace("@offset", offset).replace("@limit", limit)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getIceUser = function () { + var deferred = $q.defer(); + $http.get(urls.auth.getIceUser). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateAccount = function (userUuid, putData) { + var deferred = $q.defer(); + $http.put(urls.auth.account, putData). + success(function (data, status, headers, config) { + var oldToken = userData.jwtToken; + userData = data; + userData.jwtToken = oldToken; + sessionStorageService.setJson(userDataSessionStorageKey, userData); + + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.setSSHKey = function (userUuid, postData) { + var deferred = $q.defer(); + $http.post(urls.auth.setSSHKey, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getUserData = function(undefinedCallback) { + if(!userData) { + if(undefinedCallback) { + $log.debug("There is no user data, will invoke callback pass as argument."); + undefinedCallback(); + } else { + $log.debug("There is no user data, will be redirected into /login page."); + $state.go('app.login'); + } + } + + return userData; + }; + + this.resetUserData = function() { + $log.debug('Clearing user from cache...'); + userData = undefined; + sessionStorageService.delete(userDataSessionStorageKey); + localStorageService.setJson("ice.settings.view_type", undefined); + localStorageService.setJson("ice.settings.eng_uuid", undefined); + localStorageService.setJson("ice.settings.sub_id", undefined); + }; + + this.setUserActivationSuccess = function(activationSuccess) { + if(userData) { + userData.activationSuccess = activationSuccess; + sessionStorageService.setJson(userDataSessionStorageKey, userData); + } + }; + + this.getEngagementLeads = function() { + var deferred = $q.defer(); + var user = this.getUserData(); + if(this.isAdmin(user)) { + $http.get(urls.users.engagementleads.get) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + } else { + deferred.reject("Just admin allowed to get engagement leads list."); + } + + return deferred.promise; + }; + + this.activateUser = function(userId, token) { + var deferred = $q.defer(); + + $http.get(urls.users.activate.replace("@userid", userId).replace("@token", token), {skipAuth: true}) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getRGWASecret = function () { + var deferred = $q.defer(); + $http.get(urls.auth.getRGWASecret). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + }; +})(); diff --git a/d2ice.att.io/app/services/vf.service.js b/d2ice.att.io/app/services/vf.service.js new file mode 100755 index 00000000..8207562a --- /dev/null +++ b/d2ice.att.io/app/services/vf.service.js @@ -0,0 +1,403 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.vf', []) + + .service('vfService', ['$http', '$q', 'cacheService', function ($http, $q, cacheService) { + + var urls = cacheService.get("configuration").urls; + + this.addVfs = function (postData) { + var deferred = $q.defer(); + $http.post(urls.auth.addVfs, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateVfs = function (putData,vf_uuid) { + var deferred = $q.defer(); + $http.put(urls.vf.updateVfs.put.replace('@vf_uuid',vf_uuid),putData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.inviteMembers = function (postData) { + var deferred = $q.defer(); + $http.post(urls.auth.inviteMembers, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getCompanies = function () { + var deferred = $q.defer(); + $http.get(urls.auth.getCompanies). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getDeployTargets = function () { + var deferred = $q.defer(); + $http.get(urls.vf.deployment_target.getDeployTargets). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getECOMPReleases = function () { + var deferred = $q.defer(); + $http.get(urls.vf.ecomp.getECOMPReleases). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + this.getVFVersion = function (vfUuid) { + var deferred = $q.defer(); + $http.get(urls.vf.version.getVFVersion.replace('@vfUuid',vfUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getEngagements = function (userUuid) { + var deferred = $q.defer(); + $http.get(urls.auth.engagements). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getExpandedEngagements = function (postData) { + var deferred = $q.defer(); + $http.post(urls.engagement.engagementsExpanded, postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getSingleEngagement = function (userUuid,engagementUuid) { + var deferred = $q.defer(); + $http.get(urls.auth.single_engagement.replace('@engagementUuid',engagementUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getStarredEngagements = function(){ + var deferred = $q.defer(); + $http.get(urls.engagement.starred_engagement.get). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.putStarredEngagements = function(engagementUuid){ + var deferred = $q.defer(); + var data = {} + data['engagement_uuid'] = engagementUuid; + $http.put(urls.engagement.starred_engagement.put,data). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getRecentEngagements = function(){ + var deferred = $q.defer(); + $http.get(urls.engagement.recent_engagement.get). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getActivities = function (engagementUuid) { + var deferred = $q.defer(); + $http.get(urls.auth.activities.replace('@engagementUuid',engagementUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateProgress = function (engagementUuid, postData) { + var deferred = $q.defer(); + $http.put(urls.engagement.updateProgress.replace('@engagementUuid',engagementUuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateDeployTargets = function (engagementUuid, dt_uuid) { + var deferred = $q.defer(); + $http.put(urls.vf.deployment_target.updateDeployTargets.replace('@engagementUuid',engagementUuid). + replace('@deployment_target_uuid',dt_uuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateECOMPReleases = function (engagementUuid, ECOMP_uuid) { + var deferred = $q.defer(); + $http.put(urls.vf.ecomp.updateECOMPReleases.replace('@engagementUuid',engagementUuid). + replace('@ecomp_uuid', ECOMP_uuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateDaysLeft = function (engagementUuid, postData) { + var deferred = $q.defer(); + $http.post(urls.auth.updateDaysLeft.replace('@engagementUuid',engagementUuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.updateLabEntryDaysLeft = function (engagementUuid, postData) { + var deferred = $q.defer(); + $http.post(urls.auth.updateLabEntryDaysLeft.replace('@engagementUuid',engagementUuid), postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + + this.set_engagement_stage = function(engagementUuid, requested_stage){ + var deferred = $q.defer(); + $http.put(urls.engagement.setStage.replace('@engagementUuid',engagementUuid).replace('@stage',requested_stage)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.exportEngagementsCSV = function (stage, keyword) { + var deferred = $q.defer(); + + if(stage == null || keyword == null) { + deferred.reject("Invalid arguments on engagements export csv.") + } else { + $http({method: 'GET', url: urls.engagement.exportEngagementsCSV.replace('@stage',stage).replace("@keyword", keyword), + headers: {'Content-Type': "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}, responseType: "arraybuffer"}). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + } + + return deferred.promise; + }; + + this.archiveEngagement = function(engagementUuid, reason) { + var deferred = $q.defer(); + var putData = {"reason": reason}; + $http.put(urls.engagement.archive.put.replace('@engagementUuid',engagementUuid), putData) + .success(function (data, status, headers, config) { + deferred.resolve(); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.updateEngagementReviewer = function(engagementUuid, userUuid) { + var deferred = $q.defer(); + var putData = {"reviewer": userUuid}; + + $http.put(urls.engagement.reviewer.put.replace('@engagementUuid',engagementUuid), putData) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.updateEngagementPeerReviewer = function(engagementUuid, userUuid) { + var deferred = $q.defer(); + var putData = {"peerreviewer": userUuid}; + + $http.put(urls.engagement.peerreviewer.put.replace('@engagementUuid',engagementUuid), putData) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.switchEngagementReviewers = function(engagementUuid, reviewer_uuid, peer_reviewer_uuid) { + var deferred = $q.defer(); + var putData = {"reviewer": reviewer_uuid, "peerreviewer": peer_reviewer_uuid}; + + $http.put(urls.engagement.switchReviewers.put.replace('@engagementUuid',engagementUuid), putData) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.updateEngagement = function(engagement, status) { + var deferred = $q.defer(); + var putData = {"engagement": engagement, "status": status}; + + $http.put(urls.engagement.put.replace('@engagementUuid',engagement.uuid), putData) + .success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }) + .error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + + this.remove_user_from_eng = function(postData) { + var deferred = $q.defer(); + if (postData == null) { + deferred.reject("Invalid arguments on remove_user_from_eng.") + } + else { + $http.put(urls.engagement.engagement_team.put, postData).success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }).error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + } + return deferred.promise; + }; + }]); + +})(); diff --git a/d2ice.att.io/app/services/vfc.service.js b/d2ice.att.io/app/services/vfc.service.js new file mode 100755 index 00000000..a6ab0f9f --- /dev/null +++ b/d2ice.att.io/app/services/vfc.service.js @@ -0,0 +1,99 @@ +// +// ============LICENSE_START========================================== +// org.onap.vvp/portal +// =================================================================== +// Copyright © 2017 AT&T Intellectual Property. All rights reserved. +// =================================================================== +// +// Unless otherwise specified, all software contained herein is licensed +// under the Apache License, Version 2.0 (the “License”); +// you may not use this software except in compliance with the License. +// You may obtain a copy of the License at +// +// http:www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// +// Unless otherwise specified, all documentation contained herein is licensed +// under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +// you may not use this documentation except in compliance with the License. +// You may obtain a copy of the License at +// +// https:creativecommons.org/licenses/by/4.0/ +// +// Unless required by applicable law or agreed to in writing, documentation +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ============LICENSE_END============================================ +// +// ECOMP is a trademark and service mark of AT&T Intellectual Property. +(function () { + + 'use strict'; + + angular.module('ice.services.vfc', []) + + .service('vfcService', ['$http', '$q', 'cacheService', function ($http, $q, cacheService) { + + var urls = cacheService.get("configuration").urls; + + this.get = function (vfUuid) { + var deferred = $q.defer(); + $http.get(urls.vfcs.get.replace('@vfUuid',vfUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.delete = function (vfcUuid,vfUuid) { + var deferred = $q.defer(); + $http.delete(urls.vfcs.delete.replace('@vfUuid',vfUuid).replace('@vfcUuid',vfcUuid)). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.add = function (postData) { + var deferred = $q.defer(); + $http.post(urls.vfcs.add ,postData). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + this.getCompanies = function () { + var deferred = $q.defer(); + $http.get(urls.auth.getCompanies). + success(function (data, status, headers, config) { + deferred.resolve({data: data, status: status}); + }). + error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + return deferred.promise; + }; + + }]); + +})(); |