Skip to content
Snippets Groups Projects
Commit 1f5f53bd authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix ucoin#10 crash on windows

parent aaf64dcd
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ module.exports = ($scope, $http, $state, BMA) => { ...@@ -7,6 +7,7 @@ module.exports = ($scope, $http, $state, BMA) => {
$scope.generated = ''; $scope.generated = '';
$scope.started = false; $scope.started = false;
$scope.message = 'configuration.create_root.need_a_try';
co(function *() { co(function *() {
try { try {
...@@ -19,12 +20,16 @@ module.exports = ($scope, $http, $state, BMA) => { ...@@ -19,12 +20,16 @@ module.exports = ($scope, $http, $state, BMA) => {
}); });
$scope.start = () => co(function *() { $scope.start = () => co(function *() {
try {
yield BMA.webmin.server.http.start(); yield BMA.webmin.server.http.start();
$scope.started = true; $scope.started = true;
yield BMA.webmin.server.sendConf({ yield BMA.webmin.server.sendConf({
conf: $scope.$parent.conf conf: $scope.$parent.conf
}); });
yield $scope.try(); yield $scope.try();
} catch (e) {
$scope.message = e.message;
}
}); });
$scope.stop = () => co(function *() { $scope.stop = () => co(function *() {
...@@ -33,8 +38,13 @@ module.exports = ($scope, $http, $state, BMA) => { ...@@ -33,8 +38,13 @@ module.exports = ($scope, $http, $state, BMA) => {
}); });
$scope.try = () => co(function *() { $scope.try = () => co(function *() {
try {
$scope.block = yield BMA.webmin.server.previewNext(); $scope.block = yield BMA.webmin.server.previewNext();
$scope.generated = $scope.block.raw; $scope.generated = $scope.block.raw;
$scope.message = '';
} catch (e) {
$scope.message = e.message;
}
}); });
$scope.accept = () => co(function *() { $scope.accept = () => co(function *() {
......
...@@ -2,5 +2,6 @@ module.exports = { ...@@ -2,5 +2,6 @@ module.exports = {
"server": "", // Empty server will use the browser current host "server": "", // Empty server will use the browser current host
"port": "", // Empty port will use the browser current port "port": "", // Empty port will use the browser current port
"default_port": 9220, "default_port": 9220,
"dev_autoconf": false "dev_autoconf": false,
"api_timeout": 10000 // 10 sec timeout
}; };
...@@ -14,7 +14,7 @@ module.exports = (angular) => { ...@@ -14,7 +14,7 @@ module.exports = (angular) => {
return function(params) { return function(params) {
return $q.when(Q.Promise((resolve, reject) => { return $q.when(Q.Promise((resolve, reject) => {
var config = { var config = {
timeout: 4000 timeout: conf.api_timeout
}, suffix = '', pkeys = [], queryParams = null; }, suffix = '', pkeys = [], queryParams = null;
if (typeof params == 'object') { if (typeof params == 'object') {
pkeys = _.keys(params); pkeys = _.keys(params);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
.card-action .card-action
pre.card-panel.teal.white-text.code.left-align.small(ng-show="generated") {{ generated }} pre.card-panel.teal.white-text.code.left-align.small(ng-show="generated") {{ generated }}
blockquote.card-panel.left-align(ng-show="!generated") {{ 'configuration.create_root.need_a_try' | translate }} blockquote.card-panel.left-align(ng-show="message") {{ message | translate }}
.card-action .card-action
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment