Browse Source

Merge branch 'V20220801' into fix-1347

pull/2551/head
zhoupzh 2 years ago
parent
commit
6510b74b1b
13 changed files with 98 additions and 28 deletions
  1. +8
    -8
      routers/repo/ai_model_manage.go
  2. +2
    -2
      templates/repo/cloudbrain/inference/new.tmpl
  3. +21
    -0
      templates/repo/cloudbrain/new.tmpl
  4. +2
    -2
      templates/repo/cloudbrain/trainjob/new.tmpl
  5. +1
    -0
      templates/repo/debugjob/index.tmpl
  6. +1
    -1
      templates/repo/grampus/trainjob/gpu/new.tmpl
  7. +1
    -1
      templates/repo/grampus/trainjob/npu/new.tmpl
  8. +1
    -1
      templates/repo/migrate.tmpl
  9. +2
    -2
      templates/repo/modelarts/inferencejob/new.tmpl
  10. +22
    -0
      templates/repo/modelarts/notebook/new.tmpl
  11. +1
    -1
      templates/repo/modelarts/trainjob/new.tmpl
  12. +33
    -7
      web_src/js/components/images/Images.vue
  13. +3
    -3
      web_src/js/index.js

+ 8
- 8
routers/repo/ai_model_manage.go View File

@@ -152,6 +152,10 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
}

func SaveNewNameModel(ctx *context.Context) {
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) {
ctx.Error(403, ctx.Tr("repo.model_noright"))
return
}
name := ctx.Query("Name")
if name == "" {
ctx.Error(500, fmt.Sprintf("name or version is null."))
@@ -169,6 +173,10 @@ func SaveNewNameModel(ctx *context.Context) {
}

func SaveModel(ctx *context.Context) {
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) {
ctx.Error(403, ctx.Tr("repo.model_noright"))
return
}
log.Info("save model start.")
JobId := ctx.Query("JobId")
VersionName := ctx.Query("VersionName")
@@ -177,16 +185,8 @@ func SaveModel(ctx *context.Context) {
label := ctx.Query("Label")
description := ctx.Query("Description")
engine := ctx.QueryInt("Engine")
trainTaskCreate := ctx.QueryBool("trainTaskCreate")
modelSelectedFile := ctx.Query("modelSelectedFile")
log.Info("engine=" + fmt.Sprint(engine) + " modelSelectedFile=" + modelSelectedFile)
if !trainTaskCreate {
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) {
//ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
ctx.JSON(403, ctx.Tr("repo.model_noright"))
return
}
}

if JobId == "" || VersionName == "" {
ctx.Error(500, fmt.Sprintf("JobId or VersionName is null."))


+ 2
- 2
templates/repo/cloudbrain/inference/new.tmpl View File

@@ -421,7 +421,7 @@
identifier : 'display_job_name',
rules: [
{
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[^-]$/]',
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]',
}
]
},
@@ -472,9 +472,9 @@
document.getElementById("mask").style.display = "none"
}
}
validate();
$('.ui.create_train_job.green.button').click(function(e) {
send_run_para()
get_name()
validate()
})
</script>

+ 21
- 0
templates/repo/cloudbrain/new.tmpl View File

@@ -294,6 +294,27 @@
context.value = ''
$(".icon.icons").css("visibility", "hidden")
}
function validate(){
$('.ui.form').form({
on: 'blur',
fields: {
display_job_name:{
identifier : 'display_job_name',
rules: [
{
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
}
]
},
},
onSuccess: function(){
},
onFailure: function(e){
return false;
}
})
}
validate();
form.onsubmit = function (e) {
let value_task = $("input[name='display_job_name']").val()
let value_image = $("input[name='image']").val()


+ 2
- 2
templates/repo/cloudbrain/trainjob/new.tmpl View File

@@ -483,9 +483,9 @@
$("input#ai_flaver_name").val(name2)

}
validate();
$('.ui.create_train_job.green.button').click(function (e) {
get_name()
send_run_para()
validate()
send_run_para()
})
</script>

+ 1
- 0
templates/repo/debugjob/index.tmpl View File

@@ -427,6 +427,7 @@
{{if .CanDebug}}
<a id="model-image-{{.Cloudbrain.ID}}"
class='imageBtn ui basic {{if ne .Status "RUNNING"}}disabled {{else}}blue {{end}}button'
target="_blank"
href="{{$.RepoLink}}/cloudbrain/{{.Cloudbrain.ID}}/commit_image">{{$.i18n.Tr "repo.submit_image"}}</a>
{{else}}
<a


+ 1
- 1
templates/repo/grampus/trainjob/gpu/new.tmpl View File

@@ -433,9 +433,9 @@
$("input#ai_flavor_name").val(name2)

}
validate();
$('.ui.create_train_job.green.button').click(function(e) {
get_name()
send_run_para()
validate()
})
</script>

+ 1
- 1
templates/repo/grampus/trainjob/npu/new.tmpl View File

@@ -425,9 +425,9 @@
$("input#trainjob_work_server_num").val(val_server_num_select)

}
validate();
$('.ui.create_train_job.green.button').click(function(e) {
get_name()
send_run_para()
validate()
})
</script>

