track.ui.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. window.getItem = function(info)
  2. {
  3. const col = info.col;
  4. const color = info.item.color ? " style='color:" + info.item.color + "'" : '';
  5. const title = info.item.title;
  6. let titleHtml = `<span${color}>${title}</span>`;
  7. info.item.content = [];
  8. if(col.indexOf('demand') != -1 || col.indexOf('epic') != -1 || col.indexOf('requirement') != -1 || col.indexOf('story') != -1)
  9. {
  10. let storyPriList = langStoryPriList[info.item.storyType];
  11. let storyPri = storyPriList[info.item.pri] === undefined ? '' : storyPriList[info.item.pri];;
  12. let storyStatusList = langStoryStatusList[info.item.storyType];
  13. let storyStageList = langStoryStageList[info.item.storyType];
  14. if(privs[info.item.storyType]) titleHtml = "<a href='" + $.createLink(info.item.storyType, 'view', `storyID=${info.item.id}`) + "' data-toggle='modal' data-size='lg'" + color + ">" + title + "</a>";
  15. info.item.title = {html: `<div class="line-clamp-2"><span class="align-sub pri-${info.item.pri}">${storyPri}</span> ${titleHtml}</div>`}
  16. info.item.titleAttrs = {'title' : title};
  17. if(storyStatusList[info.item.status]) info.item.content.push({html: `<div class="status-${info.item.status}">${storyStatusList[info.item.status]}</div>`});
  18. info.item.content.push({html: `<div style="color:var(--color-gray-600)">${storyStageList[info.item.stage]}</div>`})
  19. }
  20. else if(col == 'project' || col == 'execution')
  21. {
  22. let delayHtml = '';
  23. if(info.item.delay > 0) delayHtml = `<span class='label danger-pale delayed nowrap'>${langProjectStatusList['delay']}</span>`;
  24. titleHtml = `<span${color} class="title">${title}</span>`;
  25. if(col == 'project' && privs['project']) titleHtml = "<a class='title' href='" + $.createLink('project', 'view', `projectID=${info.item.id}`) + "'>" + title + "</a>";
  26. if(col == 'execution' && privs['execution']) titleHtml = "<a class='title' href='" + $.createLink('execution', 'task', `executionID=${info.item.id}`) + "'>" + title + "</a>";
  27. info.item.title = [];
  28. info.item.title.push({html: `<div class="line-clamp-2">${titleHtml}</div>`});
  29. info.item.title.push({html: `<div>${delayHtml}</div>`, 'class': 'delayBox gap-x-2'});
  30. info.item.titleAttrs = {'title' : title, 'class': 'card-title flex'};
  31. info.item.content.push({html: `<div class="status-${info.item.status}">${langProjectStatusList[info.item.status]}</div>`});
  32. info.item.content.push({component: 'ProgressCircle', props: {percent: info.item.progress, size: 24}});
  33. }
  34. else if(col == 'task')
  35. {
  36. if(privs['task']) titleHtml = "<a href='" + $.createLink('task', 'view', `taskID=${info.item.id}`) + "' data-toggle='modal' data-size='lg'" + color + ">" + title + "</a>";
  37. info.item.title = {html: `<div class='line-clamp-2'><span class="align-sub pri-${info.item.pri}">${langTaskPriList[info.item.pri]}</span> ${titleHtml}</div>`}
  38. info.item.titleAttrs = {'title' : title};
  39. if(info.item.parent == '-1') info.item.content.push({html: `<span class="label cursor-pointer primary rounded-xl is-collapsed" onclick="toggleChildren(this, ${info.item.id})">${langChildren} <span class="toggle-icon ml-1"></span></span>`});
  40. info.item.content.push({html: `<div class="status-${info.item.status}">${langTaskStatusList[info.item.status]}</div>`});
  41. if(info.item.assignedTo) info.item.content.push({html: "<i class='icon icon-hand-right'></i> " + (users[info.item.assignedTo] ? users[info.item.assignedTo] : info.item.assignedTo)});
  42. info.item.content.push({component: 'ProgressCircle', props: {percent: info.item.progress, size: 24}});
  43. }
  44. else if(col == 'bug')
  45. {
  46. if(privs['bug']) titleHtml = "<a href='" + $.createLink('bug', 'view', `bugID=${info.item.id}`) + "' data-toggle='modal' data-size='lg'" + color + ">" + title + "</a>";
  47. info.item.title = {html: `<div class="line-clamp-2"><span class="align-sub pri-${info.item.pri}">${langBugPriList[info.item.pri]}</span> ${titleHtml}</div>`}
  48. info.item.titleAttrs = {'title' : title};
  49. severity = info.item.severity;
  50. severityHtml = `<div class="severity" data-severity="${severity}"></div>`;
  51. if(!langBugSeverityList[severity] || langBugSeverityList[severity] != severity) severityHtml = `<div class='severity severity-label' data-severity="${severity}">${langBugSeverityList[severity]}</div>`;
  52. info.item.content.push({html: severityHtml});
  53. if(info.item.assignedTo) info.item.content.push({html: "<i class='icon icon-hand-right'></i> " + (users[info.item.assignedTo] ? users[info.item.assignedTo] : info.item.assignedTo)});
  54. }
  55. else if(col == 'case')
  56. {
  57. if(privs['case']) titleHtml = "<a href='" + $.createLink('testcase', 'view', `caseID=${info.item.id}`) + "' data-toggle='modal' data-size='lg'" + color + ">" + title + "</a>";
  58. info.item.title = {html: `<div class="line-clamp-2"><span class="align-sub pri-${info.item.pri}">${langCasePriList[info.item.pri]}</span> ${titleHtml}</div>`}
  59. info.item.titleAttrs = {'title' : title};
  60. info.item.content.push({html: "<div class='status-" + info.item.lastRunResult + "'>" + (langCaseResultList[info.item.lastRunResult] ? langCaseResultList[info.item.lastRunResult] : langUnexecuted) + "</div>"});
  61. info.item.content.push({html: (users[info.item.lastRunner] ? users[info.item.lastRunner] : info.item.lastRunner)});
  62. }
  63. else if(col == 'design')
  64. {
  65. info.item.titleAttrs = {'class': 'line-clamp-3', 'title' : title};
  66. if(privs['design'])
  67. {
  68. info.item.titleUrl = $.createLink('design', 'view', `id=${info.item.id}`);
  69. info.item.titleAttrs = {'class': 'line-clamp-3', 'title' : title, 'data-toggle': 'modal', 'data-size': 'lg'};
  70. }
  71. }
  72. else if(col == 'commit')
  73. {
  74. if(privs['commit']) info.item.titleUrl = $.createLink('repo', 'revision', `repoID=${info.item.repo}&objectID=0&revision=${info.item.revision}`);
  75. info.item.titleAttrs = {'class': 'line-clamp-3', 'title' : title};
  76. }
  77. }
  78. window.getLaneCol = function(lane, col)
  79. {
  80. if(mergeCells[lane.name])
  81. {
  82. if(mergeCells[lane.name][col.name]) return {laneColClass: 'lane-col-join-with-above'};
  83. return {laneColClass: 'lane-col-shrink-with-above'};
  84. }
  85. }
  86. window.itemRender = function(info)
  87. {
  88. const col = info.col;
  89. if(col == 'task')
  90. {
  91. if(info.item.parent > '0') info.item.className.push('hidden childTask parent-' + info.item.parent);
  92. if(info.item.parent == '-1') info.item.className.push('parentTask');
  93. }
  94. }
  95. window.toggleChildren = function(obj, parentID)
  96. {
  97. if($(obj).hasClass('is-expanded'))
  98. {
  99. $(obj).removeClass('is-expanded').addClass('is-collapsed');
  100. $('.parent-' + parentID).addClass('hidden')
  101. }
  102. else
  103. {
  104. $(obj).removeClass('is-collapsed').addClass('is-expanded');
  105. $('.parent-' + parentID).removeClass('hidden')
  106. }
  107. }