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 11 kB

4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 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
4 years ago
3 years ago
3 years ago
4 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. {{template "base/head" .}}
  2. <style>
  3. .inline.required.field.cloudbrain_benchmark {
  4. display: none;
  5. }
  6. </style>
  7. {{template "custom/global_mask" .}}
  8. <div class="repository">
  9. {{template "repo/header" .}}
  10. <div class="repository new repo ui middle very relaxed page grid">
  11. <div class="column">
  12. <div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}"></div>
  13. {{template "base/alert" .}}
  14. <div class="ui negative message" id="messageInfo">
  15. <p></p>
  16. </div>
  17. {{template "custom/alert_cb" .}}
  18. <form class="ui form" id="form_id" action="{{.Link}}" method="post">
  19. {{.CsrfTokenHtml}}
  20. <h3 class="ui top attached header">
  21. {{.i18n.Tr "repo.cloudbrain.new"}}
  22. </h3>
  23. <div class="ui attached segment">
  24. <!-- <br> -->
  25. <div class="inline required field">
  26. <label>{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  27. <div class="ui blue small menu compact selectcloudbrain">
  28. <a class="item" href="{{.RepoLink}}/cloudbrain/create">
  29. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  30. <path fill="none" d="M0 0h24v24H0z"/>
  31. <path 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"/>
  32. </svg>
  33. CPU/GPU</a>
  34. <a class="active item" href="{{.RepoLink}}/modelarts/notebook/create">
  35. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  36. <path fill="none" d="M0 0h24v24H0z"/>
  37. <path 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"/>
  38. </svg>
  39. Ascend NPU</a>
  40. </div>
  41. </div>
  42. <div class="inline field">
  43. <label></label>
  44. {{template "custom/task_wait_count" .}}
  45. </div>
  46. <div class="inline required field">
  47. <label>{{.i18n.Tr "cloudbrain.task_name"}}</label>
  48. <input name="display_job_name" id="cloudbrain_job_name" placeholder="任务名称" value="{{.display_job_name}}" tabindex="3" autofocus required maxlength="36" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  49. </div>
  50. <div class="inline required field">
  51. <label>{{.i18n.Tr "cloudbrain.mirror"}}</label>
  52. <select id="cloudbrain_image" class="ui search dropdown" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" style='width:385px' name="image_id">
  53. {{range .images}}
  54. <option name="image_id" value="{{.Id}}">{{.Value}}</option>
  55. {{end}}
  56. </select>
  57. </div>
  58. <div id="select-multi-dataset">
  59. </div>
  60. <!--<div class="inline required field">
  61. <label>工作环境</label>
  62. <input name="de" id="cloudbrain_de" value="{{.env}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  63. </div>
  64. <div class="inline required field">
  65. <label>类型</label>
  66. <input name="job_type" id="cloudbrain_job_type" value="{{.notebook_type}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  67. </div> -->
  68. <!--<div class="inline required field">
  69. <label>{{.i18n.Tr "cloudbrain.specification"}}</label>
  70. <select id="cloudbrain_flavor" class="ui search dropdown" placeholder="选择规格" style='width:385px' name="flavor">
  71. {{range .flavors}}
  72. <option name="flavor" value="{{.Value}}">{{.Desc}}</option>
  73. {{end}}
  74. </select>
  75. </div>-->
  76. <div class="inline required field">
  77. <label>{{.i18n.Tr "cloudbrain.specification"}}</label>
  78. <select id="__specs__" class="ui search dropdown" ovalue="{{.spec_id}}"
  79. {{if .CloudBrainPaySwitch}}blance="{{.PointAccount.Balance}}"{{end}}
  80. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' name="spec_id"></select>
  81. {{if .CloudBrainPaySwitch}}
  82. <div class="cloudbrain_resource_spec_blance_tip" style="padding:0 5px;margin:6px 0;margin-left:265px;font-size:12px;width: 50%!important;">
  83. <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>
  84. <span style="float:right;">
  85. <i class="question circle icon link" data-position="right center" data-variation="mini"></i>
  86. <a href="{{AppSubUrl}}/reward/point/rule" target="_blank">{{$.i18n.Tr "points.points_acquisition_instructions"}}</a>
  87. </span>
  88. </div>
  89. {{end}}
  90. </div>
  91. <!--<div class="inline required field">
  92. <label>数据集存放路径</label>
  93. <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  94. </div> -->
  95. <div class="inline field">
  96. <label>{{.i18n.Tr "cloudbrain.description"}}</label>
  97. <input name="description" id="cloudbrain_description" tabindex="3" autofocus maxlength="255">
  98. </div>
  99. <div class="inline field">
  100. <label></label>
  101. <button class="ui green button">
  102. {{.i18n.Tr "repo.cloudbrain.new"}}
  103. </button>
  104. <a class="ui button cancel" href="{{.RepoLink}}/debugjob?debugListType=all">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  105. </div>
  106. </div>
  107. </form>
  108. </div>
  109. </div>
  110. </div>
  111. {{template "base/footer" .}}
  112. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  113. <script>
  114. // 判断必填选项是否填写正确
  115. let form = document.getElementById('form_id');
  116. $('#messageInfo').css('display','none')
  117. var isValidate = false;
  118. function validate(){
  119. $('.ui.form').form({
  120. on: 'blur',
  121. fields: {
  122. display_job_name:{
  123. identifier : 'display_job_name',
  124. rules: [
  125. {
  126. type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
  127. }
  128. ]
  129. },
  130. spec_id: {
  131. identifier: 'spec_id',
  132. rules: [{ type: 'empty' }]
  133. }
  134. },
  135. onSuccess: function(){
  136. isValidate = true;
  137. },
  138. onFailure: function(e){
  139. isValidate = false;
  140. return false;
  141. }
  142. })
  143. }
  144. validate();
  145. let createFlag = false
  146. form.onsubmit = function(e){
  147. if(!isValidate) return false;
  148. if(createFlag) return false;
  149. let value_task = $("input[name='display_job_name']").val()
  150. let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/
  151. let flag = re.test(value_task)
  152. if(!flag){
  153. $('#messageInfo').css('display','block')
  154. let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。'
  155. $('#messageInfo p').text(str)
  156. return false
  157. }
  158. let min_value_task = value_task.toLowerCase()
  159. $("input[name='display_job_name']").attr("value",min_value_task)
  160. document.getElementById("mask").style.display = "block"
  161. createFlag = true
  162. }
  163. // 点击按钮后遮罩层显示
  164. // function showmask() {
  165. // document.getElementById("mask").style.display = "block"
  166. // }
  167. // 页面加载完毕后遮罩层隐藏
  168. document.onreadystatechange = function() {
  169. if (document.readyState === "complete") {
  170. document.getElementById("mask").style.display = "none"
  171. }
  172. }
  173. $('select.dropdown')
  174. .dropdown();
  175. $(function() {
  176. $("#cloudbrain_job_type").change(function() {
  177. if ($(this).val() == 'BENCHMARK') {
  178. $(".cloudbrain_benchmark").show();
  179. } else {
  180. $(".cloudbrain_benchmark").hide();
  181. }
  182. })
  183. })
  184. $(document).ready(function(){
  185. $(document).keydown(function(event){
  186. if(event.keyCode==13){
  187. event.preventDefault();
  188. }
  189. });
  190. });
  191. ;(function() {
  192. var SPECS = {{ .Specs }};
  193. var showPoint = {{ .CloudBrainPaySwitch }};
  194. window.renderSpecsSelect($('#__specs__'), SPECS, showPoint, {
  195. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  196. free: {{$.i18n.Tr "cloudbrain.free"}},
  197. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  198. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  199. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  200. });
  201. })();
  202. console.log("-------------:",{{.NotStopTaskCount}})
  203. </script>