Skip to content

Commit

Permalink
Merge pull request #3785 from inception-project/bugfix/3784-Deleting-…
Browse files Browse the repository at this point in the history
…a-project-in-admin-view-should-not-redirect-to-project-overview

#3784 - Deleting a project in admin view should not redirect to project overview
  • Loading branch information
reckart authored Feb 5, 2023
2 parents 69a35b1 + ffeb605 commit cf08dc6
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.support.dialog.ChallengeResponseDialog;
import de.tudarmstadt.ukp.clarin.webanno.support.lambda.LambdaAjaxLink;
import de.tudarmstadt.ukp.clarin.webanno.ui.core.page.ProjectPageBase;

public class ProjectDangerZonePanel
extends Panel
Expand Down Expand Up @@ -80,12 +81,26 @@ private void actionDelete(AjaxRequestTarget aTarget)
private void actionDeletePerform(AjaxRequestTarget aTarget)
{
try {
boolean deletingCurrentProject = false;
var projectPageBase = findParent(ProjectPageBase.class);
if (projectPageBase != null) {
deletingCurrentProject = getModel().getObject()
.equals(projectPageBase.getProject());
}

projectService.removeProject(getModel().getObject());
setResponsePage(getApplication().getHomePage());

if (deletingCurrentProject) {
setResponsePage(getApplication().getHomePage());
}
else {
getModel().setObject(null);
aTarget.add(getPage());
}
}
catch (IOException e) {
LOG.error("Unable to remove project :" + ExceptionUtils.getRootCauseMessage(e));
error("Unable to remove project " + ":" + ExceptionUtils.getRootCauseMessage(e));
LOG.error("Error deleting project {}", getModel().getObject(), e);
error("Error deleting project:" + ExceptionUtils.getRootCauseMessage(e));
aTarget.addChildren(getPage(), IFeedback.class);
}
}
Expand Down

0 comments on commit cf08dc6

Please sign in to comment.