Add per-project and per-swimlane task limits

This change allows projects and swimlanes to be configured with task limits that apply to their whole scope (i.e. all active tasks in a project or swimlane, respectively), as opposed to the usual per-column task limits.
This commit is contained in:
Andre Nathan
2020-02-26 01:26:31 -03:00
committed by GitHub
parent 542fd17891
commit c8a617cfcb
21 changed files with 161 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
<div id="board-container">
<div id="board-container"
class="<?= ($project['task_limit'] && $project['nb_active_tasks'] > $project['task_limit']) ? 'board-task-list-limit' : '' ?>">
<?php if (empty($swimlanes) || empty($swimlanes[0]['nb_columns'])): ?>
<p class="alert alert-error"><?= t('There is no column or swimlane activated in your project!') ?></p>
<?php else: ?>

View File

@@ -15,7 +15,11 @@
<?php endif ?>
<span title="<?= t('Task count') ?>" class="board-column-header-task-count swimlane-task-count-<?= $swimlane['id'] ?>">
(<?= $swimlane['nb_tasks'] ?>)
<?php if ($swimlane['task_limit']): ?>
(<?= $swimlane['nb_tasks'] ?>/<?= $swimlane['task_limit'] ?>)
<?php else: ?>
(<?= $swimlane['nb_tasks'] ?>)
<?php endif ?>
</span>
</th>
</tr>

View File

@@ -1,5 +1,5 @@
<!-- task row -->
<tr class="board-swimlane board-swimlane-tasks-<?= $swimlane['id'] ?>">
<tr class="board-swimlane board-swimlane-tasks-<?= $swimlane['id'] ?><?= $swimlane['task_limit'] && $swimlane['nb_tasks'] > $swimlane['task_limit'] ? ' board-task-list-limit' : '' ?>">
<?php foreach ($swimlane['columns'] as $column): ?>
<td class="
board-column-<?= $column['id'] ?>

View File

@@ -7,6 +7,9 @@
<?= $this->url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?>
<?php else: ?>
<?= $this->text->e($title) ?>
<?php if (! empty($project) && $project['task_limit'] && array_key_exists('nb_active_tasks', $project)): ?>
(<span><?= intval($project['nb_active_tasks']) ?></span> / <span title="<?= t('Task limit') ?>"><?= $this->text->e($project['task_limit']) ?></span>)
<?php endif ?>
<?php endif ?>
</span>
<?php if (! empty($description)): ?>

View File

@@ -14,7 +14,10 @@
<?= $this->form->text('identifier', $values, $errors, array('autofocus')) ?>
<p class="form-help"><?= t('The project identifier is optional and must be alphanumeric, example: MYPROJECT.') ?></p>
<?= $this->form->checkbox('per_swimlane_task_limits', t('Task limits apply to each swimlane individually'), 1, false) ?>
<?= $this->form->checkbox('per_swimlane_task_limits', t('Column task limits apply to each swimlane individually'), 1, false) ?>
<?= $this->form->label(t('Task limit'), 'task_limit') ?>
<?= $this->form->number('task_limit', $values, $errors) ?>
<?php if (count($projects_list) > 1): ?>
<?= $this->form->label(t('Create from another project'), 'src_project_id') ?>

View File

@@ -28,6 +28,9 @@
<?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 4)) ?>
<?= $this->form->checkbox('per_swimlane_task_limits', t('Task limits apply to each swimlane individually'), 1, $project['per_swimlane_task_limits'] == 1, '', array('tabindex' => 5)) ?>
<?= $this->form->label(t('Task limit'), 'task_limit') ?>
<?= $this->form->number('task_limit', $values, $errors, array('tabindex' => 6)) ?>
</fieldset>
<fieldset>
@@ -42,29 +45,29 @@
<div class="form-inline">
<?= $this->form->label(t('Project owner'), 'owner_id') ?>
<?= $this->form->select('owner_id', $owners, $values, $errors, array('tabindex="6"')) ?>
<?= $this->form->select('owner_id', $owners, $values, $errors, array('tabindex="7"')) ?>
</div>
</fieldset>
<fieldset>
<legend><?= t('Dates') ?></legend>
<?= $this->form->date(t('Start date'), 'start_date', $values, $errors, array('tabindex="7"')) ?>
<?= $this->form->date(t('End date'), 'end_date', $values, $errors, array('tabindex="8"')) ?>
<?= $this->form->date(t('Start date'), 'start_date', $values, $errors, array('tabindex="8"')) ?>
<?= $this->form->date(t('End date'), 'end_date', $values, $errors, array('tabindex="9"')) ?>
</fieldset>
<fieldset>
<legend><?= t('Priorities') ?></legend>
<?= $this->form->label(t('Default priority'), 'priority_default') ?>
<?= $this->form->number('priority_default', $values, $errors, array('tabindex="9"')) ?>
<?= $this->form->number('priority_default', $values, $errors, array('tabindex="10"')) ?>
<?= $this->form->label(t('Lowest priority'), 'priority_start') ?>
<?= $this->form->number('priority_start', $values, $errors, array('tabindex="10"')) ?>
<?= $this->form->number('priority_start', $values, $errors, array('tabindex="11"')) ?>
<?= $this->form->label(t('Highest priority'), 'priority_end') ?>
<?= $this->form->number('priority_end', $values, $errors, array('tabindex="11"')) ?>
<?= $this->form->number('priority_end', $values, $errors, array('tabindex="12"')) ?>
</fieldset>
<?= $this->modal->submitButtons(array('tabindex' => 12)) ?>
<?= $this->modal->submitButtons(array('tabindex' => 13)) ?>
</form>

View File

@@ -33,10 +33,12 @@
<?php endif ?>
<?php if ($project['per_swimlane_task_limits']): ?>
<li><?= t('Task limits are applied to each swimlane individually') ?></li>
<li><?= t('Column task limits are applied to each swimlane individually') ?></li>
<?php else: ?>
<li><?= t('Task limits are applied across swimlanes') ?></li>
<li><?= t('Column task limits are applied across swimlanes') ?></li>
<?php endif ?>
<li><?= t('Task limit: ') ?><?= $project['task_limit'] ? $project['task_limit'] : '∞' ?></li>
</ul>
<?php if (! empty($project['description'])): ?>

View File

@@ -10,5 +10,8 @@
<?= $this->form->label(t('Description'), 'description') ?>
<?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
<?= $this->form->label(t('Task limit'), 'task_limit') ?>
<?= $this->form->number('task_limit', $values, $errors, array('tabindex' => 3)) ?>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -11,5 +11,8 @@
<?= $this->form->label(t('Description'), 'description') ?>
<?= $this->form->textEditor('description', $values, $errors, array('tabindex' => 2)) ?>
<?= $this->form->label(t('Task limit'), 'task_limit') ?>
<?= $this->form->number('task_limit', $values, $errors, array('tabindex' => 3)) ?>
<?= $this->modal->submitButtons() ?>
</form>

View File

@@ -4,6 +4,7 @@
<thead>
<tr>
<th><?= t('Name') ?></th>
<th class="column-15"><?= t('Task limit') ?></th>
<th class="column-15"><?= t('Open tasks') ?></th>
<th class="column-15"><?= t('Closed tasks') ?></th>
</tr>
@@ -43,6 +44,9 @@
<?= $this->app->tooltipMarkdown($swimlane['description']) ?>
<?php endif ?>
</td>
<td>
<?= $swimlane['task_limit'] > 0 ? $swimlane['task_limit'] : '∞' ?>
</td>
<td>
<?= $swimlane['nb_open_tasks'] ?>
</td>