diff --git a/databases/static/databases/databases.js b/databases/static/databases/databases.js index 6ca0b2c46..f36c839b9 100755 --- a/databases/static/databases/databases.js +++ b/databases/static/databases/databases.js @@ -842,11 +842,23 @@ app.controller('OptimizeMysql', function ($scope, $http) { app.controller('mysqlupdate', function ($scope, $http, $timeout) { $scope.cyberPanelLoading = true; $scope.dbLoading = true; - $scope.installlogs = true; + $scope.modeSecInstallBox = true; + $scope.modsecLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.modSecSuccessfullyInstalled = true; + $scope.installationFailed = true; $scope.Upgardemysql = function () { $scope.dbLoading = false; $scope.installform = true; + $scope.modSecNotifyBox = true; + $scope.modeSecInstallBox = false; + $scope.modsecLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.modSecSuccessfullyInstalled = true; + $scope.installationFailed = true; url = "/dataBases/upgrademysqlnow"; @@ -867,16 +879,27 @@ app.controller('mysqlupdate', function ($scope, $http, $timeout) { function ListInitialData(response) { $scope.cyberhosting = true; if (response.data.status === 1) { - $scope.installlogs = false; + $scope.modSecNotifyBox = true; + $scope.modeSecInstallBox = false; + $scope.modsecLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.modSecSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.statusfile = response.data.tempStatusPath $timeout(getRequestStatus, 1000); } else { - new PNotify({ - title: 'Error!', - text: response.data.error_message, - type: 'error' - }); + $scope.errorMessage = response.data.error_message; + + $scope.modSecNotifyBox = false; + $scope.modeSecInstallBox = true; + $scope.modsecLoading = true; + $scope.failedToStartInallation = false; + $scope.couldNotConnect = true; + $scope.modSecSuccessfullyInstalled = true; } } @@ -892,5 +915,84 @@ app.controller('mysqlupdate', function ($scope, $http, $timeout) { } - $scope.getRequestStatus + function getRequestStatus() { + + $scope.modSecNotifyBox = true; + $scope.modeSecInstallBox = false; + $scope.modsecLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.modSecSuccessfullyInstalled = true; + $scope.installationFailed = true; + + url = "/dataBases/upgrademysqlstatus"; + + var data = { + statusfile: $scope.statusfile + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.abort === 0) { + + $scope.modSecNotifyBox = true; + $scope.modeSecInstallBox = false; + $scope.modsecLoading = false; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + $scope.modSecSuccessfullyInstalled = true; + $scope.installationFailed = true; + + $scope.requestData = response.data.requestStatus; + $timeout(getRequestStatus, 1000); + } else { + // Notifications + $timeout.cancel(); + $scope.modSecNotifyBox = false; + $scope.modeSecInstallBox = false; + $scope.modsecLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = true; + + $scope.requestData = response.data.requestStatus; + + if (response.data.installed === 0) { + $scope.installationFailed = false; + $scope.errorMessage = response.data.error_message; + } else { + $scope.modSecSuccessfullyInstalled = false; + $timeout(function () { + $window.location.reload(); + }, 3000); + } + + } + + } + + function cantLoadInitialDatas(response) { + + $scope.modSecNotifyBox = false; + $scope.modeSecInstallBox = false; + $scope.modsecLoading = true; + $scope.failedToStartInallation = true; + $scope.couldNotConnect = false; + $scope.modSecSuccessfullyInstalled = true; + $scope.installationFailed = true; + + + } + + } }); \ No newline at end of file diff --git a/databases/templates/databases/Updatemysql.html b/databases/templates/databases/Updatemysql.html index 8e0749327..91dcf2ff1 100644 --- a/databases/templates/databases/Updatemysql.html +++ b/databases/templates/databases/Updatemysql.html @@ -19,7 +19,7 @@
+ src="{% static 'images/loading.gif' %}">
{% trans "Failed to start installation, Error message: " %} {$ errorMessage + $}
+{% trans "Could not connect. Please refresh this page." %}
+{% trans "Installation failed." %} {$ errorMessage $}
+{% trans "CSF successfully installed, refreshing page in 3 seconds.." %}
+