// jscs:disable safeContextKeyword
/*
 * LICENCE : CloudUnit is available under the Affero Gnu Public License GPL V3 : https://www.gnu.org/licenses/agpl-3.0.html
 *     but CloudUnit is licensed too under a standard commercial license.
 *     Please contact our sales team if you would like to discuss the specifics of our Enterprise license.
 *     If you are not sure whether the GPL is right for you,
 *     you can always test our software under the GPL and inspect the source code before you contact us
 *     about purchasing a commercial license.
 *
 *     LEGAL TERMS : "CloudUnit" is a registered trademark of Treeptik and can't be used to endorse
 *     or promote products derived from this project without prior written permission from Treeptik.
 *     Products or services derived from this software may not be called "CloudUnit"
 *     nor may "Treeptik" or similar confusing terms appear in their names without prior written permission.
 *     For any questions, contact us : contact@treeptik.fr
 */

(function() {
  'use strict';
  angular
    .module('webuiApp.editApplication')
    .component('jvmComponent', ConfigJVMComponent());

  function ConfigJVMComponent() {
    return {
      templateUrl: 'scripts/components/editApplication/settings/jvm/editApplication.settings.configureJVM.html',
      bindings: {
        application: '=app',
      },
      controller: ['$scope', 'JVMService', '$filter', ConfigJVMCtrl],
      controllerAs: 'configjvm',
    };
  }

  function ConfigJVMCtrl($scope, JVMService, $filter) {
    var vm = this;

    // Config JVM
    vm.jvmOptions = $filter('cleanEscapeSlashAndReverse')(vm.application.server.jvmOptions, true);
    vm.jvmMemory = vm.application.server.jvmMemory;
    vm.jvmRelease = vm.application.server.jvmRelease;
    vm.selectedJvmMemory = vm.jvmMemory;
    vm.selectedJvmRelease = vm.jvmRelease;

    vm.jvmMemorySizes = [512, 1024, 2048, 3072, 4096];
    vm.jvmReleases = ['jdk1.7.0_55', 'jdk1.8.0_25'];
    vm.saveConfigurationJVM = saveConfigurationJVM;

    // Function to save the JVM parameters
    function saveConfigurationJVM(applicationName, jvmMemory, jvmOptions, jvmRelease) {
      jvmOptions = $filter('cleanEscapeSlashAndReverse')(jvmOptions, false);
      JVMService.saveConfigurationJVM(applicationName, jvmMemory, jvmOptions, jvmRelease);
      $scope.$emit('workInProgress', { delay: 10000 });
    }

  }
})();

@@ -1344,17 +1344,17 @@
 ation: '
-=
+%3C
 app',%0A  
@@ -1580,32 +1580,533 @@
  vm.jvmOptions =
+ '';%0A    vm.jvmMemory = '';%0A    vm.jvmRelease = '';%0A    vm.selectedJvmMemory = '';%0A    vm.selectedJvmRelease = '';%0A%0A%0A    vm.jvmMemorySizes = %5B512, 1024, 2048, 3072, 4096%5D;%0A    vm.jvmReleases = %5B'jdk1.7.0_55', 'jdk1.8.0_25'%5D;%0A    vm.saveConfigurationJVM = saveConfigurationJVM;%0A%0A%0A    vm.$onChanges = function (changesObj) %7B%0A      if(changesObj.application) %7B%0A        if((changesObj.application.previousValue === undefined)%0A          %7C%7C vm.application !== undefined%0A        ) %7B%0A          vm.jvmOptions =
  $filter('cleanE
@@ -2165,24 +2165,30 @@
 ons, true);%0A
+      
     vm.jvmMe
@@ -2223,24 +2223,30 @@
 .jvmMemory;%0A
+      
     vm.jvmRe
@@ -2287,16 +2287,22 @@
 elease;%0A
+      
     vm.s
@@ -2334,24 +2334,30 @@
 Memory;%0A    
+   
+   
 vm.selectedJ
@@ -2387,167 +2387,31 @@
 se;%0A
-%0A
     
-vm.jvmMemorySizes = %5B512, 1024, 2048, 3072, 4096%5D;%0A    vm.jvmReleases = %5B'jdk1.7.0_55', 'jdk1.8.0_25'%5D;%0A    vm.saveConfigurationJVM = saveConfigurationJVM
+    %7D%0A      %7D%0A    %7D
 ;%0A%0A 

correct bug JVM Ctrl + R