diff --git a/bower.json b/bower.json index c512b45..30a4a95 100644 --- a/bower.json +++ b/bower.json @@ -12,7 +12,7 @@ "license": "MIT", "dependencies": { "angular": "~1.4.6", - "angular-bootstrap": "~0.13.4", + "angular-bootstrap": "~0.14.1", "angular-leaflet-directive": "~0.8.8", "angular-translate": "~2.8.0", "angular-jsonrpc-client": "~0.0.2", diff --git a/gulpfile.js b/gulpfile.js index 6cd215e..86e5ca6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,7 +3,9 @@ var gulp = require('gulp'); var buildDir = './gh-pages/'; gulp.task('build', function() { - gulp.src('src/index.*').pipe(gulp.dest(buildDir)); + gulp.src([ + 'src/**', + ]).pipe(gulp.dest(buildDir)); }); gulp.task('build:vendor', function() { diff --git a/src/index.html b/src/index.html index c6055ba..be7359a 100644 --- a/src/index.html +++ b/src/index.html @@ -23,6 +23,8 @@ + + @@ -694,6 +696,8 @@

{{ 'save' | translate }} + + diff --git a/src/index.js b/src/index.js index d591454..1d9423c 100644 --- a/src/index.js +++ b/src/index.js @@ -6,9 +6,9 @@ var wizard = angular.module('WizardApp', [ wizard.controller('WizardCtrl', [ '$scope', 'leafletData', '$http', '$filter', 'downloadFile', '$translate', - 'jsonrpc', + 'jsonrpc', '$uibModal', function($scope, leafletData, $http, $filter, downloadFile, $translate, - jsonrpc) { + jsonrpc, $uibModal) { $scope.changeLang = function() { $translate.use($scope.selectedLanguage); @@ -282,6 +282,22 @@ wizard.controller('WizardCtrl', [ ); }; + //TODO open dialog on submit if there are no errors + $scope.open = function() { + var modalInstance = $uibModal.open({ + templateUrl: 'partials/dialog/dialog.html', + controller: 'DialogController', + resolve: { + state: function () { + return $scope.state; + }, + wizard: function() { + return $scope.wizard; + } + } + }); + } + $scope.pow = Math.pow; } diff --git a/src/partials/dialog/dialog.html b/src/partials/dialog/dialog.html new file mode 100644 index 0000000..3c4e9da --- /dev/null +++ b/src/partials/dialog/dialog.html @@ -0,0 +1,31 @@ + + + diff --git a/src/partials/dialog/dialog.js b/src/partials/dialog/dialog.js new file mode 100644 index 0000000..e77a178 --- /dev/null +++ b/src/partials/dialog/dialog.js @@ -0,0 +1,66 @@ +angular.module('WizardApp').controller('DialogController', function ($scope, $modalInstance, state, wizard, $interval) { + + console.log(state); + + $scope.state = state; + $scope.wizard = wizard; + $scope.state.registerips = { + max: 4, + progress: 0 + }; + $scope.state.generatevpn = { + max: 4, + progress: 0 + }; + + $scope.registerIPs = function() { + //call register ips + //render confirmation code field + //check confirmation code + //write ips to wizard config + + //just some testcode + $interval(function() { + if ($scope.state.registerips.progress < $scope.state.registerips.max) { + $scope.state.registerips.progress++; + } + },1500,$scope.state.registerips.max); + }; + + $scope.generateVPN03CertAndKey = function() { + /* + * since this is not handled on the client we need a service on the router + * that perfomrs the following tasks and reports a status + * + * ask vpn server to generate cert and key + * download file + * untar file and copy cert and key to correct location + * write file location to config file + */ + + //just some testcode + $interval(function() { + if ($scope.state.generatevpn.progress < $scope.state.generatevpn.max) { + $scope.state.generatevpn.progress++; + } + },1200,$scope.state.registerips.max); + + // show download cert and key tar file button or but everything in the "Download Config"? + }; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + + if ($scope.state.ip.register) { + $scope.registerIPs(); + } + + if ($scope.wizard.internet.share && $scope.state.internet.vpn03.generate) { + $scope.generateVPN03CertAndKey(); + } +});