diff options
author | Sébastien Determe <sd378r@intl.att.com> | 2018-03-23 08:21:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-23 08:21:14 +0000 |
commit | 4b3477b503f4effed467765e41026f247c565cbd (patch) | |
tree | fb7f1955885451ea4d0951389ffce5ee60a449b3 /src/main/resources | |
parent | 36647a6e6dedf4d4fb82da40ab8bc99cd137ad1d (diff) | |
parent | 0a9277ebddbad3d07e7cf23190084e5e42389fdd (diff) |
Merge "Allow additional parameters to deployment"
Diffstat (limited to 'src/main/resources')
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 83928a9d..8e2300f6 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -190,7 +190,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 00000000..c0cd6c95 --- /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 00000000..3a5faf59 --- /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 19906d96..588b6172 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) { |