diff --git a/public/v1/js/ff/install/index.js b/public/v1/js/ff/install/index.js
index 29733b9cda..0caaf35b73 100644
--- a/public/v1/js/ff/install/index.js
+++ b/public/v1/js/ff/install/index.js
@@ -19,10 +19,7 @@
*/
-$(function () {
- "use strict";
- //var status = $('#status-box');
- // set HTML to "migrating...":
+document.addEventListener("DOMContentLoaded", (event) => {
console.log('Starting...');
startRunningCommands(0);
});
@@ -30,57 +27,81 @@ $(function () {
function startRunningCommands(index) {
console.log('Now in startRunningCommands with index' + index);
if (0 === index) {
- $('#status-box').html(' Running first command...');
+ document.querySelector('#status-box').innerHTML = ' Running first command...';
}
runCommand(index);
}
function runCommand(index) {
console.log('Now in runCommand(' + index + '): ' + runCommandUrl);
- $.post(runCommandUrl, {_token: token, index: parseInt(index)}).done(function (data) {
- if (data.error === false) {
- // increase index
- index++;
- if(data.hasNextCommand) {
- // inform user
- $('#status-box').html(' Just executed ' + data.previous + '...');
- console.log('Will call next command.');
- runCommand(index);
+ fetch(runCommandUrl, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({_token: token, index: parseInt(index)}),
+ })
+ .then(response => response.json())
+ .then(response => {
+ if (response.error === false) {
+ index++;
+ if (response.hasNextCommand) {
+ // inform user
+ document.querySelector('#status-box').innerHTML = ' Just executed ' + response.previous + '...';
+ console.log('Will call next command.');
+ runCommand(index);
+ } else {
+ completeDone();
+ console.log('Finished!');
+ }
} else {
- completeDone();
- console.log('Finished!');
+ displaySoftFail(response.errorMessage);
+ console.error(response);
}
- } else {
- displaySoftFail(data.errorMessage);
- console.error(data);
- }
-
- }).fail(function () {
- $('#status-box').html(' Command failed! See log files :(');
- });
+ })
}
function startMigration() {
console.log('Now in startMigration');
- $.post(migrateUrl, {_token: token}).done(function (data) {
- if (data.error === false) {
+
+ fetch(migrateUrl, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({_token: token}),
+ })
+ .then(response => response.json())
+ .then(response => {
+ if (response.error === false) {
// move to decrypt routine.
startDecryption();
} else {
- displaySoftFail(data.message);
+ displaySoftFail(response.message);
}
}).fail(function () {
- $('#status-box').html(' Migration failed! See log files :(');
+ document.querySelector('#status-box').innerHTML = ' Migration failed! See log files :(';
});
}
function startDecryption() {
console.log('Now in startDecryption');
- $('#status-box').html(' Setting up DB #2...');
- $.post(decryptUrl, {_token: token}).done(function (data) {
- if (data.error === false) {
+ document.querySelector('#status-box').innerHTML = ' Setting up DB #2...';
+ fetch(decryptUrl, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({_token: token}),
+ })
+ .then(response => response.json())
+ .then(response => {
+ if (response.error === false) {
// move to decrypt routine.
startPassport();
} else {
@@ -88,7 +109,7 @@ function startDecryption() {
}
}).fail(function () {
- $('#status-box').html(' Migration failed! See log files :(');
+ document.querySelector('#status-box').innerHTML = ' Migration failed! See log files :(';
});
}
@@ -96,16 +117,25 @@ function startDecryption() {
*
*/
function startPassport() {
- $('#status-box').html(' Setting up OAuth2...');
- $.post(keysUrl, {_token: token}).done(function (data) {
- if (data.error === false) {
+ document.querySelector('#status-box').innerHTML = ' Setting up OAuth2...';
+ fetch(keysUrl, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({_token: token}),
+ })
+ .then(response => response.json())
+ .then(response => {
+ if (response.error === false) {
startUpgrade();
} else {
displaySoftFail(data.message);
}
}).fail(function () {
- $('#status-box').html(' OAuth2 failed! See log files :(');
+ document.querySelector('#status-box').innerHTML = ' OAuth2 failed! See log files :(';
});
}
@@ -113,15 +143,24 @@ function startPassport() {
*
*/
function startUpgrade() {
- $('#status-box').html(' Upgrading database...');
- $.post(upgradeUrl, {_token: token}).done(function (data) {
- if (data.error === false) {
+ document.querySelector('#status-box').innerHTML = ' Upgrading database...';
+ fetch(upgradeUrl, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({_token: token}),
+ })
+ .then(response => response.json())
+ .then(response => {
+ if (response.error === false) {
startVerify();
} else {
displaySoftFail(data.message);
}
}).fail(function () {
- $('#status-box').html(' Upgrade failed! See log files :(');
+ document.querySelector('#status-box').innerHTML = ' Upgrade failed! See log files :(';
});
}
@@ -129,15 +168,24 @@ function startUpgrade() {
*
*/
function startVerify() {
- $('#status-box').html(' Verify database integrity...');
- $.post(verifyUrl, {_token: token}).done(function (data) {
- if (data.error === false) {
+ document.querySelector('#status-box').innerHTML = ' Verify database integrity...';
+ fetch(veifyUrl, {
+ method: 'POST',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({_token: token}),
+ })
+ .then(response => response.json())
+ .then(response => {
+ if (response.error === false) {
completeDone();
} else {
displaySoftFail(data.message);
}
}).fail(function () {
- $('#status-box').html(' Verification failed! See log files :(');
+ document.querySelector('#status-box').innerHTML = ' Verification failed! See log files :(';
});
}
@@ -145,14 +193,14 @@ function startVerify() {
*
*/
function completeDone() {
- $('#status-box').html(' Installation + upgrade complete! Wait to be redirected...');
+ document.querySelector('#status-box').innerHTML = ' Installation + upgrade complete! Wait to be redirected...';
setTimeout(function () {
window.location = homeUrl;
}, 3000);
}
function displaySoftFail(message) {
- $('#status-box').html(' ' + message + '
Please read the ' +
- '' +
- 'documentation about this, and upgrade by hand.');
+ document.querySelector('#status-box').innerHTML = ' ' + message + '
Please read the ' +
+ '' +
+ 'documentation about this, and upgrade by hand.';
}
diff --git a/resources/views/install/index.twig b/resources/views/install/index-old.twig
similarity index 89%
rename from resources/views/install/index.twig
rename to resources/views/install/index-old.twig
index 2635f4817a..e3c0a668b8 100644
--- a/resources/views/install/index.twig
+++ b/resources/views/install/index-old.twig
@@ -21,6 +21,6 @@
var runCommandUrl = '{{ route('installer.runCommand') }}';
var homeUrl = '{{ route('flush') }}';
-
+
{% endblock %}
diff --git a/resources/views/install/index.blade.php b/resources/views/install/index.blade.php
new file mode 100644
index 0000000000..1ad8bb5049
--- /dev/null
+++ b/resources/views/install/index.blade.php
@@ -0,0 +1,104 @@
+
+
+
Installation and update
The upgrade and installation is ongoing. Please track its progress through the box below.
+