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.

new.tmpl 29 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. {{template "base/head" .}}
  2. <style>
  3. .unite {
  4. font-family: SourceHanSansSC-medium !important;
  5. color: rgba(16, 16, 16, 100) !important;
  6. }
  7. .title {
  8. font-size: 16px !important;
  9. padding-left: 3rem !important;
  10. }
  11. .min_title{
  12. font-size: 14px !important;
  13. margin-bottom: 2rem !important;
  14. }
  15. .width100 {
  16. width: 100% !important;
  17. }
  18. .width81 {
  19. margin-left: 1.5rem;
  20. width: 81% !important;
  21. }
  22. .width85 {
  23. width: 85% !important;
  24. margin-left: 10.5rem !important;
  25. align-items: center;
  26. }
  27. .width48 {
  28. width: 48.5% !important;
  29. }
  30. .nowrapx {
  31. white-space: nowrap !important;
  32. }
  33. .v-middle {
  34. vertical-align: middle;
  35. }
  36. .label-required:after {
  37. margin: -0.2em 0 0 0.2em;
  38. content: '*';
  39. color: #db2828;
  40. visibility: visible !important;
  41. }
  42. </style>
  43. {{template "custom/global_mask" .}}
  44. <div class="repository">
  45. {{template "repo/header" .}}
  46. <div class="ui container">
  47. {{$Grampus := (or (eq (index (SubJumpablePath .Link) 1) "create_grampus_gpu") (eq (index (SubJumpablePath .Link) 1) "create_grampus_npu"))}}
  48. <div class="cloudbrain-type" style="display: none;" data-grampus="{{$Grampus}}" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
  49. {{template "base/alert" .}}
  50. <h4 class="ui top attached header">
  51. {{.i18n.Tr "repo.modelarts.evaluate_job.new_job"}}
  52. </h4>
  53. <div class="ui attached segment">
  54. <input type="hidden" name="benchmarkMode" value="{{.benchmarkMode}}">
  55. <form id="form_id" class="ui form alogrithm_form" action="{{.RepoLink}}/modelsafety/create" method="post">
  56. {{.CsrfTokenHtml}}
  57. <input type="hidden" name="compute_resource" value="{{.compute_resource}}">
  58. <input type="hidden" name="type" value="{{.type}}">
  59. <input type="hidden" id="ai_engine_name" name="engine_names" value="">
  60. <input type="hidden" id="ai_flaver_name" name="flaver_names" value="">
  61. <div class="required min_title inline field">
  62. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</label>
  63. <div class="ui blue small menu compact selectcloudbrain">
  64. <a class="item alogrithm_benchmark"
  65. href="{{.RepoLink}}/cloudbrain/benchmark/create?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}}</a>
  66. <a class="item model_benchmark"
  67. href="{{.RepoLink}}/cloudbrain/benchmark/create?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
  68. <a class="item active model_safe_benchmark"
  69. href="{{.Link}}">{{.i18n.Tr "modelsafety.model_security_evaluation"}}</a>
  70. </div>
  71. </div>
  72. <!-- <div class="required unite min_title inline field">
  73. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>
  74. <div class="ui blue mini menu compact selectcloudbrain">
  75. <a class="item {{if not $Grampus}}active{{end}}" href="{{.RepoLink}}/modelsafety/create_gpu">
  76. <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg>
  77. {{.i18n.Tr "cloudbrain.resource_cluster_openi"}}
  78. </a>
  79. <a class="item {{if $Grampus}}active{{end}}" href="{{.RepoLink}}/modelsafety/create_grampus_gpu">
  80. <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg>
  81. {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta)
  82. </a>
  83. </div>
  84. </div> -->
  85. <div class="inline min_title required field">
  86. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  87. <div class="ui blue mini menu compact selectcloudbrain">
  88. <a class="{{if eq .datasetType 0}}active{{end}} item" href="{{.RepoLink}}/modelsafety/create_{{if $Grampus}}grampus_{{end}}gpu">
  89. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  90. height="16">
  91. <path fill="none" d="M0 0h24v24H0z" />
  92. <path
  93. d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" />
  94. </svg>
  95. CPU/GPU
  96. </a>
  97. <a class="{{if eq .datasetType 1}}active{{end}} item" href="{{.RepoLink}}/modelsafety/create_{{if $Grampus}}grampus_{{end}}npu">
  98. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  99. height="16">
  100. <path fill="none" d="M0 0h24v24H0z" />
  101. <path
  102. d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" />
  103. </svg>
  104. Ascend NPU</a>
  105. </div>
  106. </div>
  107. <div>
  108. <div class="min_title inline field" style="margin-top:-10px;">
  109. <label class="label-fix-width" style="font-weight: normal;"></label>
  110. {{template "custom/task_wait_count" .}}
  111. </div>
  112. <div class="min_title inline field" style="margin-top:-20px;margin-bottom:12px !important;">
  113. <label class="label-fix-width" style="font-weight: normal;"></label>
  114. <div style="display:inline-block;">
  115. <div style="display:flex;align-items:center;color:#f2711c;">
  116. <i class="ri-error-warning-line" style="margin-right: 0.5rem; font-size: 14px"></i>
  117. <span style="font-size: 12px">{{.i18n.Tr "modelsafety.new_model_security_evaluation_tips"}}</span>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="required min_title inline field">
  122. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  123. <input style="width: 80%;" name="display_job_name" id="trainjob_job_name"
  124. placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}"
  125. tabindex="3" autofocus required maxlength="36">
  126. <span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span>
  127. </div>
  128. <div class="min_title inline field">
  129. <label class="label-fix-width" style="font-weight: normal;"
  130. for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}</label>
  131. <textarea style="width: 80%;" id="description" name="description" rows="2" maxlength="254"
  132. placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}}
  133. onchange="this.value=this.value.substring(0, 255)"
  134. onkeydown="this.value=this.value.substring(0, 255)"
  135. onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea>
  136. </div>
  137. <input type="hidden" id="ai_model_version" name="model_version" value="{{$.model_version}}">
  138. <div class="required unite inline min_title fields" style="width: 96.8%;">
  139. <div class="required eight wide field">
  140. <label style="font-size:14px;font-weight: normal;white-space: nowrap;width: 210px;text-align: right;">{{.i18n.Tr "repo.modelarts.infer_job.select_model"}}</label>
  141. <div class="ui fluid selection dropdown" id="select_model">
  142. <input type="hidden" name="model_name" required value="{{.model_name}}">
  143. <div class="text"></div>
  144. <i class="dropdown icon"></i>
  145. <div class="menu" id="model_name">
  146. </div>
  147. </div>
  148. </div>
  149. <input type="hidden" name="pre_train_model_url" value="{{.train_url}}">
  150. <div class="three wide field">
  151. <div class="ui fluid selection dropdown" id="select_model_version">
  152. <input type="hidden" name="train_url" required value="{{.train_url}}">
  153. <div class="text"></div>
  154. <i class="dropdown icon"></i>
  155. <div class="menu" id="model_name_version"></div>
  156. </div>
  157. </div>
  158. <div class="five wide field">
  159. <div class="ui fluid selection dropdown" id="select_model_checkpoint">
  160. <input type="hidden" name="ckpt_name" required value="{{.ckpt_name}}">
  161. <div class="text"></div>
  162. <i class="dropdown icon"></i>
  163. <div class="menu" id="model_checkpoint">
  164. </div>
  165. </div>
  166. </div>
  167. <span >
  168. <i class="question circle icon" data-content="{{.i18n.Tr "cloudbrain.model_file_postfix_rule"}}" data-position="top center" data-variation="inverted mini"></i>
  169. </span>
  170. </div>
  171. <div class="required inline min_title field " style="display: none;">
  172. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label>
  173. <select class="ui dropdown width48" id="trainjob_resource_pool" name="pool_id">
  174. {{range .resource_pools}}
  175. <option value="{{.ID}}">{{.Value}}</option>
  176. {{end}}
  177. </select>
  178. </div>
  179. {{if not $Grampus}}
  180. {{if eq .datasetType 0}}
  181. <div id="images-new-cb"></div>
  182. <input type="hidden" id="ai_image_name" value="{{.image}}">
  183. {{else}}
  184. <div class="required inline min_title fields" style="width: 95%;">
  185. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.AI_driver"}}</label>
  186. <div class="field" style="flex: 1.5;">
  187. <select class="ui dropdown width100" id="trainjob_engines">
  188. {{range .engines}}
  189. <option value="{{.Value}}">{{.Value}}</option>
  190. {{end}}
  191. </select>
  192. </div>
  193. <div class="field" style="flex: 2;" id="engine_name">
  194. <select class="ui dropdown width100" id="trainjob_engine_versions" name="engine_id">
  195. {{if .engine_id}}
  196. {{range .engine_versions}}
  197. {{if eq $.engine_id .ID}}
  198. <option value="{{.ID}}">{{.Value}}</option>
  199. {{end}}
  200. {{end}}
  201. {{range .engine_versions}}
  202. {{if ne $.engine_id .ID}}
  203. <option value="{{.ID}}">{{.Value}}</option>
  204. {{end}}
  205. {{end}}
  206. {{else}}
  207. {{range .engine_versions}}
  208. <option value="{{.ID}}">{{.Value}}</option>
  209. {{end}}
  210. {{end}}
  211. </select>
  212. </div>
  213. </div>
  214. {{end}}
  215. {{else}}
  216. {{if eq .datasetType 0}}
  217. <div id="images-new-grampus"></div>
  218. {{else}}
  219. <div class="required min_title inline field" id="engine_name">
  220. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}</label>
  221. <select class="ui dropdown width48" id="trainjob_images" name="image_id">
  222. {{if .image_id}}
  223. {{range .images}}
  224. {{if eq $.image_id .ID}}
  225. <option value="{{.ID}}">{{.Name}}</option>
  226. {{end}}
  227. {{end}}
  228. {{range .images}}
  229. {{if ne $.image_id .ID}}
  230. <option value="{{.ID}}">{{.Name}}</option>
  231. {{end}}
  232. {{end}}
  233. {{else}}
  234. {{range .images}}
  235. <option name="image_id" value="{{.ID}}">{{.Name}}</option>
  236. {{end}}
  237. {{end}}
  238. </select>
  239. </div>
  240. {{end}}
  241. {{end}}
  242. <div class="inline field min_title required">
  243. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label>
  244. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="{{.boot_file}}" tabindex="3" autofocus required maxlength="255">
  245. <span>
  246. <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i>
  247. </span>
  248. <a href="https://git.openi.org.cn/OpenIOSSG/aisafety" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
  249. </div>
  250. <div class="inline field min_title required fields" style="width: 95%;">
  251. <label class="label-fix-width label-required" style="font-weight: normal;">{{.i18n.Tr "modelsafety.base_data_set"}}</label>
  252. <div class="field" style="flex:1.5">
  253. <select id="baseDataSet-sel" class="ui dropdown width100" name="src_dataset" ovalue="{{.src_dataset}}"></select>
  254. </div>
  255. <div class="field" style="flex:2;display:flex;">
  256. <label class="label-fix-width label-required" style="font-weight:normal;display:flex;justify-content:right;align-items: center;">{{.i18n.Tr "modelsafety.combat_data_set"}}</label>
  257. <div style="flex:1">
  258. <select id="combatDataSet-sel" class="ui dropdown width100" name="combat_dataset" ovalue="{{.combat_dataset}}"></select>
  259. </div>
  260. </div>
  261. </div>
  262. <div class="inline min_title field required">
  263. <label class="label-fix-width" style="font-weight:normal;">{{.i18n.Tr "modelsafety.evaluation_indicators"}}</label>
  264. <input type="text" style="display:none;" name="evaluation_index" />
  265. <select id="job_indicators" class="ui dropdown width48 v-middle" multiple style='width:385px;' ovalue="{{.evaluationIndex}}">
  266. <option value="ACC">ACC</option>
  267. <!-- <option value="CAV">CAV</option>-->
  268. <option value="ASS">ASS</option>
  269. <option value="ALDp">ALDp</option>
  270. <option value="ACAC">ACAC</option>
  271. <!-- <option value="ACTC">ACTC</option> -->
  272. <option value="PSD">PSD</option>
  273. <!-- <option value="CACC">CACC</option> -->
  274. </select>
  275. {{template "repo/modelsafety/indicators_descr".}}
  276. </div>
  277. <div class="inline min_title field">
  278. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label>
  279. <span id="add_run_para" style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;">
  280. <i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}
  281. </span>
  282. <input id="store_run_para" type="hidden" name="run_para_list">
  283. <div class="dynamic field" style="margin-top: 1rem;" data-params="{{.run_para_list}}" data-params-value="{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}" data-params-name="{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}"></div>
  284. </div>
  285. <div class="required min_title inline field">
  286. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  287. <select id="__specs__" class="ui dropdown width48"
  288. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
  289. {{if .CloudBrainPaySwitch}}blance="{{.PointAccount.Balance}}"{{end}}
  290. name="spec_id">
  291. </select>
  292. <span><i class="question circle icon link"></i></span>
  293. <a href="{{AppSubUrl}}/resource_desc" target="_blank">{{.i18n.Tr "custom.resource_description"}}</a>
  294. {{if .CloudBrainPaySwitch}}
  295. <div class="cloudbrain_resource_spec_blance_tip width48" style="padding:0 5px;margin:6px 0;margin-left:155px;font-size:12px;">
  296. <span>{{$.i18n.Tr "points.balance_of_points"}}<span style="color:red;margin: 0 3px">{{.PointAccount.Balance}}</span>{{$.i18n.Tr "points.points"}}</span><span>{{$.i18n.Tr "points.expected_time"}}<span style="color:red;margin: 0 3px" class="can-use-time"></span>{{$.i18n.Tr "points.hours"}}</span>
  297. <span style="float:right;">
  298. <i class="question circle icon link" data-position="right center" data-variation="mini"></i>
  299. <a href="{{AppSubUrl}}/reward/point/rule" target="_blank">{{$.i18n.Tr "points.points_acquisition_instructions"}}</a>
  300. </span>
  301. </div>
  302. {{end}}
  303. </div>
  304. <div class="inline unite min_title field">
  305. <label class="label-fix-width" style="font-weight: normal;"></label>
  306. <button class="ui create_train_job green button">
  307. {{.i18n.Tr "repo.cloudbrain.new"}}
  308. </button>
  309. <a class="ui button" href="{{.RepoLink}}/cloudbrain/benchmark">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  310. </div>
  311. </div>
  312. </form>
  313. </div>
  314. </div>
  315. </div>
  316. {{template "base/footer" .}}
  317. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  318. <script src="{{StaticUrlPrefix}}/js/cloudbrainNew.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  319. <script>
  320. let form = document.getElementById('form_id');
  321. let createFlag = false
  322. form.onsubmit = function (e) {
  323. if(createFlag) return false
  324. createFlag = true
  325. }
  326. $('.menu .item').tab();
  327. var isValidate = false;
  328. function validate() {
  329. $('.ui.form')
  330. .form({
  331. on: 'blur',
  332. fields: {
  333. boot_file: {
  334. identifier: "boot_file",
  335. rules: [
  336. {
  337. type: "regExp[/.+.py$/g]",
  338. },
  339. ],
  340. },
  341. job_name: {
  342. identifier: "job_name",
  343. rules: [
  344. {
  345. type: "regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]",
  346. },
  347. ],
  348. },
  349. display_job_name: {
  350. identifier: "display_job_name",
  351. rules: [
  352. {
  353. type: "regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]",
  354. },
  355. ],
  356. },
  357. attachment: {
  358. identifier: "attachment",
  359. rules: [
  360. {
  361. type: "empty",
  362. },
  363. ],
  364. },
  365. spec_id: {
  366. identifier: "spec_id",
  367. rules: [{ type: "empty" }],
  368. },
  369. evaluation_index:{
  370. identifier: 'evaluation_index',
  371. rules: [{ type: 'empty', } ]
  372. },
  373. model_name:{
  374. identifier: 'model_name',
  375. rules: [{ type: 'empty', } ]
  376. },
  377. train_url:{
  378. identifier: 'train_url',
  379. rules: [{ type: 'empty', }]
  380. },
  381. ckpt_name:{
  382. identifier: 'ckpt_name',
  383. rules: [{ type: 'empty', }]
  384. },
  385. },
  386. onSuccess: function () {
  387. document.getElementById("mask").style.display = "block";
  388. isValidate = true;
  389. },
  390. onFailure: function (e) {
  391. document.getElementById("mask").style.display = "none";
  392. isValidate = false;
  393. createFlag = false;
  394. return false;
  395. }
  396. })
  397. }
  398. validate();
  399. $('.ui.create_train_job.green.button').click(function (e) {
  400. validate();
  401. });
  402. ;(function() {
  403. var SPECS = {{ .benchmark_specs }} || {{ .Specs }};
  404. var showPoint = {{ .CloudBrainPaySwitch }};
  405. window.renderSpecsSelect($('#__specs__'), SPECS, showPoint, {
  406. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  407. free: {{$.i18n.Tr "cloudbrain.free"}},
  408. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  409. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  410. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  411. });
  412. })();
  413. ;(function() {
  414. var baseDataSetName = {{.BaseDataSetName}} || '';
  415. var baseDataSetUUID = {{.BaseDataSetUUID}} || '';
  416. var combatDataSetName = {{.CombatDataSetName}} || '';
  417. var combatDataSetUUID = {{.CombatDataSetUUID}} || '';
  418. var baseDataSetSel = $('#baseDataSet-sel');
  419. var combatDataSetSel = $('#combatDataSet-sel');
  420. function initDataSetSelect(names, keys, selectEl) {
  421. selectEl.empty();
  422. var nameList = names.split(',');
  423. var keyList = keys.split(',')
  424. for (var i = 0, iLen = nameList.length; i < iLen; i++) {
  425. selectEl.append(`<option index="${i}" value="${keyList[i]}">${nameList[i]}</option>`);
  426. }
  427. var oValue = selectEl.attr('ovalue');
  428. oValue && selectEl.val(oValue);
  429. selectEl.on('change', function() {
  430. var self = $(this);
  431. var selectIndex = self.find('option:selected').attr('index');
  432. var type = self.attr('id');
  433. if (type === 'baseDataSet-sel') {
  434. var val = combatDataSetSel.find('option[index="'+selectIndex+'"]').attr('value');
  435. combatDataSetSel.dropdown('set selected', val);
  436. } else {
  437. var val = baseDataSetSel.find('option[index="'+selectIndex+'"]').attr('value');
  438. baseDataSetSel.dropdown('set selected', val);
  439. }
  440. }).trigger('change');
  441. }
  442. initDataSetSelect(baseDataSetName, baseDataSetUUID, baseDataSetSel);
  443. initDataSetSelect(combatDataSetName, combatDataSetUUID, combatDataSetSel);
  444. $('#job_indicators').on('change', function() {
  445. var value = $(this).val();
  446. $('input[name="evaluation_index"]').val(value.join(';'));
  447. }).trigger('change');
  448. var oIndicators = $('#job_indicators').attr('ovalue');
  449. if (oIndicators) {
  450. $('input[name="evaluation_index"]').val(oIndicators);
  451. $('#job_indicators').dropdown('set exactly', oIndicators.split(';'))
  452. };
  453. })();
  454. </script>