From b58ea7a34c3a1aadd531ba1570c8cc4c77046ac2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 14 Oct 2019 04:04:24 +0200 Subject: [PATCH] We don't need all those cancel callbacks, just staying on the page where we are is fine... --- src/js/yunohost/controllers/apps.js | 31 ++-------------------- src/js/yunohost/controllers/backup.js | 8 +----- src/js/yunohost/controllers/domains.js | 21 ++------------- src/js/yunohost/controllers/firewall.js | 9 ------- src/js/yunohost/controllers/postinstall.js | 2 -- src/js/yunohost/controllers/services.js | 3 --- src/js/yunohost/controllers/tools.js | 16 ----------- src/js/yunohost/controllers/users.js | 3 --- 8 files changed, 5 insertions(+), 88 deletions(-) diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 312dddc3..28b2c08a 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -490,6 +490,8 @@ if ((is_safe_for_install_color === "warning") || (is_safe_for_install_color === "danger")) { + // Disable the pacman while we ask for confirmation + $('div.loader').remove(); c.confirm( y18n.t("applications"), y18n.t("confirm_install_app_"+is_safe_for_install_color), @@ -499,10 +501,6 @@ app_infos.manifest, c.params ); - }, - function(){ - $('div.loader').remove(); - c.redirect_to('#/apps/install', {slide:false}); } ); } @@ -591,10 +589,6 @@ c.flash('fail', y18n.t('app_install_custom_no_manifest')); c.redirect_to('#/apps/install', {slide:false}); }); - }, - function(){ - c.flash('warning', y18n.t('app_install_cancel')); - c.redirect_to('#/apps/install'); } ); }); @@ -608,9 +602,6 @@ c.api('DELETE', '/apps/'+ c.params['app'], {}, function() { // http://api.yunohost.org/#!/app/app_remove_delete_4 c.redirect_to('#/apps'); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app'], {slide:false}); } ); }); @@ -673,9 +664,6 @@ c.api('DELETE', '/access?'+c.serialize(params), params, function(data) { c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false}); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false}); } ); }); @@ -693,9 +681,6 @@ c.api('DELETE', '/access?'+c.serialize(params), params, function(data) { c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false}); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false}); } ); }); @@ -713,9 +698,6 @@ c.api('PUT', '/access', params, function() { c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false}); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false}); } ); }); @@ -743,9 +725,6 @@ c.api('POST', '/access', params, function() { c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false}); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false}); } ); }); @@ -759,9 +738,6 @@ c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() { c.redirect_to('#/apps/'+ c.params['app'], {slide:false}); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app'], {slide:false}); } ); }); @@ -823,9 +799,6 @@ c.api('PUT', '/apps/' + c.params['app'] + '/changeurl', params, function(data) { // Call changeurl API c.redirect_to('#/apps/'+ c.params['app']); }); - }, - function() { - c.redirect_to('#/apps/'+ c.params['app'] + '/changeurl', {slide:false}); } ); }); diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js index 197960ed..0c97d740 100644 --- a/src/js/yunohost/controllers/backup.js +++ b/src/js/yunohost/controllers/backup.js @@ -78,10 +78,7 @@ c.api('POST', '/backup/restore/'+c.params['archive'], params, function(data) { c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive']); }); - }, this, c), - function(){ - c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false}); - } + }, this, c) ); }); @@ -94,9 +91,6 @@ c.api('DELETE', '/backup/archives/'+c.params['archive'], {}, function(data) { c.redirect_to('#/backup/'+ c.params['storage']); }); - }, - function(){ - c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false}); } ); }); diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js index 488f170d..b9cf8d37 100644 --- a/src/js/yunohost/controllers/domains.js +++ b/src/js/yunohost/controllers/domains.js @@ -211,9 +211,6 @@ c.api('POST', '/domains/cert-install/' + c.params['domain'], {}, function(data) { c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); }); - }, - function(){ - c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); } ); }); @@ -227,9 +224,6 @@ c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed", {}, function(data) { c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); }); - }, - function(){ - c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); } ); }); @@ -243,9 +237,6 @@ c.api('POST', '/domains/cert-renew/' + c.params['domain'] + "?force", {}, function(data) { c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); }); - }, - function(){ - c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); } ); }); @@ -259,9 +250,6 @@ c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed&force", {}, function(data) { c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); }); - }, - function(){ - c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false}); } ); }); @@ -276,10 +264,8 @@ c.api('DELETE', '/domains/'+ c.params['domain'], {}, function(data) { c.redirect_to('#/domains'); }); - }, - function(){ - c.redirect_to('#/domains/' + c.params["domain"], {slide:false}); - }) + } + ); }); // Set default domain @@ -305,9 +291,6 @@ var refreshDomain = window.setTimeout(function(){ c.redirect_to('#/domains'); }, 15000); - }, - function(){ - c.redirect_to('#/domains', {slide:false}); } ); } diff --git a/src/js/yunohost/controllers/firewall.js b/src/js/yunohost/controllers/firewall.js index 6550fb41..5ccd5964 100644 --- a/src/js/yunohost/controllers/firewall.js +++ b/src/js/yunohost/controllers/firewall.js @@ -47,9 +47,6 @@ c.api('GET', '/firewall/upnp', params, function(data) { c.redirect_to('#/tools/firewall'); }); - }, - function(){ - c.redirect_to('#/tools/firewall', {slide: false}); } ); }); @@ -135,9 +132,6 @@ c.params['connection'], c.params['action'] ); - }, - function(){ - c.redirect_to('#/tools/firewall', {slide: false}); } ); }); @@ -154,9 +148,6 @@ c.params['connection'], c.params['action'] ); - }, - function(){ - c.redirect_to('#/tools/firewall', {slide: false}); } ); }); diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js index a255154d..b2c5cc05 100644 --- a/src/js/yunohost/controllers/postinstall.js +++ b/src/js/yunohost/controllers/postinstall.js @@ -92,8 +92,6 @@ c.api('POST', '/postinstall', params, function(data) { c.redirect_to('#/login'); }); - }, - function(){ } ); } else { diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js index a7b252a9..3ed25951 100644 --- a/src/js/yunohost/controllers/services.js +++ b/src/js/yunohost/controllers/services.js @@ -121,9 +121,6 @@ else { c.redirect_to('#/services/'+ c.params['service'], {slide: false}); } - }, - function(){ - c.redirect_to('#/services/'+ c.params['service'], {slide: false}); } ); }); diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js index bf563adc..6b895765 100644 --- a/src/js/yunohost/controllers/tools.js +++ b/src/js/yunohost/controllers/tools.js @@ -61,9 +61,6 @@ c.api('PUT', '/upgrade?'+c.params["type"], {}, function(data) { c.redirect_to('#/tools/logs'); }); - }, - function(){ - c.redirect_to('#/update', {slide: false}); } ); }); @@ -77,9 +74,6 @@ c.api('PUT', '/upgrade/apps?app='+c.params['app'].toLowerCase(), {}, function(data) { c.redirect_to('#/tools/logs'); }); - }, - function(){ - c.redirect_to('#/update', {slide: false}); } ); }); @@ -239,10 +233,6 @@ // Force scrollTop on page load $('html, body').scrollTop(0); }, false); - - }, - function(){ - c.redirect_to('#/tools/reboot', {slide: false}); } ); } @@ -338,9 +328,6 @@ c.api('POST', '/migrations/migrate?skip&targets=' + c.params['migration_id'], {}, function(data) { c.redirect_to('#/tools/migrations', {slide: false}); }); - }, - function(){ - c.redirect_to('#/tools/migrations', {slide: false}); } ); }); @@ -417,9 +404,6 @@ c.api('DELETE', '/appslists', {'name' : c.params['appslist']}, function() { c.redirect_to('#/tools/appslists'); }); - }, - function() { - c.redirect_to('#/tools/appslists/'+ c.params['appslist'], {slide: false}); } ); }); diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js index 61a59fd1..e66aa2c0 100644 --- a/src/js/yunohost/controllers/users.js +++ b/src/js/yunohost/controllers/users.js @@ -206,9 +206,6 @@ c.api('DELETE', '/users/'+ c.params['user'], params, function(data) { c.redirect_to('#/users'); }); - }, - function(){ - c.redirect_to('#/users/'+ c.params['user'], {slide: false}); } );