You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

show.tmpl 28 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. {{template "base/head" .}}
  2. <style>
  3. .according-panel-heading {
  4. box-sizing: border-box;
  5. padding: 8px 16px;
  6. color: #252b3a;
  7. background-color: #f2f5fc;
  8. line-height: 1.5;
  9. cursor: pointer;
  10. -moz-user-select: none;
  11. -webkit-user-select: none;
  12. -ms-user-select: none;
  13. -khtml-user-select: none;
  14. user-select: none;
  15. }
  16. .accordion-panel-title {
  17. margin-top: 0;
  18. margin-bottom: 0;
  19. color: #252b3a;
  20. }
  21. .accordion-panel-title-content {
  22. vertical-align: middle;
  23. display: inline-block;
  24. width: calc(100% - 32px);
  25. cursor: default;
  26. }
  27. .acc-margin-bottom {
  28. margin-bottom: 5px;
  29. }
  30. .title_text {
  31. font-size: 12px;
  32. }
  33. .ac-display-inblock {
  34. display: inline-block;
  35. }
  36. .cti-mgRight-sm {
  37. margin-right: 8px;
  38. }
  39. .ac-text-normal {
  40. font-size: 14px;
  41. color: #575d6c;
  42. }
  43. .uc-accordionTitle-black {
  44. color: #333;
  45. }
  46. .accordion-border {
  47. border: 1px solid #cce2ff;
  48. }
  49. .padding0 {
  50. padding: 0 !important;
  51. }
  52. .content-pad {
  53. padding: 15px 35px;
  54. }
  55. .content-margin {
  56. margin: 10px 5px;
  57. }
  58. .tab_2_content {
  59. min-height: 360px;
  60. margin-left: 10px;
  61. }
  62. .ac-grid {
  63. display: block;
  64. *zoom: 1;
  65. }
  66. .ac-grid-col {
  67. float: left;
  68. width: 100%;
  69. }
  70. .ac-grid-col2 .ac-grid-col {
  71. width: 50%;
  72. }
  73. .ti-form {
  74. text-align: left;
  75. max-width: 100%;
  76. vertical-align: middle;
  77. }
  78. .ti-form>tbody {
  79. font-size: 12px;
  80. }
  81. .ti-form>tbody,
  82. .ti-form>tbody>tr {
  83. vertical-align: inherit;
  84. }
  85. .ti-text-form-label {
  86. padding-bottom: 20px;
  87. padding-right: 20px;
  88. color: #8a8e99;
  89. font-size: 12px;
  90. white-space: nowrap !important;
  91. width: 80px;
  92. line-height: 30px;
  93. }
  94. .ti-text-form-content {
  95. line-height: 30px;
  96. padding-bottom: 20px;
  97. }
  98. .ti-form>tbody>tr>td {
  99. vertical-align: top;
  100. white-space: normal;
  101. }
  102. td,
  103. th {
  104. padding: 0;
  105. }
  106. .info_text {
  107. padding-bottom: 20px;
  108. padding-right: 20px;
  109. font-size: 12px;
  110. }
  111. .ac-grid-col .text-span {
  112. width: 450px;
  113. overflow: hidden;
  114. text-overflow: ellipsis;
  115. white-space: nowrap;
  116. }
  117. .redo-color {
  118. color: #3291F8;
  119. }
  120. .ti-action-menu-item:not(:last-child) {
  121. margin-right: 10px;
  122. padding-right: 11px;
  123. text-decoration: none !important;
  124. color: #526ecc;
  125. cursor: pointer;
  126. display: inline-block;
  127. -moz-user-select: none;
  128. -webkit-user-select: none;
  129. -ms-user-select: none;
  130. -khtml-user-select: none;
  131. user-select: none;
  132. position: relative;
  133. }
  134. .ti-action-menu-item:not(:last-child):after {
  135. content: "";
  136. display: inline-block;
  137. position: absolute;
  138. height: 12px;
  139. right: 0;
  140. top: 50%;
  141. -webkit-transform: translateY(-6px);
  142. -ms-transform: translateY(-6px);
  143. -o-transform: translateY(-6px);
  144. transform: translateY(-6px);
  145. border-right: 1px solid #dfe1e6;
  146. }
  147. .text-width80 {
  148. width: 100px;
  149. line-height: 30px;
  150. }
  151. .border-according {
  152. border: 1px solid #dfe1e6;
  153. }
  154. .disabled {
  155. cursor: default;
  156. pointer-events: none;
  157. color: rgba(0, 0, 0, .6) !important;
  158. opacity: .45 !important;
  159. }
  160. .pad20 {
  161. border: 0px !important;
  162. }
  163. .model_file_bread {
  164. margin-bottom: -0.5rem !important;
  165. padding-left: 1rem;
  166. padding-top: 0.5rem;
  167. }
  168. </style>
  169. <div id="mask">
  170. <div id="loadingPage">
  171. <div class="rect1"></div>
  172. <div class="rect2"></div>
  173. <div class="rect3"></div>
  174. <div class="rect4"></div>
  175. <div class="rect5"></div>
  176. </div>
  177. </div>
  178. <div class="repository">
  179. {{template "repo/header" .}}
  180. <div class="ui container">
  181. <h4 class="ui header" id="vertical-segment">
  182. <div class="ui breadcrumb">
  183. <a class="section" href="{{.RepoLink}}/debugjob?debugListType=all">
  184. {{.i18n.Tr "repo.cloudbrain"}}
  185. </a>
  186. <div class="divider"> / </div>
  187. <a class="section" href="{{$.RepoLink}}/modelarts/train-job">
  188. {{$.i18n.Tr "repo.modelarts.train_job"}}
  189. </a>
  190. <div class="divider"> / </div>
  191. <div class="active section">{{.displayJobName}}</div>
  192. </div>
  193. </h4>
  194. {{with .task}}
  195. <div class="content-pad" style="border: 1px solid #e2e2e2;margin-top: 24px;padding: 20px 60px 40px 60px;">
  196. <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);">
  197. <a class="active item"
  198. data-tab="first">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
  199. <a class="item" data-tab="second"
  200. onclick="javascript:parseInfo()">{{$.i18n.Tr "repo.cloudbrain.runinfo"}}</a>
  201. <a class="item" data-tab="third"
  202. onclick="loadLog({{.VersionName}})">{{$.i18n.Tr "repo.modelarts.log"}}</a>
  203. <a class="item" data-tab="four"
  204. onclick="loadModelFile({{.VersionName}},'','','init')">{{$.i18n.Tr "repo.model_download"}}</a>
  205. </div>
  206. <div class="ui tab active" data-tab="first">
  207. <div style="padding-top: 10px;">
  208. <div class="tab_2_content">
  209. <div class="ac-grid ac-grid-col2">
  210. <div class="ac-grid-col">
  211. <table class="ti-form">
  212. <tbody class="ti-text-form">
  213. <tr class="ti-no-ng-animate">
  214. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  215. {{$.i18n.Tr "repo.cloudbrain_task"}}
  216. </td>
  217. <td class="ti-text-form-content">
  218. <div class="text-span text-span-w">
  219. {{.DisplayJobName}}
  220. </div>
  221. </td>
  222. </tr>
  223. <tr class="ti-no-ng-animate">
  224. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  225. {{$.i18n.Tr "repo.modelarts.status"}}
  226. </td>
  227. <td class="ti-text-form-content">
  228. <div class="text-span text-span-w" id="{{.VersionName}}-status">
  229. {{.Status}}
  230. </div>
  231. </td>
  232. </tr>
  233. <tr class="ti-no-ng-animate">
  234. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  235. {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
  236. </td>
  237. <td class="ti-text-form-content">
  238. <div class="text-span text-span-w">
  239. <span style="font-size: 12px;"
  240. class="">{{TimeSinceUnix1 .CreatedUnix}}</span>
  241. </div>
  242. </td>
  243. </tr>
  244. <tr class="ti-no-ng-animate">
  245. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  246. {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
  247. </td>
  248. <td class="ti-text-form-content">
  249. <div class="text-span text-span-w"
  250. id="{{.VersionName}}-duration">
  251. {{$.duration}}
  252. </div>
  253. </td>
  254. </tr>
  255. <tr class="ti-no-ng-animate">
  256. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  257. {{$.i18n.Tr "repo.modelarts.train_job.resource_type"}}
  258. </td>
  259. <td class="ti-text-form-content">
  260. <div class="text-span text-span-w">
  261. {{$.resource_type}}
  262. </div>
  263. </td>
  264. </tr>
  265. <tr class="ti-no-ng-animate">
  266. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  267. {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
  268. </td>
  269. <td class="ti-text-form-content">
  270. <div class="text-span text-span-w">
  271. {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{$.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{$.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{$.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{$.ShareMemMiB}}
  272. </div>
  273. </td>
  274. </tr>
  275. </tbody>
  276. </table>
  277. </div>
  278. <div class="ac-grid-col">
  279. <table class="ti-form">
  280. <tbody class="ti-text-form">
  281. <tr class="ti-no-ng-animate">
  282. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  283. {{$.i18n.Tr "cloudbrain.mirror"}}
  284. </td>
  285. <td class="ti-text-form-content">
  286. <div class="text-span text-span-w" id="{{.VersionName}}-mirror">
  287. {{.Image}}
  288. </div>
  289. </td>
  290. </tr>
  291. <tr class="ti-no-ng-animate">
  292. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  293. {{$.i18n.Tr "repo.modelarts.code_version"}}
  294. </td>
  295. <td class="ti-text-form-content">
  296. <div class="text-span text-span-w">
  297. {{.BranchName}}
  298. </div>
  299. </td>
  300. </tr>
  301. <tr class="ti-no-ng-animate">
  302. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  303. {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
  304. </td>
  305. <td class="ti-text-form-content">
  306. <div class="text-span text-span-w">
  307. {{.BootFile}}
  308. </div>
  309. </td>
  310. </tr>
  311. <tr class="ti-no-ng-animate">
  312. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  313. {{$.i18n.Tr "repo.modelarts.train_job.train_dataset"}}
  314. </td>
  315. <td class="ti-text-form-content">
  316. <div class="text-span text-span-w">
  317. {{.DatasetName}}
  318. </div>
  319. </td>
  320. </tr>
  321. <tr class="ti-no-ng-animate">
  322. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  323. {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
  324. </td>
  325. <td class="ti-text-form-content">
  326. <div class="text-span text-span-w" title="{{.Parameters}}">
  327. {{.Parameters}}
  328. </div>
  329. </td>
  330. </tr>
  331. <tr class="ti-no-ng-animate">
  332. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  333. {{$.i18n.Tr "repo.modelarts.train_job.description"}}
  334. </td>
  335. <td class="ti-text-form-content">
  336. <div class="text-span text-span-w" title="{{.Description}}">
  337. {{.Description}}
  338. </div>
  339. </td>
  340. </tr>
  341. </tbody>
  342. </table>
  343. </div>
  344. </div>
  345. </div>
  346. </div>
  347. </div>
  348. <div class="ui tab" data-tab="second">
  349. <div>
  350. <div class="ui message message{{.VersionName}}" style="display: none;">
  351. <div id="header"></div>
  352. </div>
  353. <div class="ui attached log" id="log{{.VersionName}}"
  354. style="height: 390px !important; overflow: auto;">
  355. <input type="hidden" id="json_value" value="{{$.result.JobStatus.AppExitDiagnostics}}">
  356. <input type="hidden" id="ExitDiagnostics" value="{{$.ExitDiagnostics}}">
  357. <span id="info_display" class="info_text">
  358. </span>
  359. </div>
  360. </div>
  361. </div>
  362. <div class="ui tab" data-tab="third">
  363. <div>
  364. <div class="ui message message{{.VersionName}}" style="display: none;">
  365. <div id="header"></div>
  366. </div>
  367. <div class="ui attached log" id="log{{.VersionName}}"
  368. style="height: 300px !important; overflow: auto;">
  369. <input type="hidden" name="end_line" value>
  370. <input type="hidden" name="start_line" value>
  371. <pre id="log_file{{.VersionName}}"></pre>
  372. </div>
  373. </div>
  374. </div>
  375. <div class="ui tab" data-tab="four">
  376. <input type="hidden" name="model{{.VersionName}}" value="-1">
  377. <input type="hidden" name="modelback{{.VersionName}}" value="-1">
  378. <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
  379. <div class="active section">{{.VersionName}}</div>
  380. <div class="divider"> / </div>
  381. </div>
  382. <div id="dir_list{{.VersionName}}">
  383. </div>
  384. </div>
  385. </div>
  386. {{end}} {{template "base/paginate" .}}
  387. </div>
  388. <!-- 确认模态框 -->
  389. <div id="deletemodel">
  390. <div class="ui basic modal">
  391. <div class="ui icon header">
  392. <i class="trash icon"></i> 删除任务
  393. </div>
  394. <div class="content">
  395. <p>你确认删除该任务么?此任务一旦删除不可恢复。</p>
  396. </div>
  397. <div class="actions">
  398. <div class="ui red basic inverted cancel button">
  399. <i class="remove icon"></i> 取消操作
  400. </div>
  401. <div class="ui green basic inverted ok button">
  402. <i class="checkmark icon"></i> 确定操作
  403. </div>
  404. </div>
  405. </div>
  406. </div>
  407. </div>
  408. {{template "base/footer" .}}
  409. <script>
  410. $('.menu .item').tab()
  411. $(document).ready(function () {
  412. $('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
  413. });
  414. $(document).ready(function () {
  415. $('.secondary.menu .item').tab();
  416. });
  417. let userName
  418. let repoPath
  419. let jobID
  420. let downlaodFlag = {{ $.canDownload }}
  421. let taskID = {{ $.task.ID }}
  422. let realJobName = {{ $.task.JobName }}
  423. $(document).ready(function () {
  424. let url = window.location.href;
  425. let urlArr = url.split('/')
  426. userName = urlArr.slice(-5)[0]
  427. repoPath = urlArr.slice(-4)[0]
  428. jobID = urlArr.slice(-1)[0]
  429. })
  430. function stopBubbling(e) {
  431. e = window.event || e;
  432. if (e.stopPropagation) {
  433. e.stopPropagation(); //阻止事件 冒泡传播
  434. } else {
  435. e.cancelBubble = true; //ie兼容
  436. }
  437. }
  438. function loadLog(version_name) {
  439. document.getElementById("mask").style.display = "block"
  440. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}/log?version_name=${version_name}&lines=50&order=asc`, (data) => {
  441. $('input[name=end_line]').val(data.EndLine)
  442. $('input[name=start_line]').val(data.StartLine)
  443. $(`#log_file${version_name}`).text(data.Content)
  444. document.getElementById("mask").style.display = "none"
  445. }).fail(function (err) {
  446. console.log(err);
  447. document.getElementById("mask").style.display = "none"
  448. });
  449. }
  450. function loadModelFile(version_name, parents, filename, init) {
  451. parents = parents || ''
  452. filename = filename || ''
  453. init = init || ''
  454. console.log("start")
  455. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/inference-job/${jobID}/model_list?version_name=${version_name}&parentDir=${parents}`, (data) => {
  456. $(`#dir_list${version_name}`).empty()
  457. renderDir(data, version_name)
  458. if (init === "init") {
  459. $(`input[name=model${version_name}]`).val("")
  460. $(`input[name=modelback${version_name}]`).val(version_name)
  461. $(`#file_breadcrumb${version_name}`).empty()
  462. let htmlBread = ""
  463. htmlBread += `<div class='active section'>${version_name}</div>`
  464. htmlBread += "<div class='divider'> / </div>"
  465. $(`#file_breadcrumb${version_name}`).append(htmlBread)
  466. } else {
  467. renderBrend(version_name, parents, filename, init)
  468. }
  469. }).fail(function (err) {
  470. console.log(err, version_name);
  471. });
  472. }
  473. function renderBrend(version_name, parents, filename, init) {
  474. if (init == "folder") {
  475. let htmlBrend = ""
  476. let sectionName = $(`#file_breadcrumb${version_name} .active.section`).text()
  477. let parents1 = $(`input[name=model${version_name}]`).val()
  478. let filename1 = $(`input[name=modelback${version_name}]`).val()
  479. if (parents1 === "") {
  480. $(`#file_breadcrumb${version_name} .active.section`).replaceWith(`<a class='section' onclick="loadModelFile('${version_name}','${parents1}','','init')">${sectionName}</a>`)
  481. } else {
  482. $(`#file_breadcrumb${version_name} .active.section`).replaceWith(`<a class='section' onclick="loadModelFile('${version_name}','${parents1}','${filename1}')">${sectionName}</a>`)
  483. }
  484. htmlBrend += `<div class='active section'>${filename}</div>`
  485. htmlBrend += "<div class='divider'> / </div>"
  486. $(`#file_breadcrumb${version_name}`).append(htmlBrend)
  487. $(`input[name=model${version_name}]`).val(parents)
  488. $(`input[name=modelback${version_name}]`).val(filename)
  489. } else {
  490. $(`input[name=model${version_name}]`).val(parents)
  491. $(`input[name=modelback${version_name}]`).val(filename)
  492. $(`#file_breadcrumb${version_name} a.section:contains(${filename})`).nextAll().remove()
  493. $(`#file_breadcrumb${version_name} a.section:contains(${filename})`).replaceWith(`<div class='active section'>${filename}</div>`)
  494. $(`#file_breadcrumb${version_name} div.section:contains(${filename})`).append("<div class='divider'> / </div>")
  495. }
  496. }
  497. function renderDir(data, version_name) {
  498. let html = ""
  499. html += "<div class='ui grid' style='margin:0;'>"
  500. html += "<div class='row' style='padding: 0;'>"
  501. html += "<div class='ui sixteen wide column' style='padding:1rem;'>"
  502. html += "<div class='dir list'>"
  503. html += "<table id='repo-files-table' class='ui single line table pad20'>"
  504. html += '<tbody>'
  505. // html += "</tbody>"
  506. for (let i = 0; i < data.Dirs.length; i++) {
  507. let dirs_size = renderSize(data.Dirs[i].Size)
  508. html += "<tr>"
  509. html += "<td class='name six wid'>"
  510. html += "<span class='truncate'>"
  511. html += "<span class='octicon octicon-file-directory'>"
  512. html += "</span>"
  513. if (data.Dirs[i].IsDir) {
  514. html += `<a onclick="loadModelFile('${version_name}','${data.Dirs[i].ParenDir}','${data.Dirs[i].FileName}','folder')">`
  515. html += "<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>"
  516. } else {
  517. if (downlaodFlag) {
  518. html += `<a href="${location.href}/download_model?version_name=${version_name}&fileName=${data.Dirs[i].FileName}&parentDir=${data.Dirs[i].ParenDir}&jobName=${realJobName}">`
  519. }
  520. else {
  521. html += `<a class="disabled">`
  522. }
  523. html += "<span class='fitted'><i class='file icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>"
  524. }
  525. html += '</a>'
  526. html += "</span>"
  527. html += "</td>"
  528. html += "<td class='message seven wide'>"
  529. if (data.Dirs[i].IsDir) {
  530. html += "<span class='truncate has-emoji'></span>"
  531. } else {
  532. html += "<span class='truncate has-emoji'>" + `${dirs_size}` + "</span>"
  533. }
  534. html += "</td>"
  535. html += "<td class='text right age three wide'>"
  536. html += "<span class='truncate has-emoji'>" + data.Dirs[i].ModTime + "</span>"
  537. html += "</td>"
  538. html += "</tr>"
  539. }
  540. html += "</tbody>"
  541. html += "</table>"
  542. html += "</div>"
  543. html += "</div>"
  544. html += "</div>"
  545. html += "</div>"
  546. $(`#dir_list${version_name}`).append(html)
  547. }
  548. function renderSize(value) {
  549. if (null == value || value == '') {
  550. return "0 Bytes";
  551. }
  552. var unitArr = new Array("Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
  553. var index = 0;
  554. var srcsize = parseFloat(value);
  555. index = Math.floor(Math.log(srcsize) / Math.log(1024));
  556. var size = srcsize / Math.pow(1024, index);
  557. size = size.toFixed(0);//保留的小数位数
  558. return size + unitArr[index];
  559. }
  560. function refreshStatus(version_name) {
  561. $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${taskID}?version_name=${versionname}`, (data) => {
  562. // header status and duration
  563. //$(`#${version_name}-duration-span`).text(data.JobDuration)
  564. $(`#${version_name}-status-span span`).text(data.JobStatus)
  565. $(`#${version_name}-status-span i`).attr("class", data.JobStatus)
  566. // detail status and duration
  567. //$('#'+version_name+'-duration').text(data.JobDuration)
  568. $('#' + version_name + '-status').text(data.JobStatus)
  569. loadLog(version_name)
  570. }).fail(function (err) {
  571. console.log(err);
  572. });
  573. stopBubbling(arguments.callee.caller.arguments[0])
  574. }
  575. function parseInfo() {
  576. let jsonValue = document.getElementById("json_value").value;
  577. let jsonObj = JSON.parse(jsonValue);
  578. let podRoleName = jsonObj["podRoleName"];
  579. let html = "";
  580. if (podRoleName != null) {
  581. let task0 = podRoleName["task1-0"];
  582. let podEvents = jsonObj["podEvents"];
  583. let podEventArray = podEvents[task0];
  584. if (podEventArray != null) {
  585. for (var i = 0; i < podEventArray.length; i++) {
  586. if (podEventArray[i]["reason"] != "") {
  587. html += "<p><b>[" + podEventArray[i]["reason"] + "]</b></p>";
  588. html += "<p>" + podEventArray[i]["message"] + "</p>";
  589. html += "<p>" + podEventArray[i]["action"] + "</p>";
  590. }
  591. }
  592. }
  593. let extras = jsonObj["extras"];
  594. if (extras != null) {
  595. for (var i = 0; i < extras.length; i++) {
  596. if (extras[i]["reason"] != "") {
  597. html += "<p><b>[" + extras[i]["reason"] + "]</b></p>";
  598. html += "<p>" + extras[i]["message"] + "</p>";
  599. html += "<p>" + extras[i]["action"] + "</p>";
  600. }
  601. }
  602. }
  603. }
  604. let string = document.getElementById("ExitDiagnostics").value;
  605. string = string.replace(/\r\n/g, "<br>")
  606. string = string.replace(/\n/g, "<br>");
  607. string = string.replace(/(\r\n)|(\n)/g, '<br>');
  608. if (string != "") {
  609. html += "<p><b>[ExitDiagnostics]</b></p>";
  610. html += "<p>" + string + "</p>";
  611. }
  612. document.getElementById("info_display").innerHTML = html;
  613. }
  614. </script>