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 8.3 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
4 years ago
3 years ago
4 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. {{template "base/head" .}}
  2. <style>
  3. .inline.required.field.cloudbrain_benchmark {
  4. display: none;
  5. }
  6. </style>
  7. <div id="mask">
  8. <div id="loadingPage">
  9. <div class="rect1"></div>
  10. <div class="rect2"></div>
  11. <div class="rect3"></div>
  12. <div class="rect4"></div>
  13. <div class="rect5"></div>
  14. </div>
  15. </div>
  16. <div class="repository">
  17. {{template "repo/header" .}}
  18. <div class="repository new repo ui middle very relaxed page grid">
  19. <div class="column">
  20. {{template "base/alert" .}}
  21. <div class="ui positive message" id="messageInfo">
  22. <p></p>
  23. </div>
  24. <form class="ui form" id="form_id" action="{{.Link}}" method="post">
  25. {{.CsrfTokenHtml}}
  26. <h3 class="ui top attached header">
  27. {{.i18n.Tr "repo.cloudbrain.new"}}
  28. </h3>
  29. <div class="ui attached segment">
  30. <!-- <br> -->
  31. <div class="inline required field">
  32. <label>计算资源</label>
  33. <div class="ui blue small menu compact selectcloudbrain">
  34. <a class="item" href="{{.RepoLink}}/cloudbrain/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. CPU/GPU</a>
  40. <a class="active item" href="{{.RepoLink}}/modelarts/notebook/create">
  41. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  42. <path fill="none" d="M0 0h24v24H0z"/>
  43. <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"/>
  44. </svg>
  45. Ascend NPU</a>
  46. </div>
  47. </div>
  48. <div class="inline required field">
  49. <label>任务名称</label>
  50. <input name="job_name" id="cloudbrain_job_name" placeholder="任务名称" value="{{.job_name}}" tabindex="3" autofocus required maxlength="255" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  51. </div>
  52. <div class="inline required field">
  53. <label>镜像</label>
  54. <select id="cloudbrain_image" class="ui search dropdown" placeholder="选择镜像" style='width:385px' name="image_id">
  55. {{range .images}}
  56. <option name="image_id" value="{{.Id}}">{{.Value}}</option>
  57. {{end}}
  58. </select>
  59. </div>
  60. <div class="inline field">
  61. <label>数据集</label>
  62. <input type="text" list="cloudbrain_dataset" placeholder="选择数据集" name="" id="answerInput" autofocus maxlength="36">
  63. <datalist id="cloudbrain_dataset" class="ui search" style='width:385px' name="attachment">
  64. {{range .attachments}}
  65. <option name="attachment" data-value="{{.UUID}}">{{.Attachment.Name}}</option>
  66. {{end}}
  67. </datalist>
  68. <input type="hidden" name="attachment" id="answerInput-hidden">
  69. </div>
  70. <!--<div class="inline required field">
  71. <label>工作环境</label>
  72. <input name="de" id="cloudbrain_de" value="{{.env}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  73. </div>
  74. <div class="inline required field">
  75. <label>类型</label>
  76. <input name="job_type" id="cloudbrain_job_type" value="{{.notebook_type}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  77. </div> -->
  78. <div class="inline required field">
  79. <label>规格</label>
  80. <select id="cloudbrain_flavor" class="ui search dropdown" placeholder="选择规格" style='width:385px' name="flavor">
  81. {{range .flavors}}
  82. <option name="flavor" value="{{.Value}}">{{.Desc}}</option>
  83. {{end}}
  84. </select>
  85. </div>
  86. <!--<div class="inline required field">
  87. <label>数据集存放路径</label>
  88. <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  89. </div> -->
  90. <div class="inline field">
  91. <label>描述</label>
  92. <input name="description" id="cloudbrain_description" tabindex="3" autofocus maxlength="255">
  93. </div>
  94. <div class="inline field">
  95. <label></label>
  96. <button class="ui green button">
  97. {{.i18n.Tr "repo.cloudbrain.new"}}
  98. </button>
  99. <a class="ui button cancel" href="">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  100. </div>
  101. </div>
  102. </form>
  103. </div>
  104. </div>
  105. </div>
  106. {{template "base/footer" .}}
  107. <script>
  108. // 判断必填选项是否填写正确
  109. let form = document.getElementById('form_id');
  110. $('#messageInfo').css('display','none')
  111. form.onsubmit = function(e){
  112. let value_task = $("input[name='job_name']").val()
  113. let re = /^[a-z0-9][a-z0-9-_]{1,36}$/
  114. let flag = re.test(value_task)
  115. if(!flag){
  116. $('#messageInfo').css('display','block')
  117. let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-、最长36个字符。'
  118. $('#messageInfo p').text(str)
  119. return false
  120. }
  121. let min_value_task = value_task.toLowerCase()
  122. $("input[name='job_name']").attr("value",min_value_task)
  123. document.getElementById("mask").style.display = "block"
  124. }
  125. // 点击按钮后遮罩层显示
  126. // function showmask() {
  127. // document.getElementById("mask").style.display = "block"
  128. // }
  129. // 页面加载完毕后遮罩层隐藏
  130. document.onreadystatechange = function() {
  131. if (document.readyState === "complete") {
  132. document.getElementById("mask").style.display = "none"
  133. }
  134. }
  135. $('select.dropdown')
  136. .dropdown();
  137. $(function() {
  138. $("#cloudbrain_job_type").change(function() {
  139. if ($(this).val() == 'BENCHMARK') {
  140. $(".cloudbrain_benchmark").show();
  141. } else {
  142. $(".cloudbrain_benchmark").hide();
  143. }
  144. })
  145. })
  146. document.querySelector('input[list]').addEventListener('input',function(e){
  147. var input = e.target,
  148. list = input.getAttribute('list'),
  149. options = document.querySelectorAll('#'+list+' option'),
  150. hiddenInput = document.getElementById(input.getAttribute('id')+'-hidden'),
  151. inputValue = input.value;
  152. hiddenInput.value = inputValue;
  153. for (let i=0;i<options.length;i++){
  154. var option = options[i]
  155. if(option.innerText===inputValue){
  156. hiddenInput.value = option.getAttribute('data-value');
  157. break
  158. }
  159. }
  160. })
  161. </script>