feat: Rework task management in PlanBundle
- Introduced migration Version_0_13_0 to update task schema: - Changed start_date and end_date to DATE type, truncating time. - Added new columns: task_kind, definition_of_done, planned_work. - Removed parent_id and its index, replacing with a dependency graph. - Created new tables: plan_task_dependencies and plan_task_raci, including a join table for stakeholders. - Updated Version_0_4_0 migration to remove references to parent_id. - Refactored TaskModel to return tasks as flat rows with dependencies and RACI assignments. - Modified task table view to display tasks without hierarchical structure, adding badges for milestones and phases. - Enhanced task form to include dependencies and RACI roles, with appropriate macros for rendering. - Updated task list view to reflect new task structure and display status based on task kind. - Added new validation constraints for task dependencies and dates, ensuring no cycles or self-references. - Removed obsolete ValidTaskParent validation as parent-child relationships are no longer supported. - Updated translations to reflect changes in task management and new fields. - Revised documentation to describe new task handling and features.
This commit is contained in:
1 parent
8696acd01c
commit
8268fad886
33 files changed
+1454
-251
No files matched your search
@@ -50,8 +50,7 @@
|
||||
{% for row in taskTree %}
|
||||
{% set task = row.task %}
|
||||
{% set canEdit = not readOnly and securityHasEntityAccess(taskPermissions['plan:tasks:editown']|default(false), taskPermissions['plan:tasks:editother']|default(false), task.createdBy) %}
|
||||
{% set childCount = taskTree|filter(r => r.task.parent and r.task.parent.id == task.id)|length %}
|
||||
<tr class="plan-task" data-task-id="{{ task.id }}" data-depth="{{ row.depth }}">
|
||||
<tr class="plan-task" data-task-id="{{ task.id }}">
|
||||
<td class="plan-col-pictogram text-center">
|
||||
{% set taskTypeIcon = plan_item_type_icon('task', task.type) %}
|
||||
{% if taskTypeIcon %}<i class="{{ taskTypeIcon }} plan-item-type-icon" style="font-size: 24px;" aria-hidden="true"></i>{% endif %}
|
||||
@@ -60,19 +59,16 @@
|
||||
{{ plan_item_type_name('task', task.type) ?? 'mautic.plan.description_item.type.unknown'|trans({'%key%': task.type}) }}
|
||||
</td>
|
||||
<td class="plan-col-name">
|
||||
<span style="display: inline-block; padding-left: {{ row.depth * 24 }}px;">
|
||||
{% if row.depth > 0 %}
|
||||
<i class="ri-corner-down-right-line text-muted" title="{{ 'mautic.plan.task.subtask_of'|trans({'%parent%': task.parent.name}) }}"></i>
|
||||
{% endif %}
|
||||
{% if canEdit %}
|
||||
<a href="{{ path('plan_task_action', {'objectAction': 'edit', 'objectId': task.id, 'returnTo': 'plan'}) }}" data-toggle="ajax">{{ task.name }}</a>
|
||||
{% else %}
|
||||
{{ task.name }}
|
||||
{% endif %}
|
||||
{% if childCount > 0 %}
|
||||
<span class="text-muted small" title="{{ 'mautic.plan.task.subtasks'|trans }}">({{ childCount }})</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
{% if canEdit %}
|
||||
<a href="{{ path('plan_task_action', {'objectAction': 'edit', 'objectId': task.id, 'returnTo': 'plan'}) }}" data-toggle="ajax">{{ task.name }}</a>
|
||||
{% else %}
|
||||
{{ task.name }}
|
||||
{% endif %}
|
||||
{% if task.taskKind == constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Milestone') %}
|
||||
<span class="label label-success" title="{{ 'mautic.plan.task.kind.milestone'|trans }}">{{ 'mautic.plan.task.kind.milestone_short'|trans }}</span>
|
||||
{% elseif task.taskKind == constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Phase') %}
|
||||
<span class="label label-primary" title="{{ 'mautic.plan.task.kind.phase'|trans }}">{{ 'mautic.plan.task.kind.phase_short'|trans }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="plan-col-description text-muted">
|
||||
{# Same 10-line clamp and read-more as the Description tab; URLs become links. #}
|
||||
@@ -81,9 +77,14 @@
|
||||
'id': 'plan-task-desc-' ~ task.id,
|
||||
}) }}
|
||||
</td>
|
||||
<td class="plan-col-date">{{ task.startDate ? dateToFull(task.startDate) : '' }}</td>
|
||||
<td class="plan-col-date">{{ task.endDate ? dateToFull(task.endDate) : '' }}</td>
|
||||
<td class="plan-col-status"><span class="label {{ task.status.labelClass }}">{{ task.status.labelKey|trans }}</span></td>
|
||||
<td class="plan-col-date">{{ task.startDate ? task.startDate|date('Y-m-d') : '' }}</td>
|
||||
<td class="plan-col-date">{{ task.endDate ? task.endDate|date('Y-m-d') : '' }}</td>
|
||||
<td class="plan-col-status">
|
||||
{# A phase has no status of its own — skip the column value. #}
|
||||
{% if task.taskKind != constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Phase') %}
|
||||
<span class="label {{ task.status.labelClass }}">{{ task.status.labelKey|trans }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@@ -10,6 +10,57 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{# The dependencies and the RACI rows: the same editable, sortable rows as the plan form's
|
||||
collections. Adding, removing and reordering is handled by Assets/js/plan.js through the
|
||||
plan-collection-* classes. #}
|
||||
{% macro dependency_row(dependency) %}
|
||||
<li class="plan-collection-row list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-1 text-center">
|
||||
<span class="plan-collection-handle text-muted" title="{{ 'mautic.plan.task.dependency.drag'|trans }}" style="cursor: move;">
|
||||
<i class="ri-draggable ri-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<div class="row">
|
||||
<div class="col-md-7">{{ form_row(dependency.dependsOn) }}</div>
|
||||
<div class="col-md-5">{{ form_row(dependency.dependencyType) }}</div>
|
||||
</div>
|
||||
{{ form_widget(dependency.position) }}
|
||||
</div>
|
||||
<div class="col-xs-1 text-right">
|
||||
<button type="button" class="btn btn-ghost btn-sm plan-collection-remove" title="{{ 'mautic.plan.task.dependency.remove'|trans }}">
|
||||
<i class="ri-delete-bin-line"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro raci_row(raci) %}
|
||||
<li class="plan-collection-row list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-1 text-center">
|
||||
<span class="plan-collection-handle text-muted" title="{{ 'mautic.plan.task.raci.drag'|trans }}" style="cursor: move;">
|
||||
<i class="ri-draggable ri-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<div class="row">
|
||||
<div class="col-md-4">{{ form_row(raci.role) }}</div>
|
||||
<div class="col-md-8">{{ form_row(raci.stakeholders) }}</div>
|
||||
</div>
|
||||
{{ form_widget(raci.position) }}
|
||||
</div>
|
||||
<div class="col-xs-1 text-right">
|
||||
<button type="button" class="btn btn-ghost btn-sm plan-collection-remove" title="{{ 'mautic.plan.task.raci.remove'|trans }}">
|
||||
<i class="ri-delete-bin-line"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
{{ form_start(form) }}
|
||||
<div class="box-layout">
|
||||
@@ -28,18 +79,70 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ form_row(form.description) }}
|
||||
{{ form_row(form.definitionOfDone) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 height-auto">
|
||||
<div class="pr-lg pl-lg pt-md pb-md">
|
||||
{{ form_row(form.status) }}
|
||||
{{ form_row(form.plan) }}
|
||||
{{ form_row(form.taskKind) }}
|
||||
{{ form_row(form.startDate) }}
|
||||
{{ form_row(form.endDate) }}
|
||||
{{ form_row(form.plan) }}
|
||||
{{ form_row(form.parent) }}
|
||||
<p class="text-muted small">{{ 'mautic.plan.task.parent.help'|trans }}</p>
|
||||
{% if form.status is defined %}
|
||||
{{ form_row(form.status) }}
|
||||
{% else %}
|
||||
{# A phase has no status of its own: its state comes from its tasks. #}
|
||||
<p class="text-muted small">{{ 'mautic.plan.task.kind.phase_status_note'|trans }}</p>
|
||||
{% endif %}
|
||||
{{ form_row(form.plannedWork) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
<div class="pa-md">
|
||||
<div class="col-md-12">
|
||||
{# Dependencies: several edges, each another task of the plan with the relation type. #}
|
||||
<div class="plan-collection plan-task-dependencies"
|
||||
data-prototype="{{ _self.dependency_row(form.dependencies.vars.prototype)|e('html_attr') }}"
|
||||
data-prototype-name="__dependency__">
|
||||
<h4 class="mt-lg mb-sm">{{ 'mautic.plan.task.field.dependencies'|trans }}</h4>
|
||||
{{ form_errors(form.dependencies) }}
|
||||
<p class="text-muted plan-collection-empty{% if form.dependencies|length > 0 %} hide{% endif %}">
|
||||
{{ 'mautic.plan.task.dependency.empty'|trans }}
|
||||
</p>
|
||||
<ul class="list-group plan-collection-list">
|
||||
{% for dependency in form.dependencies %}
|
||||
{{ _self.dependency_row(dependency) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<button type="button" class="btn btn-ghost plan-collection-add">
|
||||
<i class="ri-add-line"></i> {{ 'mautic.plan.task.dependency.add'|trans }}
|
||||
</button>
|
||||
</div>
|
||||
{% do form.dependencies.setRendered %}
|
||||
|
||||
{# RACI: one row per role, several stakeholders per role, picked from the plan's. #}
|
||||
<div class="plan-collection plan-task-raci"
|
||||
data-prototype="{{ _self.raci_row(form.raci.vars.prototype)|e('html_attr') }}"
|
||||
data-prototype-name="__raci__">
|
||||
<h4 class="mt-lg mb-sm">{{ 'mautic.plan.task.field.raci'|trans }}</h4>
|
||||
{{ form_errors(form.raci) }}
|
||||
<p class="text-muted plan-collection-empty{% if form.raci|length > 0 %} hide{% endif %}">
|
||||
{{ 'mautic.plan.task.raci.empty'|trans }}
|
||||
</p>
|
||||
<ul class="list-group plan-collection-list">
|
||||
{% for raci in form.raci %}
|
||||
{{ _self.raci_row(raci) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<button type="button" class="btn btn-ghost plan-collection-add">
|
||||
<i class="ri-add-line"></i> {{ 'mautic.plan.task.raci.add'|trans }}
|
||||
</button>
|
||||
</div>
|
||||
{% do form.raci.setRendered %}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_row(form.buttons) }}
|
||||
{# render_rest is false, so the hidden CSRF token must be rendered explicitly. #}
|
||||
{{ form_widget(form._token) }}
|
||||
{{ form_end(form, {'render_rest': false}) }}
|
||||
{% endblock %}
|
||||
@@ -117,9 +117,16 @@
|
||||
{% set description = item.description|default('')|striptags|trim %}
|
||||
{{ (description|length > 120 ? description|slice(0, 120) ~ '…' : description)|plan_linkify }}
|
||||
</td>
|
||||
<td>{{ item.startDate ? dateToFull(item.startDate) : '' }}</td>
|
||||
<td>{{ item.endDate ? dateToFull(item.endDate) : '' }}</td>
|
||||
<td><span class="label {{ item.status.labelClass }}">{{ item.status.labelKey|trans }}</span></td>
|
||||
<td>{{ item.startDate ? item.startDate|date('Y-m-d') : '' }}</td>
|
||||
<td>{{ item.endDate ? item.endDate|date('Y-m-d') : '' }}</td>
|
||||
<td>
|
||||
{# A phase has no status of its own: its state comes from its tasks. #}
|
||||
{% if item.taskKind != constant('MauticPlugin\\PlanBundle\\Entity\\TaskKind::Phase') %}
|
||||
<span class="label {{ item.status.labelClass }}">{{ item.status.labelKey|trans }}</span>
|
||||
{% else %}
|
||||
<span class="label label-primary">{{ 'mautic.plan.task.kind.phase_short'|trans }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in new issue
Block a user