build.ui.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. window.renderCell = function(result, {col, row})
  2. {
  3. if(col.name == 'path')
  4. {
  5. result[0] = '';
  6. if(row.data.pathType == 'scmPath' && row.data.scmPath)
  7. {
  8. const colorStyle = row.data.scmPath.indexOf('http') === 0 ? "style='color:#2463c7;'" : '';
  9. let scmPathHtml = '';
  10. scmPathHtml += "<div><i class='icon icon-file-code' " + colorStyle + "title='" + scmPathTip + "'></i> ";
  11. scmPathHtml += "<span title='" + row.data.scmPath + "'>";
  12. scmPathHtml += colorStyle.length ? "<a target='_blank' " + colorStyle + " href='" + row.data.filePath + "'>" + row.data.scmPath + "</a>" : row.data.scmPath;
  13. scmPathHtml += '</span></div>';
  14. result[result.length] = {html: scmPathHtml};
  15. }
  16. if(row.data.pathType == 'filePath' && row.data.filePath)
  17. {
  18. const colorStyle = row.data.filePath.indexOf('http') === 0 ? "style='color:#2463c7;'" : '';
  19. let filePathHtml = '';
  20. filePathHtml += "<div><i class='icon icon-download' " + colorStyle + "title='" + filePathTip + "'></i> ";
  21. filePathHtml += "<span title='" + row.data.filePath + "'>";
  22. filePathHtml += colorStyle.length ? "<a target='_blank' " + colorStyle + " href='" + row.data.filePath + "'>" + row.data.filePath + "</a>" : row.data.filePath;
  23. filePathHtml += '</span></div>';
  24. result[result.length] = {html: filePathHtml};
  25. }
  26. return result;
  27. }
  28. if(col.name == 'name' && row.data.execution == 0)
  29. {
  30. result[0].props.className = 'overflow-hidden';
  31. result[result.length] = {html:'<span class="label gray-pale rounded-xl clip">' + integratedTip + '</span>', className:'flex items-end', style:{flexDirection:"column"}};
  32. return result;
  33. }
  34. if(col.name == 'executionName')
  35. {
  36. let executionHtml = "<span title='" + row.data.executionName + "'>" + row.data.executionName + '</span>';
  37. if(row.data.executionDeleted == 1) executionHtml += " <span class='label danger-pale'>" + deletedTip + '</span>';
  38. result[0] = {html: executionHtml};
  39. return result;
  40. }
  41. return result;
  42. }
  43. /**
  44. * Change product.
  45. *
  46. * @access public
  47. * @return void
  48. */
  49. window.changeProduct = function(e)
  50. {
  51. const link = changeProductLink.replace('{productID}', $(e.target).val());
  52. loadPage(link);
  53. }
  54. /**
  55. * 合并单元格。
  56. * cell span in the column.
  57. *
  58. * @param object cell
  59. * @access public
  60. * @return object
  61. */
  62. window.getCellSpan = function(cell)
  63. {
  64. if(['id', 'name', 'productName', 'branchName', 'system', 'builder', 'date', 'actions'].includes(cell.col.name) && cell.row.data.rowspan)
  65. {
  66. return {rowSpan: cell.row.data.rowspan};
  67. }
  68. if(cell.col.name == 'path' && cell.row.data.pathRowspan)
  69. {
  70. return {rowSpan: cell.row.data.pathRowspan};
  71. }
  72. if(cell.col.name == 'execution' && cell.row.data.executionRowspan)
  73. {
  74. return {rowSpan: cell.row.data.executionRowspan};
  75. }
  76. }