Skip to content

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
geirkairam committed Oct 17, 2015
1 parent a7b5f4f commit ea4c101
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 59 deletions.
117 changes: 61 additions & 56 deletions src/js/controllers/dialog.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,75 @@
'use strict'
'use strict';

module.exports= function(app) {
app.controller('DialogController', function ($scope, $modalInstance, state, wizard, $interval) {
module.exports = function(app) {
app.controller('DialogController',
function($scope, $modalInstance, state, wizard, $interval) {

console.log(state);
console.log(state);

$scope.state = state;
$scope.wizard = wizard;
$scope.state.registerips = {
max: 4,
progress: 0
};
$scope.state.generatevpn = {
max: 4,
progress: 0
};
$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
$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);
};
//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
*/
$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);
//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"?
};
// show download cert and key tar file button or but everything in the "Download Config"?
};

$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.ok = function() {
$modalInstance.close($scope.selected.item);
};

$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};

if ($scope.state.ip.register) {
$scope.registerIPs();
}
if ($scope.state.ip.register) {
$scope.registerIPs();
}

if ($scope.wizard.internet.share && $scope.state.internet.vpn03.generate) {
$scope.generateVPN03CertAndKey();
if ($scope.wizard.internet.share &&
$scope.state.internet.vpn03.generate) {
$scope.generateVPN03CertAndKey();
}
}
});
);
};
6 changes: 3 additions & 3 deletions src/js/controllers/wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,21 +281,21 @@ module.exports = function(app) {

$scope.pow = Math.pow;

//TODO open dialog on submit if there are no errors
//TODO open dialog on submit if there are no errors
$scope.open = function() {
var modalInstance = $uibModal.open({
templateUrl: '/view/partials/dialog/dialog.html',
controller: 'DialogController',
resolve: {
state: function () {
state: function() {
return $scope.state;
},
wizard: function() {
return $scope.wizard;
}
}
});
}
};
}
]);
};

0 comments on commit ea4c101

Please sign in to comment.