runcase.ui.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. var custom = false;
  2. $('#runCaseModal').closest('.modal').off('hide.zui.modal').on('hide.zui.modal', function(e, info)
  3. {
  4. const $target = $(e.target);
  5. if($target.is('.modal') || (Array.isArray(info) && info[0] instanceof zui.Modal))
  6. {
  7. const modalID = $target.attr('id');
  8. if(modalID.indexOf('fileModal') == -1 && modalID.indexOf('stepResultFileModal') == -1) loadCurrentPage();
  9. }
  10. });
  11. /**
  12. * Load result.
  13. *
  14. * @access public
  15. * @return void
  16. */
  17. window.loadResult = function()
  18. {
  19. loadCurrentPage({url: resultsLink, selector: '#casesResults', partial: true});
  20. window.waitDom('#casesResults .result-item', function(){ $('#casesResults .result-item').first().trigger('click');})
  21. $(document).off('mouseover', 'li.file').on('mouseover', 'li.file', function()
  22. {
  23. $(this).children('span.right-icon').removeClass("hidden");
  24. $(this).addClass('backgroundColor');
  25. });
  26. $(document).off('mouseout', 'li.file').on('mouseout', 'li.file', function()
  27. {
  28. $(this).children('span.right-icon').addClass("hidden");
  29. $(this).removeClass('backgroundColor');
  30. });
  31. }
  32. /**
  33. * When real change.
  34. *
  35. * @param event $event
  36. * @access public
  37. * @return void
  38. */
  39. function realChange(event)
  40. {
  41. var $target = $(event.target);
  42. var $preSelect = $(event.target).closest('table').closest('tr').find('[name^="result"]');
  43. if($target.val() == '' && $preSelect.val() == 'fail')
  44. {
  45. $preSelect.zui('picker').$.changeState({value: 'pass'});
  46. }
  47. else if($target.val() != '' && $preSelect.val() == 'pass')
  48. {
  49. $preSelect.zui('picker').$.changeState({value: 'fail'});
  50. setTimeout(function(){$preSelect.closest('.picker-box.form-group-wrapper').addClass('has-error');}, 10);
  51. setTimeout(function(){$preSelect.closest('.picker-box.form-group-wrapper').removeClass('has-error');}, 1000);
  52. }
  53. }
  54. /**
  55. * Check step value is changed.
  56. *
  57. * @param event $event
  58. * @access public
  59. * @return void
  60. */
  61. function checkStepValue(event)
  62. {
  63. if($(event.target).val() == 'pass') custom = true;
  64. }
  65. /**
  66. * Set height of the file modal.
  67. *
  68. * @access public
  69. * @return void
  70. */
  71. function setFileModalHeight()
  72. {
  73. $($(this).data('target')).find('.modal-content').css('max-height', $('#runCaseModal').height() + 'px');
  74. }