Propagate tools_update and tools_upgrade api changes

This commit is contained in:
Alexandre Aubin 2019-04-24 02:44:48 +02:00
parent 34f22ee7de
commit 27a07d0956
3 changed files with 8 additions and 32 deletions

View file

@ -49,23 +49,13 @@
// System update & upgrade
app.get('#/update', function (c) {
c.api('/update', function(data) {
var packagesLength = data.packages.length;
for(var i = 0; i < packagesLength; i++) {
data.packages[i].delayed = false;
// Check for special packages that need delayed upgrade.
if (["moulinette", "yunohost", "yunohost-admin", "ssowat", "python"].indexOf(data.packages[i].name) != -1) {
c.flash('warning', y18n.t('system_delayed_upgrade_warning', [data.packages[i].name]));
data.packages[i].delayed = true;
}
}
c.view('update/update', data);
}, 'PUT');
});
// Upgrade apps or packages
app.get('#/upgrade/:type', function (c) {
if (c.params['type'] !== 'apps' && c.params['type'] !== 'packages') {
if (c.params['type'] !== 'apps' && c.params['type'] !== 'system') {
c.flash('fail', y18n.t('unknown_argument', [c.params['type']]));
store.clear('slide');
c.redirect('#/update');
@ -76,16 +66,9 @@
// confirm_update_apps and confirm_update_packages
y18n.t('confirm_update_' + c.params['type'].toLowerCase()),
function(){
var endurl = '';
if (c.params['type'] == 'packages') {endurl = 'ignore_apps';}
else if (c.params['type'] == 'apps') {endurl = 'ignore_packages';}
c.api('/upgrade?'+endurl, function(data) {
// 'log' is a reserved name, maybe in handlebars
data.logs = data.log;
c.view('upgrade/upgrade', data);
c.api('/upgrade?'+c.params["type"], function(data) {
c.view('home', data);
}, 'PUT');
},
function(){
store.clear('slide');

View file

@ -88,7 +88,7 @@
"confirm_service_disable": "Are you sure you want to disable %s?",
"confirm_uninstall": "Are you sure you want to uninstall %s?",
"confirm_update_apps": "Are you sure you want to update all applications?",
"confirm_update_packages": "Are you sure you want to update all packages?",
"confirm_update_system": "Are you sure you want to update all system packages?",
"confirm_update_specific_app": "Are you sure you want to update %s?",
"confirm_upnp_enable": "Are you sure you want to enable UPnP?",
"confirm_upnp_disable": "Are you sure you want to disable UPnP?",
@ -306,8 +306,6 @@
"system": "System",
"system_apps": "Apps",
"system_apps_nothing": "There are no apps to upgrade.",
"system_delayed_upgrade": "Delayed upgrade",
"system_delayed_upgrade_warning": "<b>%s</b> will be upgraded automatically within the next hour.",
"system_packages": "Packages",
"system_packages_nothing": "There are no packages to upgrade.",
"system_update": "System update",

View file

@ -9,23 +9,18 @@
<div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-cube"></span> {{t 'system'}}</h2>
</div>
{{#if packages}}
{{#if system}}
<div class="list-group">
{{#packages}}
{{#system}}
<div class="list-group-item">
{{#if delayed}}
<span class="text-warning pull-right">
<span class="fa-warning"></span> {{t 'system_delayed_upgrade'}}
</span>
{{/if}}
<h3 class="list-group-item-heading">
{{name}} <small>{{fullname}}</small>
</h3>
</div>
{{/packages}}
{{/system}}
</div>
<div class="panel-footer">
<a href="#/upgrade/packages" role="button" class="btn btn-success">{{t 'system_upgrade_all_packages_btn'}}</a>
<a href="#/upgrade/system" role="button" class="btn btn-success">{{t 'system_upgrade_all_packages_btn'}}</a>
</div>
{{else}}
<div class="panel-body">