Fix App Uninstall navigation

This commit is contained in:
Taylor Helsper 2022-07-22 21:58:06 -05:00
parent 971eec2b75
commit e2d52fee56
3 changed files with 16 additions and 3 deletions

View File

@ -846,6 +846,13 @@ def uninstall_app_page():
uninstall_app(app_name)
flash("Application Uninstalled", category="message")
r = request.args.get("return_page")
if r:
if r == "marketplace_app":
return redirect("/marketplace/{}".format(app_name))
elif r == "settings":
return redirect("/settings")
return redirect("/apps")
@mynode_settings.route("/settings/toggle-uploader")

View File

@ -40,11 +40,15 @@ function install(name, short_name) {
}
}
function uninstall(name, short_name) {
function uninstall(name, short_name, return_page="") {
if ( confirm("Are you sure you want to uninstall "+name+"? ") ) {
$('#loading_spinner_message').html("Uninstalling...");
$('#loading_spinner_overlay').fadeIn();
window.location.href='/settings/uninstall-app?app='+short_name;
r = ""
if (return_page != "") {
r = "&return_page="+return_page
}
window.location.href='/settings/uninstall-app?app='+short_name+r;
}
}

View File

@ -49,6 +49,8 @@
<div class="main_header">{{app.name}}</div>
{% include 'includes/message_display.html' %}
<div class="marketplace_app_page_container">
<div class="marketplace_app_page_block_header">&nbsp;</div>
<div class="marketplace_app_page_block_contents">
@ -72,7 +74,7 @@
<button class="ui-button ui-widget ui-corner-all mynode_button marketplace_app_page_button" onclick="reinstall('{{ app.name }}', '{{ app.short_name }}');">Reinstall</button>
{% endif %}
{% if app.can_uninstall %}
<button class="ui-button ui-widget ui-corner-all mynode_button marketplace_app_page_button uninstall_button" onclick="uninstall('{{ app.name }}', '{{ app.short_name }}');">Uninstall</button>
<button class="ui-button ui-widget ui-corner-all mynode_button marketplace_app_page_button uninstall_button" onclick="uninstall('{{ app.name }}', '{{ app.short_name }}', 'marketplace_app');">Uninstall</button>
{% endif %}
{% endif %}
{% else %}