From 8c96a63b8556a1286bebb8435f667a3f1da5d988 Mon Sep 17 00:00:00 2001 From: CongLu Date: Fri, 6 Mar 2015 11:10:52 -0800 Subject: [PATCH] network_autofill+tab Change-Id: I6328e47cbfa953eb774cd906817a9dd16b99f4ff --- .../src/app/controllers/baseController.coffee | 3 +- .../app/controllers/wizardController.coffee | 37 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/v2.5/src/app/controllers/baseController.coffee b/v2.5/src/app/controllers/baseController.coffee index 39c2559..f980190 100755 --- a/v2.5/src/app/controllers/baseController.coffee +++ b/v2.5/src/app/controllers/baseController.coffee @@ -5,8 +5,9 @@ define(['angular' 'angularDragDrop' 'ngSpinner' 'ngBsDaterangepicker' + 'angularAnimate' ], (ng)-> 'use strict'; - ng.module('compass.controllers', ['ui.router','ngTable','ui.bootstrap','ngDragDrop', 'angularSpinner', 'ngBootstrap']); + ng.module('compass.controllers', ['ui.router','ngTable','ui.bootstrap','ngDragDrop', 'angularSpinner', 'ngBootstrap','ngAnimate']); ); \ No newline at end of file diff --git a/v2.5/src/app/controllers/wizardController.coffee b/v2.5/src/app/controllers/wizardController.coffee index 2024d0b..dc8cf1c 100644 --- a/v2.5/src/app/controllers/wizardController.coffee +++ b/v2.5/src/app/controllers/wizardController.coffee @@ -82,8 +82,8 @@ define(['./baseController'], ()-> $scope.commit = (sendRequest) -> wizardService.globalCommit($scope,sendRequest) ] - .controller 'networkCtrl', ['$scope', 'wizardService', 'ngTableParams', '$filter', '$modal', - ($scope, wizardService, ngTableParams, $filter, $modal) -> + .controller 'networkCtrl', ['$scope', 'wizardService', 'ngTableParams', '$filter', '$modal', '$timeout' + ($scope, wizardService, ngTableParams, $filter, $modal, $timeout) -> wizardService.networkInit($scope) wizardService.watchingTriggeredStep($scope) @@ -100,6 +100,13 @@ define(['./baseController'], ()-> hostname_rule = $("#hostname-rule").val() wizardService.fillHostname($scope, hostname_rule) + $scope.networkAlerts = [{ + msg: 'Autofill Done!' + }] + if alertFade + $timeout -> + $scope.networkAlerts = [] + , alertFade $scope.addInterface = (newInterface) -> wizardService.addInterface($scope, newInterface) @@ -137,6 +144,19 @@ define(['./baseController'], ()-> wizardService.displayDataInTable($scope, $scope.servers) ] + .directive 'ngKeypress', [-> + return (scope, element, attrs) -> + element.bind "keydown keypress", (event)-> + if event.which is 9 + current = attrs.position + result = current.split('_') + next = result[0]+"_"+(parseInt(result[1])+1) + if $("input[data-position=" + next + "]").length + $("input[data-position=" + next + "]").focus() + else + $(".btn-next").focus() + event.preventDefault(); + ] .controller 'partitionCtrl', ['$scope', 'wizardService', ($scope, wizardService) -> @@ -267,5 +287,16 @@ define(['./baseController'], ()-> wizardService.displayDataInTable($scope, $scope.servers) ] - + .animation '.fade-animation', [-> + return + enter: (element, done) -> + element.css('display', 'none') + element.fadeIn(500, done) + return -> + element.stop() + leave: (element,done) -> + element.fadeOut(500,done) + return -> + element.stop() + ] ) \ No newline at end of file