-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0dadd3
commit bba0e50
Showing
8 changed files
with
229 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/** | ||
* First we will load all of this project's JavaScript dependencies which | ||
* includes Vue and other libraries. It is a great starting point when | ||
* building robust, powerful web applications using Vue and Laravel. | ||
*/ | ||
|
||
require('../../bootstrap'); | ||
|
||
import Vue from 'vue'; | ||
|
||
import Global from './../../mixins/global'; | ||
|
||
import {Progress} from 'element-ui'; | ||
|
||
Vue.use(Progress); | ||
|
||
const app = new Vue({ | ||
el: '#app', | ||
|
||
mixins: [ | ||
Global | ||
], | ||
|
||
components: { | ||
[Progress.name]: Progress, | ||
}, | ||
|
||
data: function () { | ||
return { | ||
changelog: { | ||
show:false, | ||
html: null | ||
}, | ||
update: { | ||
steps: [], | ||
steps_total: 0, | ||
total: 0, | ||
path: '', | ||
status: 'success', | ||
html: '' | ||
}, | ||
page: 'check', | ||
name: null, | ||
version: null | ||
} | ||
}, | ||
|
||
mounted() { | ||
if (document.getElementById('page') != null && document.getElementById('page').value == 'update') { | ||
this.steps(); | ||
} | ||
}, | ||
|
||
methods: { | ||
onChangelog() { | ||
axios.get(url + '/install/updates/changelog') | ||
.then(response => { | ||
this.changelog.show = true; | ||
this.changelog.html = response.data; | ||
}) | ||
.catch(e => { | ||
this.errors.push(e) | ||
}) | ||
.finally(function () { | ||
// always executed | ||
}); | ||
}, | ||
|
||
steps() { | ||
let name = document.getElementById('name').value; | ||
|
||
axios.post(url + '/install/updates/steps', { | ||
name: name, | ||
version: version | ||
}) | ||
.then(response => { | ||
if (response.data.error) { | ||
this.update.status = 'exception'; | ||
this.update.html = '<div class="text-danger">' + response.data.message + '</div>'; | ||
} | ||
|
||
// Set steps | ||
if (response.data.data) { | ||
this.update.steps = response.data.data; | ||
this.update.steps_total = this.update.steps.length; | ||
|
||
this.next(); | ||
} | ||
}) | ||
.catch(error => { | ||
}); | ||
}, | ||
|
||
next() { | ||
let data = this.update.steps.shift(); | ||
|
||
let name = document.getElementById('name').value; | ||
let alias = document.getElementById('alias').value; | ||
let version = document.getElementById('version').value; | ||
let installed = document.getElementById('installed').value; | ||
|
||
if (data) { | ||
this.update.total = (100 - ((this.update.steps.length / this.update.steps_total) * 100)); | ||
|
||
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, { | ||
name: name, | ||
alias: alias, | ||
version: version, | ||
installed: installed, | ||
path: this.update.path, | ||
}) | ||
.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>'; | ||
} | ||
|
||
if (response.data.success) { | ||
this.update.status = 'success'; | ||
} | ||
|
||
if (response.data.data.path) { | ||
this.update.path = response.data.data.path; | ||
} | ||
|
||
if (!response.data.error && !response.data.redirect) { | ||
let self = this; | ||
|
||
setTimeout(function() { | ||
self.next(); | ||
}, 800); | ||
} | ||
|
||
if (response.data.redirect) { | ||
window.location = response.data.redirect; | ||
} | ||
}) | ||
.catch(error => { | ||
}); | ||
} | ||
} | ||
} | ||
}); |
Oops, something went wrong.