diff options
author | ac2550 <ac2550@intl.att.com> | 2018-03-22 10:29:44 +0100 |
---|---|---|
committer | ac2550 <ac2550@intl.att.com> | 2018-03-22 10:48:17 +0100 |
commit | 0a9277ebddbad3d07e7cf23190084e5e42389fdd (patch) | |
tree | c0fedfe789b5899b8494f63f4a9dda4824ceea58 | |
parent | 3dc5f2a4a5c066a57ef0ce346be884b045ae73c9 (diff) |
Allow additional parameters to deployment
Change-Id: I760d0f0d54f83282d8556b74a588361669fa5375
Issue-ID: CLAMP-142
Signed-off-by: ac2550 <ac2550@intl.att.com>
4 files changed, 112 insertions, 2 deletions
diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html index 584d2f828..5e0c72504 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -195,7 +195,8 @@ <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 index 000000000..c0cd6c953 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/deploy_parameters.html @@ -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">×</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 index 000000000..3a5faf592 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/scripts/DeploymentCtrl.js @@ -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(); + }; + } + +]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js index 19906d967..588b61723 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/app.js +++ b/src/main/resources/META-INF/resources/designer/scripts/app.js @@ -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) { |