view.html.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * The activate view file of gogs module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Ke Zhao<zhaoke@easycorp.ltd>
  7. * @package gogs
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. global $lang;
  12. detailHeader
  13. (
  14. isAjaxRequest('modal') ? to::prefix() : '',
  15. to::title(
  16. entityLabel(
  17. set(array('entityID' => $job->id, 'level' => 1, 'text' => $job->name))
  18. ),
  19. $job->deleted ? span(setClass('label danger'), $lang->product->deleted) : null
  20. )
  21. );
  22. $hasResult = ($compile && !empty($compile->testtask));
  23. $hasLog = ($compile && !empty($compile->logs));
  24. $repo = $repo ? $repo : new stdclass();
  25. if($repo->SCM == 'Gitlab') $job->pipeline = $repo->name;
  26. if($compile and $compile->status)
  27. {
  28. $status = zget($lang->compile->statusList, $compile->status);
  29. }
  30. elseif($job->lastStatus)
  31. {
  32. $status = zget($lang->compile->statusList, $job->lastStatus);
  33. }
  34. $customParam = '';
  35. if($job->customParam)
  36. {
  37. foreach(json_decode($job->customParam) as $paramName => $paramValue)
  38. {
  39. $paramValue = str_replace('$zentao_version', zget($lang->job->paramValueList, $paramValue). '(' . $this->config->version . ')', $paramValue);
  40. $paramValue = str_replace('$zentao_account', zget($lang->job->paramValueList, $paramValue). '(' . $this->app->user->account . ')', $paramValue);
  41. $paramValue = str_replace('$zentao_product', zget($lang->job->paramValueList, $paramValue). '(' . $job->product . ')', $paramValue);
  42. $paramValue = str_replace('$zentao_repopath', zget($lang->job->paramValueList, $paramValue). '(' . zget($repo, 'path', '') . ')', $paramValue);
  43. $customParam .= "<p>$paramName : $paramValue</p>";
  44. }
  45. }
  46. detailBody
  47. (
  48. sectionList
  49. (
  50. tabs
  51. (
  52. tabPane
  53. (
  54. set::key('job-basic'),
  55. set::title($lang->job->lblBasic),
  56. set::active(!$hasResult && !$hasLog),
  57. tableData
  58. (
  59. setClass('jobBaseTable'),
  60. item
  61. (
  62. set::name($lang->job->engine),
  63. zget($lang->job->engineList, $job->engine)
  64. ),
  65. item
  66. (
  67. set::name($lang->job->repo),
  68. zget($repo, 'name', '')
  69. ),
  70. item
  71. (
  72. set::name($lang->job->product),
  73. $product ? $product->name : ''
  74. ),
  75. item
  76. (
  77. set::name($lang->job->frame),
  78. zget($lang->job->frameList, $job->frame)
  79. ),
  80. item
  81. (
  82. set::name($lang->job->server),
  83. span(setID('jobServer'), urldecode($job->pipeline) . '@' . $jenkins->name)
  84. ),
  85. item
  86. (
  87. set::name($lang->job->triggerType),
  88. $this->job->getTriggerConfig($job)
  89. ),
  90. item
  91. (
  92. set::name($lang->compile->status),
  93. !empty($status) ? $status : ''
  94. ),
  95. item
  96. (
  97. set::name($lang->compile->time),
  98. !empty($job->lastExec) ? $job->lastExec : ''
  99. ),
  100. item
  101. (
  102. set::name($lang->job->customParam),
  103. html($customParam)
  104. )
  105. )
  106. ),
  107. $hasResult ? tabPane
  108. (
  109. set::key('job-result'),
  110. set::title($lang->compile->result),
  111. set::active(true),
  112. div(setID('jobCases'), setData('task', $compile->testtask))
  113. ) : '',
  114. $hasLog ? tabPane
  115. (
  116. set::key('job-log'),
  117. set::title($lang->compile->logs),
  118. set::active(!$hasResult),
  119. tableData
  120. (
  121. div
  122. (
  123. set::className('mt-4'),
  124. html(nl2br($compile->logs))
  125. )
  126. )
  127. ) : ''
  128. )
  129. )
  130. );