Allow columns to have a point limit

Summary:
Fixes T5885. This implements optional soft point limits for workboard columns, per traditional Kanban.

  - Allow columns to have a point limit set.
  - When a column has a point limit, show it in the header.
  - If a column has too many points in it, show the column and point count in red.

@chad, this could probably use some design tweaks. In particular:

  - I changed the color of "hidden" columns to avoid confusion with "overfull" columns. We might be able to find a better color.
  - UI hints for overfull columns might need adjustment.

(After T4427, we'll let you sum some custom field instead of total number of tasks, which is why this is called "points" rather than "number of tasks".)

Test Plan:
{F190914}

Note that:

  - "Pre-planning" has a limit, so it shows "4/12".
  - "Planning" has a limit and is overfull, so it shows "5 / 4".
  - Other columns do not have limits.
  - "Post-planning" is a hidden column. This might be too muted now.

Transactions:

{F190915}

Error messages / edit screen:

{F190916}

Reviewers: btrahan, chad

Reviewed By: btrahan

Subscribers: chad, epriestley

Maniphest Tasks: T5885

Differential Revision: https://secure.phabricator.com/D10276
This commit is contained in:
epriestley
2014-08-15 11:16:08 -07:00
parent eaacb4a511
commit 300910f462
12 changed files with 178 additions and 43 deletions

View File

@@ -18,9 +18,6 @@ JX.behavior('project-boards', function(config) {
var data = JX.Stratcom.getData(col);
var cards = finditems(col);
// Add the "empty" CSS class if the column has nothing in it.
JX.DOM.alterClass(col, 'project-column-empty', !cards.length);
// Update the count of tasks in the column header.
if (!data.countTagNode) {
data.countTagNode = JX.$(data.countTagID);
@@ -33,17 +30,34 @@ JX.behavior('project-boards', function(config) {
sum += 1;
}
JX.DOM.setContent(JX.$(data.countTagContentID), sum);
// TODO: This is a little bit hacky, but we don't have a PHUIX version of
// this element yet.
var over_limit = (data.pointLimit && (sum > data.pointLimit));
var display_value = sum;
if (data.pointLimit) {
display_value = sum + ' / ' + data.pointLimit;
}
JX.DOM.setContent(JX.$(data.countTagContentID), display_value);
var panel_map = {
'project-panel-empty': !cards.length,
'project-panel-over-limit': over_limit
};
var panel = JX.DOM.findAbove(col, 'div', 'workpanel');
for (var k in panel_map) {
JX.DOM.alterClass(panel, k, !!panel_map[k]);
}
var color_map = {
'phui-tag-shade-disabled': (sum === 0),
'phui-tag-shade-blue': (sum > 0)
'phui-tag-shade-blue': (sum > 0 && !over_limit),
'phui-tag-shade-red': (over_limit)
};
for (var k in color_map) {
JX.DOM.alterClass(data.countTagNode, k, color_map[k]);
JX.DOM.alterClass(data.countTagNode, k, !!color_map[k]);
}
}