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

4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. <div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}"></div>
  21. {{template "base/alert" .}}
  22. <div class="ui negative message" id="messageInfo">
  23. <p></p>
  24. </div>
  25. <form class="ui form" id="form_id" action="{{.Link}}" method="post">
  26. {{.CsrfTokenHtml}}
  27. <h3 class="ui top attached header">
  28. {{.i18n.Tr "repo.cloudbrain.new"}}
  29. </h3>
  30. <div class="ui attached segment">
  31. <!-- <br> -->
  32. <div class="inline required field">
  33. <label>{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  34. <div class="ui blue small menu compact selectcloudbrain">
  35. <a class="item" href="{{.RepoLink}}/cloudbrain/create">
  36. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  37. <path fill="none" d="M0 0h24v24H0z"/>
  38. <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"/>
  39. </svg>
  40. CPU/GPU</a>
  41. <a class="active item" href="{{.RepoLink}}/modelarts/notebook/create">
  42. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  43. <path fill="none" d="M0 0h24v24H0z"/>
  44. <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"/>
  45. </svg>
  46. Ascend NPU</a>
  47. </div>
  48. </div>
  49. <div class="inline required field">
  50. <label>{{.i18n.Tr "cloudbrain.task_name"}}</label>
  51. <input name="display_job_name" id="cloudbrain_job_name" placeholder="任务名称" value="{{.display_job_name}}" tabindex="3" autofocus required maxlength="255" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  52. </div>
  53. <div class="inline required field">
  54. <label>{{.i18n.Tr "cloudbrain.mirror"}}</label>
  55. <select id="cloudbrain_image" class="ui search dropdown" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" style='width:385px' name="image_id">
  56. {{range .images}}
  57. <option name="image_id" value="{{.Id}}">{{.Value}}</option>
  58. {{end}}
  59. </select>
  60. </div>
  61. <div id="select-multi-dataset">
  62. </div>
  63. <!--<div class="inline required field">
  64. <label>工作环境</label>
  65. <input name="de" id="cloudbrain_de" value="{{.env}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  66. </div>
  67. <div class="inline required field">
  68. <label>类型</label>
  69. <input name="job_type" id="cloudbrain_job_type" value="{{.notebook_type}}" tabindex="3" disabled autofocus required maxlength="255" readonly="readonly">
  70. </div> -->
  71. <div class="inline required field">
  72. <label>{{.i18n.Tr "cloudbrain.specification"}}</label>
  73. <select id="cloudbrain_flavor" class="ui search dropdown" placeholder="选择规格" style='width:385px' name="flavor">
  74. {{range .flavors}}
  75. <option name="flavor" value="{{.Value}}">{{.Desc}}</option>
  76. {{end}}
  77. </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>
  101. // 判断必填选项是否填写正确
  102. let form = document.getElementById('form_id');
  103. $('#messageInfo').css('display','none')
  104. form.onsubmit = function(e){
  105. let value_task = $("input[name='display_job_name']").val()
  106. let re = /^[a-z0-9][a-z0-9-_]{1,36}$/
  107. let flag = re.test(value_task)
  108. if(!flag){
  109. $('#messageInfo').css('display','block')
  110. let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-、最长36个字符。'
  111. $('#messageInfo p').text(str)
  112. return false
  113. }
  114. let min_value_task = value_task.toLowerCase()
  115. $("input[name='display_job_name']").attr("value",min_value_task)
  116. document.getElementById("mask").style.display = "block"
  117. }
  118. // 点击按钮后遮罩层显示
  119. // function showmask() {
  120. // document.getElementById("mask").style.display = "block"
  121. // }
  122. // 页面加载完毕后遮罩层隐藏
  123. document.onreadystatechange = function() {
  124. if (document.readyState === "complete") {
  125. document.getElementById("mask").style.display = "none"
  126. }
  127. }
  128. $('select.dropdown')
  129. .dropdown();
  130. $(function() {
  131. $("#cloudbrain_job_type").change(function() {
  132. if ($(this).val() == 'BENCHMARK') {
  133. $(".cloudbrain_benchmark").show();
  134. } else {
  135. $(".cloudbrain_benchmark").hide();
  136. }
  137. })
  138. })
  139. $(document).ready(function(){
  140. $(document).keydown(function(event){
  141. if(event.keyCode==13){
  142. event.preventDefault();
  143. }
  144. });
  145. });
  146. </script>