From 487c4b633cd15387862fe0e3456bc89fee6a82fa Mon Sep 17 00:00:00 2001 From: maria Date: Sun, 18 Oct 2015 01:05:59 +0200 Subject: [PATCH] Issue #9: get ip addresses automatically add ip confirmation field to ui --- src/js/controllers/dialog.js | 58 ++++++++++++++++++++++++---- src/view/partials/dialog/dialog.html | 17 ++++++++ 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/src/js/controllers/dialog.js b/src/js/controllers/dialog.js index acde627..a274286 100644 --- a/src/js/controllers/dialog.js +++ b/src/js/controllers/dialog.js @@ -2,7 +2,7 @@ module.exports = function(app) { app.controller('DialogController', - function($scope, $modalInstance, state, wizard, $interval) { + function($scope, $modalInstance, state, wizard, $interval, $http) { console.log(state); @@ -17,21 +17,63 @@ module.exports = function(app) { progress: 0 }; - $scope.registerIPs = function() { + $scope.reserveIPs = function() { //call register ips - //render confirmation code field - //check confirmation code - //write ips to wizard config + $http.get('/nls/locale-de.json').then(function(response) { + //success callback + //TODO handle error in response + //render confirmation code field + $scope.state.registerips.reserved = true; + $scope.state.registerips.message = { + type:'info', + value: 'success.reserveip' + } + $scope.state.registerips.progress++; + }, function(response){ + //error callback + console.log(response); + $scope.state.registerips.message = { + type:'error', + value: 'error.reserveip' + } + }); //just some testcode - $interval(function() { + /*$interval(function() { if ($scope.state.registerips.progress < $scope.state.registerips.max) { $scope.state.registerips.progress++; } - },1500,$scope.state.registerips.max); + },3500,$scope.state.registerips.max);*/ }; + //check confirmation code + $scope.confirmIPs = function() { + $scope.state.registerips.progress++; + $http.get('gibs/nich.html').then( + function(response) { + //succuess callback + + //TODO check for error in response + + $scope.state.registerips.progress++; + + $scope.state.registerips.message = { + type:'success', + value: 'success.reserveip' + } + //write ips to wizard config + }, function(response) { + //error callback + console.log(response); + $scope.state.registerips.message = { + type:'error', + value: 'error.confirmip' + } + } + ); + } + $scope.generateVPN03CertAndKey = function() { /* * since this is not handled on the client we need a service on the router @@ -63,7 +105,7 @@ module.exports = function(app) { }; if ($scope.state.ip.register) { - $scope.registerIPs(); + $scope.reserveIPs(); } if ($scope.wizard.internet.share && diff --git a/src/view/partials/dialog/dialog.html b/src/view/partials/dialog/dialog.html index 3c4e9da..da9519d 100644 --- a/src/view/partials/dialog/dialog.html +++ b/src/view/partials/dialog/dialog.html @@ -11,6 +11,16 @@

Register IPs

{{state.registerips.progress}} / {{state.registerips.max}} +
+ + Message: + {{state.registerips.message.value}} +
+
+ + +
@@ -21,6 +31,13 @@

Generate VPN Certificate and Key

{{state.generatevpn.progress}} / {{state.generatevpn.max}} +