This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit 12096f1de1124f0c77020ecb93263dcd30729f2a Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 16 10:22:33 2015 +0200 hostpage: only fields for the current connection are shown in form --- bower.json | 1 - static/js/controllers/hostPageCtrl.js | 42 +++++++++++++---------------------- static/js/mumApp.js | 2 +- views/hostpage.html | 13 +++++------ 4 files changed, 21 insertions(+), 37 deletions(-) diff --git a/bower.json b/bower.json index dfcc7f0..0e80c92 100644 --- a/bower.json +++ b/bower.json @@ -7,7 +7,6 @@ "angular-toastr": "0.4.2", "angular-route": "~1.2.28", "angular-bootstrap": "~0.12.1", - "angular-sanitize": "~1.2.28", "angular-file-upload": "~1.1.5" }, "resolutions": { diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 041632d..8376b82 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -404,7 +404,7 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI }; }); -mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $templateCache, $route, conf_conn_args, FileUploader) { +mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, conf_conn_args, FileUploader) { $scope.uploader = new FileUploader({ url: '/upload' }); @@ -412,9 +412,14 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo $scope.conf_conn_args = conf_conn_args; /* {'addr_host': val, 'modname': val, 'current_config': val - 'loaded_conn_mods': ...} */ - - $scope.loaded_conn_mods = $scope.loaded_conn_mods; /* { + 'loaded_conn_mods': + { + modname:{param1:type ,param2:type}, + ... + } + } */ + + /*$scope.loaded_conn_mods = $scope.loaded_conn_mods; /* { mod_name: { 'class_name': val, => the name of the class to instanciate @@ -434,6 +439,11 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo $scope.keys_list = []; + $scope.show_form = function(param_name){ + //alert(JSON.stringify($scope.conf_conn_args.loaded_conn_mods[$scope.conf_conn_args.modname].params)); + return $scope.conf_conn_args.loaded_conn_mods[$scope.conf_conn_args.modname].hasOwnProperty(param_name); + } + $rootScope.$broadcast("sendViaWs", JSON.stringify({"GET_KEYS_LIST": ""})); $scope.$on("keysList", function (event, args) { @@ -551,26 +561,4 @@ mumApp.controller('ModalBlockInstanceCtrl', function ($scope, $rootScope, $modal $scope.cancel = function () { $modalInstance.close(); }; -}); -/* -mumApp.directive("formLoader", ['$compile', '$templateCache', function ($compile, $templateCache) { - - var getTemplate = function(data) { - // use data to determine which template to use - var templateid = 'foo'; - var template = $templateCache.get(templateid); - return template; - } - - return { - templateUrl: 'views/partials/template.html', - scope: {data: '='}, - restrict: 'E', - link: function(scope, element) { - var template = getTemplate(scope.data); - - element.html(template); - $compile(element.contents())(scope); - } - }; -}]);*/ \ No newline at end of file +}); \ No newline at end of file diff --git a/static/js/mumApp.js b/static/js/mumApp.js index 42bcc3d..c2e3afa 100644 --- a/static/js/mumApp.js +++ b/static/js/mumApp.js @@ -1,4 +1,4 @@ -var mumApp = angular.module('mumApp', ['angularFileUpload', 'ngSanitize', 'ngRoute', 'ui.bootstrap', 'toastr']); +var mumApp = angular.module('mumApp', ['angularFileUpload', 'ngRoute', 'ui.bootstrap', 'toastr']); mumApp.factory('DataHosts', function(){ return {Items: []}; diff --git a/views/hostpage.html b/views/hostpage.html index b56c6c0..a737f66 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -246,7 +246,7 @@ <button ng-click="item.upload(item, '\keys')">upload</button> </li> </ul>--> - <div class="row"> + <div class="row" ng-show="show_form('private_key')"> <div class="col-xs-3"> <label for="private_key">Select a private key</label> <select class="form-control input-sm" id="private_key" @@ -254,7 +254,7 @@ ng-options="key as key for key in keys_list"></select> </div> </div> - <div class="row"> + <div class="row" ng-show="show_form('private_key')"> <div class="col-xs-3"> <form action="/upload" method="post" enctype="multipart/form-data"> <label for="upload_key">Or upload a new key couple:</label> @@ -263,27 +263,24 @@ </form> </div> </div> - <div class="row"> + <div class="row" ng-show="show_form('port')"> <div class="col-xs-2"> <label for="port">Port used</label> <input type="number" id="port" min="0" ng-model="port"> </div> </div> - <div class="row"> + <div class="row" ng-show="show_form('username')"> <div class="col-xs-3"> <label for="usrname">Login</label> <input type="text" id="usrname" ng-model="username"/> </div> </div> - <div class="row"> + <div class="row" ng-show="show_form('password')"> <div class="col-xs-3"> <label for="password">Password</label> <input type="password" id="password" ng-model="password"/> </div> </div> - - - <!--<div ng-include=" 'templateForm.html' "></div>--> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="cancel()">Close</button> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.