Example of WIP Validation in ASP.NET MVC Kanban Control
This sample demonstrates the work in progress validation capabilities of the Kanban component, enabling workflow constraints to be applied and monitored for improved task management and process control.
To Do
In Progress
In Review
Done
Validate Constraints
<template id="kanban-col-todo"><span class="ui-kanban-col-icon ui-kanban-col-todo"></span>To Do</template>
<template id="kanban-col-progress"><span class="ui-kanban-col-icon ui-kanban-col-progress"></span>In Progress</template>
<template id="kanban-col-review"><span class="ui-kanban-col-icon ui-kanban-col-review"></span>In Review</template>
<template id="kanban-col-done"><span class="ui-kanban-col-icon ui-kanban-col-done"></span>Done</template>
@Html.UiKanban(new UiKanbanOptions
{
Id = "wipBoard",
DataSource = (IEnumerable<object>)ViewData["DataSource"],
KeyField = "Status",
CardSettings = new UiKanbanCardSettings { HeaderField = "Id", ContentField = "Summary", TagsField = "Tags", GrabberField = "Cls" },
Columns = new List<UiKanbanColumn>
{
new UiKanbanColumn { KeyField = "Open", HeaderText = "To Do", Template = "#kanban-col-todo" },
new UiKanbanColumn { KeyField = "InProgress", HeaderText = "In Progress", Template = "#kanban-col-progress", MinCount = 1, MaxCount = 3 },
new UiKanbanColumn { KeyField = "Testing, Validate", HeaderText = "In Review", Template = "#kanban-col-review" },
new UiKanbanColumn { KeyField = "Close", HeaderText = "Done", Template = "#kanban-col-done" }
},
SwimlaneSettings = new UiKanbanSwimlaneSettings { KeyField = "Assignee" },
ConstraintType = UiKanbanConstraintType.Column,
Height = "auto",
AriaLabel = "Task board"
})
<div class="demo-property-panel">
<h3>Validate Constraints</h3>
<div class="demo-property-row"><label for="wipType">Type</label><select id="wipType"><option>Column</option><option>Swimlane</option></select></div>
<div class="demo-property-row"><label for="wipColumn">Columns</label><select id="wipColumn"><option value="Open">To Do</option><option value="InProgress" selected>In Progress</option><option value="Testing">In Review</option><option value="Close">Done</option></select></div>
<div class="demo-property-row"><label for="wipMin">MinCount</label><input id="wipMin" type="number" min="0" value="1" /></div>
<div class="demo-property-row"><label for="wipMax">MaxCount</label><input id="wipMax" type="number" min="0" value="3" /></div>
<div class="demo-property-row"><button type="button" id="wipValidate">Validate</button></div>
</div>
<script>
(function () {
document.getElementById('wipValidate').addEventListener('click', function () {
var board = window.Lumen.get('wipBoard');
board.setConstraintType(document.getElementById('wipType').value);
board.setColumnLimits(document.getElementById('wipColumn').value, {
minCount: document.getElementById('wipMin').value,
maxCount: document.getElementById('wipMax').value
});
});
}());
</script>
<template id="kanban-col-todo"><span class="ui-kanban-col-icon ui-kanban-col-todo"></span>To Do</template>
<template id="kanban-col-progress"><span class="ui-kanban-col-icon ui-kanban-col-progress"></span>In Progress</template>
<template id="kanban-col-review"><span class="ui-kanban-col-icon ui-kanban-col-review"></span>In Review</template>
<template id="kanban-col-done"><span class="ui-kanban-col-icon ui-kanban-col-done"></span>Done</template>
<style>
.ui-kanban-col-icon { align-items: center; border-radius: 3px; color: #fff; display: inline-flex; font-size: 11px; height: 16px; justify-content: center; margin-right: 8px; width: 16px; }
.ui-kanban-col-todo { background: #2563eb; }
.ui-kanban-col-progress { background: #f59e0b; }
.ui-kanban-col-review { background: #9c27b0; }
.ui-kanban-col-done { background: #43a047; }
.ui-kanban-col-todo::before { content: "\2630"; }
.ui-kanban-col-progress::before { content: "\2731"; }
.ui-kanban-col-review::before { content: "\25C9"; }
.ui-kanban-col-done::before { content: "\2714"; }
</style>
<style>
.ui-kanban-card-grabber.sf-low { background: #7ed321; }
.ui-kanban-card-grabber.sf-normal { background: #f5c518; }
.ui-kanban-card-grabber.sf-critical { background: #9c27b0; }
.ui-kanban-card-grabber.sf-breaker { background: #e53935; }
</style>
@Html.UiKanban(new UiKanbanOptions
{
Id = "wipBoard",
DataSource = (IEnumerable<object>)ViewData["DataSource"],
KeyField = "Status",
CardSettings = new UiKanbanCardSettings { HeaderField = "Id", ContentField = "Summary", TagsField = "Tags", GrabberField = "Cls" },
Columns = new List<UiKanbanColumn>
{
new UiKanbanColumn { KeyField = "Open", HeaderText = "To Do", Template = "#kanban-col-todo" },
new UiKanbanColumn { KeyField = "InProgress", HeaderText = "In Progress", Template = "#kanban-col-progress", MinCount = 1, MaxCount = 3 },
new UiKanbanColumn { KeyField = "Testing, Validate", HeaderText = "In Review", Template = "#kanban-col-review" },
new UiKanbanColumn { KeyField = "Close", HeaderText = "Done", Template = "#kanban-col-done" }
},
SwimlaneSettings = new UiKanbanSwimlaneSettings { KeyField = "Assignee" },
ConstraintType = UiKanbanConstraintType.Column,
Height = "auto",
AriaLabel = "Task board"
})
<div class="demo-property-panel">
<h3>Validate Constraints</h3>
<div class="demo-property-row"><label for="wipType">Type</label><select id="wipType"><option>Column</option><option>Swimlane</option></select></div>
<div class="demo-property-row"><label for="wipColumn">Columns</label><select id="wipColumn"><option value="Open">To Do</option><option value="InProgress" selected>In Progress</option><option value="Testing">In Review</option><option value="Close">Done</option></select></div>
<div class="demo-property-row"><label for="wipMin">MinCount</label><input id="wipMin" type="number" min="0" value="1" /></div>
<div class="demo-property-row"><label for="wipMax">MaxCount</label><input id="wipMax" type="number" min="0" value="3" /></div>
<div class="demo-property-row"><button type="button" id="wipValidate">Validate</button></div>
</div>
<script>
(function () {
document.getElementById('wipValidate').addEventListener('click', function () {
var board = window.Lumen.get('wipBoard');
board.setConstraintType(document.getElementById('wipType').value);
board.setColumnLimits(document.getElementById('wipColumn').value, {
minCount: document.getElementById('wipMin').value,
maxCount: document.getElementById('wipMax').value
});
});
}());
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class KanbanController : Controller
{
// The page is Views/Kanban/WipValidation.cshtml; it draws what ViewData holds.
public ActionResult WipValidation()
{
ViewData["DataSource"] = OverviewCards();
return View();
}
private const string Open = "Open";
private const string InProgress = "InProgress";
/// <summary>Syncfusion's Overview data: tasks by assignee, a priority (its colour), and up to two tags.</summary>
private static List<object> OverviewCards()
{
// Syncfusion's Overview data: tasks by assignee, a priority (its colour), and up to two tags.
string[][] rows =
{
new[] { "Task - 29033", "Open", "Arrange web meeting with customer to get editing requirements.", "sf-breaker", "Story", "Improvement", "Andrew Fuller" },
new[] { "Task - 29002", "InProgress", "Add responsive support to applicaton.", "sf-normal", "Story", "Kanban", "Andrew Fuller" },
new[] { "Task - 29004", "InProgress", "Fix the issues reported in the IE browser.", "sf-critical", "Bug", "Customer", "Andrew Fuller" },
new[] { "Task - 29016", "Testing", "Fix the issues reported in IE browser.", "sf-critical", "Bug", "Customer", "Andrew Fuller" },
new[] { "Task - 29018", "Close", "Arrange web meeting with customer to get login page requirement.", "sf-critical", "Feature", "", "Andrew Fuller" },
new[] { "Task - 29025", "Close", "Add input validation for editing.", "sf-breaker", "Bug", "Breaking Issue", "Andrew Fuller" },
new[] { "Task - 29003", "Open", "Show the retrived data from the server in grid control.", "sf-breaker", "Bug", "Breaking Issue", "Janet Leverling" },
new[] { "Task - 29030", "InProgress", "Test editing functionality.", "sf-normal", "Story", "", "Janet Leverling" },
new[] { "Task - 29017", "Testing", "Enhance editing functionality.", "sf-low", "Story", "Kanban", "Janet Leverling" },
new[] { "Task - 29022", "Close", "Analyze stored procedure.", "sf-breaker", "CustomSample", "", "Janet Leverling" },
new[] { "Task - 29031", "Open", "Fix the issues reported by the customer.", "sf-normal", "Bug", "Customer", "Janet Leverling" },
new[] { "Task - 29019", "Validate", "Validate the new requirements.", "sf-low", "Story", "", "Janet Leverling" }
};
return rows.Select(r => (object)new Dictionary<string, object>
{
{ "Id", r[0] }, { "Status", r[1] }, { "Summary", r[2] }, { "Cls", r[3] }, { "Tag1", r[4] }, { "Tag2", r[5] },
{ "Tags", string.Join(",", new[] { r[4], r[5] }.Where(t => t.Length > 0)) }, { "Type", r[4] }, { "Estimate", (Array.IndexOf(rows, r) % 5 + 1) * 0.5 },
{ "Assignee", r[6] }, { "Initials", string.Concat(r[6].Split(' ').Select(w => w.Substring(0, 1))) }
}).ToList();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
This sample demonstrates work in progress validation in the Kanban component using the ConstraintType property. WIP validation helps enforce workflow limits by controlling the minimum and maximum number of cards allowed within a column or swimlane.
The ConstraintType property supports the following validation modes:
Column: Validates cards based on the total number of cards within a column. This is the default validation mode.Swimlane: Validates cards based on the number of cards within a specific swimlane and column combination.
This sample also demonstrates the following validation-related settings:
Columns: Allows you to configure validation settings for a selected column.MinCount: Specifies the minimum number of cards required in a column. A validation indicator is displayed when the card count falls below this limit.MaxCount: Specifies the maximum number of cards allowed in a column. A validation indicator is displayed when the card count exceeds this limit.