Update progress bar added asyn
This commit is contained in:
parent
790644d9fd
commit
86c06e27a1
33
resources/assets/js/views/install/update.js
vendored
33
resources/assets/js/views/install/update.js
vendored
@ -57,9 +57,10 @@ const app = new Vue({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onChangelog() {
|
async onChangelog() {
|
||||||
axios.get(url + '/install/updates/changelog')
|
let changelog_promise = Promise.resolve(axios.get(url + '/install/updates/changelog'));
|
||||||
.then(response => {
|
|
||||||
|
changelog_promise.then(response => {
|
||||||
this.changelog.show = true;
|
this.changelog.show = true;
|
||||||
this.changelog.html = response.data;
|
this.changelog.html = response.data;
|
||||||
})
|
})
|
||||||
@ -71,14 +72,15 @@ const app = new Vue({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
steps() {
|
async steps() {
|
||||||
let name = document.getElementById('name').value;
|
let name = document.getElementById('name').value;
|
||||||
|
|
||||||
axios.post(url + '/install/updates/steps', {
|
let steps_promise = Promise.resolve(axios.post(url + '/install/updates/steps', {
|
||||||
name: name,
|
name: name,
|
||||||
version: version
|
version: version
|
||||||
})
|
}));
|
||||||
.then(response => {
|
|
||||||
|
steps_promise.then(response => {
|
||||||
if (response.data.error) {
|
if (response.data.error) {
|
||||||
this.update.status = 'exception';
|
this.update.status = 'exception';
|
||||||
this.update.html = '<div class="text-danger">' + response.data.message + '</div>';
|
this.update.html = '<div class="text-danger">' + response.data.message + '</div>';
|
||||||
@ -96,7 +98,7 @@ const app = new Vue({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
next() {
|
async next() {
|
||||||
let data = this.update.steps.shift();
|
let data = this.update.steps.shift();
|
||||||
|
|
||||||
let name = document.getElementById('name').value;
|
let name = document.getElementById('name').value;
|
||||||
@ -105,18 +107,19 @@ const app = new Vue({
|
|||||||
let installed = document.getElementById('installed').value;
|
let installed = document.getElementById('installed').value;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.update.total = (100 - ((this.update.steps.length / this.update.steps_total) * 100)).toFixed(0);
|
this.update.total = parseInt((100 - ((this.update.steps.length / this.update.steps_total) * 100)).toFixed(0));
|
||||||
|
|
||||||
this.update.html = '<span class="text-default"><i class="fa fa-spinner fa-spin update-spin"></i> ' + data['text'] + '</span> </br>';
|
this.update.html = '<span class="text-default"><i class="fa fa-spinner fa-spin update-spin"></i> ' + data['text'] + '</span> </br>';
|
||||||
|
|
||||||
axios.post(data.url, {
|
let step_promise = Promise.resolve(axios.post(data.url, {
|
||||||
name: name,
|
name: name,
|
||||||
alias: alias,
|
alias: alias,
|
||||||
version: version,
|
version: version,
|
||||||
installed: installed,
|
installed: installed,
|
||||||
path: this.update.path,
|
path: this.update.path,
|
||||||
})
|
}));
|
||||||
.then(response => {
|
|
||||||
|
step_promise.then(response => {
|
||||||
if (response.data.error) {
|
if (response.data.error) {
|
||||||
this.update.status = 'exception';
|
this.update.status = 'exception';
|
||||||
this.update.html = '<div class="text-danger"><i class="fa fa-times update-error"></i> ' + response.data.message + '</div>';
|
this.update.html = '<div class="text-danger"><i class="fa fa-times update-error"></i> ' + response.data.message + '</div>';
|
||||||
@ -131,11 +134,9 @@ const app = new Vue({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!response.data.error && !response.data.redirect) {
|
if (!response.data.error && !response.data.redirect) {
|
||||||
let self = this;
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
self.next();
|
this.next();
|
||||||
}, 800);
|
}.bind(this), 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.data.redirect) {
|
if (response.data.redirect) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user