+ 1
- 1
templates/repo/migrate.tmpl View File

@@ -11,7 +11,7 @@
{{template "base/alert" .}}
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
<label for="clone_addr">{{.i18n.Tr "repo.migrate.clone_address"}}</label>
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="off" />
<span class="help">
{{.i18n.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{.i18n.Tr "repo.migrate.clone_local_path"}}{{end}}
<br/>{{.i18n.Tr "repo.migrate.migrate_items_options"}}


+ 2
- 2
templates/repo/modelarts/inferencejob/new.tmpl View File

@@ -438,7 +438,7 @@
identifier : 'display_job_name',
rules: [
{
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[^-]$/]',
type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]',
}
]
},
@@ -489,9 +489,9 @@
document.getElementById("mask").style.display = "none"
}
}
validate();
$('.ui.create_train_job.green.button').click(function(e) {
send_run_para()
get_name()
validate()
})
</script>

+ 22
- 0
templates/repo/modelarts/notebook/new.tmpl View File

@@ -110,6 +110,28 @@

$('#messageInfo').css('display','none')

function validate(){
$('.ui.form').form({
on: 'blur',
fields: {
display_job_name:{
identifier : 'display_job_name',
rules: [
{
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,36}$/]',
}
]
},
},
onSuccess: function(){
},
onFailure: function(e){
return false;
}
})
}
validate();

form.onsubmit = function(e){
let value_task = $("input[name='display_job_name']").val()



+ 1
- 1
templates/repo/modelarts/trainjob/new.tmpl View File

@@ -500,9 +500,9 @@
$("input#trainjob_work_server_num").val(val_server_num_select)

}
validate();
$('.ui.create_train_job.green.button').click(function (e) {
get_name()
send_run_para()
validate()
})
</script>

+ 33
- 7
web_src/js/components/images/Images.vue View File

@@ -215,16 +215,16 @@
<div style="display:flex;align-items: center;justify-content: center;">
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span>
<span v-else style="color: rgb(19, 194, 141);">公开</span>
<el-tooltip class="item" effect="dark" content="镜像提交中..." placement="top">
<i v-if="scope.row.status===0" class="CREATING" style="margin-left:0.3rem"></i>
<el-tooltip v-if="scope.row.status===0" class="item" effect="dark" content="镜像提交中..." placement="top">
<i class="CREATING" style="margin-left:0.3rem"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="检测提交镜像是否大小超过20G!" placement="top">
<i v-if="scope.row.status===2" class="FAILED" style="margin-left:0.3rem"></i>
<el-tooltip v-if="scope.row.status===2" class="item" effect="dark" content="检测提交镜像是否大小超过20G!" placement="top">
<i class="FAILED" style="margin-left:0.3rem"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="镜像提交成功" placement="top">
<i v-if="scope.row.status===1" class="SUCCEEDED" style="margin-left:0.3rem"></i>
<el-tooltip v-if="scope.row.status===1" class="item" effect="dark" content="镜像提交成功" placement="top">
<i class="SUCCEEDED" style="margin-left:0.3rem"></i>
</el-tooltip>
</div>
@@ -473,6 +473,7 @@ export default {
tableDataCustom: [],
starCustom:[],
loadingCustom:false,
refreshCustomTimer: null,

currentPageStar:1,
pageSizeStar:10,
@@ -485,6 +486,7 @@ export default {
methods: {
handleClick(tab, event) {
this.search = ''
this.stopImageListCustomRefresh();
if(tab.name=="first"){
this.paramsPublic.q = ''
this.getImageListPublic()
@@ -560,9 +562,31 @@ export default {
});
this.loadingCustom = false
this.getImageListCustomRefresh()
})
},

getImageListCustomRefresh() {
this.stopImageListCustomRefresh();
this.refreshCustomTimer = setInterval(() => {
this.tableDataCustom.forEach(item => {
if (item.status === 0) {
this.$axios.get(`/image/${item.id}`, {}).then((res) => {
const newData = res.data;
this.tableDataCustom.forEach(it => {
if (it.id === newData.id) {
it.status = newData.status;
}
});
})
}
});
}, 5000);
},

stopImageListCustomRefresh() {
this.refreshCustomTimer && clearInterval(this.refreshCustomTimer);
},
getImageListStar(){
this.loadingStar = true
this.$axios.get('/explore/images/star',{
@@ -715,8 +739,10 @@ export default {
else{
this.getImageListPublic()
}
},
beforeDestroy() {
this.stopImageListCustomRefresh();
}

};
</script>



+ 3
- 3
web_src/js/index.js View File

@@ -2950,13 +2950,13 @@ $(document).ready(async () => {
}

const $cloneAddr = $("#clone_addr");
$cloneAddr.on("change", () => {
$cloneAddr.on("input change", () => {
const $repoName = $("#alias");
const $owner = $("#ownerDropdown div.text").attr("title");
const $urlAdd =
location.href.split("/")[0] + "//" + location.href.split("/")[2];
if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) {
// Only modify if repo_name input is blank
if ($cloneAddr.val().length > 0 /* && $repoName.val().length === 0 */) {
// modify when clone address change
const repoValue = $cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3];
$repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]);
$.get(


Loading…
Cancel
Save