1/** 2 * $Id: mxAtlassian.js,v 1.0 2018/24/05 12:32:06 mate Exp $ 3 * Copyright (c) 2006-2018, JGraph Ltd 4 */ 5//********************************************************************************************************************************************************** 6// Issue 7//********************************************************************************************************************************************************** 8/** 9* Extends mxShape. 10*/ 11function mxAtlassianJiraIssue(bounds, fill, stroke, strokewidth) 12{ 13 mxShape.call(this); 14 this.bounds = bounds; 15 this.fill = fill; 16 this.stroke = stroke; 17 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 18 this.dx = 0.5; 19}; 20 21/** 22* Extends mxShape. 23*/ 24mxUtils.extend(mxAtlassianJiraIssue, mxRectangleShape); 25 26mxAtlassianJiraIssue.prototype.customProperties = [ 27 {name: 'issueType', dispName: 'Issue Type', type: 'enum', 28 enumList: [{val: 'story', dispName: 'Story'}, 29 {val: 'task', dispName: 'Task'}, 30 {val: 'subTask', dispName: 'Sub-Task'}, 31 {val: 'feature', dispName: 'Feature'}, 32 {val: 'bug', dispName: 'Bug'}, 33 {val: 'techTask', dispName: 'Tech Task'}, 34 {val: 'epic', dispName: 'Epic'}, 35 {val: 'improvement', dispName: 'Improvement'}, 36 {val: 'fault', dispName: 'Fault'}, 37 {val: 'change', dispName: 'Change'}, 38 {val: 'access', dispName: 'Access'}, 39 {val: 'purchase', dispName: 'Purchase'}, 40 {val: 'itHelp', dispName: 'IT Help'}] 41 }, 42 {name: 'issuePriority', dispName: 'Issue Priority', type: 'enum', 43 enumList: [{val: 'blocker', dispName: 'Blocker'}, 44 {val: 'critical', dispName: 'Critical'}, 45 {val: 'major', dispName: 'Major'}, 46 {val: 'minor', dispName: 'Minor'}, 47 {val: 'trivial', dispName: 'Trivial'}] 48 }, 49 {name: 'issueStatus', dispName: 'Issue Status', type: 'enum', 50 enumList: [{val: 'todo', dispName: 'TODO'}, 51 {val: 'inProgress', dispName: 'In Progress'}, 52 {val: 'inReview', dispName: 'In Review'}, 53 {val: 'done', dispName: 'Done'}] 54 } 55]; 56 57mxAtlassianJiraIssue.prototype.cst = {ISSUE : 'mxgraph.atlassian.issue'}; 58 59/** 60* Function: paintVertexShape 61* 62* Paints the vertex shape. 63*/ 64mxAtlassianJiraIssue.prototype.paintForeground = function(c, x, y, w, h) 65{ 66 c.translate(x, y); 67 68 var issueType = mxUtils.getValue(this.style, 'issueType', 'task'); 69 var issuePriority = mxUtils.getValue(this.style, 'issuePriority', 'minor'); 70 var issueStatus = mxUtils.getValue(this.style, 'issueStatus', 'todo'); 71 72 c.setStrokeColor('none'); 73 74 switch (issueType) { 75 case 'story': 76 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.story'); 77 78 if (stencil != null) 79 { 80 c.setFillColor('#61B659'); 81 stencil.drawShape(c, this, 5, 5, 10, 10); 82 } 83 84 break; 85 case 'task': 86 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.task'); 87 88 if (stencil != null) 89 { 90 c.setFillColor('#5EA3E4'); 91 stencil.drawShape(c, this, 5, 5, 10, 10); 92 } 93 94 break; 95 case 'subTask': 96 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.subtask'); 97 98 if (stencil != null) 99 { 100 c.setFillColor('#5EA3E4'); 101 stencil.drawShape(c, this, 5, 5, 10, 10); 102 } 103 104 break; 105 case 'feature': 106 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.new_feature'); 107 108 if (stencil != null) 109 { 110 c.setFillColor('#61B659'); 111 stencil.drawShape(c, this, 5, 5, 10, 10); 112 } 113 114 break; 115 case 'bug': 116 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.bug'); 117 118 if (stencil != null) 119 { 120 c.setFillColor('#CE0000'); 121 stencil.drawShape(c, this, 5, 5, 10, 10); 122 } 123 124 break; 125 case 'techTask': 126 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.tech_task'); 127 128 if (stencil != null) 129 { 130 c.setFillColor('#999C95'); 131 stencil.drawShape(c, this, 5, 5, 10, 10); 132 } 133 134 break; 135 case 'epic': 136 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.epic'); 137 138 if (stencil != null) 139 { 140 c.setFillColor('#9E4ADD'); 141 stencil.drawShape(c, this, 5, 5, 10, 10); 142 } 143 144 break; 145 case 'improvement': 146 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.improvement'); 147 148 if (stencil != null) 149 { 150 c.setFillColor('#61B659'); 151 stencil.drawShape(c, this, 5, 5, 10, 10); 152 } 153 154 break; 155 case 'fault': 156 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.fault'); 157 158 if (stencil != null) 159 { 160 c.setFillColor('#F8902F'); 161 stencil.drawShape(c, this, 5, 5, 10, 10); 162 } 163 164 break; 165 case 'change': 166 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.change'); 167 168 if (stencil != null) 169 { 170 c.setFillColor('#9E4ADD'); 171 stencil.drawShape(c, this, 5, 5, 10, 10); 172 } 173 174 break; 175 case 'access': 176 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.access'); 177 178 if (stencil != null) 179 { 180 c.setFillColor('#F8902F'); 181 stencil.drawShape(c, this, 5, 5, 10, 10); 182 } 183 184 break; 185 case 'purchase': 186 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.purchase'); 187 188 if (stencil != null) 189 { 190 c.setFillColor('#61B659'); 191 stencil.drawShape(c, this, 5, 5, 10, 10); 192 } 193 194 break; 195 case 'itHelp': 196 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.it_help'); 197 198 if (stencil != null) 199 { 200 c.setFillColor('#5EA3E4'); 201 stencil.drawShape(c, this, 5, 5, 10, 10); 202 } 203 204 break; 205 } 206 207 switch (issuePriority) { 208 case 'blocker': 209 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.no'); 210 211 if (stencil != null) 212 { 213 c.setFillColor('#CE0000'); 214 stencil.drawShape(c, this, 85, 5, 10, 10); 215 } 216 break; 217 case 'critical': 218 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.critical'); 219 220 if (stencil != null) 221 { 222 c.setFillColor('#CE0000'); 223 stencil.drawShape(c, this, 86, 3, 8, 14); 224 } 225 break; 226 case 'major': 227 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.double_up'); 228 229 if (stencil != null) 230 { 231 c.setFillColor('#CE0000'); 232 stencil.drawShape(c, this, 85, 5, 10, 10); 233 } 234 break; 235 case 'minor': 236 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.double'); 237 238 if (stencil != null) 239 { 240 c.setFillColor('#2A8735'); 241 stencil.drawShape(c, this, 85, 5, 10, 10); 242 } 243 break; 244 case 'trivial': 245 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.single'); 246 247 if (stencil != null) 248 { 249 c.setFillColor('#9AA1B2'); 250 stencil.drawShape(c, this, 85, 5, 10, 10); 251 } 252 break; 253 } 254 255 c.setFillColor('#FFFFFD'); 256 c.setFontColor('#4E6B89'); 257 258 switch (issueStatus) { 259 case 'todo': 260 c.rect(w - 45, 5, 40, 20); 261 c.fill(); 262 263 c.text(w - 25, 15, 0, 0, 'TO DO', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0); 264 break; 265 case 'inProgress': 266 c.rect(w - 85, 5, 80, 20); 267 c.fill(); 268 269 c.text(w - 45, 15, 0, 0, 'IN PROGRESS', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0); 270 break; 271 case 'inReview': 272 c.rect(w - 75, 5, 70, 20); 273 c.fill(); 274 275 c.text(w - 40, 15, 0, 0, 'IN REVIEW', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0); 276 break; 277 case 'done': 278 c.rect(w - 45, 5, 40, 20); 279 c.fill(); 280 281 c.text(w - 25, 15, 0, 0, 'DONE', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0); 282 break; 283 default: 284 var tw = mxUtils.getValue(this.style, 'issueStatusWidth', issueStatus.length * 6.5); 285 c.rect(w - tw - 5, 5, tw, 20); 286 c.fill(); 287 c.text(w - 7, 15, 0, 0, issueStatus, mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0); 288 } 289}; 290 291mxCellRenderer.registerShape(mxAtlassianJiraIssue.prototype.cst.ISSUE, mxAtlassianJiraIssue); 292