mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Mooooar buttons (update view)
This commit is contained in:
parent
eab2e2c368
commit
52b4623222
2 changed files with 36 additions and 31 deletions
|
@ -47,37 +47,42 @@
|
|||
// System update & upgrade
|
||||
app.get('#/update', function (c) {
|
||||
c.api('PUT', '/update', {}, function(data) {
|
||||
c.view('update/update', data);
|
||||
c.view('update/update', data, function() {
|
||||
// Configure buttons behaviors
|
||||
$("button[data-upgrade]").on("click", function() {
|
||||
|
||||
var what = $(this).data("upgrade").toLowerCase();
|
||||
|
||||
// Upgrade all apps or the system
|
||||
|
||||
if ((what == "system") || (what == "system"))
|
||||
{
|
||||
var confirm_message = y18n.t('confirm_update_' + what);
|
||||
var api_url = '/upgrade?'+what;
|
||||
}
|
||||
|
||||
// Upgrade a specific apps
|
||||
|
||||
else
|
||||
{
|
||||
var confirm_message = y18n.t('confirm_update_specific_app', [what]);
|
||||
var api_url = '/upgrade/apps?app='+what;
|
||||
}
|
||||
|
||||
c.confirm(
|
||||
y18n.t('tools'),
|
||||
confirm_message,
|
||||
function(){
|
||||
c.api('PUT', api_url, {}, function(data) {
|
||||
c.redirect_to('#/tools/logs');
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Upgrade apps or packages
|
||||
app.get('#/upgrade/:type', function (c) {
|
||||
c.confirm(
|
||||
y18n.t('tools'),
|
||||
// confirm_update_apps and confirm_update_packages
|
||||
y18n.t('confirm_update_' + c.params['type'].toLowerCase()),
|
||||
function(){
|
||||
c.api('PUT', '/upgrade?'+c.params["type"], {}, function(data) {
|
||||
c.redirect_to('#/tools/logs');
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Upgrade a specific apps
|
||||
app.get('#/upgrade/apps/:app', function (c) {
|
||||
c.confirm(
|
||||
y18n.t('tools'),
|
||||
y18n.t('confirm_update_specific_app', [c.params['app']]),
|
||||
function(){
|
||||
c.api('PUT', '/upgrade/apps?app='+c.params['app'].toLowerCase(), {}, function(data) {
|
||||
c.redirect_to('#/tools/logs');
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Display journals list
|
||||
app.get('#/tools/logs', function (c) {
|
||||
c.api('GET', "/logs?limit=25&with_details", {}, function(categories) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
{{/system}}
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="#/upgrade/system" role="button" class="btn btn-success">{{t 'system_upgrade_all_packages_btn'}}</a>
|
||||
<button class="btn btn-success" data-upgrade="system">{{t 'system_upgrade_all_packages_btn'}}</button>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="panel-body">
|
||||
|
@ -37,14 +37,14 @@
|
|||
<div class="list-group">
|
||||
{{#apps}}
|
||||
<div class="list-group-item clearfix">
|
||||
<a href="#/upgrade/apps/{{id}}" role="button" class="btn btn-success pull-right">{{t 'system_upgrade_btn'}}</a>
|
||||
<button class="btn btn-success pull-right" data-upgrade="{{id}}">{{t 'system_upgrade_btn'}}</button>
|
||||
<h3 class="list-group-item-heading">{{label}} <small>{{id}}</small></h3>
|
||||
<p class="list-group-item-text">{{t 'from_to' current_version new_version}}</p>
|
||||
</div>
|
||||
{{/apps}}
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a role="button" href="#/upgrade/apps" class="btn btn-success">{{t 'system_upgrade_all_applications_btn'}}</a>
|
||||
<button class="btn btn-success" data-upgrade="apps">{{t 'system_upgrade_all_applications_btn'}}</button>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="panel-body">
|
||||
|
|
Loading…
Reference in a new issue