Finish code for deleting private application

Also fixed adding from dockerhub searches not taking you back to apps
tab when clicking done
This commit is contained in:
Squidly271 2017-10-22 10:00:25 -04:00
parent 5cb416bcb3
commit 8875ea3893
3 changed files with 30 additions and 8 deletions

View File

@ -954,7 +954,7 @@ function dockerConvert(dockerID) {
$.post(URL,{action:'convert_docker',ID:dockerID},function(data) { $.post(URL,{action:'convert_docker',ID:dockerID},function(data) {
if (data) { if (data) {
myCloseAlert(); myCloseAlert();
templateURL = "AddContainer?xmlTemplate=default:" + myTrim(data); templateURL = "Apps/AddContainer?xmlTemplate=default:" + myTrim(data);
window.open(templateURL,"<?=$tabMode?>"); window.open(templateURL,"<?=$tabMode?>");
$("#Total").html(totalDisplayed); $("#Total").html(totalDisplayed);
} }
@ -1064,12 +1064,12 @@ function uninstallApp(application,humanName) {
}, },
function() { function() {
swal("Uninstalling "+humanName,"","info"); swal("Uninstalling "+humanName,"","info");
$.post(URL,{action:'uninstall_application',application:application}, function(data) { $.post(URL,{action:'uninstall_application',application:application}, function(data) {
if (data) { if (data) {
swal("","Uninstalled","success"); swal("","Uninstalled","success");
previousApps("InstalledApps",true); previousApps("InstalledApps",true);
} }
}); });
}); });
} }
} }
@ -1087,6 +1087,15 @@ function deletePrivateApp(path,name,author) {
closeOnConfirm: false, closeOnConfirm: false,
showLoaderOnConfirm: true, showLoaderOnConfirm: true,
html: true html: true
},
function() {
swal("Removing "+name,"","info");
$.post(URL,{action:'removePrivateApp',path:path},function(data) {
if (data) {
swal("","Removed","success");
location.reload();
}
});
}); });
} }

View File

@ -596,7 +596,7 @@ function my_display_apps($viewMode,$file,$pageNumber=1,$officialFlag=false,$sele
} }
} else { } else {
if ( $template['Private'] == "true" ) { if ( $template['Private'] == "true" ) {
$template['display_Uninstall'] = "<img class='ca_tooltip' src='{$communityPaths['deleteIcon']}' title='Remove Private Application' style='width:20px;height:20px;cursor:pointer' onclick='deletePrivateApp(&quot;{$template['Path']}&quot;,&quot;{$template['SortName']}&quot;,&quot;{$template['Author']}&quot;);'>"; $template['display_Uninstall'] = "<img class='ca_tooltip' src='{$communityPaths['deleteIcon']}' title='Remove Private Application' style='width:20px;height:20px;cursor:pointer' onclick='deletePrivateApp(&quot;{$template['Path']}&quot;,&quot;{$template['SortName']}&quot;,&quot;{$template['SortAuthor']}&quot;);'>";
} }
} }
$template['display_removable'] = $template['Removable'] ? "<img class='ca_tooltip' src='{$communityPaths['deleteIcon']}' title='Remove Application From List' style='width:20px;height:20px;cursor:pointer' onclick='removeApp(&quot;".$template['MyPath']."&quot;,&quot;".$template['Name']."&quot;);'>" : ""; $template['display_removable'] = $template['Removable'] ? "<img class='ca_tooltip' src='{$communityPaths['deleteIcon']}' title='Remove Application From List' style='width:20px;height:20px;cursor:pointer' onclick='removeApp(&quot;".$template['MyPath']."&quot;,&quot;".$template['Name']."&quot;);'>" : "";
@ -2037,5 +2037,18 @@ case 'checkStale':
echo "false"; echo "false";
} }
break; break;
#######################################
# #
# Removes a private app from the list #
# #
#######################################
case 'removePrivateApp':
$path = getPost("path",false);
if ( path ) {
@unlink($path);
}
echo "done";
break;
} }
?> ?>