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

Fix: show the error during sync if one occurs

parent 91decd51
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
var co = require('co');
module.exports = ($scope, $http, $state, $timeout, $stateParams, BMA, UIUtils) => {
module.exports = ($scope, $http, $state, $timeout, $stateParams, $translate, BMA, UIUtils) => {
let syncWS = BMA.webmin.ws();
......@@ -38,17 +38,18 @@ module.exports = ($scope, $http, $state, $timeout, $stateParams, BMA, UIUtils) =
$scope.synchronizing = true;
return co(function *() {
let sp = $scope.checked_host.split(':');
let translatedErr = yield $translate('err.sync.interrupted');
syncWS.on(undefined, (data) => {
if (data.type == 'sync') {
$scope.down_percent = 100;
$scope.apply_percent = 100;
$scope.sync_failed = data.value;
let errorMessage = data.msg && (data.msg.message || data.msg);
errorMessage = translatedErr + ' « ' + errorMessage + ' »';
if (data.value === true) {
$state.go('index');
} else {
$timeout(() => {
window.location.href = "";
}, 500);
$state.go('error', { err: errorMessage });
}
} else {
let changed = true;
......
......@@ -12,6 +12,7 @@
"err.unknown": "Unknown error",
"err.connection": "Could not connect to node",
"err.back_index": "Get back to previous screen",
"err.sync.interrupted": "Sync interrupted because the following error occured:",
"index.message.loading": "Loading...",
"index.message.current_block": "Current block {{ number }}",
"configuration.init.choose.title": "Initialization",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment