From d350d5ac25c8df2846e4f0d9082cb4d364a17a83 Mon Sep 17 00:00:00 2001 From: "Sonsino, Ofir (os0695)" Date: Mon, 6 Aug 2018 16:14:59 +0300 Subject: UI Feature flagging support Change-Id: Ic2151dab6306c42364483e9064c01bab3dd7378b Issue-ID: VID-208 Signed-off-by: Sonsino, Ofir (os0695) --- .../webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp | 2 +- .../src/main/webapp/WEB-INF/jsp/serviceModels.jsp | 11 +- .../src/main/webapp/WEB-INF/jsp/welcome.jsp | 34 +- .../app/fusion/external/ebz/angular_js/app.js | 11 +- .../app/fusion/external/lodash/lodash.min.0.10.js | 40 + .../webapp/WEB-INF/conf/dev.features.properties | 14 + .../main/webapp/WEB-INF/conf/features.properties | 11 + .../vid/scripts/constants/componentConstants.js | 30 +- .../app/vid/scripts/constants/fieldConstants.js | 10 +- .../app/vid/scripts/constants/vidConfiguration.js | 7 +- .../scripts/controller/InstantiationController.js | 2566 ++++++++++---------- .../scripts/controller/ServiceModelController.js | 136 +- .../controller/ServiceProxyConfigController.js | 3 + .../webapp/app/vid/scripts/controller/VidApp.js | 8 + .../scripts/controller/aaiSubscriberController.js | 452 +++- .../controller/change-management.controller.js | 103 +- .../scripts/controller/creationDialogController.js | 682 +++--- .../controller/deleteResumeDialogController.js | 109 +- .../scripts/controller/msoCommitModalController.js | 11 +- .../controller/pnfSearchAssociationController.js | 3 + .../controller/testEnvironmentsController.js | 2 +- .../change-managements-by-statuses.filter.js | 16 +- .../alert-change-management.html | 1 + .../cancel-pending-workflow.html | 4 +- .../change-management-manual-tasks.controller.js | 2 + .../vid/scripts/modals/css/manual-task-popup.css | 10 + .../failed-change-management.html | 3 +- .../in-progress-change-management.html | 1 + .../vid/scripts/modals/mso-commit/mso-commit.html | 2 +- .../new-change-management.controller.js | 58 +- .../new-change-management.html | 6 +- .../new-test-environment/new-test-environment.html | 2 +- .../webapp/app/vid/scripts/services/aaiService.js | 109 +- .../webapp/app/vid/scripts/services/asdcService.js | 63 +- .../app/vid/scripts/services/creationService.js | 11 +- .../webapp/app/vid/scripts/services/dataService.js | 12 + .../vid/scripts/services/deleteResumeService.js | 23 +- .../app/vid/scripts/services/detailsService.js | 142 +- .../webapp/app/vid/scripts/services/msoService.js | 72 +- .../app/vid/scripts/services/utilityService.js | 53 +- .../vid/scripts/view-models/change-management.html | 36 +- .../app/vid/scripts/view-models/creationDialog.htm | 68 +- .../app/vid/scripts/view-models/detailsDialog.htm | 4 +- .../webapp/app/vid/scripts/view-models/iframe.htm | 1 + .../app/vid/scripts/view-models/iframeDialog.htm | 6 + .../app/vid/scripts/view-models/instantiate.htm | 708 ++++-- .../scripts/view-models/previousVersionDialog.htm | 8 +- .../app/vid/scripts/view-models/serviceModels.htm | 36 +- 48 files changed, 3367 insertions(+), 2335 deletions(-) create mode 100644 epsdk-app-onap/src/main/webapp/app/fusion/external/lodash/lodash.min.0.10.js create mode 100644 vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties create mode 100644 vid-app-common/src/main/webapp/WEB-INF/conf/features.properties create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/css/manual-task-popup.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/iframe.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/iframeDialog.htm diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp b/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp index 2248fd491..44fe53a88 100644 --- a/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp +++ b/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ebz/ebz_header.jsp @@ -44,7 +44,7 @@ - + <%----%> diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/serviceModels.jsp b/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/serviceModels.jsp index 57aa16ef4..fb55c1168 100755 --- a/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/serviceModels.jsp +++ b/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/serviceModels.jsp @@ -25,6 +25,9 @@ + + + @@ -42,6 +45,7 @@ + @@ -56,6 +60,7 @@ + @@ -81,6 +86,7 @@ + @@ -96,9 +102,10 @@ + SystemProperties.getProperty(MsoProperties.MSO_POLLING_INTERVAL_MSECS) + "}"; %> -
-
+
+
diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/welcome.jsp b/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/welcome.jsp index e52484e2a..479459f09 100755 --- a/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/welcome.jsp +++ b/epsdk-app-onap/src/main/webapp/WEB-INF/jsp/welcome.jsp @@ -1,5 +1,11 @@ + + + +<%@ page import="org.onap.vid.properties.Features"%> +<%@ page import="org.onap.vid.properties.VidProperties" %> +<%@ page import="org.onap.portalsdk.core.util.SystemProperties" %>

ONAP


@@ -19,7 +25,33 @@

Contact Us

Please click here to contact us. - + <% + if (Features.FLAG_ADD_MSO_TESTAPI_FIELD.isActive()) { + + String displayTestApi = SystemProperties.getProperty(VidProperties.MSO_DISPLAY_TEST_API_ON_SCREEN); + String defaultTestApiValue = SystemProperties.getProperty(VidProperties.MSO_DEFAULT_TEST_API); + + String selectionVisibility = Boolean.parseBoolean(displayTestApi) ? "inherit" : "hidden"; + %> +
+


+ + +
+ + <% + } + %>

