browse.ui.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. window.renderCell = function(result, {col, row})
  2. {
  3. if(col.name == 'system' && row.data.releases)
  4. {
  5. result[0] = {className: 'overflow-hidden', html: result[0]};
  6. result[result.length] = {html:'<span class="label gray-pale rounded-xl clip">' + integratedLabel + '</span>', className:'flex items-end', style:{flexDirection:"column"}};
  7. }
  8. if(col.name == 'name')
  9. {
  10. if(row.data.marker == 1)
  11. {
  12. result[result.length] = {html: "<icon class='icon icon-flag red' title='" + markerTitle + "'></icon>"};
  13. return result;
  14. }
  15. }
  16. if(col.name == 'build')
  17. {
  18. result = [];
  19. if(!row.data.build.name) return result;
  20. let branchLabel = showBranch && typeof row.data.build.branchName != 'undefined' ? "<span class='label label-outline label-badge mr-1' title='" + row.data.build.branchName + "'>" + row.data.build.branchName + '</span> ' : '';
  21. if(isFromDoc || isFromAI)
  22. {
  23. result.push({html: branchLabel + row.data.build.name});
  24. }
  25. else
  26. {
  27. result.push({html: branchLabel + "<a href='" + row.data.build.link + "' title='" + row.data.build.name + "'>" + row.data.build.name + '</a>'});
  28. }
  29. return result;
  30. }
  31. if(col.name == 'project')
  32. {
  33. result = [];
  34. if(!row.data.projectName) return result;
  35. result.push({html: `<span title='${row.data.projectName}'>${row.data.projectName}</span>`});
  36. return result;
  37. }
  38. return result;
  39. }
  40. /**
  41. * 合并单元格。
  42. * cell span in the column.
  43. *
  44. * @param object cell
  45. * @access public
  46. * @return object
  47. */
  48. window.getCellSpan = function(cell)
  49. {
  50. if(['id', 'branchName', 'name', 'branch', 'status', 'date', 'desc', 'releasedDate', 'actions', 'system'].includes(cell.col.name) && cell.row.data.rowspan)
  51. {
  52. return {rowSpan: cell.row.data.rowspan};
  53. }
  54. }
  55. window.firstRendered = false;
  56. window.toggleCheckRows = function(idList)
  57. {
  58. if(!idList?.length || firstRendered) return;
  59. firstRendered = true;
  60. const dtable = zui.DTable.query($('#releases'));
  61. dtable.$.toggleCheckRows(idList.split(','), true);
  62. }