element-ui#Progress JavaScript Examples
The following examples show how to use
element-ui#Progress.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: update.js From akaunting with GNU General Public License v3.0 | 5 votes |
Vue.use(Progress);
Example #2
Source File: item.js From akaunting with GNU General Public License v3.0 | 5 votes |
// plugin setup
Vue.use(DashboardPlugin, Progress);
Example #3
Source File: update.js From akaunting with GNU General Public License v3.0 | 4 votes |
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)).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, {
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 => {
});
}
}
}
})
Example #4
Source File: item.js From akaunting with GNU General Public License v3.0 | 4 votes |
app = new Vue({
el: '#app',
mixins: [
Global
],
components: {
[Progress.name]: Progress,
AkauntingCarousel
},
mounted() {
this.onGetReviews('', 1);
},
data: function () {
return {
reviews: '',
faq: false,
installation: {
show: false,
steps: [],
steps_total: 0,
total: 0,
path: '',
version: '',
status: 'success',
html: ''
},
}
},
methods: {
onChangeCategory(category) {
let path = document.getElementById('category_page').value;
if (category) {
path += '/' + encodeURIComponent(category);
} else {
path = app_home;
}
location = path;
},
onGetReviews (path, page) {
axios.post(url + '/apps/' + app_slug + '/reviews', {
patth: path,
page: page
})
.then(response => {
this.reviews = response.data.html;
})
.catch(error => {
});
},
onShowFaq() {
this.faq = true;
},
onInstall(path, name, version) {
this.installation.show = true;
this.installation.total = 0;
this.installation.path = path;
this.installation.version = version;
axios.post(url + '/apps/steps', {
name: name,
version: version
})
.then(response => {
if (response.data.error) {
this.installation.status = 'exception';
this.installation.html = '<div class="text-danger">' + response.data.message + '</div>';
}
// Set steps
if (response.data.data) {
this.installation.steps = response.data.data;
this.installation.steps_total = this.installation.steps.length;
this.next();
}
})
.catch(error => {
});
},
next() {
let data = this.installation.steps.shift();
if (data) {
this.installation.total = (100 - ((this.installation.steps.length / this.installation.steps_total) * 100)).toFixed(0);
this.installation.html = '<span class="text-default"><i class="fa fa-spinner fa-spin update-spin"></i> ' + data['text'] + '</span> </br>';
axios.post(data.url, {
version: this.installation.version,
path: this.installation.path,
})
.then(response => {
if (response.data.error) {
this.installation.status = 'exception';
this.installation.html = '<div class="text-danger"><i class="fa fa-times update-error"></i> ' + response.data.message + '</div>';
}
if (response.data.success) {
this.installation.status = 'success';
}
if (response.data.data.path) {
this.installation.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 => {
});
}
}
}
})