diff --git a/epsdk-app-onap/src/main/webapp/app/fusion/external/ebz/angular_js/app.js b/epsdk-app-onap/src/main/webapp/app/fusion/external/ebz/angular_js/app.js index e5db518d4..416dc3272 100755 --- a/epsdk-app-onap/src/main/webapp/app/fusion/external/ebz/angular_js/app.js +++ b/epsdk-app-onap/src/main/webapp/app/fusion/external/ebz/angular_js/app.js @@ -1,5 +1,14 @@ angular.module('att.abs.helper', []); angular.module('quantum', []); var app=angular.module("abs", ["att.abs", "att.abs.helper","modalServices", /*'ngAnimate','ngTouch',*/ 'ui.bootstrap', - "att.gridster","checklist-model","ngRoute", "ngCookies", 'btorfs.multiselect','ngFileUpload']); + "att.gridster","checklist-model","ngRoute", "ngCookies", 'btorfs.multiselect','ngFileUpload','feature-flags', 'angularMoment']); +app.run(function(featureFlags, $http) { + $http.get('flags').then(function (results) { + var flags = []; + for (var key in results.data) { + flags.push({"key":key, "active":results.data[key]}) + } + featureFlags.set(flags); + }) +}); diff --git a/epsdk-app-onap/src/main/webapp/app/fusion/external/lodash/lodash.min.0.10.js b/epsdk-app-onap/src/main/webapp/app/fusion/external/lodash/lodash.min.0.10.js new file mode 100644 index 000000000..ec3b3e7dc --- /dev/null +++ b/epsdk-app-onap/src/main/webapp/app/fusion/external/lodash/lodash.min.0.10.js @@ -0,0 +1,40 @@ +/*! + Lo-Dash 0.10.0 lodash.com/license + Underscore.js 1.4.2 underscorejs.org/LICENSE +*/ +;(function(e,t){function s(e){if(e&&e.__wrapped__)return e;if(!(this instanceof s))return new s(e);this.__wrapped__=e}function o(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||Z);if(i)for(var s={},n=t-1;++nn||e===t)return 1;if(ei;i++)r+="i='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===l)&&"),r+="h.call(l,i)){x=l[i];"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return t",Function("e,h,j,k,p,n,s","return function("+t+"){"+r+"}")(l,bt,m,N,Yt,Lt,Et)}function h(e){return"\\"+ + Zt[e]}function p(e){return un[e]}function d(){}function v(e){return an[e]}function m(e){return xt.call(e)==_t}function g(e){var t=i;if(!e||"object"!=typeof e||m(e))return t;var n=e.constructor;return(!$t||"function"==typeof e.toString||"string"!=typeof (e+""))&&(!x(n)||n instanceof n)?Rt?(sn(e,function(e,n,r){return t=!bt.call(r,n),i}),t===i):(sn(e,function(e,n){t=n}),t===i||bt.call(e,t)):t}function y(e){var t=[];return on(e,function(e,n){t.push(n)}),t}function b(e,t,n,s,o){if(e==r)return e;n&&(t= + i);if(n=T(e)){var u=xt.call(e);if(!Gt[u]||Wt&&m(e))return e;var a=u==Dt,n=a||(u==jt?cn(e):n)}if(!n||!t)return n?a?St.call(e):rn({},e):e;n=e.constructor;switch(u){case Pt:case Ht:return new n(+e);case Bt:case It:return new n(e);case Ft:return n(e.source,ot.exec(e))}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u];var f=a?n(e.length):{};return s.push(e),o.push(f),(a?pn:on)(e,function(e,n){f[n]=b(e,t,r,s,o)}),f}function w(e){var t=[];return sn(e,function(e,n){x(e)&&t.push(n)}),t.sort() +}function E(e){var t={};return on(e,function(e,n){t[e]=n}),t}function S(e,t,s,o){if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;var u=xt.call(e);if(u!=xt.call(t))return i;switch(u){case Pt:case Ht:return+e==+t;case Bt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case Ft:case It:return e==t+""}var a=u==Dt||u==_t;if(Wt&&!a&&(a=m(e))&&!m(t))return i;if(!a){if(e.__wrapped__||t.__wrapped__)return S(e.__wrapped__||e,t.__wrapped__||t);if(u!=jt||$t&&("function"!=typeof e.toString&&"string"==typeof + (e+"")||"function"!=typeof t.toString&&"string"==typeof (t+"")))return i;var u=e.constructor,f=t.constructor;if(u!=f&&(!x(u)||!(u instanceof u&&x(f)&&f instanceof f)))return i}s||(s=[]),o||(o=[]);for(u=s.length;u--;)if(s[u]==e)return o[u]==t;var u=-1,f=n,l=0;s.push(e),o.push(t);if(a){l=e.length;if(f=l==t.length)for(;l--&&(f=S(e[l],t[l],s,o)););return f}for(var c in e)if(bt.call(e,c)&&(l++,!bt.call(t,c)||!S(e[c],t[c],s,o)))return i;for(c in t)if(bt.call(t,c)&&!(l--))return i;if(qt)for(;7>++u;)if(c= + dt[u],bt.call(e,c)&&(!bt.call(t,c)||!S(e[c],t[c],s,o)))return i;return n}function x(e){return"function"==typeof e}function T(e){return e?Yt[typeof e]:i}function N(e){return xt.call(e)==It}function C(e,t,n){var i=arguments,s=0,o=2,u=i[3],a=i[4];n!==Y&&(u=[],a=[],"number"!=typeof n&&(o=i.length));for(;++sn?At(0,s+n):n)||0;return"number"==typeof s?o=-1<(N(e)?e.indexOf(t,n):q(e,t,n)):pn(e,function(e){if(++r>=n)return!(o=e===t)}),o}function A(e,t,r){var i=n,t=l(t,r);if(ln(e))for(var r=-1,s=e.length;++rr&&(r=n,o=e)});else for(;++io&&(o=e[i]);return o}function P(e,t){var n=[];return pn(e,function(e){n.push(e[t])}),n}function H(e,t,n,r){var s=3>arguments.length,t=l(t,r);return pn(e,function(e,r,o){n=s?(s=i,e):t(n,e,r,o)}),n}function B(e,t,n,r){var s=e,o=e?e.length:0,u=3>arguments.length;if("number"!=typeof o)var a=hn(e),o=a.length;else Vt&&N(e)&&(s=e.split(""));return pn(e,function(e,f,l){f=a?a[--o]:--o,n=u?(u=i,s[f]):t.call(r,n,s[f],f,l)}),n}function j(e,t,n){var r,t=l(t,n);if(ln(e))for(var n=-1,i=e.length;++nn?At(0,i+n):n||0)-1;else if(n)return r=U(e,t),e[r]===t?r:-1;for(;++r>>1,n(e[r])q(a,h))(n||f)&&a.push(h),u.push(r)}return u}function W(e,t){return Kt||Tt&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,nt=/&(?:amp|lt|gt|quot|#x27);/g,rt=/\b__p\+='';/g,it=/\b(__p\+=)''\+/g,st=/(__e\(.*?\)|\b__t\))\+'';/g + ,ot=/\w*$/,ut=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,at=RegExp("^"+(Q.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ft=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,lt=/<%=([\s\S]+?)%>/g,ct=/($^)/,ht=/[&<>"']/g,pt=/['\n\r\t\u2028\u2029\\]/g,dt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),vt=Math.ceil,mt=K.concat,gt=Math.floor,yt=at.test(yt=Object.getPrototypeOf)&&yt,bt=Q.hasOwnProperty,wt=K.push,Et= + Q.propertyIsEnumerable,St=K.slice,xt=Q.toString,Tt=at.test(Tt=St.bind)&&Tt,Nt=at.test(Nt=Array.isArray)&&Nt,Ct=e.isFinite,kt=e.isNaN,Lt=at.test(Lt=Object.keys)&&Lt,At=Math.max,Ot=Math.min,Mt=Math.random,_t="[object Arguments]",Dt="[object Array]",Pt="[object Boolean]",Ht="[object Date]",Bt="[object Number]",jt="[object Object]",Ft="[object RegExp]",It="[object String]",qt,Rt,Ut=(Ut={0:1,length:1},K.splice.call(Ut,0,1),Ut[0]),zt=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y + :1};for(var n in new e)t.push(n);for(n in arguments)zt=!n;qt=!/valueOf/.test(t),Rt="x"!=t[0]})(1);var Wt=!m(arguments),Xt="x"!=St.call("x")[0],Vt="xx"!="x"[0]+Object("x")[0];try{var $t=("[object Object]",xt.call(e.document||0)==jt)}catch(Jt){}var Kt=Tt&&/\n|Opera/.test(Tt+xt.call(e.opera)),Qt=Lt&&/^.+$|true/.test(Lt+!!e.attachEvent),Gt={};Gt[_t]=Gt["[object Function]"]=i,Gt[Dt]=Gt[Pt]=Gt[Ht]=Gt[Bt]=Gt[jt]=Gt[Ft]=Gt[It]=n;var Yt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Zt= + {"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:lt,variable:""};var en={a:"o,v,g",k:"for(var a=1,b=typeof g=='number'?2:arguments.length;a":">",'"':""","'":"'"},an=E(un),fn=c(en,{g:"if(t[i]==null)"+en.g}),ln=Nt||function(e){return xt.call(e)==Dt};x(/x/)&&(x=function(e){return"[object Function]"==xt.call(e)});var cn=yt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=yt(t))&&yt(n);return n?e==n||yt(e)==n&&!m(e):g(e)}:g,hn=Lt?function(e){return"function"==typeof e&&Et.call(e,"prototype")?y(e):T(e)?Lt(e):[]}:y,pn=c(tn);s.VERSION="0.10.0",s.assign=rn,s + .after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=W,s.bindAll=function(e){for(var t=arguments,n=1q(i,e)){for(var s=n;--s;)if(!(r[s]||(r[s]=o(t[s])))(e))return;i.push(e)}}),i},s.invert=E,s.invoke=function(e,t){var n=St.call(arguments,2),r="function"==typeof t,i=[];return pn(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.isArguments=m,s.isArray=ln,s.isBoolean= + function(e){return e===n||e===i||xt.call(e)==Pt},s.isDate=function(e){return xt.call(e)==Ht},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=xt.call(e),s=e.length;return r==Dt||r==It||r==_t||Wt&&m(e)||r==jt&&"number"==typeof s&&x(e.splice)?!s:(on(e,function(){return t=i}),t)},s.isEqual=S,s.isFinite=function(e){return Ct(e)&&!kt(parseFloat(e))},s.isFunction=x,s.isNaN=function(e){return xt.call(e)==Bt&&e!=+e},s.isNull=function(e){return e===r},s + .isNumber=function(e){return xt.call(e)==Bt},s.isObject=T,s.isPlainObject=cn,s.isRegExp=function(e){return xt.call(e)==Ft},s.isString=N,s.isUndefined=function(e){return e===t},s.keys=hn,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:St.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?At(0,r+n):Ot(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=_,s.max=D,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments +):arguments[0];return bt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=C,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!ln(e))t=!t&&N(e)?u:l(t,n),pn(e,function(e,n,i){n=t(e,n,i),nq(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return on(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,St.call(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=mt.apply(K,arguments),o=s.length;++i=f?(clearTimeout(u),a=r,s=e.apply(o,i) +):u||(u=setTimeout(n,f)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r= 0) - vnftype = vnftype.substring(n+1); - }*/ - - var svcModel = $scope.service.convertedModel; - var vnfModelInvariantUuid = null; - var vnfModelVersion = null; - var vnfModelCustomizationUuid = null; - var vnfModel = null; - var vnfModelVersionId = null; - - vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID]; - vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; - vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModelInvariantUuid, - "modelVersion": "", - "modelNameVersionId": vnfModelVersionId, - "modelCustomizationName": "", - "customizationUuid": vnfModelCustomizationUuid, - "modelName": "", - "inputs": "" - }); - - if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) { - if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) { - vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; - } - else { - vnfModel = svcModel.vnfs[vnfModelVersionId]; - } - //console.log ( "vnf models: "); console.log ( JSON.stringify ($scope.service.convertedModel.vnfs, null, 4) ); - if ( !($scope.isObjectEmpty(vnfModel) ) ) { - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModel.invariantUuid, - "modelVersion": vnfModel.version, - "modelNameVersionId": vnfModel.uuid, - "modelCustomizationName": vnfModel.modelCustomizationName, - "customizationUuid": vnfModel.customizationUuid, - "modelName": vnfModel.name, - "inputs": "" - }); - } - } - - DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - - $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { - componentId : COMPONENT.VNF, - callbackFunction : deleteOrResumeCallback, - dialogMethod: COMPONENT.DELETE - }); - - }; - - - - $scope.deleteVolumeGroup = function(serviceObject, vnf, vfModule, volumeGroup) { - - console.log("Removing Volume Group " + volumeGroup.name); - var haveModel = false; - var svcModel = $scope.service.convertedModel; - - var vnfModelInvariantUuid = null; - var vnfModelVersion = null; - var vnfModelCustomizationUuid = null; - var vnfModel = null; - var vnfModelVersionId = null; - - vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID]; - vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; - vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": "", - "modelVersion": "", - "modelNameVersionId": "", - "modelCustomizationName": "", - "customizationUuid": "", - "modelName": "", - "inputs": "" - }); - - if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) { - if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) { - vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; - } - else { - vnfModel = svcModel.vnfs[vnfModelVersionId]; - } - } - - - // volume groups don't have model-invariant-id/version in a&ai. - // Their model-invariant-id/version is the one for the associated vfModule - - var vfModuleInvariantUuid = vfModule.object[FIELD.ID.MODEL_INVAR_ID]; - var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID]; - var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - var volGroupModel = null; - - if ( !($scope.isObjectEmpty(vnfModel.volumeGroups) ) ) { - if ( ( !($scope.isObjectEmpty(vnfModel) ) ) && ( !($scope.isObjectEmpty(vnfModel.volumeGroups) ) ) ) { - if ( (svcModel.isNewFlow) && (UtilityService.hasContents(vfModuleCustomizationUuid) ) ){ - volGroupModel = vnfModel.volumeGroups[vfModuleCustomizationUuid]; - } - else { - volGroupModel = vnfModel.volumeGroups[vfModuleModelVersionId]; - } - if ( !($scope.isObjectEmpty(volGroupModel) ) ) { - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": volGroupModel.invariantUuid, - "modelVersion": volGroupModel.version, - "modelNameVersionId": volGroupModel.uuid, - "modelCustomizationName": volGroupModel.modelCustomizationName, - "customizationUuid": volGroupModel.customizationUuid, - "modelName": volGroupModel.name, - "inputs": "" - }); - - } - } - } - - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(volumeGroup.object); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - DataService.setVnfInstanceId(vnf.nodeId); - DataService.setVolumeGroupInstanceId(volumeGroup.nodeId); - - $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { - componentId : COMPONENT.VOLUME_GROUP, - dialogMethod: COMPONENT.DELETE - }); - }; - - $scope.deleteVnfVolumeGroup = function(serviceObject, vnf, volumeGroup) { - - console.log("Removing Volume Group " + volumeGroup.name); - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(volumeGroup.object); - - var svcModel = $scope.service.convertedModel; - - var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID]; - var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; - var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - var volGroupModelInvariantUuid = volumeGroup.object[FIELD.ID.MODEL_INVAR_ID]; - var volGroupModelVersionId = volumeGroup.object[FIELD.ID.MODEL_VERSION_ID]; - var volGroupModelCustomizationUuid = volumeGroup.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - var vnfModel = null; - var volGroupModel = null; - - // send an empty model by default since model is not required for deletes - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {}); - - if ( svcModel.isNewFlow ) { - vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; - if ( UtilityService.hasContents (volGroupModelCustomizationUuid) ) { - volGroupModel = vnfModel.volumeGroups[volGroupModelCustomizationUuid]; - } - } - else { - - vnfModel = svcModel.vnfs[vnfModelVersionId]; - if ( UtilityService.hasContents (volGroupModelVersionId) ) { - volGroupModel = vnfModel.volumeGroups[volGroupModelVersionId]; - } - } - if ( !($scope.isObjectEmpty(volGroupModel) ) ) { - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": volGroupModel.invariantUuid, - "modelVersion": volGroupModel.version, - "modelNameVersionId": volGroupModel.uuid, - "modelName": volGroupModel.name, - "modelCustomizationName": volGroupModel.modelCustomizationName, - "customizationUuid": volGroupModel.customizationUuid, - "inputs": "" - }); - } - - DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - DataService.setVnfInstanceId(vnf.nodeId); - DataService.setVolumeGroupInstanceId(volumeGroup.nodeId); - - $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { - componentId : COMPONENT.VOLUME_GROUP, - callbackFunction : deleteOrResumeCallback, - dialogMethod: COMPONENT.DELETE - }); - }; - - $scope.describeNetwork = function(serviceObject, networkObject) { - var serviceInstance = serviceObject.object; - var network = networkObject.object; - //console.log ("networkObject="); console.log (JSON.stringify(networkObject, null, 4)); - - DataService.setResCustomizationUuid(" "); - - var svcModel = $scope.service.convertedModel; - var netModel = null; - - if ( !($scope.isObjectEmpty(network) ) ) { - - var netModelInvariantUuid = network[FIELD.ID.MODEL_INVAR_ID]; - var netModelVersionId = network[FIELD.ID.MODEL_VERSION_ID]; - var netModelCustomizationUuid = network[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - if ( UtilityService.hasContents (netModelCustomizationUuid) ) { - // set it to what came from a&ai - DataService.setResCustomizationUuid(netModelCustomizationUuid); - } - - if ( (!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.networks))) ) { - if ( svcModel.isNewFlow ) { - netModel = svcModel.networks[netModelCustomizationUuid]; - } - else { - netModel = svcModel.networks[netModelVersionId]; - } - /* - * The details pop-up should use a&ai info - * if ( !($scope.isObjectEmpty(netModel) ) ) { - if (UtilityService.hasContents(netModel.customizationUuid)) { - DataService.setResCustomizationUuid(netModel.customizationUuid); - } - }*/ - } - } - - DataService.setNetworkInstanceId(network[FIELD.ID.NETWORK_ID]); - DataService.setInventoryItem(networkObject); - DataService.setSubscriberName(serviceObject.subscriberName); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { - componentId : COMPONENT.NETWORK - }); - }; - - // for service instance id - no need for this! - $scope.describeService = function(serviceObject) { - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(serviceInstance); - //DataService.setModelInfo(serviceInstance['service-instance-id'], serviceInstance); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - //Display popup with additional service information - $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { - componentId : COMPONENT.SERVICE - }); - - }; - - $scope.describeVfModule = function(serviceObject, vfModuleObject, vnf) { - var serviceInstance = serviceObject.object; - var vfModule = vfModuleObject.object; - - /*var vfModuleInvariantUuid = vfModule[FIELD.ID.MODEL_INVAR_ID]; - var vfModuleModelVersionId = vfModule[FIELD.ID.MODEL_VERSION_ID];*/ - var vfModuleCustomizationUuid = vfModule[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - DataService.setCustomizationUuid(" "); - if ( UtilityService.hasContents (vfModuleCustomizationUuid) ) { - DataService.setCustomizationUuid(vfModuleCustomizationUuid); - } - - //Display popup with additional VF-Module information - DataService.setVfModuleInstanceId(vfModule[FIELD.ID.VF_MODULE_ID]); - DataService.setInventoryItem(vfModule) - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { - componentId : COMPONENT.VF_MODULE - }); - }; - - $scope.getStatusOfVnf = function(serviceObject, vnfObject) { - var serviceInstance = serviceObject.object; - var vnf = vnfObject.object; - - DataService.setVnfInstanceId(vnf[FIELD.ID.VNF_ID]); - DataService.setInventoryItem(vnf); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - DataService.setServiceInstanceName(serviceInstance[FIELD.ID.SERVICE_INSTANCE_NAME]); - - $scope.$broadcast(COMPONENT.COMPONENT_STATUS, { - componentId : COMPONENT.VNF, - callbackFunction : updateProvStatusVnfCallbackFunction - }); - }; - - $scope.describeVnf = function(serviceObject, vnfObject) { - var serviceInstance = serviceObject.object; - var vnf = vnfObject.object; - DataService.setResCustomizationUuid(" "); - - //var vnfInvariantUuid = vnf[FIELD.ID.MODEL_INVAR_ID]; - //var vnfVersionId = vnf[FIELD.ID.MODEL_VERSION_ID]; - var vnfCustomizationUuid = vnf[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - if ( UtilityService.hasContents (vnfCustomizationUuid) ) { - DataService.setResCustomizationUuid(vnfCustomizationUuid); - } - //Display popup with additional VNF information - DataService.setVnfInstanceId(vnf[FIELD.ID.VNF_ID]); - DataService.setInventoryItem(vnf); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { - componentId : COMPONENT.VNF - }); - }; - - $scope.describeVolumeGroup = function(serviceObject, vnf, volumeGroupObject) { - - var serviceInstance = serviceObject.object; - var volumeGroup = volumeGroupObject.object; - - //var volGroupInvariantUuid = volumeGroup[FIELD.ID.MODEL_INVAR_ID]; - //var volGroupVersionId = volumeGroup[FIELD.ID.MODEL_VERSION_ID]; - var volGroupCustomizationUuid = volumeGroup[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - - DataService.setCustomizationUuid(" "); - if ( UtilityService.hasContents(volGroupCustomizationUuid) ) { - DataService.setCustomizationUuid(volGroupCustomizationUuid); - } - DataService.setVolumeGroupInstanceId(volumeGroup[FIELD.ID.VOLUME_GROUP_ID]); - DataService.setInventoryItem(volumeGroup); - - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); - - - $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { - componentId : COMPONENT.VOLUME_GROUP - }); - }; - - $scope.addNetworkInstance = function(netModel, existingVnfs) { - - // For networks we assume that we always follow the new flow - console.log("Adding network to service instance" + this.service.instance.name); - if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED && (UtilityService.hasContents(existingVnfs)) && (existingVnfs.length > 0) ) { - var msg = VnfService.isVnfListStatusValid (existingVnfs); - if ( msg != "" ) { - alert ( msg ); - return; - } - } - - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - - DataService.setModelInfo(COMPONENT.NETWORK, { - "modelType": "network", - "modelInvariantId": netModel.invariantUuid, - "modelVersion": netModel.version, - "modelNameVersionId": netModel.uuid, - "modelName": netModel.name, - "modelCustomizationName": netModel.modelCustomizationName, - "customizationUuid": netModel.customizationUuid, - "inputs": "", - "displayInputs": netModel.displayInputs - }); - setCurrentServiceModelInfoFromScope(); - - - $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { - componentId : COMPONENT.NETWORK, - callbackFunction : createVnfCallbackFunction - }); - }; - - $scope.addVnfInstance = function(vnf, existingVnfs) { - - if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED && (UtilityService.hasContents(existingVnfs)) && (existingVnfs.length > 0) ) { - var msg = VnfService.isVnfListStatusValid (existingVnfs); - if ( msg != "" ) { - alert ( msg ); - return; - } - } - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - - console.log ( "existingVnfs: " ); - console.log (JSON.stringify ( existingVnfs, null, 4)); - console.log ( "existingVnfs: " ); console.log (JSON.stringify ( existingVnfs, null, 4)); - var vnf_type = ""; - var vnf_role = ""; - var vnf_function = ""; - var vnf_code = ""; - - if (UtilityService.hasContents (vnf.nfType) ) { - vnf_type = vnf.nfType; - } - if (UtilityService.hasContents (vnf.nfRole) ) { - vnf_role = vnf.nfRole; - } - if (UtilityService.hasContents (vnf.nfFunction) ) { - vnf_function = vnf.nfFunction; - } - if (UtilityService.hasContents (vnf.nfCode) ) { - vnf_code = vnf.nfCode; - } - DataService.setModelInfo(COMPONENT.VNF, { - "modelType": vnf.isPnf ? "pnf" : "vnf", - "modelInvariantId": vnf.invariantUuid, - "modelVersion": vnf.version, - "modelNameVersionId": vnf.uuid, - "modelName": vnf.name, - "modelCustomizationName": vnf.modelCustomizationName, - "customizationUuid": vnf.customizationUuid, - "inputs": "", - "displayInputs": vnf.displayInputs, - "vnfType": vnf_type, - "vnfRole": vnf_role, - "vnfFunction": vnf_function, - "vnfCode": vnf_code, - "properties": vnf.properties - }); - - DataService.setModelInstanceName($scope.service.model.service.name); - setCurrentServiceModelInfoFromScope(); - - if (vnf.isConfig) { - DataService.setServiceProxies($scope.service.model.serviceProxies); - DataService.setSourceServiceProxies(vnf.sourceNodes); - DataService.setCollectorServiceProxies(vnf.collectorNodes); - DataService.setConfigurationByPolicy(vnf.isConfigurationByPolicy); - $location.path("/addNetworkNode"); - } else if(vnf.isPnf){ - $location.path("/pnfSearchAssociation"); - } else { - $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { - componentId: COMPONENT.VNF, - callbackFunction: createVnfCallbackFunction - }); - } - }; - - $scope.addVfModuleInstance = function(vnfInstance, vfModuleModel) { - - if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED ) { - var msg = VnfService.isVnfStatusValid (vnfInstance); - if ( msg != "" ) { - alert ( msg ); - return; - } - - } - var svcModel = $scope.service.convertedModel; - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - - var vnfModelInvariantUuid = vnfInstance.object[FIELD.ID.MODEL_INVAR_ID]; - var vnfModelVersionId = vnfInstance.object[FIELD.ID.MODEL_VERSION_ID]; - var vnfModelCustomizationUuid = vnfInstance.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - var vnfModel = null; - if ( svcModel.isNewFlow ) { - vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; - } - else { - vnfModel = svcModel.vnfs[vnfModelVersionId]; - } - - var availableVolumeGroupList = []; - angular.forEach(vnfInstance[FIELD.ID.AVAILABLEVOLUMEGROUPS], function(volumeGroupInstance, key) { - availableVolumeGroupList.push({"instance": volumeGroupInstance}); - }); - - DataService.setAvailableVolumeGroupList(availableVolumeGroupList); - setCurrentServiceModelInfoFromScope(); - - DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]); - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModel.invariantUuid, - "modelVersion": vnfModel.version, - "modelNameVersionId": vnfModel.uuid, - "modelName": vnfModel.name, - "modelCustomizationName": vnfModel.modelCustomizationName, - "customizationUuid": vnfModel.customizationUuid, - "inputs": "" - }); - - DataService.setModelInfo(COMPONENT.VF_MODULE, { - "modelInvariantId": vfModuleModel.invariantUuid, - "modelVersion": vfModuleModel.version, - "modelNameVersionId": vfModuleModel.uuid, - "customizationUuid": vfModuleModel.customizationUuid, - "modelCustomizationName": vfModuleModel.modelCustomizationName, - "modelName": vfModuleModel.name, - "inputs": "" - }); - - $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { - componentId : COMPONENT.VF_MODULE, - callbackFunction : createVfModuleCallbackFunction - }); - - }; - - $scope.addVolumeGroupInstance = function(vnfInstance, volumeGroupModel) { - if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED ) { - var msg = VnfService.isVnfStatusValid (vnfInstance); - if ( msg != "" ) { - alert ( msg ); - return; - } - } - var svcModel = $scope.service.convertedModel; - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - setCurrentServiceModelInfoFromScope(); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": $scope.service.model.service.invariantUuid, - "modelVersion": $scope.service.model.service.version, - "modelNameVersionId": $scope.service.model.service.uuid, - "modelName": $scope.service.model.service.name, - "inputs": "" - }); - - DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]); - - var vnfModelInvariantUuid = vnfInstance.object[FIELD.ID.MODEL_INVAR_ID]; - var vnfModelVersionId = vnfInstance.object[FIELD.ID.MODEL_VERSION_ID]; - var vnfCustomizationUuid = vnfInstance.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - var vnfModel = null; - - if ( svcModel.isNewFlow ) { - vnfModel = svcModel.vnfs[vnfCustomizationUuid]; - } - else { - vnfModel = svcModel.vnfs[vnfModelVersionId]; - } - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModel.invariantUuid, - "modelVersion": vnfModel.version, - "modelNameVersionId": vnfModel.uuid, - "modelName": vnfModel.name, - "modelCustomizationName": vnfModel.modelCustomizationName, - "customizationUuid": vnfModel.customizationUuid, - "inputs": "" - }); - - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": volumeGroupModel.invariantUuid, - "modelVersion": volumeGroupModel.version, - "modelNameVersionId": volumeGroupModel.uuid, - "modelName": volumeGroupModel.name, - "modelCustomizationName": volumeGroupModel.modelCustomizationName, - "customizationUuid": volumeGroupModel.customizationUuid, - "inputs": "" - }); - - $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { - componentId : COMPONENT.VOLUME_GROUP, - callbackFunction : createVolumeGroupCallbackFunction - }); - }; - - $scope.resume = function(serviceObject, vfModule, vnfModel) { - populate_popup_vfModule(serviceObject, vfModule, vnfModel); - setCurrentVNFModelInfo(vnfModel); - DataService.setVfModuleInstanceName(vfModule.object[FIELD.ID.VF_MODULE_NAME]); - setCurrentServiceModelInfoFromScope(); - $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { - componentId : COMPONENT.VF_MODULE, - callbackFunction : deleteOrResumeCallback, - dialogMethod: COMPONENT.RESUME - }); - }; - - $scope.deleteConfiguration = function (serviceObject, configuration) { - console.log("Deleting Configuration " + configuration.name); - - var serviceInstance = serviceObject.object; + function setCurrentNetworkModelInfoFromScope(network) { var svcModel = $scope.service.convertedModel; - var configModel; - DataService.setInventoryItem(configuration.object); + var netModel; // set model default and override later if found - DataService.setModelInfo(COMPONENT.CONFIGURATION, {}); + DataService.setModelInfo(COMPONENT.NETWORK, {}); - if ( configuration.object != null ) { + if (network.object != null) { //var netModelInvariantUuid = network.object[FIELD.ID.MODEL_INVAR_ID]; - var configModelVersionId = configuration.object[FIELD.ID.MODEL_VERSION_ID]; // model uuid - var configModelCustomizationUuid = configuration.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + var netModelVersionId = network.object[FIELD.ID.MODEL_VERSION_ID]; // model uuid + var netModelCustomizationUuid = network.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; - //configurations added to vnfs list, in order to be part of the "Add VNF" drop-down list - if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) { - if ( (svcModel.isNewFlow) && (UtilityService.hasContents(configModelCustomizationUuid) ) ) { - configModel = svcModel.vnfs[configModelCustomizationUuid]; + if (UtilityService.hasContents(netModelCustomizationUuid)) { + // set it to what came from a&ai + DataService.setResCustomizationUuid(netModelCustomizationUuid); + } + + if ((!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.networks)))) { + if ((svcModel.isNewFlow) && (UtilityService.hasContents(netModelCustomizationUuid))) { + netModel = svcModel.networks[netModelCustomizationUuid]; } else { - if ( UtilityService.hasContents(configModelVersionId) ) { - configModel = svcModel.vnfs[configModelVersionId]; + if (UtilityService.hasContents(netModelVersionId)) { + netModel = svcModel.networks[netModelVersionId]; } } } } - if (!($scope.isObjectEmpty(configModel) ) ) { - DataService.setModelInfo(COMPONENT.CONFIGURATION, { - "modelInvariantId": configModel.invariantUuid, - "modelVersion": configModel.version, - "modelNameVersionId": configModel.uuid, - "modelCustomizationName": configModel.modelCustomizationName, - "customizationUuid": configModel.customizationUuid, - "modelName": configModel.name, + if (!($scope.isObjectEmpty(netModel))) { + DataService.setModelInfo(COMPONENT.NETWORK, { + "modelInvariantId": netModel.invariantUuid, + "modelVersion": netModel.version, + "modelNameVersionId": netModel.uuid, + "modelCustomizationName": netModel.modelCustomizationName, + "customizationUuid": netModel.customizationUuid, + "modelName": netModel.name, "inputs": "" }); } + } - DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); - DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); - DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + function setCurrentVfModuleModelInfoFromScope(vnf, vfModule) { - DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceName($scope.service.model.service.name); - DataService.setServiceUuid($scope.service.model.service.uuid); - DataService.setConfigurationInstanceId(configuration.object[FIELD.ID.CONFIGURATION_ID]); + var svcModel = $scope.service.convertedModel; + + //var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID]; + var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; + var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + var vnfModel = null; + var vfModuleModel = null; - $scope.$broadcast(COMPONENT.DELETE_COMPONENT, { - componentId : COMPONENT.CONFIGURATION, - callbackFunction : deleteCallbackFunction + DataService.setModelInfo(COMPONENT.VF_MODULE, { + "modelInvariantId": "", + "modelVersion": "", + "modelNameVersionId": "", + "modelCustomizationName": "", + "customizationUuid": "", + "modelName": "", + "inputs": "" }); - }; - $scope.resetProgress = function() { - $scope.percentProgress = 0; - $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO; - }; - - $scope.setProgress = function(percentProgress) { - percentProgress = parseInt(percentProgress); - if (percentProgress >= 100) { - $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_SUCCESS; - } - - if (percentProgress < $scope.percentProgress) { - return; - } - - $scope.percentProgress = percentProgress; - $scope.progressWidth = {width: percentProgress + "%"}; - if (percentProgress >= 5) { - $scope.progressText = percentProgress + " %"; - } else { - // Hidden since color combination is barely visible when progress portion is narrow. - $scope.progressText = ""; - } - }; - $scope.isObjectEmpty = function(o) { - var len = 0; - if (UtilityService.hasContents(o)){ - var keys = Object.keys(o); - len = keys.length; - if ( len == 0 ) { - return true; - } - else { - return false; - } - } - else { - return true; - } - } - $scope.isMacro = function() { - if (UtilityService.arrayContains (VIDCONFIGURATION.MACRO_SERVICES, $scope.service.model.service.invariantUuid )) { - return(true); - - } - else { - return (false); - } - } - $scope.reloadRoute = function() { - $route.reload(); - } - - - - /* - Private metthods - */ - - /* - setPnf - * set the controller pnf param using api call - * return: void - */ - function _setPnf(data){ // data is the $scope.service.instance object - return PnfService.getPnfs(data) - .then( - function success(response){ - return response.data; - // * can add here changes on the data that are needed to the view ( filter, ect..) - }, - function error(error){ - console.error(error); - } - ); + if ((!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.vnfs)))) { + if ((svcModel.isNewFlow) && (vnfModelCustomizationUuid != null)) { + vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; + + var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + if (!($scope.isObjectEmpty(vnfModel)) && !($scope.isObjectEmpty(vnfModel.vfModules)) && UtilityService.hasContents(vfModuleCustomizationUuid)) { + + vfModuleModel = vnfModel.vfModules[vfModuleCustomizationUuid]; + + } + } + else { + // old flow + if (vnfModelVersionId != null) { + vnfModel = svcModel.vnfs[vnfModelVersionId]; + } + //var vfModuleInvariantUuid = vfModule.object[FIELD.ID.MODEL_INVAR_ID]; + var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID]; + if ((!($scope.isObjectEmpty(vnfModel))) && (!($scope.isObjectEmpty(vnfModel.vfModules))) && + UtilityService.hasContents(vfModuleModelVersionId)) { + vfModuleModel = vnfModel.vfModules[vfModuleModelVersionId]; + } + } + if (!($scope.isObjectEmpty(vfModuleModel))) { + DataService.setModelInfo(COMPONENT.VF_MODULE, { + "modelInvariantId": vfModuleModel.invariantUuid, + "modelVersion": vfModuleModel.version, + "modelNameVersionId": vfModuleModel.uuid, + "modelCustomizationName": vfModuleModel.modelCustomizationName, + "customizationUuid": vfModuleModel.customizationUuid, + "modelName": vfModuleModel.name, + "inputs": "" + }); + } + } } - /* - Callbaks functions + function setCurrentVolumeGroupModelInfoFromScope(vnf, vfModule) { + var svcModel = $scope.service.convertedModel; - */ - var updateProvStatusVnfCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = FIELD.ID.COLOR_NONE; - $scope.callbackStyle = { - "background-color" : color - }; - $scope.reloadRoute(); - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; - if (response.isSuccessful) { - color = FIELD.ID.COLOR_8F8; - - } else { - color = FIELD.ID.COLOR_F88; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var createVnfCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = FIELD.ID.COLOR_NONE; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; - if (response.isSuccessful) { - color = FIELD.ID.COLOR_8F8; - $scope.reloadRoute(); - } else { - color = FIELD.ID.COLOR_F88; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - - - }; - - var deleteOrResumeCallback = function(response) { - $scope.callbackResults = ""; - var color = FIELD.ID.COLOR_NONE; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; - if (response.isSuccessful) { - color = FIELD.ID.COLOR_8F8; - $scope.reloadRoute(); - } else { - color = FIELD.ID.COLOR_F88; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var createVfModuleCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = FIELD.ID.COLOR_NONE; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; - if (response.isSuccessful) { - color = FIELD.ID.COLOR_8F8; - $scope.reloadRoute(); - } else { - color = FIELD.ID.COLOR_F88; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var deleteServiceInstanceCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = FIELD.ID.COLOR_NONE; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; - if (response.isSuccessful) { - color = FIELD.ID.COLOR_8F8; - $location.path(COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH) - } else { - color = FIELD.ID.COLOR_F88; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var createVolumeGroupCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = FIELD.ID.COLOR_NONE; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; - if (response.isSuccessful) { - color = FIELD.ID.COLOR_8F8; - $scope.reloadRoute(); - } else { - color = FIELD.ID.COLOR_F88; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - - - }; - - }); + var vnfModelCustomizationUuid = null; + var vnfModel = null; + var vnfModelVersionId = null; + + vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; + vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { + "modelInvariantId": "", + "modelVersion": "", + "modelNameVersionId": "", + "modelCustomizationName": "", + "customizationUuid": "", + "modelName": "", + "inputs": "" + }); + + if ((!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.vnfs)))) { + if ((svcModel.isNewFlow) && (vnfModelCustomizationUuid != null)) { + vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; + } + else { + vnfModel = svcModel.vnfs[vnfModelVersionId]; + } + } + + + // volume groups don't have model-invariant-id/version in a&ai. + // Their model-invariant-id/version is the one for the associated vfModule + + var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID]; + var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + var volGroupModel = null; + + if (!($scope.isObjectEmpty(vnfModel)) && !($scope.isObjectEmpty(vnfModel.volumeGroups))) { + if ((svcModel.isNewFlow) && (UtilityService.hasContents(vfModuleCustomizationUuid))) { + volGroupModel = vnfModel.volumeGroups[vfModuleCustomizationUuid]; + } + else { + volGroupModel = vnfModel.volumeGroups[vfModuleModelVersionId]; + } + if (!($scope.isObjectEmpty(volGroupModel))) { + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { + "modelInvariantId": volGroupModel.invariantUuid, + "modelVersion": volGroupModel.version, + "modelNameVersionId": volGroupModel.uuid, + "modelCustomizationName": volGroupModel.modelCustomizationName, + "customizationUuid": volGroupModel.customizationUuid, + "modelName": volGroupModel.name, + "inputs": "" + }); + + } + } + } + + function setCurrentVolumeGroupModelInfoByVfModuleFromScope(vnf, volumeGroup) { + var svcModel = $scope.service.convertedModel; + + var vnfModelCustomizationUuid = null; + var vnfModel = null; + var vnfModelVersionId = null; + + vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; + vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { + "modelInvariantId": "", + "modelVersion": "", + "modelNameVersionId": "", + "modelCustomizationName": "", + "customizationUuid": "", + "modelName": "", + "inputs": "" + }); + + if ((!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.vnfs)))) { + if ((svcModel.isNewFlow) && (vnfModelCustomizationUuid != null)) { + vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; + } + else { + vnfModel = svcModel.vnfs[vnfModelVersionId]; + } + } + + + // volume groups don't have model-invariant-id/version in a&ai. + // Their model-invariant-id/version is the one for the associated vfModule + + var vfModuleModelVersionId = volumeGroup.object[FIELD.ID.VF_MODULE_MODEL_VERSION_ID]; + var vfModuleCustomizationUuid = volumeGroup.object[FIELD.ID.VF_MODULE_MODEL_CUSTOMIZATION_ID]; + var volGroupModel = null; + if ((!($scope.isObjectEmpty(vnfModel))) && (!($scope.isObjectEmpty(vnfModel.volumeGroups)))) { + if ((svcModel.isNewFlow) && (UtilityService.hasContents(vfModuleCustomizationUuid))) { + volGroupModel = vnfModel.volumeGroups[vfModuleCustomizationUuid]; + } + else { + volGroupModel = vnfModel.volumeGroups[vfModuleModelVersionId]; + } + if (!($scope.isObjectEmpty(volGroupModel))) { + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { + "modelInvariantId": volGroupModel.invariantUuid, + "modelVersion": volGroupModel.version, + "modelNameVersionId": volGroupModel.uuid, + "modelCustomizationName": volGroupModel.modelCustomizationName, + "customizationUuid": volGroupModel.customizationUuid, + "modelName": volGroupModel.name, + "inputs": "" + }); + + } + } + } + + $scope.deleteVnf = function (serviceObject, vnf) { + console.log("Removing VNF " + vnf.name); + + var serviceInstance = serviceObject.object; + var svcModel = $scope.service.convertedModel; + DataService.setInventoryItem(vnf.object); + + /*var vnftype = vnf.object['vnf-type']; + if (vnftype == null) + vnftype = ""; + else + { + var n = vnftype.search("/"); + if (n >= 0) + vnftype = vnftype.substring(n+1); + }*/ + + var svcModel = $scope.service.convertedModel; + var vnfModelInvariantUuid = null; + var vnfModelVersion = null; + var vnfModelCustomizationUuid = null; + var vnfModel = null; + var vnfModelVersionId = null; + + vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID]; + vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; + vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + DataService.setModelInfo(COMPONENT.VNF, { + "modelInvariantId": vnfModelInvariantUuid, + "modelVersion": "", + "modelNameVersionId": vnfModelVersionId, + "modelCustomizationName": "", + "customizationUuid": vnfModelCustomizationUuid, + "modelName": "", + "inputs": "" + }); + + if ((!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.vnfs)))) { + if ((svcModel.isNewFlow) && (vnfModelCustomizationUuid != null)) { + vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; + } + else { + vnfModel = svcModel.vnfs[vnfModelVersionId]; + } + //console.log ( "vnf models: "); console.log ( JSON.stringify ($scope.service.convertedModel.vnfs, null, 4) ); + if (!($scope.isObjectEmpty(vnfModel))) { + + DataService.setModelInfo(COMPONENT.VNF, { + "modelInvariantId": vnfModel.invariantUuid, + "modelVersion": vnfModel.version, + "modelNameVersionId": vnfModel.uuid, + "modelCustomizationName": vnfModel.modelCustomizationName, + "customizationUuid": vnfModel.customizationUuid, + "modelName": vnfModel.name, + "inputs": "" + }); + } + } + + DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); + DataService.setServiceInstanceName($scope.service.instance.name); + + DataService.setServiceName($scope.service.model.service.name); + + DataService.setServiceUuid($scope.service.model.service.uuid); + + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.VNF, + callbackFunction: deleteOrResumeCallback, + dialogMethod: COMPONENT.DELETE + }); + + }; + + $scope.deleteVolumeGroup = function (serviceObject, vnf, vfModule, volumeGroup) { + + console.log("Removing Volume Group " + volumeGroup.name); + var haveModel = false; + + var serviceInstance = serviceObject.object; + + setCurrentVolumeGroupModelInfoFromScope(vnf, vfModule); + + DataService.setInventoryItem(volumeGroup.object); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); + DataService.setServiceInstanceName($scope.service.instance.name); + + DataService.setServiceName($scope.service.model.service.name); + + DataService.setServiceUuid($scope.service.model.service.uuid); + DataService.setVnfInstanceId(vnf.nodeId); + DataService.setVolumeGroupInstanceId(volumeGroup.nodeId); + + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.VOLUME_GROUP, + dialogMethod: COMPONENT.DELETE + }); + }; + + $scope.deleteVnfVolumeGroup = function (serviceObject, vnf, volumeGroup) { + + console.log("Removing Volume Group " + volumeGroup.name); + var serviceInstance = serviceObject.object; + + DataService.setInventoryItem(volumeGroup.object); + + var svcModel = $scope.service.convertedModel; + + var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID]; + var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID]; + var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + var volGroupModelInvariantUuid = volumeGroup.object[FIELD.ID.MODEL_INVAR_ID]; + var volGroupModelVersionId = volumeGroup.object[FIELD.ID.MODEL_VERSION_ID]; + var volGroupModelCustomizationUuid = volumeGroup.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + var vnfModel = null; + var volGroupModel = null; + + // send an empty model by default since model is not required for deletes + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {}); + + if (svcModel.isNewFlow) { + vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; + if (UtilityService.hasContents(volGroupModelCustomizationUuid)) { + volGroupModel = vnfModel.volumeGroups[volGroupModelCustomizationUuid]; + } + } + else { + + vnfModel = svcModel.vnfs[vnfModelVersionId]; + if (UtilityService.hasContents(volGroupModelVersionId)) { + volGroupModel = vnfModel.volumeGroups[volGroupModelVersionId]; + } + } + if (!($scope.isObjectEmpty(volGroupModel))) { + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { + "modelInvariantId": volGroupModel.invariantUuid, + "modelVersion": volGroupModel.version, + "modelNameVersionId": volGroupModel.uuid, + "modelName": volGroupModel.name, + "modelCustomizationName": volGroupModel.modelCustomizationName, + "customizationUuid": volGroupModel.customizationUuid, + "inputs": "" + }); + } + + DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); + DataService.setServiceInstanceName($scope.service.instance.name); + + DataService.setServiceName($scope.service.model.service.name); + + DataService.setServiceUuid($scope.service.model.service.uuid); + DataService.setVnfInstanceId(vnf.nodeId); + DataService.setVolumeGroupInstanceId(volumeGroup.nodeId); + + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.VOLUME_GROUP, + callbackFunction: deleteOrResumeCallback, + dialogMethod: COMPONENT.DELETE + }); + }; + + $scope.describeNetwork = function (serviceObject, networkObject) { + var serviceInstance = serviceObject.object; + var network = networkObject.object; + //console.log ("networkObject="); console.log (JSON.stringify(networkObject, null, 4)); + + DataService.setResCustomizationUuid(" "); + + setCurrentServiceModelInfoFromScope(); + setCurrentNetworkModelInfoFromScope(networkObject); + + DataService.setNetworkInstanceId(network[FIELD.ID.NETWORK_ID]); + DataService.setInventoryItem(networkObject); + DataService.setSubscriberName(serviceObject.subscriberName); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { + componentId: COMPONENT.NETWORK + }); + }; + + // for service instance id - no need for this! + $scope.describeService = function (serviceObject) { + var serviceInstance = serviceObject.object; + setCurrentServiceModelInfoFromScope(); + + DataService.setInventoryItem(serviceInstance); + //DataService.setModelInfo(serviceInstance['service-instance-id'], serviceInstance); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + //Display popup with additional service information + $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { + componentId: COMPONENT.SERVICE + }); + + }; + + $scope.describeVfModule = function (serviceObject, vfModuleObject, vnf) { + var serviceInstance = serviceObject.object; + var vfModule = vfModuleObject.object; + + /*var vfModuleInvariantUuid = vfModule[FIELD.ID.MODEL_INVAR_ID]; + var vfModuleModelVersionId = vfModule[FIELD.ID.MODEL_VERSION_ID];*/ + var vfModuleCustomizationUuid = vfModule[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + setCurrentServiceModelInfoFromScope(); + setCurrentVfModuleModelInfoFromScope(vnf, vfModuleObject); + + DataService.setCustomizationUuid(" "); + if (UtilityService.hasContents(vfModuleCustomizationUuid)) { + DataService.setCustomizationUuid(vfModuleCustomizationUuid); + } + + //Display popup with additional VF-Module information + DataService.setVfModuleInstanceId(vfModule[FIELD.ID.VF_MODULE_ID]); + DataService.setInventoryItem(vfModule) + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { + componentId: COMPONENT.VF_MODULE + }); + }; + + $scope.getStatusOfVnf = function (serviceObject, vnfObject) { + var serviceInstance = serviceObject.object; + var vnf = vnfObject.object; + + DataService.setVnfInstanceId(vnf[FIELD.ID.VNF_ID]); + DataService.setInventoryItem(vnf); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + DataService.setServiceInstanceName(serviceInstance[FIELD.ID.SERVICE_INSTANCE_NAME]); + + $scope.$broadcast(COMPONENT.COMPONENT_STATUS, { + componentId: COMPONENT.VNF, + callbackFunction: updateProvStatusVnfCallbackFunction + }); + }; + + $scope.describeVnf = function (serviceObject, vnfObject) { + var serviceInstance = serviceObject.object; + var vnf = vnfObject.object; + DataService.setResCustomizationUuid(" "); + + //var vnfInvariantUuid = vnf[FIELD.ID.MODEL_INVAR_ID]; + //var vnfVersionId = vnf[FIELD.ID.MODEL_VERSION_ID]; + var vnfCustomizationUuid = vnf[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + if (UtilityService.hasContents(vnfCustomizationUuid)) { + DataService.setResCustomizationUuid(vnfCustomizationUuid); + } + + setCurrentServiceModelInfoFromScope(); + setCurrentVNFModelInfo(vnfObject); + + //Display popup with additional VNF information + DataService.setVnfInstanceId(vnf[FIELD.ID.VNF_ID]); + DataService.setInventoryItem(vnf); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { + componentId: COMPONENT.VNF + }); + }; + + $scope.describeVolumeGroup = function (serviceObject, vnf, volumeGroupObject) { + + var serviceInstance = serviceObject.object; + var volumeGroup = volumeGroupObject.object; + + var volGroupCustomizationUuid = volumeGroup[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + setCurrentServiceModelInfoFromScope(); + setCurrentVolumeGroupModelInfoByVfModuleFromScope(vnf, volumeGroupObject); + + DataService.setCustomizationUuid(" "); + if (UtilityService.hasContents(volGroupCustomizationUuid)) { + DataService.setCustomizationUuid(volGroupCustomizationUuid); + } + DataService.setVolumeGroupInstanceId(volumeGroup[FIELD.ID.VOLUME_GROUP_ID]); + DataService.setInventoryItem(volumeGroup); + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + + $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, { + componentId: COMPONENT.VOLUME_GROUP + }); + }; + + $scope.addNetworkInstance = function (netModel, existingVnfs) { + + // For networks we assume that we always follow the new flow + console.log("Adding network to service instance" + this.service.instance.name); + if (VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED && (UtilityService.hasContents(existingVnfs)) && (existingVnfs.length > 0)) { + var msg = VnfService.isVnfListStatusValid(existingVnfs); + if (msg != "") { + alert(msg); + return; + } + } + + DataService.setSubscriberName($scope.service.instance.subscriberName); + DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); + DataService.setServiceType($scope.service.instance.serviceType); + DataService.setServiceInstanceName($scope.service.instance.name); + DataService.setServiceInstanceId($scope.service.instance.id); + DataService.setServiceName($scope.service.model.service.name); + + DataService.setModelInfo(COMPONENT.NETWORK, { + "modelType": "network", + "modelInvariantId": netModel.invariantUuid, + "modelVersion": netModel.version, + "modelNameVersionId": netModel.uuid, + "modelName": netModel.name, + "modelCustomizationName": netModel.modelCustomizationName, + "customizationUuid": netModel.customizationUuid, + "inputs": "", + "displayInputs": netModel.displayInputs + }); + setCurrentServiceModelInfoFromScope(); + + + $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { + componentId: COMPONENT.NETWORK, + callbackFunction: createVnfCallbackFunction + }); + }; + + $scope.addVnfInstance = function (vnf, existingVnfs) { + + if (VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED && (UtilityService.hasContents(existingVnfs)) && (existingVnfs.length > 0)) { + var msg = VnfService.isVnfListStatusValid(existingVnfs); + if (msg != "") { + alert(msg); + return; + } + } + + var isVfc = false; + + _.map($scope.service.model.vnfs, function (value, key) { + if (value.uuid == vnf.uuid) { + if (!_.isEmpty(value.vfcInstanceGroups)) { + isVfc = true; + var queryData = { + serviceModelId: $scope.service.model.service.uuid, + serviceInstanceID: $scope.service.instance.id, + globalCustomerId: $scope.service.instance.globalCustomerId, + serviceType: $scope.service.instance.serviceType, + serviceInstanceName: $scope.service.instance.name, + modelCustomizationName: value.modelCustomizationName, + modelCustomizationId: value.customizationUuid, + subscriberName: $scope.service.instance.subscriberName + }; + + $scope.$broadcast(COMPONENT.IFRAME_DIALOG, queryData); + return; + } + } + }); + + DataService.setSubscriberName($scope.service.instance.subscriberName); + DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); + DataService.setServiceType($scope.service.instance.serviceType); + DataService.setServiceInstanceName($scope.service.instance.name); + DataService.setServiceInstanceId($scope.service.instance.id); + DataService.setServiceName($scope.service.model.service.name); + + console.log("existingVnfs: "); + console.log(JSON.stringify(existingVnfs, null, 4)); + console.log("existingVnfs: "); + console.log(JSON.stringify(existingVnfs, null, 4)); + var vnf_type = ""; + var vnf_role = ""; + var vnf_function = ""; + var vnf_code = ""; + + if (UtilityService.hasContents(vnf.nfType)) { + vnf_type = vnf.nfType; + } + if (UtilityService.hasContents(vnf.nfRole)) { + vnf_role = vnf.nfRole; + } + if (UtilityService.hasContents(vnf.nfFunction)) { + vnf_function = vnf.nfFunction; + } + if (UtilityService.hasContents(vnf.nfCode)) { + vnf_code = vnf.nfCode; + } + DataService.setModelInfo(COMPONENT.VNF, { + "modelType": vnf.isPnf ? "pnf" : "vnf", + "modelInvariantId": vnf.invariantUuid, + "modelVersion": vnf.version, + "modelNameVersionId": vnf.uuid, + "modelName": vnf.name, + "modelCustomizationName": vnf.modelCustomizationName, + "customizationUuid": vnf.customizationUuid, + "inputs": "", + "displayInputs": vnf.displayInputs, + "vnfType": vnf_type, + "vnfRole": vnf_role, + "vnfFunction": vnf_function, + "vnfCode": vnf_code, + "properties": vnf.properties + }); + + DataService.setModelInstanceName($scope.service.model.service.name); + setCurrentServiceModelInfoFromScope(); + + if (vnf.isConfig) { + DataService.setServiceProxies($scope.service.model.serviceProxies); + DataService.setSourceServiceProxies(vnf.sourceNodes); + DataService.setCollectorServiceProxies(vnf.collectorNodes); + DataService.setConfigurationByPolicy(vnf.isConfigurationByPolicy); + $location.path("/addNetworkNode"); + } else if (vnf.isPnf) { + $location.path("/pnfSearchAssociation"); + } else if (isVfc) { + //do nothing + } else { + $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { + componentId: COMPONENT.VNF, + callbackFunction: createVnfCallbackFunction + }); + } + }; + + $scope.addVfModuleInstance = function (vnfInstance, vfModuleModel) { + + if (VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED) { + var msg = VnfService.isVnfStatusValid(vnfInstance); + if (msg != "") { + alert(msg); + return; + } + + } + var svcModel = $scope.service.convertedModel; + DataService.setSubscriberName($scope.service.instance.subscriberName); + DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); + DataService.setServiceType($scope.service.instance.serviceType); + DataService.setServiceInstanceName($scope.service.instance.name); + DataService.setServiceInstanceId($scope.service.instance.id); + DataService.setServiceName($scope.service.model.service.name); + + var vnfModelInvariantUuid = vnfInstance.object[FIELD.ID.MODEL_INVAR_ID]; + var vnfModelVersionId = vnfInstance.object[FIELD.ID.MODEL_VERSION_ID]; + var vnfModelCustomizationUuid = vnfInstance.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + var vnfModel = null; + if (svcModel.isNewFlow) { + vnfModel = svcModel.vnfs[vnfModelCustomizationUuid]; + } + else { + vnfModel = svcModel.vnfs[vnfModelVersionId]; + } + + var availableVolumeGroupList = []; + angular.forEach(vnfInstance[FIELD.ID.AVAILABLEVOLUMEGROUPS], function (volumeGroupInstance, key) { + availableVolumeGroupList.push({"instance": volumeGroupInstance}); + }); + + DataService.setAvailableVolumeGroupList(availableVolumeGroupList); + setCurrentServiceModelInfoFromScope(); + + DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]); + + DataService.setModelInfo(COMPONENT.VNF, { + "modelInvariantId": vnfModel.invariantUuid, + "modelVersion": vnfModel.version, + "modelNameVersionId": vnfModel.uuid, + "modelName": vnfModel.name, + "modelCustomizationName": vnfModel.modelCustomizationName, + "customizationUuid": vnfModel.customizationUuid, + "inputs": "" + }); + + DataService.setModelInfo(COMPONENT.VF_MODULE, { + "modelInvariantId": vfModuleModel.invariantUuid, + "modelVersion": vfModuleModel.version, + "modelNameVersionId": vfModuleModel.uuid, + "customizationUuid": vfModuleModel.customizationUuid, + "modelCustomizationName": vfModuleModel.modelCustomizationName, + "modelName": vfModuleModel.name, + "inputs": "" + }); + + $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { + componentId: COMPONENT.VF_MODULE, + callbackFunction: createVfModuleCallbackFunction + }); + + }; + + $scope.addVolumeGroupInstance = function (vnfInstance, volumeGroupModel) { + if (VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED) { + var msg = VnfService.isVnfStatusValid(vnfInstance); + if (msg != "") { + alert(msg); + return; + } + } + var svcModel = $scope.service.convertedModel; + DataService.setSubscriberName($scope.service.instance.subscriberName); + DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); + DataService.setServiceType($scope.service.instance.serviceType); + DataService.setServiceInstanceName($scope.service.instance.name); + DataService.setServiceInstanceId($scope.service.instance.id); + DataService.setServiceName($scope.service.model.service.name); + setCurrentServiceModelInfoFromScope(); + + DataService.setModelInfo(COMPONENT.SERVICE, { + "modelInvariantId": $scope.service.model.service.invariantUuid, + "modelVersion": $scope.service.model.service.version, + "modelNameVersionId": $scope.service.model.service.uuid, + "modelName": $scope.service.model.service.name, + "inputs": "" + }); + + DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]); + + var vnfModelInvariantUuid = vnfInstance.object[FIELD.ID.MODEL_INVAR_ID]; + var vnfModelVersionId = vnfInstance.object[FIELD.ID.MODEL_VERSION_ID]; + var vnfCustomizationUuid = vnfInstance.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + var vnfModel = null; + + if (svcModel.isNewFlow) { + vnfModel = svcModel.vnfs[vnfCustomizationUuid]; + } + else { + vnfModel = svcModel.vnfs[vnfModelVersionId]; + } + + DataService.setModelInfo(COMPONENT.VNF, { + "modelInvariantId": vnfModel.invariantUuid, + "modelVersion": vnfModel.version, + "modelNameVersionId": vnfModel.uuid, + "modelName": vnfModel.name, + "modelCustomizationName": vnfModel.modelCustomizationName, + "customizationUuid": vnfModel.customizationUuid, + "inputs": "" + }); + + DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { + "modelInvariantId": volumeGroupModel.invariantUuid, + "modelVersion": volumeGroupModel.version, + "modelNameVersionId": volumeGroupModel.uuid, + "modelName": volumeGroupModel.name, + "modelCustomizationName": volumeGroupModel.modelCustomizationName, + "customizationUuid": volumeGroupModel.customizationUuid, + "inputs": "" + }); + + $scope.$broadcast(COMPONENT.CREATE_COMPONENT, { + componentId: COMPONENT.VOLUME_GROUP, + callbackFunction: createVolumeGroupCallbackFunction + }); + }; + + $scope.resume = function (serviceObject, vfModule, vnfModel) { + populate_popup_vfModule(serviceObject, vfModule, vnfModel); + setCurrentVNFModelInfo(vnfModel); + DataService.setVfModuleInstanceName(vfModule.object[FIELD.ID.VF_MODULE_NAME]); + setCurrentServiceModelInfoFromScope(); + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.VF_MODULE, + callbackFunction: deleteOrResumeCallback, + dialogMethod: COMPONENT.RESUME + }); + }; + + $scope.deleteConfiguration = function (serviceObject, configuration) { + console.log("Deleting Configuration " + configuration.name); + + var serviceInstance = serviceObject.object; + var svcModel = $scope.service.convertedModel; + var configModel; + DataService.setInventoryItem(configuration.object); + // set model default and override later if found + DataService.setModelInfo(COMPONENT.CONFIGURATION, {}); + + if (configuration.object != null) { + + //var netModelInvariantUuid = network.object[FIELD.ID.MODEL_INVAR_ID]; + var configModelVersionId = configuration.object[FIELD.ID.MODEL_VERSION_ID]; // model uuid + var configModelCustomizationUuid = configuration.object[FIELD.ID.MODEL_CUSTOMIZATION_ID]; + + //configurations added to vnfs list, in order to be part of the "Add VNF" drop-down list + if ((!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.vnfs)))) { + if ((svcModel.isNewFlow) && (UtilityService.hasContents(configModelCustomizationUuid))) { + configModel = svcModel.vnfs[configModelCustomizationUuid]; + } + else { + + if (UtilityService.hasContents(configModelVersionId)) { + configModel = svcModel.vnfs[configModelVersionId]; + } + + } + } + } + if (!($scope.isObjectEmpty(configModel))) { + DataService.setModelInfo(COMPONENT.CONFIGURATION, { + "modelInvariantId": configModel.invariantUuid, + "modelVersion": configModel.version, + "modelNameVersionId": configModel.uuid, + "modelCustomizationName": configModel.modelCustomizationName, + "customizationUuid": configModel.customizationUuid, + "modelName": configModel.name, + "inputs": "" + }); + } + + DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]); + DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]); + DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]); + + DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]); + DataService.setServiceInstanceName($scope.service.instance.name); + DataService.setServiceName($scope.service.model.service.name); + DataService.setServiceUuid($scope.service.model.service.uuid); + DataService.setConfigurationInstanceId(configuration.object[FIELD.ID.CONFIGURATION_ID]); + + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.CONFIGURATION, + dialogMethod: COMPONENT.DELETE, + callbackFunction: deleteCallbackFunction + }); + }; + + var deleteCallbackFunction = function () { + console.log('hi') + } + + $scope.resetProgress = function () { + $scope.percentProgress = 0; + $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO; + }; + + $scope.setProgress = function (percentProgress) { + percentProgress = parseInt(percentProgress); + if (percentProgress >= 100) { + $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_SUCCESS; + } + + if (percentProgress < $scope.percentProgress) { + return; + } + + $scope.percentProgress = percentProgress; + $scope.progressWidth = {width: percentProgress + "%"}; + if (percentProgress >= 5) { + $scope.progressText = percentProgress + " %"; + } else { + // Hidden since color combination is barely visible when progress portion is narrow. + $scope.progressText = ""; + } + }; + $scope.isObjectEmpty = function (o) { + var len = 0; + if (UtilityService.hasContents(o)) { + var keys = Object.keys(o); + len = keys.length; + if (len == 0) { + return true; + } + else { + return false; + } + } + else { + return true; + } + } + $scope.isMacro = function () { + return $scope.service && AsdcService.isMacro($scope.service.model); + } + $scope.reloadRoute = function () { + $route.reload(); + } + + + /* +Private metthods +*/ + + /* + setPnf + * set the controller pnf param using api call + * return: void + */ + function _setPnf(data) { // data is the $scope.service.instance object + return PnfService.getPnfs(data) + .then( + function success(response) { + return response.data; + // * can add here changes on the data that are needed to the view ( filter, ect..) + }, + function error(error) { + console.error(error); + } + ); + } + + + function _setCr(data) { // data is the $scope.service.instance object + return CrService.getCr(data) + .then( + function success(response) { + return response.data.results; + // * can add here changes on the data that are needed to the view ( filter, ect..) + }, + function error(error) { + console.error(error); + } + ); + } + + + /* + Callbaks functions + + */ + var updateProvStatusVnfCallbackFunction = function (response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color": color + }; + $scope.reloadRoute(); + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function () { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color": color + }; + }, 500); + + }; + + var createVnfCallbackFunction = function (response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color": color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function () { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $scope.reloadRoute(); + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color": color + }; + }, 500); + + + }; + + var deleteOrResumeCallback = function (response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color": color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function () { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $scope.reloadRoute(); + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color": color + }; + }, 500); + + }; + + var createVfModuleCallbackFunction = function (response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color": color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function () { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $scope.reloadRoute(); + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color": color + }; + }, 500); + + }; + + var deleteServiceInstanceCallbackFunction = function (response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color": color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function () { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $location.path(COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH) + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color": color + }; + }, 500); + + }; + + var createVolumeGroupCallbackFunction = function (response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color": color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function () { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $scope.reloadRoute(); + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color": color + }; + }, 500); + + + }; + + }); })(); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js index b52b463bc..c85e86529 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js @@ -22,17 +22,30 @@ 'use strict'; appDS2.controller("ServiceModelController", function ($scope, $http, $location, COMPONENT, VIDCONFIGURATION, FIELD, DataService, vidService, - PropertyService, UtilityService) { + PropertyService, UtilityService, AsdcService,$timeout) { $scope.popup = {}; - + var defaultViewPerPage = 10; // var baseEndpoint = "vid"; var pathQuery = COMPONENT.SERVICES_DIST_STATUS_PATH + VIDCONFIGURATION.ASDC_MODEL_STATUS; if ( VIDCONFIGURATION.ASDC_MODEL_STATUS === FIELD.STATUS.ALL) { pathQuery = COMPONENT.SERVICES_PATH; } - + window.addEventListener("message", receiveMessage, false); + + function receiveMessage(event){ + if(event.data == 'navigateTo') { + $location.path('/models/services').search({}); + $scope.$apply(); + $scope.rememberFilter = true; + } + if(event.data == 'navigateToInstantiationStatus') { + $location.path('/instantiationStatus').search({}); + $scope.$apply(); + } + } + $scope.getServiceModels = function() { $scope.status = FIELD.STATUS.FETCHING_SERVICE_CATALOG_ASDC; @@ -41,16 +54,28 @@ $scope.services = []; if (response.data && angular.isArray(response.data.services)) { wholeData = response.data.services; - $scope.services = $scope.filterDataWithHigherVersion(wholeData); - $scope.viewPerPage=10; - $scope.totalPage=$scope.services.length/$scope.viewPerPage; - $scope.sortBy=COMPONENT.NAME; - $scope.scrollViewPerPage=2; - $scope.currentPage=1; - $scope.searchCategory; - $scope.currentPageNum=1; - $scope.isSpinnerVisible = false; - $scope.isProgressVisible = false; + $scope.services = $scope.filterDataWithHigherVersion(wholeData); + $scope.viewPerPage = defaultViewPerPage; + $scope.totalPage=$scope.services.length/$scope.viewPerPage; + $scope.sortBy=COMPONENT.NAME; + $scope.scrollViewPerPage=2; + $scope.currentPage=1; + $scope.currentPageNum=1; + $scope.isSpinnerVisible = false; + $scope.isProgressVisible = false; + if (sessionStorage.getItem("searchKey")!='undefined' && ($scope.rememberFilter)) { + var searchKey = JSON.parse(sessionStorage.getItem("searchKey")); + $scope.searchString = searchKey.searchString || ''; + $scope.viewPerPage = searchKey.viewPerPage || defaultViewPerPage; + $scope.totalPage = $scope.services.length / $scope.viewPerPage; + $timeout(function () { + // the table controller handles the current page once + // data is loaded, therefore we're delying the paging + // override + $scope.currentPage = $scope.currentPageNum = searchKey.currentPage ? parseInt(searchKey.currentPage) : 1; + }, 0); + $scope.rememberFilter = false; + } } else { $scope.status = FIELD.STATUS.FAILED_SERVICE_MODELS_ASDC; $scope.error = true; @@ -99,25 +124,32 @@ //PropertyService.setMsoBaseUrl("testmso"); PropertyService.setServerResponseTimeoutMsec(30000); - } + }; $scope.prevPage = function() { $scope.currentPage--; - } + }; $scope.nextPage = function() { $scope.currentPage++; - } + }; + + $scope.createType = COMPONENT.A_LA_CARTE; $scope.deployService = function(service) { - + var searchKey = { + searchString: $scope.searchString, + viewPerPage: $scope.viewPerPage, + currentPage: $scope.currentPage + }; + sessionStorage.setItem("searchKey",JSON.stringify(searchKey)); console.log("Instantiating SDC service " + service.uuid); - + $http.get(COMPONENT.SERVICES_PATH + service.uuid) .then(function successCallback(getServiceResponse) { - + var serviceModel = getServiceResponse.data; //VID-233 bug fix when models doesn't exists @@ -157,41 +189,42 @@ DataService.setALaCarte (true); $scope.createType = COMPONENT.A_LA_CARTE; var broadcastType = COMPONENT.CREATE_COMPONENT; - - if (UtilityService.arrayContains (VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid )) { - DataService.setALaCarte (false); - $scope.createType = COMPONENT.MACRO; - var convertedAsdcModel = UtilityService.convertModel(serviceModel); - - //console.log ("display inputs "); - //console.log (JSON.stringify ( convertedAsdcModel.completeDisplayInputs)); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": serviceModel.service.invariantUuid, - "modelVersion": serviceModel.service.version, - "modelNameVersionId": serviceModel.service.uuid, - "modelName": serviceModel.service.name, - "description": serviceModel.service.description, - "category":serviceModel.service.category, - "serviceEcompNaming": serviceModel.service.serviceEcompNaming, - "inputs": serviceModel.service.inputs, - "serviceType": serviceModel.service.serviceType, - "serviceRole": serviceModel.service.serviceRole, - "displayInputs": convertedAsdcModel.completeDisplayInputs - }); - }; - + if (AsdcService.isMacro(serviceModel)) { + DataService.setALaCarte(false); + if(AsdcService.shouldExcludeMacroFromAsyncInstatiationFlow(serviceModel)){ + DataService.setShouldExcludeMacroFromAsyncInstatiationFlow(true); + $scope.createType = COMPONENT.MACRO; + var convertedAsdcModel = UtilityService.convertModel(serviceModel); + + DataService.setModelInfo(COMPONENT.SERVICE, { + "modelInvariantId": serviceModel.service.invariantUuid, + "modelVersion": serviceModel.service.version, + "modelNameVersionId": serviceModel.service.uuid, + "modelName": serviceModel.service.name, + "description": serviceModel.service.description, + "category": serviceModel.service.category, + "serviceEcompNaming": serviceModel.service.serviceEcompNaming, + "inputs": serviceModel.service.inputs, + "serviceType": serviceModel.service.serviceType, + "serviceRole": serviceModel.service.serviceRole, + "displayInputs": convertedAsdcModel.completeDisplayInputs + }); + + } + } + $scope.$broadcast(broadcastType, { componentId : COMPONENT.SERVICE, + modelNameVersionId: serviceModel.service.uuid, callbackFunction : function(response) { if (response.isSuccessful) { vidService.setModel(serviceModel); - + var subscriberId = FIELD.STATUS.NOT_FOUND; var serviceType = FIELD.STATUS.NOT_FOUND; - + var serviceInstanceId = response.instanceId; - + for (var i = 0; i < response.control.length; i++) { if (response.control[i].id == COMPONENT.SUBSCRIBER_NAME) { subscriberId = response.control[i].value; @@ -199,14 +232,13 @@ serviceType = response.control[i].value; } } - - + + $scope.refreshSubs(subscriberId,serviceType,serviceInstanceId); - + } } }); - }, function errorCallback(response) { console.log("Error: " + response); }); @@ -231,7 +263,7 @@ callbackFunction : function(response) { } }); - } + }; $scope.refreshSubs = function(subscriberId, serviceType, serviceInstanceId) { $scope.status = FIELD.STATUS.FETCHING_SUBSCRIBER_LIST_AAI; @@ -243,7 +275,7 @@ }).then(function(response){ if (response.data.status < 200 || response.data.status > 202) { - $scope.showError(FIELD.ERROR.MSO) + $scope.showError(FIELD.ERROR.MSO); return; } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js index 6e7ad50cf..5d17faa9e 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js @@ -163,6 +163,9 @@ appDS2.controller("ServiceProxyConfigController", ["COMPONENT", "$log", "FIELD", }, requestParams: function () { return requestParams; + }, + configuration: function () { + return null; } } }); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js index 6129fd96a..e30bd3856 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js @@ -73,6 +73,14 @@ controller: 'ServiceProxyConfigController', templateUrl: 'app/vid/scripts/view-models/serviceProxyConfig.htm' }) + .when('/servicePlanning', { + controller: 'iframeController', + templateUrl: 'app/vid/scripts/view-models/iframe.htm' + }) + .when('/instantiationStatus', { + controller: 'iframeController', + templateUrl: 'app/vid/scripts/view-models/iframe.htm' + }) .otherwise({ redirectTo: '/models/services' }); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js index aeac7f336..164c71c7e 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js @@ -20,8 +20,8 @@ "use strict"; -appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "$uibModal", "VIDCONFIGURATION", "UtilityService", "vidService", "AaiService", "MsoService", "OwningEntityService", "$q", - function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, $uibModal, VIDCONFIGURATION, UtilityService, vidService, AaiService, MsoService, OwningEntityService, $q) { +appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "$uibModal", "VIDCONFIGURATION", "UtilityService", "vidService", "AaiService", "MsoService", "OwningEntityService", "AsdcService","featureFlags", "$q", "_", + function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, $uibModal, VIDCONFIGURATION, UtilityService, vidService, AaiService, MsoService, OwningEntityService, AsdcService, featureFlags, $q, _) { $scope.showVnfDetails = function (vnf) { console.log("showVnfDetails"); @@ -44,6 +44,8 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.serviceTypes = [FIELD.PROMPT.SELECT_SERVICE, COMPONENT.UCPE_VMS, COMPONENT.SDN_L3_BONDING, COMPONENT.SDN_ETHERNET_INTERNET]; $scope.defaultSubscriberName = [FIELD.PROMPT.SELECT_SUB]; + $scope.verifyButtonEnabled = true; + var callbackFunction = function (response) { alert(response); }; @@ -223,7 +225,8 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.createType = "a la carte"; var broadcastType = "createComponent"; - if (UtilityService.arrayContains(VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid)) { + if (AsdcService.isMacro(serviceModel)) { + DataService.setShouldExcludeMacroFromAsyncInstatiationFlow(AsdcService.shouldExcludeMacroFromAsyncInstatiationFlow(serviceModel)); DataService.setALaCarte(false); $scope.createType = "Macro"; var convertedAsdcModel = UtilityService.convertModel(serviceModel); @@ -464,6 +467,61 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.setProgress(2); // Show "a little" progress } + function getRelatedInstanceGroupsByVnfId(genericVnf) { + var model = vidService.getModel(); + if (model && model.vnfs && !_.isEmpty(model.vnfs)) { + Object.keys(model.vnfs).forEach(function (key) { + var vnf = model.vnfs[key]; + if (vnf.vfcInstanceGroups && !_.isEmpty(vnf.vfcInstanceGroups)) { + if (vnf.uuid === genericVnf.modelVersionId) { + AaiService.getInstanceGroupsByVNFInstanceId(genericVnf.nodeId, + function (response) { //success + handleGetRelatedInstanceGroupsResponseForVnf(response, genericVnf); + }, + function (response) { //failure + $scope.showError(FIELD.ERROR.AAI); + $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICE_INSTANCE_DATA + response.status; + $scope.errorDetails = response.data; + } + ) + } + } + }) + } + } + + function resolveModelDataIfMissing(modelVersionId) { + var model = vidService.getModel(); + if (model && model.service && model.service.uuid === modelVersionId) { + return $q.resolve(); // no need to resolve anything + } else { + // resolve model and value of isPermitted + return resolveIfIsPermitted() + .then(function() { + return getAsdcModelByVersionId(modelVersionId); + }) + } + } + + function resolveIfIsPermitted() { + var deferred = $q.defer(); + AaiService.searchServiceInstances( + '?subscriberId=' + $location.search().subscriberId + + '&serviceInstanceIdentifier=' + $location.search().serviceInstanceId) + .then(function (response) { + if (response.displayData && response.displayData.length) { + var first = response.displayData[0]; + $scope.isPermitted = first.isPermitted; + deferred.resolve(first.isPermitted); + } else { + deferred.reject("some error while resolveIfIsPermitted") + } + }); + + return deferred.promise; + } + + $scope.getComponentList = function (event, request) { $scope.isSpinnerVisible = true; @@ -484,34 +542,70 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", //$scope.getAsdcModel($location.search().modelUuid); - $scope.namedQueryId = VIDCONFIGURATION.COMPONENT_LIST_NAMED_QUERY_ID; - $scope.status = FIELD.STATUS.FETCHING_SERVICE_INST_DATA + $scope.serviceInstanceId; - - AaiService.runNamedQuery($scope.namedQueryId, $scope.globalCustomerId, $scope.serviceType, $scope.serviceInstanceId, - function (response) { //success - $scope.handleInitialResponseInventoryItems(response); - $scope.setProgress(100); // done - $scope.status = FIELD.STATUS.DONE; - $scope.isSpinnerVisible = false; - }, - function (response) { //failure - $scope.showError(FIELD.ERROR.AAI); - $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICE_INSTANCE_DATA + response.status; - $scope.errorDetails = response.data; - } - ); - - } + return getModelVersionIdForServiceInstance({ + globalCustomerId: $location.search().subscriberId, + serviceInstanceId: $location.search().serviceInstanceId, + aaiModelVersionId: $location.search().aaiModelVersionId + }) + .then(resolveModelDataIfMissing) + .then($scope.prepareScopeWithModel) + .then(function () { + + $scope.namedQueryId = VIDCONFIGURATION.COMPONENT_LIST_NAMED_QUERY_ID; + $scope.status = FIELD.STATUS.FETCHING_SERVICE_INST_DATA + $scope.serviceInstanceId; + + return AaiService.runNamedQuery($scope.namedQueryId, $scope.globalCustomerId, $scope.serviceType, $scope.serviceInstanceId, + function (response) { //success + $scope.handleInitialResponseInventoryItems(response); + $scope.setProgress(100); // done + $scope.status = FIELD.STATUS.DONE; + $scope.isSpinnerVisible = false; + //TODO + }, + function (response) { //failure + $scope.showError(FIELD.ERROR.AAI); + $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICE_INSTANCE_DATA + response.status; + $scope.errorDetails = response.data; + } + ) + }) + }; $scope.handleServerError = function (response, status) { alert(response.statusText); } + function handleGetRelatedInstanceGroupsResponseForVnf(response, genericVnf) { + _.forEach(response.data, function (instanceGroup) { + var newInstanceGroup = { + name: instanceGroup.name, + type: instanceGroup.type + }; + genericVnf.instanceGroups.push(newInstanceGroup); + }) + } + + + function getModelVersionIdForServiceInstance(instance) { if (UtilityService.hasContents(instance.aaiModelVersionId)) { return $q.resolve(instance.aaiModelVersionId); + } else if ($scope.modelVersionIdForServiceInstance + && $scope.modelVersionIdForServiceInstance.globalCustomerId === instance.globalCustomerId + && $scope.modelVersionIdForServiceInstance.serviceInstanceId === instance.serviceInstanceId + ) { + return $q.resolve($scope.modelVersionIdForServiceInstance.aaiModelVersionId); } else { - return AaiService.getModelVersionId(instance.globalCustomerId, instance.serviceInstanceId); + $scope.status = FIELD.STATUS.FETCHING_SERVICE_INST_DATA + $scope.serviceInstanceId; + return AaiService.getModelVersionId(instance.globalCustomerId, instance.serviceInstanceId) + .then(function (aaiModelVersionId) { + $scope.modelVersionIdForServiceInstance = { + globalCustomerId: instance.globalCustomerId, + serviceInstanceId: instance.serviceInstanceId, + aaiModelVersionId: aaiModelVersionId + }; + return $q.resolve(aaiModelVersionId); + }); } } @@ -529,6 +623,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", COMPONENT.SUBSCRIBERNAME_SUB_PATH + disData.subscriberName + COMPONENT.SERVICETYPE_SUB_PATH + disData.serviceType + COMPONENT.SERVICEINSTANCEID_SUB_PATH + disData.serviceInstanceId + + COMPONENT.MODELVERSIONID_SUB_PATH + disData.aaiModelVersionId + COMPONENT.IS_PERMITTED_SUB_PATH + disData.isPermitted; } }; @@ -547,13 +642,22 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", method: 'GET', url: pathQuery }).then(function successCallback(response) { - vidService.setModel(response.data); - console.log("aaiSubscriber getAsdcModel DONE!!!!"); - }, function errorCallback(response) { + if (response.headers()['content-type'].includes('json')) { + vidService.setModel(response.data); + console.log("aaiSubscriber getAsdcModel DONE!!!!"); + } else { + // the response is erroneous + console.log("aaiSubscriber getAsdcModel BAD RESPONSE"); + errorCallback(response); + return $q.reject() + } + }, errorCallback); + + function errorCallback(response) { $log.error("aaiSubscriber getAsdcModel - " + FIELD.ERROR.NO_MATCHING_MODEL_AAI + aaiModelVersionId); $scope.errorMsg = FIELD.ERROR.NO_MATCHING_MODEL_AAI + aaiModelVersionId; alert($scope.errorMsg); - }); + } } function returnMatchingServiceSubscription(serviceSubs, serviceId){ @@ -580,15 +684,20 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", }); } + $scope.isConfigurationDataAvailiable = function (configuration) { + $log.debug(configuration); + return configuration.configData && (!configuration.configData.errorDescription); + } + $scope.isActivateDeactivateEnabled = function(btnType) { - if ($scope.serviceOrchestrationStatus && $scope.service.model.service.serviceType.toLowerCase().indexOf('transport') != -1) { + if ($scope.serviceOrchestrationStatus) { + var status = $scope.serviceOrchestrationStatus.toLowerCase(); switch (btnType) { case "activate": - return $scope.serviceOrchestrationStatus === 'Created' || - $scope.serviceOrchestrationStatus.toLowerCase() === 'pendingdelete' || $scope.serviceOrchestrationStatus.toLowerCase() === 'pending-delete'; + return _.includes(COMPONENT.ACTIVATE_SERVICE_STATUSES, status); break; case "deactivate": - return $scope.serviceOrchestrationStatus === 'Active'; + return status === 'active'; break; } } @@ -596,6 +705,58 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", return false; }; + $scope.isShowVerifyService = function () { + return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_VERIFY_SERVICE); + } + + $scope.isEnableVerifyService = function () { + //Button should only be enabled when the service type is A la carte + if (DataService.getALaCarte()) { + return $scope.verifyButtonEnabled; + } + return false; + }; + + $scope.activateVerifyService = function () { + $scope.verifyButtonEnabled = false; + let url = COMPONENT.VERIFY_SERVICE_URL; + + let config = { + headers: { + 'Content-Type': 'application/json' + } + }; + + let data = { + "serviceInstanceList": [ + { + "serviceInstanceId": $scope.serviceInstanceId, + "modelVersionId": $scope.service.model.service.uuid, + "modelInvariantId": $scope.service.model.service.invariantUuid, + "customerId": $scope.globalCustomerId, + "serviceType": $scope.service.instance.serviceType, + } + ] + }; + AaiService.postPOMBAverificationRequest(url, data, config); + + }; + + $scope.isShowAssignmentsEnabled = function () { + if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ASSIGNMENTS)) { + if ($scope.serviceOrchestrationStatus) { + return $scope.serviceOrchestrationStatus.toLowerCase() === 'assigned'; + } + } + return false; + }; + + $scope.isResumeShown = function (status) { + var vfModuleStatus = status.toLowerCase(); + var serviceStatus = $scope.serviceOrchestrationStatus && $scope.serviceOrchestrationStatus.toLowerCase(); + return _.includes(['pendingactivation', 'assigned'], vfModuleStatus) && !$scope.isActivateDeactivateEnabled("activate"); + }; + $scope.handleInitialResponseInventoryItems = function (response) { $scope.inventoryResponseItemList = response.data[FIELD.ID.INVENTORY_RESPONSE_ITEM]; // get data from json @@ -642,6 +803,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "configurations": [] }; + var portMirroringConfigurationIds = []; if (inventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) { angular.forEach(inventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function (subInventoryResponseItem, key) { @@ -693,12 +855,23 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "nodeType": genericVnfObject[FIELD.ID.VNF_TYPE], "nodeId": genericVnfObject[FIELD.ID.VNF_ID], "nodeStatus": genericVnfObject[FIELD.ID.ORCHESTRATION_STATUS], + "modelVersionId" : genericVnfObject[FIELD.ID.MODEL_VERSION_ID], "object": genericVnfObject, "vfModules": [], "volumeGroups": [], + "instanceGroups": [], "availableVolumeGroups": [] }; + if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_VLAN_TAGGING_VIEW_EDIT)) { + + //TODO should be changed after integration + genericVnf["instanceGroups"] = [{"name":"a2"}]; + + } $scope.service.instance[FIELD.ID.VNFS].push(genericVnf); + getRelatedInstanceGroupsByVnfId(genericVnf); + + // look for volume-groups if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) { @@ -787,6 +960,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", } } + if (subInventoryResponseItem[FIELD.ID.GENERIC_CONFIGURATION] != null) { var configObject = subInventoryResponseItem[FIELD.ID.GENERIC_CONFIGURATION]; var config = { @@ -800,36 +974,60 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "modelVersionId": configObject[FIELD.ID.MODEL_VERSION_ID], "modelCustomizationId": configObject[FIELD.ID.MODEL_CUSTOMIZATION_ID], "object": configObject, - "ports": [] + "ports": [], + "configData" : null }; + portMirroringConfigurationIds.push(configObject[FIELD.ID.CONFIGURATION_ID]); $scope.allowConfigurationActions = [FIELD.STATUS.AAI_ACTIVE, FIELD.STATUS.AAI_INACTIVE, FIELD.STATUS.AAI_CREATED].indexOf(config.nodeStatus) != -1; - if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) { - angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function (subSubInventoryResponseItem, key) { - var port = {}; - var portObject; - if (subSubInventoryResponseItem[FIELD.ID.PORT] != null) { - portObject = subSubInventoryResponseItem[FIELD.ID.PORT]; - port = { - "portId": portObject[FIELD.ID.PORT_ID], - "portName": portObject[FIELD.ID.PORT_NAME], - "portStatus": portObject[FIELD.ID.PORT_MIRRORED] === true ? FIELD.STATUS.AAI_ENABLED : FIELD.ID.AAI_DISABLED, - "object": portObject - }; - config.ports.push(port); - } - }); - } $scope.service.instance[FIELD.ID.CONFIGURATIONS].push(config); } }); + + AaiService.getPortMirroringData(portMirroringConfigurationIds).then(function(result){ + angular.forEach($scope.service.instance[FIELD.ID.CONFIGURATIONS], function(config){ + config['configData'] = result.data[config['nodeId']] + + if (config.configData && config.configData.errorDescription) { + $scope.errorMsg = ($scope.errorMsg ? $scope.errorMsg + "\n" : "") + + "Cannot read cloud-region for configuration \"" + config.name + "\": " + + config.configData.errorDescription; + } + }); + }); + + AaiService.getPortMirroringSourcePorts(portMirroringConfigurationIds).then(function(result){ + angular.forEach($scope.service.instance[FIELD.ID.CONFIGURATIONS], function(config){ + angular.forEach(result.data[config['nodeId']], function(port){ + if (port.errorDescription) { + $scope.errorMsg = ($scope.errorMsg ? $scope.errorMsg + "\n" : "") + + "Cannot read a source port for configuration \"" + config.name + "\": " + + port.errorDescription; + } else { + config.ports.push({ + "portId": port[FIELD.ID.PORT_ID], + "portName": port[FIELD.ID.PORT_NAME], + "portStatus": port[FIELD.ID.PORT_MIRRORED] === true ? FIELD.STATUS.AAI_ENABLED : FIELD.STATUS.AAI_DISABLED + }); + } + }); + }); + }); + } }); + }); + + + } + + + $scope.handleInitialResponse = function (response) { try { $scope.enableCloseButton(true); @@ -977,7 +1175,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", }); }; - var activateDeactivateServiceInstance = function(msoType) { + var activateDeactivateServiceInstance = function (msoType) { var requestParams = { model: $scope.service.model, instance: $scope.service.instance @@ -997,73 +1195,111 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", } }; - $scope.activateMSOInstance = function() { + $scope.showAssignmentsSDNC = function () { + + if ($scope.service && $scope.service.instance) { + return VIDCONFIGURATION.SDNC_SHOW_ASSIGNMENTS_URL.replace("" , $scope.service.instance.id); + } + return null; + }; + + $scope.activateMSOInstance = function () { activateDeactivateServiceInstance(COMPONENT.MSO_ACTIVATE_SERVICE_REQ); }; - $scope.deactivateMSOInstance = function() { + $scope.deactivateMSOInstance = function () { activateDeactivateServiceInstance(COMPONENT.MSO_DEACTIVATE_SERVICE_REQ); }; - $scope.toggleConfigurationStatus = function (serviceObject, configuration) { - + $scope.deleteConfiguration = function (serviceObject, configuration) { AaiService.getLoggedInUserID(function (response) { - DataService.setLoggedInUserId(response.data); - var requestParams = { - serviceModel: { - "modelType": "service", - "modelInvariantId": serviceObject.model.service.invariantUuid, - "modelVersionId": "uuid", - "modelName": serviceObject.model.service.name, - "modelVersion": serviceObject.model.service.version - }, - configurationModel: { - "modelType": "configuration", - "modelInvariantId": configuration.modelInvariantId, - "modelVersionId": configuration.modelVersionId, - "modelCustomizationId": configuration.modelCustomizationId - }, - serviceInstanceId: serviceObject.instance.serviceInstanceId, - configurationId: configuration.nodeId, - configStatus: configuration.nodeStatus, - userId: DataService.getLoggedInUserId() - }; + DataService.setLoggedInUserId(response.data); + var requestParams = { + serviceModel: { + "modelType": "configuration", + "modelInvariantId": serviceObject.model.service.invariantUuid, + "modelVersionId": serviceObject.model.service.uuid, + "modelName": serviceObject.model.service.name, + "modelVersion": serviceObject.model.service.version + }, + configurationModel: { + "modelType": "configuration", + "modelInvariantId": configuration.modelInvariantId, + "modelVersionId": configuration.modelVersionId, + "modelCustomizationId": configuration.modelCustomizationId + }, + serviceInstanceId: serviceObject.instance.serviceInstanceId, + configurationId: configuration.nodeId, + configStatus: configuration.DELETE, + userId: DataService.getLoggedInUserId() + }; - openMsoModal(COMPONENT.MSO_CHANGE_CONFIG_STATUS_REQ, requestParams); - }); + openMsoModal(COMPONENT.MSO_DELETE_CONFIGURATION_REQ, requestParams, configuration); + }); }; - $scope.togglePortStatus = function(serviceObject, configuration, port) { + $scope.toggleConfigurationStatus = function (serviceObject, configuration) { + AaiService.getLoggedInUserID(function (response) { + DataService.setLoggedInUserId(response.data); + var requestParams = { + serviceModel: { + "modelType": "service", + "modelInvariantId": serviceObject.model.service.invariantUuid, + "modelVersionId": serviceObject.model.service.uuid, + "modelName": serviceObject.model.service.name, + "modelVersion": serviceObject.model.service.version + }, + configurationModel: { + "modelType": "configuration", + "modelInvariantId": configuration.modelInvariantId, + "modelVersionId": configuration.modelVersionId, + "modelCustomizationId": configuration.modelCustomizationId + }, + serviceInstanceId: serviceObject.instance.serviceInstanceId, + configurationId: configuration.nodeId, + configStatus: configuration.nodeStatus, + userId: DataService.getLoggedInUserId() + }; + + openMsoModal(COMPONENT.MSO_CHANGE_CONFIG_STATUS_REQ, requestParams, configuration); + }); - var requestParams = { - serviceInstanceId: serviceObject.instance.serviceInstanceId, - configurationId: configuration.nodeId, - portId: port.portId, - portStatus: port.portStatus, - serviceModel: { - "modelType": "service", - "modelInvariantId": serviceObject.model.service.invariantUuid, - "modelVersionId": "uuid", - "modelName": serviceObject.model.service.name, - "modelVersion": serviceObject.model.service.version - }, - configurationModel: { - "modelType": "configuration", - "modelInvariantId": configuration.modelInvariantId, - "modelVersionId": configuration.modelVersionId, - "modelCustomizationId": configuration.modelCustomizationId - }, - userId: DataService.getLoggedInUserId() - }; + }; - openMsoModal(COMPONENT.MSO_CHANGE_PORT_STATUS_REQ, requestParams); + $scope.togglePortStatus = function (serviceObject, configuration, port) { + AaiService.getLoggedInUserID(function (response) { + DataService.setLoggedInUserId(response.data); + + var requestParams = { + serviceInstanceId: serviceObject.instance.serviceInstanceId, + configurationId: configuration.nodeId, + portId: port.portId, + portStatus: port.portStatus, + serviceModel: { + "modelType": "service", + "modelInvariantId": serviceObject.model.service.invariantUuid, + "modelVersionId": serviceObject.model.service.uuid, + "modelName": serviceObject.model.service.name, + "modelVersion": serviceObject.model.service.version + }, + configurationModel: { + "modelType": "configuration", + "modelInvariantId": configuration.modelInvariantId, + "modelVersionId": configuration.modelVersionId, + "modelCustomizationId": configuration.modelCustomizationId + }, + userId: DataService.getLoggedInUserId() + }; + + openMsoModal(COMPONENT.MSO_CHANGE_PORT_STATUS_REQ, requestParams, configuration); + }); }; - $scope.dissociatePnf = function(pnfName) { + $scope.dissociatePnf = function (pnfName) { var jobInfo = { status: "confirm", @@ -1098,12 +1334,14 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", }; if (DataService.getLoggedInUserId()) { + requestParams.userId = DataService.getLoggedInUserId(); requestParams.attuuid = DataService.getLoggedInUserId(); openMsoModal(COMPONENT.MSO_REMOVE_RELATIONSHIP, requestParams); } else { AaiService.getLoggedInUserID(function (response) { DataService.setLoggedInUserId(response.data); + requestParams.userId = response.data; requestParams.attuuid = response.data; openMsoModal(COMPONENT.MSO_REMOVE_RELATIONSHIP, requestParams); }); @@ -1114,35 +1352,38 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", }; - var openMsoModal = function (msoType, requestParams) { + var openMsoModal = function (msoType, requestParams, configuration) { var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/mso-commit/mso-commit.html', - controller : "msoCommitModalController", + controller: "msoCommitModalController", backdrop: false, resolve: { msoType: function () { return msoType; }, - requestParams: function() { + requestParams: function () { requestParams.callbackFunction = updateViewCallbackFunction; return requestParams; + }, + configuration: function () { + return configuration; } } }); }; - var updateViewCallbackFunction = function(response) { + var updateViewCallbackFunction = function (response) { $scope.callbackResults = ""; var color = FIELD.ID.COLOR_NONE; $scope.callbackStyle = { - "background-color" : color + "background-color": color }; /* * This 1/2 delay was only added to visually highlight the status * change. Probably not needed in the real application code. */ - $timeout(function() { + $timeout(function () { $scope.callbackResults = UtilityService.getCurrentTime() + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; if (response.isSuccessful) { @@ -1152,7 +1393,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", color = FIELD.ID.COLOR_F88; } $scope.callbackStyle = { - "background-color" : color + "background-color": color }; }, 500); }; @@ -1198,7 +1439,8 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", } } }; - }]).directive('restrictInput', function () { + } +]).directive('restrictInput', function () { return { diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js index 488ada697..e15ce5fda 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js @@ -8,6 +8,7 @@ vm.lastTimeUpdated = ""; vm.hasScheduler = !!VIDCONFIGURATION.SCHEDULER_PORTAL_URL; + vm.currModal = null; vm.init = function() { vm.lastTimeUpdated = $filter('date')(new Date(), "MM/dd/yyyy | HH:mm:ss"); @@ -15,11 +16,31 @@ loadSchedulerChangeManagements(); }; + var fuseMsoAndSchedulerTaks = function() { + if (vm.changeManagements && vm.pendingChangeManagements) { + var requestIdToVnfName = {} + vm.pendingChangeManagements.forEach(function(schedulerItem) { + if (schedulerItem.msoRequestId && schedulerItem.vnfName) { + requestIdToVnfName[schedulerItem.msoRequestId] = schedulerItem.vnfName; + } + }) + $log.debug("requestIdToVnfName", requestIdToVnfName); + + vm.changeManagements = vm.changeManagements.map(function(msoItem) { + msoItem['vnfNameFromScheduler'] = requestIdToVnfName[msoItem.requestId]; + return msoItem; + }) + } + }; + var loadMSOChangeManagements = function() { changeManagementService.getMSOChangeManagements() .then(function(response) { vm.changeManagements = response.data; }) + .then(function () { + fuseMsoAndSchedulerTaks(); + }) .catch(function (error) { $log.error(error); }); @@ -43,12 +64,16 @@ } }); }) + .then(function () { + fuseMsoAndSchedulerTaks(); + }) .catch(function(error) { $log.error(error); }); }; vm.createNewChange = function() { + vm.closeCurrentModalIfOpen(); var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/new-change-management/new-change-management.html', controller: 'newChangeManagementModalController', @@ -56,6 +81,8 @@ resolve: {} }); + vm.currModal = modalInstance; + modalInstance.result.then(function (result) { console.log("This is the result of the new change management modal.", result); }); @@ -65,29 +92,18 @@ console.log("function for searching changes: " + vm.searchChangesTerm) }; - vm.openFailedModal = function(jobInfo) { - var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/failed-change-management/failed-change-management.html', - controller: 'changeManagementManualTasksController', - controllerAs: 'vm', - resolve: { - jobInfo: function () { - return jobInfo; - } - }, - }); + vm.openManualTasksPopup = function($event, jobInfo, templateUrl, message) { - modalInstance.result.then(function (result) { - console.log("This is the result of the failed change management modal.", result); - }); - }; + vm.closeCurrentModalIfOpen(); - vm.openInProgressModal = function(jobInfo) { var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html', + templateUrl: templateUrl, controller: 'changeManagementManualTasksController', controllerAs: 'vm', + backdrop: false, + animation: true, + appendTo: angular.element($event.currentTarget).parent(), resolve: { jobInfo: function () { return jobInfo; @@ -96,31 +112,38 @@ }); modalInstance.result.then(function (result) { - console.log("This is the result of the in progress change management modal.", result); + console.log(message, result); }); + + vm.currModal = modalInstance; }; - vm.openAlertModal = function(jobInfo) { - var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/alert-change-management/alert-change-management.html', - controller: 'changeManagementManualTasksController', - controllerAs: 'vm', - resolve: { - jobInfo: function () { - return jobInfo; - } - } - }); + vm.openFailedModal = function($event, jobInfo) { + vm.openManualTasksPopup($event, jobInfo, + 'app/vid/scripts/modals/failed-change-management/failed-change-management.html', + "This is the result of the failed change management modal.") + }; - modalInstance.result.then(function (result) { - console.log("This is the result of the alert change management modal.", result); - }); + vm.openInProgressModal = function($event, jobInfo) { + vm.openManualTasksPopup($event, jobInfo, + 'app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html', + "This is the result of the in progress change management modal.") + }; + + vm.openAlertModal = function($event, jobInfo) { + vm.openManualTasksPopup($event, jobInfo, + 'app/vid/scripts/modals/alert-change-management/alert-change-management.html', + "This is the result of the alert change management modal.") }; + vm.openBasicAlertModal = function(jobInfo) { + vm.closeCurrentModalIfOpen(); var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/alert-modal/alert-modal.html', controller: 'alertModalController', controllerAs: 'vm', + backdrop: false, + animation: true, appendTo: angular.element(".jobs-table").eq(0), resolve: { jobInfo: function () { @@ -128,12 +151,16 @@ } } }); + vm.currModal = modalInstance; modalInstance.result.then(function (result) { console.log("This is the result of the alert change management modal.", result); }); }; vm.openPendingModal = function($event, changeManagement) { + + vm.closeCurrentModalIfOpen(); + var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html', controller: 'cancelPendingWorkflowController', @@ -148,6 +175,8 @@ } }); + vm.currModal = modalInstance; + modalInstance.result.then(function (result) { // send to service if(result){ @@ -173,6 +202,16 @@ }}); }; + vm.isChangeManagementDeleted = function(changeManagement) { + return changeManagement.scheduleRequest.status!=='Deleted' + }; + + vm.closeCurrentModalIfOpen = function() { + if (vm.currModal != null) { + vm.currModal.close(); + vm.currModal = null; + } + } vm.init(); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js index 3d8cba5c1..e8fa529fc 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js @@ -20,331 +20,357 @@ "use strict"; -var creationDialogController = function( COMPONENT, FIELD, PARAMETER, $scope, $http, $timeout, $log, - CreationService, UtilityService, DataService,VIDCONFIGURATION) { - - $scope.isDialogVisible = false; - $scope.summaryControl = {}; - $scope.userProvidedControl = {}; - - var callbackFunction = undefined; - var componentId = undefined; - - $scope.$on(COMPONENT.CREATE_COMPONENT, function(event, request) { - - $scope.isSpinnerVisible = true; - $scope.isErrorVisible = false; - $scope.isDataVisible = false; - $scope.isConfirmEnabled = false; - $scope.isDialogVisible = true; - $scope.popup.isVisible = true; - - callbackFunction = request.callbackFunction; - componentId = request.componentId; - CreationService.initializeComponent(request.componentId); - - CreationService.setHttpErrorHandler(function(response) { - showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService - .getHttpErrorMessage(response)); - }); - - $scope.componentName = CreationService.getComponentDisplayName(); - - CreationService.getParameters(handleGetParametersResponse); - - }); - - var handleGetParametersResponse = function(parameters) { - $scope.summaryControl.setList(parameters.summaryList); - $scope.userProvidedControl.setList(parameters.userProvidedList); - - $scope.isSpinnerVisible = false; - $scope.isDataVisible = true; - $scope.isConfirmEnabled = true; - }; - - var validateInstanceName = function(iname) { - var patt1 = /^([a-z])+([0-9a-z\-_\.]*)$/i; - - if ( iname == null ){ - return false; - } - if ( !iname.match(patt1) ) { - return false; - } - return true; - }; - var validateMap = function(mname) { - var patt1 = /^{(\s*\w+\s*:\s*\w+\s*)(\s*,\s*\w+\s*:\s*\w+\s*)*}$/im; - if ( mname == null ){ - return true; - } - if ( !mname.match(patt1) ) { - return false; - } - return true; - }; - - var validateList = function(lname) { - var patt1 = /^\[(\s*\w+\s*)(\s*,\s*\w+\s*)*\]$/i; - if ( lname == null ){ - return true; - } - if ( !lname.match(patt1) ) { - return false; - } - return true; - }; - - $scope.userParameterChanged = function(id) { - CreationService.updateUserParameterList(id, $scope.userProvidedControl); - } - - $scope.confirm = function() { - - var requiredFields = $scope.userProvidedControl.getRequiredFields(); - if (requiredFields !== "") { - showError(FIELD.ERROR.MISSING_DATA, requiredFields); - return; - } - - var isUploadAvailable = false; - var uploadIndex =0; - var paramList = $scope.userProvidedControl.getList(); - var isAnyError = false; - for (var i = 0; i < paramList.length; i++) { - if (paramList[i].id === FIELD.ID.SUPPLEMENTORY_DATA_FILE) { - isUploadAvailable = true; - uploadIndex=i; - } - if (paramList[i].id === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE && paramList[i].value && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value=='' ) { - isAnyError = true; - } - } - - if(isUploadAvailable && isAnyError ){ - showError(FIELD.ERROR.MISSING_DATA, FIELD.ERROR.MISSING_FILE); - return; - }else if(isUploadAvailable && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value!='' ){ - var errorMsg = ""; - var fileInput = document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE); - var file = fileInput.files[0]; - var reader = new FileReader(); - reader.onload = function(e) { - try{ - paramList[uploadIndex].value = JSON.parse(reader.result); - FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'] = paramList[uploadIndex].value; - - var instanceName = ""; - - if ( DataService.getALaCarte() ) { - if ( paramList != null ) { - for (var i = 0; i < paramList.length; i++) { - if (paramList[i].id === FIELD.ID.INSTANCE_NAME) { - instanceName = paramList[i].value; - break; - } - } - } - var isValid = validateInstanceName (instanceName); - if ( isValid ) { - $scope.isErrorVisible = false; - } else { - showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName, - FIELD.ERROR.INSTANCE_NAME_VALIDATE); - return; - } - } - var arbitraryParametersList = DataService.getArbitraryParameters(); - var p = null; - if (UtilityService.hasContents (arbitraryParametersList)) { - for (var i = 0; i < arbitraryParametersList.length; i++) { - p = arbitraryParametersList[i]; - if (p.type === PARAMETER.MAP) { - //validate a map: { : , ... , : } - // need to find the value in paramList - for (var j = 0; j < paramList.length; j++) { - if (paramList[j].id === p.id) { - p.value = paramList[j].value; - var isValid = validateMap (p.value); - if ( isValid ) { - $scope.isErrorVisible = false; - break; - } - else { - showError(FIELD.ERROR.INVALID_MAP + p.id, - FIELD.ERROR.MAP_VALIDATE); - return; - } - } - } - } else if (p.type === PARAMETER.LIST) { - //validate a list: { value or a list of comma separated values } - // need to find the value in paramList - for (var j = 0; j < paramList.length; j++) { - if (paramList[j].id === p.id) { - p.value = paramList[j].value; - var isValid = validateList (p.value); - if ( isValid ) { - $scope.isErrorVisible = false; - break; - } - else { - showError(FIELD.ERROR.INVALID_LIST + p.id, - FIELD.ERROR.LIST_VALIDATE); - return; - } - } - } - } - } - } - var requestDetails = CreationService - .getMsoRequestDetails($scope.userProvidedControl.getList()); - - $scope.isDialogVisible = false; - - $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { - url : CreationService.getMsoUrl(), - requestDetails : requestDetails, - componentId: componentId, - callbackFunction : function(response) { - if (response.isSuccessful) { - $scope.popup.isVisible = false; - runCallback(response); - } else { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - } - } - }); - - }catch(e){ - errorMsg = errorMsg+ FIELD.ERROR.INVALID_DATA_FORMAT; - } - if (errorMsg !== "") { - showError(FIELD.ERROR.SYSTEM_FAILURE, errorMsg); - return; - } - } - reader.readAsText(file); - }else{ - - var paramList = $scope.userProvidedControl.getList(); - var instanceName = ""; - - if ( DataService.getALaCarte() ) { - if ( paramList != null ) { - for (var i = 0; i < paramList.length; i++) { - if (paramList[i].id === FIELD.ID.INSTANCE_NAME) { - instanceName = paramList[i].value; - break; - } - } - } - var isValid = validateInstanceName (instanceName); - if ( isValid ) { - $scope.isErrorVisible = false; - } else { - showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName, - FIELD.ERROR.INSTANCE_NAME_VALIDATE); - return; - } - } - var arbitraryParametersList = DataService.getArbitraryParameters(); - var p = null; - if (UtilityService.hasContents (arbitraryParametersList)) { - for (var i = 0; i < arbitraryParametersList.length; i++) { - p = arbitraryParametersList[i]; - if (p.type === PARAMETER.MAP) { - //validate a map: { : , ... , : } - // need to find the value in paramList - for (var j = 0; j < paramList.length; j++) { - if (paramList[j].id === p.id) { - p.value = paramList[j].value; - var isValid = validateMap (p.value); - if ( isValid ) { - $scope.isErrorVisible = false; - break; - } - else { - showError(FIELD.ERROR.INVALID_MAP + p.id, - FIELD.ERROR.MAP_VALIDATE); - return; - } - } - } - } else if (p.type === PARAMETER.LIST) { - //validate a list: { value or a list of comma separated values } - // need to find the value in paramList - for (var j = 0; j < paramList.length; j++) { - if (paramList[j].id === p.id) { - p.value = paramList[j].value; - var isValid = validateList (p.value); - if ( isValid ) { - $scope.isErrorVisible = false; - break; - } - else { - showError(FIELD.ERROR.INVALID_LIST + p.id, - FIELD.ERROR.LIST_VALIDATE); - return; - } - } - } - } - } - } - var requestDetails = CreationService - .getMsoRequestDetails($scope.userProvidedControl.getList()); - - $scope.isDialogVisible = false; - - $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { - url : CreationService.getMsoUrl(), - requestDetails : requestDetails, - componentId: componentId, - callbackFunction : function(response) { - if (response.isSuccessful) { - $scope.popup.isVisible = false; - runCallback(response); - } else { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - } - } - }); - } - } - - $scope.cancel = function() { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - runCallback(false); - } - - var runCallback = function(response) { - if (angular.isFunction(callbackFunction)) { - callbackFunction({ - isSuccessful : response.isSuccessful, - control : $scope.userProvidedControl.getList(), - instanceId : response.instanceId - }); - } - } - - var showError = function(summary, details) { - var message = summary; - if (UtilityService.hasContents(details)) { - message += " (" + details + ")"; - } - $scope.isSpinnerVisible = false; - $scope.isErrorVisible = true; - $scope.error = message; - } - -} - -appDS2.controller("creationDialogController", [ "COMPONENT", "FIELD", "PARAMETER", "$scope", "$http", - "$timeout", "$log", "CreationService", "UtilityService", "DataService","VIDCONFIGURATION", - creationDialogController ]); +var creationDialogController = function (COMPONENT, FIELD, PARAMETER, $scope, $http, $timeout, $log, + CreationService, UtilityService, DataService, VIDCONFIGURATION, $location) { + + $scope.isDialogVisible = false; + $scope.summaryControl = {}; + $scope.userProvidedControl = {}; + + var callbackFunction = undefined; + var componentId = undefined; + + $scope.shouldShowOldPopup = function () { + return DataService.getALaCarte() || DataService.getShouldExcludeMacroFromAsyncInstatiationFlow() + }; + + function receiveMessage(event) { + if (event.data == 'closeIframe') { + window.removeEventListener("message", receiveMessage, false); + + $scope.cancel(); + } + else if (event.data.eventId == 'submitIframe') { + { + $location.path('/servicePlanning').search({serviceModelId: event.data.data.serviceModelId}); + } + } + $scope.$apply(); + } + + $scope.$on(COMPONENT.CREATE_COMPONENT, function (event, request) { + $scope.isSpinnerVisible = true; + $scope.isErrorVisible = false; + $scope.isDataVisible = false; + $scope.isConfirmEnabled = false; + $scope.isDialogVisible = true; + $scope.popup.isVisible = true; + + + if (!$scope.shouldShowOldPopup()) { + $scope.url = COMPONENT.SERVICE_POPUP_IFRAME_URL + request.modelNameVersionId + "&isCreate=true&r=" + Math.random(); + window.addEventListener("message", receiveMessage, false); + + } + else { + callbackFunction = request.callbackFunction; + componentId = request.componentId; + CreationService.initializeComponent(request.componentId); + + CreationService.setHttpErrorHandler(function (response) { + showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService + .getHttpErrorMessage(response)); + }); + + $scope.componentName = CreationService.getComponentDisplayName(); + + CreationService.getParameters(handleGetParametersResponse); + } + + }); + + var handleGetParametersResponse = function (parameters) { + $scope.summaryControl.setList(parameters.summaryList); + $scope.userProvidedControl.setList(parameters.userProvidedList); + + $scope.isSpinnerVisible = false; + $scope.isDataVisible = true; + $scope.isConfirmEnabled = true; + }; + + var validateInstanceName = function (iname) { + var patt1 = /^([a-z])+([0-9a-z\-_\.]*)$/i; + + if (iname == null) { + return false; + } + if (!iname.match(patt1)) { + return false; + } + return true; + }; + var validateMap = function (mname) { + var patt1 = /^{(\s*\w+\s*:\s*\w+\s*)(\s*,\s*\w+\s*:\s*\w+\s*)*}$/im; + if (mname == null) { + return true; + } + if (!mname.match(patt1)) { + return false; + } + return true; + }; + + var validateList = function (lname) { + var patt1 = /^\[(\s*\w+\s*)(\s*,\s*\w+\s*)*\]$/i; + if (lname == null) { + return true; + } + if (!lname.match(patt1)) { + return false; + } + return true; + }; + + $scope.userParameterChanged = function (id) { + CreationService.updateUserParameterList(id, $scope.userProvidedControl); + }; + + $scope.confirm = function () { + + var requiredFields = $scope.userProvidedControl.getRequiredFields(); + if (requiredFields !== "") { + showError(FIELD.ERROR.MISSING_DATA, requiredFields); + return; + } + + var isUploadAvailable = false; + var uploadIndex = 0; + var paramList = $scope.userProvidedControl.getList(); + var isAnyError = false; + for (var i = 0; i < paramList.length; i++) { + if (paramList[i].id === FIELD.ID.SUPPLEMENTORY_DATA_FILE) { + isUploadAvailable = true; + uploadIndex = i; + } + if (paramList[i].id === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE && paramList[i].value && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value == '') { + isAnyError = true; + } + } + + if (isUploadAvailable && isAnyError) { + showError(FIELD.ERROR.MISSING_DATA, FIELD.ERROR.MISSING_FILE); + + } else if (isUploadAvailable && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value != '') { + var errorMsg = ""; + var fileInput = document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE); + var file = fileInput.files[0]; + var reader = new FileReader(); + reader.onload = function (e) { + try { + paramList[uploadIndex].value = JSON.parse(reader.result); + FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'] = paramList[uploadIndex].value; + + var instanceName = ""; + + if (DataService.getALaCarte()) { + if (paramList != null) { + for (var i = 0; i < paramList.length; i++) { + if (paramList[i].id === FIELD.ID.INSTANCE_NAME) { + instanceName = paramList[i].value; + break; + } + } + } + var isValid = validateInstanceName(instanceName); + if (isValid) { + $scope.isErrorVisible = false; + } else { + showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName, + FIELD.ERROR.INSTANCE_NAME_VALIDATE); + return; + } + } + var arbitraryParametersList = DataService.getArbitraryParameters(); + var p = null; + if (UtilityService.hasContents(arbitraryParametersList)) { + for (var i = 0; i < arbitraryParametersList.length; i++) { + p = arbitraryParametersList[i]; + if (p.type === PARAMETER.MAP) { + //validate a map: { : , ... , : } + // need to find the value in paramList + for (var j = 0; j < paramList.length; j++) { + if (paramList[j].id === p.id) { + p.value = paramList[j].value; + var isValid = validateMap(p.value); + if (isValid) { + $scope.isErrorVisible = false; + break; + } + else { + showError(FIELD.ERROR.INVALID_MAP + p.id, + FIELD.ERROR.MAP_VALIDATE); + return; + } + } + } + } else if (p.type === PARAMETER.LIST) { + //validate a list: { value or a list of comma separated values } + // need to find the value in paramList + for (var j = 0; j < paramList.length; j++) { + if (paramList[j].id === p.id) { + p.value = paramList[j].value; + var isValid = validateList(p.value); + if (isValid) { + $scope.isErrorVisible = false; + break; + } + else { + showError(FIELD.ERROR.INVALID_LIST + p.id, + FIELD.ERROR.LIST_VALIDATE); + return; + } + } + } + } + } + } + var requestDetails = CreationService + .getMsoRequestDetails($scope.userProvidedControl.getList()); + + $scope.isDialogVisible = false; + + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url: CreationService.getMsoUrl(), + requestDetails: requestDetails, + componentId: componentId, + callbackFunction: function (response) { + if (response.isSuccessful) { + $scope.popup.isVisible = false; + runCallback(response); + } else { + $scope.isDialogVisible = false; + $scope.popup.isVisible = false; + } + } + }); + + } catch (e) { + errorMsg = errorMsg + FIELD.ERROR.INVALID_DATA_FORMAT; + } + if (errorMsg !== "") { + showError(FIELD.ERROR.SYSTEM_FAILURE, errorMsg); + + } + }; + reader.readAsText(file); + } else { + + var paramList = $scope.userProvidedControl.getList(); + var instanceName = ""; + + if (DataService.getALaCarte()) { + if (paramList != null) { + for (var i = 0; i < paramList.length; i++) { + if (paramList[i].id === FIELD.ID.INSTANCE_NAME) { + instanceName = paramList[i].value; + break; + } + } + } + var isValid = validateInstanceName(instanceName); + if (isValid) { + $scope.isErrorVisible = false; + } else { + showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName, + FIELD.ERROR.INSTANCE_NAME_VALIDATE); + return; + } + } + var arbitraryParametersList = DataService.getArbitraryParameters(); + var p = null; + if (UtilityService.hasContents(arbitraryParametersList)) { + for (var i = 0; i < arbitraryParametersList.length; i++) { + p = arbitraryParametersList[i]; + if (p.type === PARAMETER.MAP) { + //validate a map: { : , ... , : } + // need to find the value in paramList + for (var j = 0; j < paramList.length; j++) { + if (paramList[j].id === p.id) { + p.value = paramList[j].value; + var isValid = validateMap(p.value); + if (isValid) { + $scope.isErrorVisible = false; + break; + } + else { + showError(FIELD.ERROR.INVALID_MAP + p.id, + FIELD.ERROR.MAP_VALIDATE); + return; + } + } + } + } else if (p.type === PARAMETER.LIST) { + //validate a list: { value or a list of comma separated values } + // need to find the value in paramList + for (var j = 0; j < paramList.length; j++) { + if (paramList[j].id === p.id) { + p.value = paramList[j].value; + var isValid = validateList(p.value); + if (isValid) { + $scope.isErrorVisible = false; + break; + } + else { + showError(FIELD.ERROR.INVALID_LIST + p.id, + FIELD.ERROR.LIST_VALIDATE); + return; + } + } + } + } + } + } + var requestDetails = CreationService + .getMsoRequestDetails($scope.userProvidedControl.getList()); + + $scope.isDialogVisible = false; + + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url: CreationService.getMsoUrl(), + requestDetails: requestDetails, + componentId: componentId, + callbackFunction: function (response) { + if (response.isSuccessful) { + $scope.popup.isVisible = false; + runCallback(response); + } else { + $scope.isDialogVisible = false; + $scope.popup.isVisible = false; + } + } + }); + } + }; + + $scope.cancel = function () { + $scope.isDialogVisible = false; + $scope.popup.isVisible = false; + runCallback(false); + }; + + + var runCallback = function (response) { + if (angular.isFunction(callbackFunction)) { + callbackFunction({ + isSuccessful: response.isSuccessful, + control: $scope.userProvidedControl.getList(), + instanceId: response.instanceId + }); + } + }; + + var showError = function (summary, details) { + var message = summary; + if (UtilityService.hasContents(details)) { + message += " (" + details + ")"; + } + $scope.isSpinnerVisible = false; + $scope.isErrorVisible = true; + $scope.error = message; + } + +}; + +appDS2.controller("creationDialogController", ["COMPONENT", "FIELD", "PARAMETER", "$scope", "$http", + "$timeout", "$log", "CreationService", "UtilityService", "DataService", "VIDCONFIGURATION", "$location", + creationDialogController]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js index cdda3a143..e71f2ac18 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js @@ -26,77 +26,76 @@ var deleteResumeDialogController = function( COMPONENT, FIELD, $scope, $http, $t $scope.isDialogVisible = false; $scope.summaryControl = {}; $scope.userProvidedControl = {}; - + var callbackFunction = undefined; var componentId = undefined; + $scope.dialogMethod = COMPONENT.DELETE; $scope.$on(COMPONENT.DELETE_RESUME_COMPONENT, function(event, request) { $scope.isE2EService = false; - $scope.isDataVisible = false; - $scope.isSpinnerVisible = false; - $scope.isErrorVisible = false; - $scope.isDialogVisible = true; - $scope.popup.isVisible = true; - $scope.isConfirmEnabled = false; - $scope.dialogMethod = request.dialogMethod; - callbackFunction = request.callbackFunction; - componentId = request.componentId; - $scope.isServiceInstance = componentId === "service"; - - DeleteResumeService.initializeComponent(request.componentId); + $scope.isDataVisible = false; + $scope.isSpinnerVisible = false; + $scope.isErrorVisible = false; + $scope.isDialogVisible = true; + $scope.popup.isVisible = true; + $scope.isConfirmEnabled = false; + $scope.dialogMethod = request.dialogMethod; + $scope.serviceStatus = request.serviceStatus; + callbackFunction = request.callbackFunction; + componentId = request.componentId; - $scope.componentName = DeleteResumeService.getComponentDisplayName(); + DeleteResumeService.initializeComponent(request.componentId); - $scope.summaryControl.setList(DeleteResumeService.getSummaryList()); + $scope.componentName = DeleteResumeService.getComponentDisplayName(); + $scope.summaryControl.setList(DeleteResumeService.getSummaryList()); - DeleteResumeService.getParameters(handleGetParametersResponse); + DeleteResumeService.getParameters(handleGetParametersResponse); }); - + var handleGetParametersResponse = function(parameters, dontshow) { - $scope.summaryControl.setList(parameters.summaryList); - $scope.userProvidedControl.setList(parameters.userProvidedList); - - $scope.isSpinnerVisible = false; - if (dontshow) - $scope.isDataVisible = false; - else - $scope.isDataVisible = true; - $scope.isConfirmEnabled = true; - }; - - $scope.userParameterChanged = function(id) { + $scope.summaryControl.setList(parameters.summaryList); + $scope.userProvidedControl.setList(parameters.userProvidedList); + + $scope.isSpinnerVisible = false; + if (dontshow) + $scope.isDataVisible = false; + else + $scope.isDataVisible = true; + $scope.isConfirmEnabled = true; + }; + + $scope.userParameterChanged = function(id) { DeleteResumeService.updateUserParameterList(id, $scope.userProvidedControl); - } + } $scope.confirm = function() { DataService.setE2EService($scope.isE2EService); //VoLTE support + var requiredFields = $scope.userProvidedControl.getRequiredFields(); + if (requiredFields === "") { + $scope.isErrorVisible = false; + } else { + showError(FIELD.ERROR.MISSING_DATA, requiredFields); + return; + } - var requiredFields = $scope.userProvidedControl.getRequiredFields(); - if (requiredFields === "") { - $scope.isErrorVisible = false; - } else { - showError(FIELD.ERROR.MISSING_DATA, requiredFields); - return; - } - - var callbackAfterMSO = function(isSuccessful) { + var callbackAfterMSO = function(isSuccessful) { if (isSuccessful) { $scope.popup.isVisible = false; runCallback(true); } else { - $scope.isDialogVisible = true; + $scope.isDialogVisible = true; } }; - $scope.isDialogVisible = false; + $scope.isDialogVisible = false; - if ($scope.dialogMethod == COMPONENT.DELETE) - { + if ($scope.dialogMethod == COMPONENT.DELETE) + { var requestDetails = DeleteResumeService.getMsoRequestDetails($scope.userProvidedControl.getList()); @@ -105,13 +104,13 @@ var deleteResumeDialogController = function( COMPONENT, FIELD, $scope, $http, $t } $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, { - url : DeleteResumeService.getMsoUrl(), + url : DeleteResumeService.getMsoUrl($scope.serviceStatus), requestDetails : requestDetails, - componentId: componentId, + componentId: componentId, callbackFunction : callbackAfterMSO }); - } - else + } + else if ($scope.dialogMethod == COMPONENT.RESUME) { CreationService.initializeComponent(componentId); @@ -133,17 +132,17 @@ var deleteResumeDialogController = function( COMPONENT, FIELD, $scope, $http, $t } $scope.cancel = function() { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - runCallback(false); + $scope.isDialogVisible = false; + $scope.popup.isVisible = false; + runCallback(false); } var runCallback = function(isSuccessful) { - if (angular.isFunction(callbackFunction)) { - callbackFunction({ - isSuccessful : isSuccessful - }); - } + if (angular.isFunction(callbackFunction)) { + callbackFunction({ + isSuccessful : isSuccessful + }); + } } } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js index 148b4ccec..631d0122f 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js @@ -21,7 +21,7 @@ "use strict"; var msoCommitModalController = function(COMPONENT, FIELD, $scope, $http, $timeout, $window, $log, - MsoService, PropertyService, UtilityService, DataService, $uibModalInstance, msoType, requestParams, vidService) { + MsoService, PropertyService, UtilityService, DataService, $uibModalInstance, msoType, requestParams, configuration, vidService, featureFlags) { $scope.isSpinnerVisible = true; $scope.isProgressVisible = true; @@ -153,12 +153,14 @@ var msoCommitModalController = function(COMPONENT, FIELD, $scope, $http, $timeou var init = function(msoType) { switch(msoType) { + case COMPONENT.MSO_DELETE_CONFIGURATION_REQ : + return MsoService.deleteConfiguration(requestParams, configuration); case COMPONENT.MSO_CREATE_REQ: return MsoService.createConfigurationInstance(requestParams); case COMPONENT.MSO_CHANGE_CONFIG_STATUS_REQ: - return MsoService.toggleConfigurationStatus(requestParams); + return MsoService.toggleConfigurationStatus(requestParams, configuration); case COMPONENT.MSO_CHANGE_PORT_STATUS_REQ: - return MsoService.togglePortStatus(requestParams); + return MsoService.togglePortStatus(requestParams, configuration); case COMPONENT.MSO_CREATE_REALATIONSHIP: return MsoService.associatePnf(requestParams); case COMPONENT.MSO_REMOVE_RELATIONSHIP: @@ -223,6 +225,7 @@ var msoCommitModalController = function(COMPONENT, FIELD, $scope, $http, $timeou _this.msoRequestType = msoType; + init(_this.msoRequestType) .then(function (response) { successCallbackFunction(response); @@ -233,5 +236,5 @@ var msoCommitModalController = function(COMPONENT, FIELD, $scope, $http, $timeou }; appDS2.controller("msoCommitModalController", [ "COMPONENT", "FIELD", "$scope", "$http", "$timeout", - "$window", "$log", "MsoService", "PropertyService", "UtilityService", "DataService", "$uibModalInstance", "msoType", "requestParams", "vidService", + "$window", "$log", "MsoService", "PropertyService", "UtilityService", "DataService", "$uibModalInstance", "msoType", "requestParams", "configuration", "vidService", "featureFlags", msoCommitModalController ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js index 22a20abf8..04717c5f8 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js @@ -94,6 +94,9 @@ appDS2.controller("pnfSearchAssociationController", ["COMPONENT", "$log", "FIELD requestParams: function () { requestParams.callbackFunction = updateViewCallbackFunction; return requestParams; + }, + configuration: function () { + return null; } } }) diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js index f5c3a0e0a..63ddac2fb 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js @@ -53,7 +53,7 @@ _.find(relatedEcompEnv.relationshipData, {"relationshipKey": "operational-environment.operational-environment-id"}) .relationshipValue; var relatedInstanceName = - _.find(relatedEcompEnv.relatedToProperty, {"propertyKey": "operational-environment.operational-name"}) + _.find(relatedEcompEnv.relatedToProperty, {"propertyKey": "operational-environment.operational-environment-name"}) .propertyValue; var workloadContext = testEnv.workloadContext; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js b/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js index 6f0ae2c69..82dbebcb7 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js @@ -7,12 +7,16 @@ var result = []; if(changeManagements && metadata && metadata.statuses) { angular.forEach(changeManagements, function(changeManagement) { - angular.forEach(metadata.statuses, function(status) { - if(changeManagement.requestStatus.requestState === status) { - result.push(changeManagement); - return; - } - }); + var found = metadata.statuses + .map(function(c) { return c.toLowerCase(); }) + .indexOf(changeManagement.requestStatus.requestState.toLowerCase()) !== -1; + + if (metadata.notContains && !found) { + result.push(changeManagement); + } + if (! metadata.notContains && found) { + result.push(changeManagement); + } }); } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html index 60596f499..6988aab9d 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html @@ -1,5 +1,6 @@ +