view.ui.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. window.renderCell = function(result, info)
  2. {
  3. if(info.col.name == 'title' && result)
  4. {
  5. const story = info.row.data;
  6. const key = story.type + '-' + story.grade;
  7. const html = "<span class='label gray-pale rounded-xl clip'>" + storyGrades[key] + "</span> ";
  8. result.unshift({html});
  9. }
  10. if(info.col.name == 'roadmapOrPlan' && result)
  11. {
  12. const story = info.row.data;
  13. const roadmapID = story.roadmap;
  14. const planID = story.plan.trim().replace(/^[,]+|[,]+$/g, '');
  15. const objectType = roadmapID != 0 ? 'roadmap' : (planID != 0 ? 'plan' : '');
  16. const objectID = objectType == 'roadmap' ? roadmapID : (objectType == 'plan' ? planID : 0);
  17. let roadmapOrPlanName = '';
  18. if(objectType && objectID)
  19. {
  20. if(objectID.indexOf(',') !== -1)
  21. {
  22. const objectIdList = objectID.split(',');
  23. for(let key in objectIdList)
  24. {
  25. let id = objectType + '-' + objectIdList[key];
  26. roadmapOrPlanName += roadmapPlans[story.product][story.branch][id] + ', ';
  27. }
  28. }
  29. else
  30. {
  31. const key = objectType + '-' + objectID;
  32. roadmapOrPlanName = roadmapPlans[story.product][story.branch][key];
  33. }
  34. }
  35. result[0] = roadmapOrPlanName.trim().replace(/^[,]+|[,]+$/g, '');
  36. result[1]['attrs']['title'] = roadmapOrPlanName.trim().replace(/^[,]+|[,]+$/g, '');
  37. const labelName = objectType == 'roadmap' ? roadmapCommon : (objectType == 'plan' ? planCommon : '');
  38. const html = roadmapOrPlanName ? "<span class='label gray-pale rounded-xl clip'>" + labelName + "</span> " : '';
  39. result.unshift({html});
  40. }
  41. return result;
  42. }