diff options
Diffstat (limited to 'src/main')
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 45b0c4b6..adcdf537 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -189,7 +189,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 a1e48a62..1d707c08 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/app.js +++ b/src/main/resources/META-INF/resources/designer/scripts/app.js @@ -366,7 +366,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"); @@ -993,6 +993,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) { |