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

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