-/*-\r
- * ================================================================================\r
- * ECOMP Portal\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ================================================================================\r
- */\r
-'use strict';\r
-\r
-(function () {\r
- class ContactUsManageController {\r
- constructor($scope,$log, message, $q, $http, conf,contactUsService,confirmBoxService) {\r
- $scope.contactUsList=[];\r
- $scope.contactUsAllAppList=[];\r
- $scope.errMsg='';\r
- $scope.newContactUs ={\r
- app:'',\r
- name:'',\r
- email:'',\r
- url:'',\r
- desc:'' \r
- };\r
- /*Get the existing contact us first, then based on the existing, filter from all apps*/\r
- $scope.getContactUsList = function(){\r
- contactUsService.getContactUs().then(res=> {\r
- // $log.info('getting getContactUs',res.response);\r
- if(res!=null && res.response!=null){\r
- for(var i=0; i<res.response.length;i++){\r
- if(res.response[i].appId!=1)\r
- $scope.contactUsList.push(res.response[i]);\r
- }\r
- }\r
- /*get all the apps*/\r
- contactUsService.getListOfApp().then(res=> {\r
- var tableData=[];\r
- $scope.contactUsAllAppListTemp=[];\r
- // $log.info('contactUsService::getListOfApp: getting res');\r
- var result = (typeof(res.data) != "undefined" && res.data!=null)?res.data:null;\r
- // $log.info('contactUsService::getListOfApp: result',result); \r
- var res1 = result;\r
- var realAppIndex = 0;\r
- $scope.contactUsAllAppList.length=0;\r
- for (var i = 1; i <= res1.length; i++) {\r
- if (!res1[i - 1].restrictedApp) {\r
- var okToAdd = true;\r
- for(var j =0; j<$scope.contactUsList.length;j++){\r
- if(res1[i - 1].title==$scope.contactUsList[j].appName)\r
- okToAdd=false;\r
- }\r
- // not allowed to add(duplicate) another entry if the app is already available in the table\r
- if(okToAdd){\r
- if(res1[i - 1].title){\r
- $scope.contactUsAllAppList.push({\r
- index: realAppIndex,\r
- title: res1[i - 1].title,\r
- value: res1[i - 1].index\r
- });\r
- } \r
- realAppIndex = realAppIndex + 1;\r
- } \r
- } else {\r
- // $log.debug('contactUsService:getAvailableApps:: Restricted/URL only App will not be used = ' + res1[i - 1].title);\r
- }\r
- } \r
- }).catch(err=> {\r
- $log.error('contactUsService:error:: ', err);\r
- \r
- \r
- }).finally(() => {\r
- //this.isLoadingTable = false;\r
- });\r
- });\r
- }\r
- \r
- $scope.getContactUsList();\r
- \r
- $scope.closeDialog = function(){\r
- $scope.closeThisDialog( $scope.widgetData);\r
- }\r
- \r
- /*Add new Contact Us*/\r
- $scope.newContactUsFun = function(){ \r
- if($scope.newContactUs.app.title==null || $scope.newContactUs.app.title=='' ){\r
- confirmBoxService.showInformation('Please select an App to add').then(isConfirmed => {\r
- return;\r
- }); \r
- }\r
- \r
- if($scope.newContactUs.url !=null && $scope.newContactUs.url != '' && !validateUrl($scope.newContactUs.url)){\r
- var warningMsg = "Please enter a valid URL";\r
- confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});\r
- return;\r
- }\r
- \r
- contactUsService.addContactUs($scope.newContactUs).then(res=> {\r
- // $log.info('contactUsService: add ContactUs successfully');\r
- $scope.contactUsList.length=0;\r
- // $log.info('contactUsService: refreshing the Contact US table');\r
- $scope.getContactUsList();\r
- $scope.errMsg='';\r
- /* confirmBoxService.showInformation('You have added a new Contact Us item').then(isConfirmed => { });*/\r
- var defaultSel={\r
- index: 0,\r
- title: '',\r
- value: ''\r
- }\r
- $scope.newContactUs ={\r
- app:defaultSel, \r
- name:'',\r
- email:'',\r
- url:'',\r
- desc:'' \r
- };\r
-\r
- }).catch(err=> {\r
- $log.error('contactUsService: addContactUs error:: ', err);\r
- // $scope.errMsg=err;\r
- confirmBoxService.showInformation('Add Contact Us list failed: ' + err);\r
- \r
- }).finally(() => {\r
- //this.isLoadingTable = false;\r
- });\r
- }\r
- /* Edit Contact Us*/\r
- $scope.editContactUsFun = function(contactObj){\r
- // $log.info('contactUsService: edit ContactUs save successfully', contactObj); \r
- var contactUsObj={\r
- appId:contactObj.appId,\r
- appName:contactObj.appName,\r
- description:contactObj.description,\r
- contactName:contactObj.contactName,\r
- contactEmail:contactObj.contactEmail,\r
- url:contactObj.url, \r
- };\r
- \r
- contactUsService.modifyContactUs(contactUsObj).then(res=> {\r
- // $log.info('contactUsService: edit ContactUs successfully');\r
- // confirmBoxService.showInformation('You have saved the changes').then(isConfirmed => {});\r
- $scope.errMsg='';\r
- \r
- }).catch(err=> {\r
- $log.error('contactUsService: editContactUs error:: ', err);\r
- confirmBoxService.showInformation('Edit Contact Us list failed: ' + err);\r
- // $scope.errMsg=err;\r
- }).finally(() => {\r
- //this.isLoadingTable = false;\r
- });\r
- \r
- }\r
- \r
- $scope.$watch('newContactUs.app.value', (newVal, oldVal) => {\r
- for(var i=0;i<$scope.contactUsAllAppList.length;i++){\r
- if($scope.contactUsAllAppList[i].value==newVal){\r
- $scope.newContactUs.app=angular.copy($scope.contactUsAllAppList[i]);;\r
- }\r
- }\r
- });\r
- /*del Contact Us*/\r
- $scope.delContactUsFun = function(appObj){\r
- var confirmMsg = 'Are you sure you want to delete '+appObj.appName +' from the list?' + ' Press OK to delete.';\r
- confirmBoxService.confirm(confirmMsg).then(function (confirmed) {\r
- if (confirmed == true) { \r
- contactUsService.removeContactUs(appObj.appId).then(res=> { \r
- // $log.info('delContactUsFun: delete ContactUs successfully',res);\r
- $scope.errMsg='';\r
- $scope.contactUsList.length=0;\r
- $scope.getContactUsList();\r
- confirmBoxService.showInformation('Item has been deleted').then(isConfirmed => {});\r
- }).catch(err=> {\r
- $log.error('contactUsService: addContactUs error:: ', err);\r
- confirmBoxService.showInformation('Deletion failed: ' + err);\r
- // $scope.errMsg=err;\r
- }).finally(() => {\r
- //this.isLoadingTable = false;\r
- });\r
- }\r
- });\r
- \r
- } \r
- \r
- } \r
- }\r
- ContactUsManageController.$inject = ['$scope','$log', 'message', '$q', '$http', 'conf','contactUsService','confirmBoxService'];\r
- angular.module('ecompApp').controller('ContactUsManageController', ContactUsManageController);\r
-\r
- \r
-})();\r
-function validateUrl(value){\r
- return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);\r
- }\r
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 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============================================
+ *
+ *
+ */
+'use strict';
+
+(function () {
+ class ContactUsManageController {
+ constructor($scope,$log, message, $q, $http, conf,contactUsService,confirmBoxService) {
+ $scope.contactUsList=[];
+ $scope.contactUsAllAppList=[];
+ $scope.errMsg='';
+ $scope.newContactUs ={
+ app:'',
+ name:'',
+ email:'',
+ url:'',
+ desc:''
+ };
+ /*Get the existing contact us first, then based on the existing, filter from all apps*/
+ $scope.getContactUsList = function(){
+ contactUsService.getContactUs().then(res=> {
+ // $log.info('getting getContactUs',res.response);
+ if(res!=null && res.response!=null){
+ for(var i=0; i<res.response.length;i++){
+ if(res.response[i].appId!=1)
+ $scope.contactUsList.push(res.response[i]);
+ }
+ }
+ /*get all the apps*/
+ contactUsService.getListOfApp().then(res=> {
+ var tableData=[];
+ $scope.contactUsAllAppListTemp=[];
+ // $log.info('contactUsService::getListOfApp: getting res');
+ var result = (typeof(res.data) != "undefined" && res.data!=null)?res.data:null;
+ // $log.info('contactUsService::getListOfApp: result',result);
+ var res1 = result;
+ var realAppIndex = 0;
+ $scope.contactUsAllAppList.length=0;
+ for (var i = 1; i <= res1.length; i++) {
+ if (!res1[i - 1].restrictedApp) {
+ var okToAdd = true;
+ for(var j =0; j<$scope.contactUsList.length;j++){
+ if(res1[i - 1].title==$scope.contactUsList[j].appName)
+ okToAdd=false;
+ }
+ // not allowed to add(duplicate) another entry if the app is already available in the table
+ if(okToAdd){
+ if(res1[i - 1].title){
+ $scope.contactUsAllAppList.push({
+ index: realAppIndex,
+ title: res1[i - 1].title,
+ value: res1[i - 1].index
+ });
+ }
+ realAppIndex = realAppIndex + 1;
+ }
+ } else {
+ // $log.debug('contactUsService:getAvailableApps:: Restricted/URL only App will not be used = ' + res1[i - 1].title);
+ }
+ }
+ }).catch(err=> {
+ $log.error('contactUsService:error:: ', err);
+
+
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+ });
+ }
+
+ $scope.getContactUsList();
+
+ $scope.closeDialog = function(){
+ $scope.closeThisDialog( $scope.widgetData);
+ }
+
+ /*Add new Contact Us*/
+ $scope.newContactUsFun = function(){
+ if($scope.newContactUs.app.title==null || $scope.newContactUs.app.title=='' ){
+ confirmBoxService.showInformation('Please select an App to add').then(isConfirmed => {
+ return;
+ });
+ }
+
+ if($scope.newContactUs.url !=null && $scope.newContactUs.url != '' && !validateUrl($scope.newContactUs.url)){
+ var warningMsg = "Please enter a valid URL";
+ confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;});
+ return;
+ }
+
+ contactUsService.addContactUs($scope.newContactUs).then(res=> {
+ // $log.info('contactUsService: add ContactUs successfully');
+ $scope.contactUsList.length=0;
+ // $log.info('contactUsService: refreshing the Contact US table');
+ $scope.getContactUsList();
+ $scope.errMsg='';
+ /* confirmBoxService.showInformation('You have added a new Contact Us item').then(isConfirmed => { });*/
+ var defaultSel={
+ index: 0,
+ title: '',
+ value: ''
+ }
+ $scope.newContactUs ={
+ app:defaultSel,
+ name:'',
+ email:'',
+ url:'',
+ desc:''
+ };
+
+ }).catch(err=> {
+ $log.error('contactUsService: addContactUs error:: ', err);
+ // $scope.errMsg=err;
+ confirmBoxService.showInformation('Add Contact Us list failed: ' + err);
+
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+ }
+ /* Edit Contact Us*/
+ $scope.editContactUsFun = function(contactObj){
+ // $log.info('contactUsService: edit ContactUs save successfully', contactObj);
+ var contactUsObj={
+ appId:contactObj.appId,
+ appName:contactObj.appName,
+ description:contactObj.description,
+ contactName:contactObj.contactName,
+ contactEmail:contactObj.contactEmail,
+ url:contactObj.url,
+ };
+
+ contactUsService.modifyContactUs(contactUsObj).then(res=> {
+ // $log.info('contactUsService: edit ContactUs successfully');
+ // confirmBoxService.showInformation('You have saved the changes').then(isConfirmed => {});
+ $scope.errMsg='';
+
+ }).catch(err=> {
+ $log.error('contactUsService: editContactUs error:: ', err);
+ confirmBoxService.showInformation('Edit Contact Us list failed: ' + err);
+ // $scope.errMsg=err;
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+
+ }
+
+ $scope.$watch('newContactUs.app.value', (newVal, oldVal) => {
+ for(var i=0;i<$scope.contactUsAllAppList.length;i++){
+ if($scope.contactUsAllAppList[i].value==newVal){
+ $scope.newContactUs.app=angular.copy($scope.contactUsAllAppList[i]);;
+ }
+ }
+ });
+ /*del Contact Us*/
+ $scope.delContactUsFun = function(appObj){
+ var confirmMsg = 'Are you sure you want to delete '+appObj.appName +' from the list?' + ' Press OK to delete.';
+ confirmBoxService.confirm(confirmMsg).then(function (confirmed) {
+ if (confirmed == true) {
+ contactUsService.removeContactUs(appObj.appId).then(res=> {
+ // $log.info('delContactUsFun: delete ContactUs successfully',res);
+ $scope.errMsg='';
+ $scope.contactUsList.length=0;
+ $scope.getContactUsList();
+ confirmBoxService.showInformation('Item has been deleted').then(isConfirmed => {});
+ }).catch(err=> {
+ $log.error('contactUsService: addContactUs error:: ', err);
+ confirmBoxService.showInformation('Deletion failed: ' + err);
+ // $scope.errMsg=err;
+ }).finally(() => {
+ //this.isLoadingTable = false;
+ });
+ }
+ });
+
+ }
+
+ }
+ }
+ ContactUsManageController.$inject = ['$scope','$log', 'message', '$q', '$http', 'conf','contactUsService','confirmBoxService'];
+ angular.module('ecompApp').controller('ContactUsManageController', ContactUsManageController);
+
+
+})();
+function validateUrl(value){
+ return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
+ }