Some bugfixes

Former-commit-id: 95af9a5f45798e949634b352b3a264353012714b
pull/10/head
Jens Pelzetter 2021-03-08 21:04:36 +01:00
parent e3df86ca21
commit 69f246f8a1
7 changed files with 49 additions and 12 deletions

View File

@ -11,6 +11,7 @@ import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.workflow.CircularTaskDependencyException;
import org.libreccm.workflow.Task;
import org.libreccm.workflow.TaskDependency;
import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.TaskRepository;
import org.libreccm.workflow.Workflow;
@ -19,6 +20,7 @@ import org.libreccm.workflow.WorkflowRepository;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
@ -757,7 +759,6 @@ public class ConfigurationWorkflowController {
}
final Task task = taskResult.get();
taskManager.removeTask(workflow, task);
taskRepo.delete(task);
return String.format(
"redirect:/%s/configuration/workflows/%s",
@ -1291,6 +1292,7 @@ public class ConfigurationWorkflowController {
workflow.getDescription()
)
);
model.setHasTasks(!workflow.getTasks().isEmpty());
model.setName(
globalizationHelper.getValueFromLocalizedString(workflow.getName())
);
@ -1309,6 +1311,10 @@ public class ConfigurationWorkflowController {
task.getDescription()
)
);
model.setHasDependencies(
!task.getBlockedTasks().isEmpty()
|| !task.getBlockingTasks().isEmpty()
);
model.setLabel(
globalizationHelper.getValueFromLocalizedString(
task.getLabel()

View File

@ -25,6 +25,8 @@ public class WorkflowTaskTemplateListModel {
private String description;
private boolean hasDependencies;
public long getTaskId() {
return taskId;
}
@ -57,4 +59,14 @@ public class WorkflowTaskTemplateListModel {
this.description = description;
}
public boolean getHasDependencies() {
return hasDependencies;
}
public void setHasDependencies(final boolean hasDependencies) {
this.hasDependencies = hasDependencies;
}
}

View File

@ -19,6 +19,8 @@ public class WorkflowTemplateListModel {
private String description;
private boolean hasTasks;
public long getWorkflowId() {
return workflowId;
}
@ -51,4 +53,12 @@ public class WorkflowTemplateListModel {
this.description = description;
}
public boolean getHasTasks() {
return hasTasks;
}
public void setHasTasks(boolean hasTasks) {
this.hasTasks = hasTasks;
}
}

View File

@ -229,6 +229,7 @@
</div>
</td>
<td class="del-col">
<c:if test="#{!task.hasDependencies}">
<libreccm:deleteDialog
actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/workflows/UUID-#{SelectedWorkflowTemplateModel.uuid}/tasks/UUID-#{task.uuid}/@remove"
buttonText="#{CmsAdminMessages['contentsection.configuration.workflow.tasks.remove.button.label']}"
@ -238,6 +239,7 @@
dialogTitle="#{CmsAdminMessages['contentsection.configuration.workflow.tasks.remove.dialog.title']}"
message="#{CmsAdminMessages.getMessage('contentsection.configuration.workflow.tasks.remove.dialog.message', [ContentSectionModel.sectionName, SelectedWorkflowTemplateModel.displayName, task.label])}"
/>
</c:if>
</td>
</tr>
</c:forEach>

View File

@ -159,6 +159,7 @@
</div>
</td>
<td class="del-col">
<c:if test="#{!workflowTemplate.hasTasks}">
<libreccm:deleteDialog
actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/workflows/UUID-#{workflowTemplate.uuid}/@delete"
buttonText="#{CmsAdminMessages['contentsection.configuration.workflows.delete_button.label']}"
@ -168,6 +169,7 @@
dialogTitle="#{CmsAdminMessages['contentsection.configuration.workflows.delete_dialog.title']}"
message="#{CmsAdminMessages.getMessage('contentsection.configuration.workflows.delete_dialog.message', [ContentSectionModel.sectionName, workflowTemplate.name])}"
/>
</c:if>
</td>
</tr>
</c:forEach>

View File

@ -117,7 +117,7 @@ table.contentsection-roles-table {
table.lifecycles-table,
table.workflows-table,
table.workflow-tasks-table {
table.wor{
td.info-col {
width: 3em;
}

View File

@ -24,9 +24,12 @@ import org.libreccm.core.CcmObject;
import javax.enterprise.context.RequestScoped;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import java.util.Optional;
import java.util.UUID;
import javax.transaction.Transactional;
/**
* Repository for {@link Workflow}s.
*
@ -63,6 +66,8 @@ public class WorkflowRepository extends AbstractEntityRepository<Long, Workflow>
workflow.setUuid(UUID.randomUUID().toString());
}
/**
* Find a {@link Workflow} by its UUID.
*