view.html.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <?php
  2. /**
  3. * The view view file of zahost 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 Zeng Gang<zenggang@easycorp.ltd>
  7. * @package zahost
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('hostID', $zahost->id);
  12. jsVar('zahostLang', $lang->zahost);
  13. $imageLink = html::a($this->createLink('zahost', 'browseImage', "hostID=$zahost->id", '', true), $lang->zahost->image->downloadImage, '', "data-toggle='modal'");
  14. $createNode = html::a($this->createLink('zanode', 'create', "hostID=$zahost->id"), $lang->zahost->createZanode);
  15. $mainActions = array();
  16. $commonActions = array();
  17. foreach($config->zahost->view->operateList as $operate)
  18. {
  19. if(!common::hasPriv('zahost', $operate)) continue;
  20. $action = $config->zahost->dtable->fieldList['actions']['list'][$operate];
  21. if($operate == 'delete')
  22. {
  23. $nodeList = $this->loadModel('zanode')->getListByHost($zahost->id);
  24. if($nodeList)
  25. {
  26. $action['disabled'] = true;
  27. $action['hint'] = $lang->zahost->undeletedNotice;
  28. }
  29. }
  30. if($operate === 'edit' || $operate === 'delete')
  31. {
  32. $commonActions[] = $action;
  33. continue;
  34. }
  35. $mainActions[] = $action;
  36. }
  37. detailHeader
  38. (
  39. to::title
  40. (
  41. entityLabel
  42. (
  43. set::entityID($zahost->id),
  44. set::level(1),
  45. set::text($zahost->name)
  46. ),
  47. $zahost->deleted ? span(setClass('label danger'), $lang->zahost->deleted) : null
  48. )
  49. );
  50. detailBody
  51. (
  52. sectionList
  53. (
  54. section
  55. (
  56. set::title($lang->zahost->baseInfo),
  57. h::table
  58. (
  59. setClass('w-full'),
  60. h::tr
  61. (
  62. h::td
  63. (
  64. div
  65. (
  66. setClass('flex flex-wrap pt-2 mx-4'),
  67. div
  68. (
  69. setClass('w-1/3'),
  70. span
  71. (
  72. setClass('text-gray'),
  73. $lang->zahost->extranet
  74. ),
  75. span
  76. (
  77. setClass('ml-2'),
  78. $zahost->extranet
  79. )
  80. ),
  81. div
  82. (
  83. setClass('w-1/3'),
  84. span
  85. (
  86. setClass('text-gray'),
  87. $lang->zahost->cpuCores
  88. ),
  89. span
  90. (
  91. setClass('ml-2'),
  92. $zahost->cpuCores . '' . $lang->zahost->cpuUnit
  93. )
  94. ),
  95. div
  96. (
  97. setClass('w-1/3'),
  98. span
  99. (
  100. setClass('text-gray'),
  101. $lang->zahost->zaHostType
  102. ),
  103. span
  104. (
  105. setClass('ml-2'),
  106. $lang->zahost->zaHostTypeList[$zahost->hostType]
  107. )
  108. ),
  109. div
  110. (
  111. setClass('w-1/3 mt-4'),
  112. span
  113. (
  114. setClass('text-gray'),
  115. $lang->zahost->status
  116. ),
  117. span
  118. (
  119. setClass('ml-2'),
  120. zget($lang->zahost->statusList, $zahost->status)
  121. )
  122. ),
  123. div
  124. (
  125. setClass('w-1/3 mt-4'),
  126. span
  127. (
  128. setClass('text-gray'),
  129. $lang->zahost->memory
  130. ),
  131. span
  132. (
  133. setClass('ml-2'),
  134. $zahost->memory . '' . $lang->zahost->unitList['GB']
  135. )
  136. ),
  137. div
  138. (
  139. setClass('w-1/3 mt-4'),
  140. span
  141. (
  142. setClass('text-gray'),
  143. $lang->zahost->vsoft
  144. ),
  145. span
  146. (
  147. setClass('ml-2'),
  148. zget($lang->zahost->softwareList, $zahost->vsoft)
  149. )
  150. ),
  151. div
  152. (
  153. setClass('w-1/3 mt-4'),
  154. span
  155. (
  156. setClass('text-gray'),
  157. $lang->zahost->registerDate
  158. ),
  159. span
  160. (
  161. setClass('ml-2'),
  162. helper::isZeroDate($zahost->heartbeat) ? '' : $zahost->heartbeat
  163. )
  164. ),
  165. div
  166. (
  167. setClass('w-1/3 mt-4'),
  168. span
  169. (
  170. setClass('text-gray'),
  171. $lang->zahost->diskSize
  172. ),
  173. span
  174. (
  175. setClass('ml-2'),
  176. $zahost->diskSize . '' . $lang->zahost->unitList['GB']
  177. )
  178. )
  179. )
  180. )
  181. )
  182. )
  183. ),
  184. section
  185. (
  186. set::title($lang->zahost->desc),
  187. set::content($zahost->desc),
  188. set::useHtml(true)
  189. )
  190. ),
  191. sectionList
  192. (
  193. div
  194. (
  195. setClass('text-lg font-bold'),
  196. $lang->zahost->init->statusTitle,
  197. button
  198. (
  199. setClass('ghost btn'),
  200. icon('refresh', setClass('text-primary')),
  201. $lang->zahost->init->checkStatus,
  202. on::click('ajaxGetServiceStatus')
  203. )
  204. ),
  205. div
  206. (
  207. set::id('statusContainer')
  208. ),
  209. div
  210. (
  211. setClass('init-success hidden'),
  212. html(sprintf($lang->zahost->init->initSuccessNotice, $imageLink, $createNode))
  213. ),
  214. div
  215. (
  216. setClass('init-fail hidden'),
  217. html($lang->zahost->init->initFailNotice),
  218. textarea
  219. (
  220. set::id('initBash'),
  221. setClass('hidden'),
  222. $initBash
  223. ),
  224. div
  225. (
  226. setClass('zahost-init'),
  227. $initBash,
  228. h::button
  229. (
  230. setClass('ghost btn btn-info btn-mini btn-init-copy text-primary'),
  231. icon
  232. (
  233. setClass('icon-common-copy icon-copy'),
  234. set::title($lang->zahost->copy),
  235. set::name('')
  236. ),
  237. on::click('onCopy')
  238. )
  239. )
  240. )
  241. ),
  242. common::hasPriv('zanode', 'browse') ? sectionList
  243. (
  244. section
  245. (
  246. set::title($lang->zahost->browseNode)
  247. ),
  248. !empty($nodeList) ? div
  249. (
  250. setID('nodeList'),
  251. h::js('loadTarget("' . createLink('zanode', 'nodeList', "hostID={$zahost->id}") . '", "#nodeList")')
  252. ) : $lang->noData
  253. ) : null,
  254. floatToolbar
  255. (
  256. to::prefix(backBtn(set::icon('back'), $lang->goback)),
  257. set::main($mainActions),
  258. set::suffix($commonActions),
  259. set::object($zahost)
  260. ),
  261. detailSide
  262. (
  263. history()
  264. )
  265. );
  266. render();