Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2585 Reviewed-by: lewis <747342561@qq.com>pull/2590/head
@@ -66,7 +66,7 @@ func grampusTrainJobNewDataPrepare(ctx *context.Context, processType string) err | |||||
ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
t := time.Now() | t := time.Now() | ||||
var displayJobName = cutString(ctx.User.Name, 5) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
var displayJobName = jobNamePrefixValid(cutString(ctx.User.Name, 5)) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
ctx.Data["display_job_name"] = displayJobName | ctx.Data["display_job_name"] = displayJobName | ||||
//get valid images | //get valid images | ||||
@@ -686,7 +686,7 @@ func trainJobNewDataPrepare(ctx *context.Context) error { | |||||
//} | //} | ||||
t := time.Now() | t := time.Now() | ||||
var displayJobName = cutString(ctx.User.Name, 5) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
var displayJobName = jobNamePrefixValid(cutString(ctx.User.Name, 5)) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
ctx.Data["display_job_name"] = displayJobName | ctx.Data["display_job_name"] = displayJobName | ||||
attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | ||||
@@ -791,7 +791,7 @@ func trainJobErrorNewDataPrepare(ctx *context.Context, form auth.CreateModelArts | |||||
//} | //} | ||||
t := time.Now() | t := time.Now() | ||||
var displayJobName = cutString(ctx.User.Name, 5) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
var displayJobName = jobNamePrefixValid(cutString(ctx.User.Name, 5)) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
ctx.Data["display_job_name"] = displayJobName | ctx.Data["display_job_name"] = displayJobName | ||||
attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | ||||
@@ -974,7 +974,7 @@ func versionErrorDataPrepare(ctx *context.Context, form auth.CreateModelArtsTrai | |||||
} | } | ||||
t := time.Now() | t := time.Now() | ||||
var jobName = cutString(ctx.User.Name, 5) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
var jobName = jobNamePrefixValid(cutString(ctx.User.Name, 5)) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
ctx.Data["job_name"] = task.JobName | ctx.Data["job_name"] = task.JobName | ||||
attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | ||||
@@ -2321,7 +2321,7 @@ func inferenceJobNewDataPrepare(ctx *context.Context) error { | |||||
ctx.Data["newInference"] = true | ctx.Data["newInference"] = true | ||||
t := time.Now() | t := time.Now() | ||||
var displayJobName = cutString(ctx.User.Name, 5) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
var displayJobName = jobNamePrefixValid(cutString(ctx.User.Name, 5)) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] | |||||
ctx.Data["display_job_name"] = displayJobName | ctx.Data["display_job_name"] = displayJobName | ||||
attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) | ||||
@@ -69,8 +69,8 @@ | |||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 80%;" name="display_job_name" id="trainjob_job_name" | <input style="width: 80%;" name="display_job_name" id="trainjob_job_name" | ||||
placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | ||||
tabindex="3" autofocus required maxlength="254"> | |||||
<span class="tooltips" style="display: block;margin-left:11.5rem;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
tabindex="3" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="display: block;margin-left:11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="required min_title inline field"> | <div class="required min_title inline field"> | ||||
<label class="label-fix-width" style="font-weight: normal;" | <label class="label-fix-width" style="font-weight: normal;" | ||||
@@ -165,8 +165,8 @@ | |||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 80%;" name="display_job_name" id="trainjob_job_name" | <input style="width: 80%;" name="display_job_name" id="trainjob_job_name" | ||||
placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | ||||
tabindex="3" autofocus required maxlength="254"> | |||||
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
tabindex="3" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="min_title inline field"> | <div class="min_title inline field"> | ||||
<label class="label-fix-width" style="font-weight: normal;" | <label class="label-fix-width" style="font-weight: normal;" | ||||
@@ -331,7 +331,7 @@ | |||||
identifier: 'display_job_name', | identifier: 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
promt: '' | promt: '' | ||||
} | } | ||||
] | ] | ||||
@@ -94,8 +94,8 @@ | |||||
</div> | </div> | ||||
<div class="required min_title inline field"> | <div class="required min_title inline field"> | ||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" onkeyup="this.value=this.value.replace(/[, ]/g,'')" tabindex="3" autofocus required maxlength="64"> | |||||
<span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" onkeyup="this.value=this.value.replace(/[, ]/g,'')" tabindex="3" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="unite min_title inline field"> | <div class="unite min_title inline field"> | ||||
@@ -444,7 +444,7 @@ | |||||
identifier : 'display_job_name', | identifier : 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -132,8 +132,8 @@ | |||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" | <input style="width: 60%;" name="display_job_name" id="display_job_name" | ||||
placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | ||||
tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required | tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required | ||||
maxlength="64"> | |||||
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
maxlength="36"> | |||||
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="inline min_title field"> | <div class="inline min_title field"> | ||||
@@ -441,7 +441,7 @@ | |||||
identifier: 'display_job_name', | identifier: 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -118,8 +118,8 @@ | |||||
</div> | </div> | ||||
<div class="required min_title inline field"> | <div class="required min_title inline field"> | ||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="64"> | |||||
<span class="tooltips" style="margin-left: 11.5rem;display: block;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="margin-left: 11.5rem;display: block;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="min_title inline field"> | <div class="min_title inline field"> | ||||
@@ -387,7 +387,7 @@ | |||||
identifier : 'display_job_name', | identifier : 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -115,8 +115,8 @@ | |||||
<div class="required min_title inline field"> | <div class="required min_title inline field"> | ||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="64"> | |||||
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="min_title inline field"> | <div class="min_title inline field"> | ||||
@@ -416,7 +416,7 @@ | |||||
identifier : 'display_job_name', | identifier : 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -94,8 +94,8 @@ | |||||
</div> | </div> | ||||
<div class="required min_title inline field"> | <div class="required min_title inline field"> | ||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" onkeyup="this.value=this.value.replace(/[, ]/g,'')" tabindex="3" autofocus required maxlength="64"> | |||||
<span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" onkeyup="this.value=this.value.replace(/[, ]/g,'')" tabindex="3" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="min_title inline field"> | <div class="min_title inline field"> | ||||
@@ -468,7 +468,7 @@ | |||||
identifier : 'display_job_name', | identifier : 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -50,7 +50,7 @@ | |||||
</div> | </div> | ||||
<div class="inline required field"> | <div class="inline required field"> | ||||
<label>{{.i18n.Tr "cloudbrain.task_name"}}</label> | <label>{{.i18n.Tr "cloudbrain.task_name"}}</label> | ||||
<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,'')"> | |||||
<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,'')"> | |||||
</div> | </div> | ||||
<div class="inline required field"> | <div class="inline required field"> | ||||
@@ -118,7 +118,7 @@ | |||||
identifier : 'display_job_name', | identifier : 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,36}$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -136,11 +136,11 @@ | |||||
let value_task = $("input[name='display_job_name']").val() | let value_task = $("input[name='display_job_name']").val() | ||||
let re = /^[a-z0-9][a-z0-9-_]{1,36}$/ | |||||
let re = /^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/ | |||||
let flag = re.test(value_task) | let flag = re.test(value_task) | ||||
if(!flag){ | if(!flag){ | ||||
$('#messageInfo').css('display','block') | $('#messageInfo').css('display','block') | ||||
let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-、最长36个字符。' | |||||
let str = '只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。' | |||||
$('#messageInfo p').text(str) | $('#messageInfo p').text(str) | ||||
return false | return false | ||||
} | } | ||||
@@ -122,8 +122,8 @@ | |||||
</div> | </div> | ||||
<div class="required inline min_title field"> | <div class="required inline min_title field"> | ||||
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | ||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="64"> | |||||
<span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||||
<input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="36"> | |||||
<span class="tooltips" style="margin-left:11.5rem;display: block;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span> | |||||
</div> | </div> | ||||
<div class="inline min_title field"> | <div class="inline min_title field"> | ||||
@@ -469,7 +469,7 @@ | |||||
identifier: 'display_job_name', | identifier: 'display_job_name', | ||||
rules: [ | rules: [ | ||||
{ | { | ||||
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||||
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]', | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||