Allow additional parameters to deployment 21/37721/1
authorac2550 <ac2550@intl.att.com>
Thu, 22 Mar 2018 09:29:44 +0000 (10:29 +0100)
committerac2550 <ac2550@intl.att.com>
Thu, 22 Mar 2018 09:48:17 +0000 (10:48 +0100)
Change-Id: I760d0f0d54f83282d8556b74a588361669fa5375
Issue-ID: CLAMP-142
Signed-off-by: ac2550 <ac2550@intl.att.com>
src/main/resources/META-INF/resources/designer/index.html
src/main/resources/META-INF/resources/designer/partials/portfolios/deploy_parameters.html [new file with mode: 0644]
src/main/resources/META-INF/resources/designer/scripts/DeploymentCtrl.js [new file with mode: 0644]
src/main/resources/META-INF/resources/designer/scripts/app.js

index 584d2f8..5e0c725 100644 (file)
      
      <script src="scripts/AutosaveProjectCtrl.js"></script>
      <script src="scripts/userPreferencesService.js"></script>
-     
+
+     <script src="scripts/DeploymentCtrl.js"></script>
      <script src="scripts/ExtraUserInfoCtrl.js"></script>
      <script src="scripts/ExtraUserInfoService.js"></script>     
      <script src="scripts/saveConfirmationModalPopUpCtrl.js"></script>
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/deploy_parameters.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/deploy_parameters.html
new file mode 100644 (file)
index 0000000..c0cd6c9
--- /dev/null
@@ -0,0 +1,40 @@
+<!--
+  ============LICENSE_START=======================================================
+  ONAP CLAMP
+  ================================================================================
+  Copyright (C) 2018 AT&T Intellectual Property. All rights
+                              reserved.
+  ================================================================================
+  Licensed under the Apache License, Version 2.0 (the "License"); 
+  you may not use this file except in compliance with the License. 
+  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software 
+  distributed under the License is distributed on an "AS IS" BASIS, 
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+  See the License for the specific language governing permissions and 
+  limitations under the License.
+  ============LICENSE_END============================================
+  ===================================================================
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  -->
+
+<div id="deploy-parameters">
+       <div class="modal-header">
+               <button type="button" class="close" ng-click="close()" aria-hidden="true" style="margin-top: -3px">&times;</button>
+               <h4>Deployment parameters</h4>
+       </div>
+       <div class="modal-body" style="height: 150px">
+                 <div style="height: 30px">
+        Deployment parameters as JSON.
+      </div>
+      <textarea class="form-control" focus="true" name="deployProperties"  id="deployProperties" />
+       </div>
+       <div class="modal-footer">
+      <button ng-click="deploy()"  class="btn btn-primary">Deploy</button>
+                 <button ng-click="close()" class="btn btn-primary">Cancel</button>
+       </div>
+</div>
+
diff --git a/src/main/resources/META-INF/resources/designer/scripts/DeploymentCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/DeploymentCtrl.js
new file mode 100644 (file)
index 0000000..3a5faf5
--- /dev/null
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ *                             reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+app.controller('DeploymentCtrl',
+               ['$scope','$rootScope','$modalInstance','data','dialogs', 'cldsModelService',
+       function( $scope,  $rootScope,  $modalInstance,  data,  dialogs,   cldsModelService) {
+
+           function set_deploy_parameters(parameters) {
+               if (!'global' in elementMap) {
+                   elementMap["global"] = [];
+               }
+
+               var index = elementMap["global"].findIndex(function (e) { return (typeof e == "object" && !(e instanceof Array)) && "deployParameters" in e; });
+               if (index == -1) {
+                   elementMap["global"].push({"deployParameters": parameters});
+               } else {
+                   elementMap["global"][index]["deployParameters"] =  parameters;
+               }
+           }
+
+           $scope.deploy = function() {
+               var parameters = $("#deployProperties").val();
+               try {
+                   parameters = JSON.parse(parameters);
+                   set_deploy_parameters(parameters);
+                   $modalInstance.close();
+               } catch (e) {
+                   console.error("Couldn't parse deploy parameters json");
+               }
+           };
+
+           $scope.close = function() {
+               $modalInstance.dismiss();
+           };
+       }
+
+]);
index 19906d9..588b617 100644 (file)
@@ -369,7 +369,7 @@ var app = angular.module('clds-app', ['ngRoute',
               $scope.cldsOpenModelProperties();
             } else if (name == "Deploy") {
               $scope
-                .cldsConfirmToggleDeployPerformAction("Deploy");
+                .cldsAskDeployParametersPerformAction();
             } else if (name == "UnDeploy") {
               $scope
                 .cldsConfirmToggleDeployPerformAction("UnDeploy");
@@ -996,6 +996,18 @@ var app = angular.module('clds-app', ['ngRoute',
           });
         };
 
+        $scope.cldsAskDeployParametersPerformAction = function() {
+            var dlg = dialogs.create('partials/portfolios/deploy_parameters.html',
+                                     'DeploymentCtrl',
+                                     {}, {keyboard: true, backdrop: true, windowClass: 'deploy-parameters'});
+            dlg.result.then(function() {
+                var confirm = dialogs.confirm('Deploy', 'Are you sure you want to deploy the closed loop?');
+                confirm.result.then(function() {
+                    cldsToggleDeploy("deploy");
+                });
+            });
+        };
+
         $scope.cldsConfirmToggleDeployPerformAction = function(
           uiAction) {