|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- {{template "base/head" .}}
- <style>
- /* 遮罩层css效果图 */
-
- #mask {
- position: fixed;
- top: 0px;
- left: 0px;
- right: 0px;
- bottom: 0px;
- filter: alpha(opacity=60);
- background-color: #777;
- z-index: 1000;
- display: none;
- opacity: 0.8;
- -moz-opacity: 0.5;
- padding-top: 100px;
- color: #000000
- }
- /* 加载圈css效果图 */
-
- #loadingPage {
- margin: 200px auto;
- width: 50px;
- height: 40px;
- text-align: center;
- font-size: 10px;
- display: block;
- }
-
- #loadingPage>div {
- background-color: green;
- height: 100%;
- width: 6px;
- display: inline-block;
- -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
- animation: sk-stretchdelay 1.2s infinite ease-in-out;
- }
-
- #loadingPage .rect2 {
- -webkit-animation-delay: -1.1s;
- animation-delay: -1.1s;
- }
-
- #loadingPage .rect3 {
- -webkit-animation-delay: -1.0s;
- animation-delay: -1.0s;
- }
-
- #loadingPage .rect4 {
- -webkit-animation-delay: -0.9s;
- animation-delay: -0.9s;
- }
-
- #loadingPage .rect5 {
- -webkit-animation-delay: -0.8s;
- animation-delay: -0.8s;
- }
-
- @-webkit-keyframes sk-stretchdelay {
- 0%,
- 40%,
- 100% {
- -webkit-transform: scaleY(0.4)
- }
- 20% {
- -webkit-transform: scaleY(1.0)
- }
- }
-
- @keyframes sk-stretchdelay {
- 0%,
- 40%,
- 100% {
- transform: scaleY(0.4);
- -webkit-transform: scaleY(0.4);
- }
- 20% {
- transform: scaleY(1.0);
- -webkit-transform: scaleY(1.0);
- }
- }
-
- .inline.required.field.cloudbrain_benchmark {
- display: none;
- }
- </style>
-
- <div id="mask">
- <div id="loadingPage">
- <div class="rect1"></div>
- <div class="rect2"></div>
- <div class="rect3"></div>
- <div class="rect4"></div>
- <div class="rect5"></div>
- </div>
- </div>
- <div class="repository">
- {{template "repo/header" .}}
- <div class="repository new repo ui middle very relaxed page grid">
- <div class="column">
- {{template "base/alert" .}}
- <div class="ui positive message" id="messageInfo">
- <p></p>
- </div>
- <form class="ui form" id="form_id" action="{{.Link}}" method="post">
- {{.CsrfTokenHtml}}
- <h3 class="ui top attached header">
- {{.i18n.Tr "repo.cloudbrain.new"}}
- </h3>
- <div class="ui attached segment">
- <!-- <br> -->
- <div class="inline required field">
- <label>任务名称</label>
- <input name="job_name" id="cloudbrain_job_name" placeholder="任务名称" value="{{.job_name}}" tabindex="3" autofocus required maxlength="254">
- </div>
-
- <div class="inline field">
- <label>数据集</label>
- <input type="text" list="cloudbrain_dataset" placeholder="选择数据集" name="" id="answerInput" autofocus maxlength="36">
- <datalist id="cloudbrain_dataset" class="ui search" style='width:385px' name="attachment">
- {{range .attachments}}
- <option name="attachment" data-value="{{.UUID}}">{{.Attachment.Name}}</option>
- {{end}}
- </datalist>
- <input type="hidden" name="attachment" id="answerInput-hidden">
- </div>
-
- <div class="inline required field">
- <label>工作环境</label>
- <input name="de" id="cloudbrain_de" value="{{.env}}" tabindex="3" disabled autofocus required maxlength="254" readonly="readonly">
- </div>
- <div class="inline required field">
- <label>类型</label>
- <input name="job_type" id="cloudbrain_job_type" value="{{.notebook_type}}" tabindex="3" disabled autofocus required maxlength="254" readonly="readonly">
- </div>
- <div class="inline required field">
- <label>规格</label>
- <select id="cloudbrain_flavor" class="ui search dropdown" placeholder="选择规格" style='width:385px' name="flavor">
- {{range .flavors}}
- <option name="flavor" value="{{.Value}}">{{.Desc}}</option>
-
- {{end}}
- </select>
- </div>
- <div class="inline required field">
- <label>数据集存放路径</label>
- <input name="dataset_path" id="cloudbrain_dataset_path" value="{{.dataset_path}}" tabindex="3" disabled autofocus required maxlength="254" readonly="readonly">
- </div>
- <div class="inline field">
- <label>描述</label>
- <input name="description" id="cloudbrain_description" tabindex="3" autofocus maxlength="254">
- </div>
- <div class="inline field">
- <label></label>
- <button class="ui green button">
- {{.i18n.Tr "repo.cloudbrain.new"}}
- </button>
- <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- {{template "base/footer" .}}
-
- <script>
- // 取消创建跳转
- let url_href = window.location.pathname.split('create')[0]
- $(".ui.button").attr('href',url_href)
-
- // 判断必填选项是否填写正确
- let form = document.getElementById('form_id');
-
- $('#messageInfo').css('display','none')
-
- form.onsubmit = function(e){
- let value_task = $("input[name='job_name']").val()
-
-
- let re = /^[a-z0-9][a-z0-9-_]{1,36}$/
- let flag = re.test(value_task)
- if(!flag){
- $('#messageInfo').css('display','block')
- let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-、最长36个字符。'
- $('#messageInfo p').text(str)
- return false
- }
-
- let min_value_task = value_task.toLowerCase()
-
- $("input[name='job_name']").attr("value",min_value_task)
- document.getElementById("mask").style.display = "block"
-
- }
- // 点击按钮后遮罩层显示
- // function showmask() {
- // document.getElementById("mask").style.display = "block"
- // }
-
- // 页面加载完毕后遮罩层隐藏
- document.onreadystatechange = function() {
- if (document.readyState === "complete") {
- document.getElementById("mask").style.display = "none"
- }
- }
-
- $('select.dropdown')
- .dropdown();
-
- $(function() {
- $("#cloudbrain_job_type").change(function() {
- if ($(this).val() == 'BENCHMARK') {
- $(".cloudbrain_benchmark").show();
- } else {
- $(".cloudbrain_benchmark").hide();
- }
- })
- })
- document.querySelector('input[list]').addEventListener('input',function(e){
- var input = e.target,
- list = input.getAttribute('list'),
- options = document.querySelectorAll('#'+list+' option'),
- hiddenInput = document.getElementById(input.getAttribute('id')+'-hidden'),
- inputValue = input.value;
- hiddenInput.value = inputValue;
- for (let i=0;i<options.length;i++){
- var option = options[i]
- if(option.innerText===inputValue){
-
- hiddenInput.value = option.getAttribute('data-value');
- break
-
- }
- }
-
-
- })
- </script>
|