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: {
|
||||
onChangelog() {
|
||||
axios.get(url + '/install/updates/changelog')
|
||||
.then(response => {
|
||||
async onChangelog() {
|
||||
let changelog_promise = Promise.resolve(axios.get(url + '/install/updates/changelog'));
|
||||
|
||||
changelog_promise.then(response => {
|
||||
this.changelog.show = true;
|
||||
this.changelog.html = response.data;
|
||||
})
|
||||
@ -71,14 +72,15 @@ const app = new Vue({
|
||||
});
|
||||
},
|
||||
|
||||
steps() {
|
||||
async steps() {
|
||||
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,
|
||||
version: version
|
||||
})
|
||||
.then(response => {
|
||||
}));
|
||||
|
||||
steps_promise.then(response => {
|
||||
if (response.data.error) {
|
||||
this.update.status = 'exception';
|
||||
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 name = document.getElementById('name').value;
|
||||
@ -105,18 +107,19 @@ const app = new Vue({
|
||||
let installed = document.getElementById('installed').value;
|
||||
|
||||
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>';
|
||||
|
||||
axios.post(data.url, {
|
||||
let step_promise = Promise.resolve(axios.post(data.url, {
|
||||
name: name,
|
||||
alias: alias,
|
||||
version: version,
|
||||
installed: installed,
|
||||
path: this.update.path,
|
||||
})
|
||||
.then(response => {
|
||||
}));
|
||||
|
||||
step_promise.then(response => {
|
||||
if (response.data.error) {
|
||||
this.update.status = 'exception';
|
||||
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) {
|
||||
let self = this;
|
||||
|
||||
setTimeout(function() {
|
||||
self.next();
|
||||
}, 800);
|
||||
this.next();
|
||||
}.bind(this), 800);
|
||||
}
|
||||
|
||||
if (response.data.redirect) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user