Browse Source

Merge branch 'V20220801' into fix-2477

pull/2568/head
chenshihai 2 years ago
parent
commit
4230c036c0
38 changed files with 316 additions and 142 deletions
  1. +2
    -1
      models/user_business_analysis.go
  2. +2
    -2
      options/locale/locale_en-US.ini
  3. +2
    -2
      options/locale/locale_zh-CN.ini
  4. +8
    -8
      routers/repo/ai_model_manage.go
  5. +54
    -30
      routers/repo/cloudbrain.go
  6. +3
    -3
      routers/repo/grampus.go
  7. +12
    -8
      routers/repo/modelarts.go
  8. +1
    -0
      routers/routes/routes.go
  9. +2
    -2
      templates/admin/dataset/list.tmpl
  10. +8
    -5
      templates/explore/dataset_list.tmpl
  11. +1
    -1
      templates/org/create.tmpl
  12. +9
    -1
      templates/repo/cloudbrain/benchmark/show.tmpl
  13. +2
    -2
      templates/repo/cloudbrain/inference/new.tmpl
  14. +9
    -1
      templates/repo/cloudbrain/inference/show.tmpl
  15. +21
    -0
      templates/repo/cloudbrain/new.tmpl
  16. +9
    -1
      templates/repo/cloudbrain/show.tmpl
  17. +2
    -2
      templates/repo/cloudbrain/trainjob/new.tmpl
  18. +9
    -1
      templates/repo/cloudbrain/trainjob/show.tmpl
  19. +1
    -1
      templates/repo/create.tmpl
  20. +3
    -2
      templates/repo/debugjob/index.tmpl
  21. +1
    -1
      templates/repo/grampus/trainjob/gpu/new.tmpl
  22. +1
    -1
      templates/repo/grampus/trainjob/npu/new.tmpl
  23. +2
    -2
      templates/repo/migrate.tmpl
  24. +2
    -2
      templates/repo/modelarts/inferencejob/new.tmpl
  25. +22
    -0
      templates/repo/modelarts/notebook/new.tmpl
  26. +9
    -1
      templates/repo/modelarts/notebook/show.tmpl
  27. +1
    -1
      templates/repo/modelarts/trainjob/new.tmpl
  28. +1
    -1
      templates/repo/modelarts/trainjob/show.tmpl
  29. +1
    -1
      templates/repo/modelmanage/convertIndex.tmpl
  30. +2
    -1
      templates/repo/modelmanage/index.tmpl
  31. +1
    -1
      templates/user/dashboard/cloudbrains.tmpl
  32. +9
    -7
      web_src/js/components/Model.vue
  33. +33
    -7
      web_src/js/components/images/Images.vue
  34. +26
    -12
      web_src/js/features/clipboard.js
  35. +14
    -7
      web_src/js/features/cloudbrainShow.js
  36. +3
    -3
      web_src/js/index.js
  37. +27
    -21
      web_src/less/_dataset.less
  38. +1
    -0
      web_src/less/openi.less

+ 2
- 1
models/user_business_analysis.go View File

@@ -920,7 +920,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time,
CountDate = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 1, 0, 0, currentTimeNow.Location())
}

DataDate := startTime.Format("2006-01-02")
DataDate := CountDate.Format("2006-01-02")
CodeMergeCountMap := queryPullRequest(start_unix, end_unix)
CommitCountMap := queryCommitAction(start_unix, end_unix, 5)
IssueCountMap := queryCreateIssue(start_unix, end_unix)
@@ -1103,6 +1103,7 @@ func updateNewUserAcitivity(currentUserActivity map[int64]map[int64]int64, userA
",activate_regist_user=" + fmt.Sprint(useMetrics.ActivateRegistUser) +
",not_activate_regist_user=" + fmt.Sprint(useMetrics.CurrentDayRegistUser-useMetrics.ActivateRegistUser) +
",current_day_regist_user=" + fmt.Sprint(useMetrics.CurrentDayRegistUser) +
",data_date='" + time.Unix(key, 0).Format("2006-01-02") + "'" +
" where count_date=" + fmt.Sprint(key)

statictisSess.Exec(updateSql)


+ 2
- 2
options/locale/locale_en-US.ini View File

@@ -1007,7 +1007,7 @@ cloudbrain.time.starttime=Start run time
cloudbrain.time.endtime=End run time
cloudbrain.datasetdownload=Dataset download url
model_manager = Model
model_noright=No right
model_noright=You have no right to do the operation.
model_rename=Duplicate model name, please modify model name.

date=Date
@@ -1225,7 +1225,7 @@ model.manage.create_new_convert_task=Create Model Transformation Task
modelconvert.manage.create_error1=A model transformation task with the same name already exists.
modelconvert.manage.create_error2=Only one running model transformation task can be created.
modelconvert.manage.model_not_exist=The model does not exist.
modelconvert.manage.no_operate_right=No operation permission.
modelconvert.manage.no_operate_right=You have no right to do the operation.

grampus.train_job.ai_center = AI Center
grampus.dataset_path_rule = The code is storaged in /cache/code;the dataset is storaged in /cache/dataset;and please put your model into /cache/output, then you can download it online。


+ 2
- 2
options/locale/locale_zh-CN.ini View File

@@ -1006,7 +1006,7 @@ datasets.desc=数据集功能
cloudbrain_helper=使用GPU/NPU资源,开启Notebook、模型训练任务等

model_manager = 模型
model_noright=无权限操作
model_noright=您没有操作权限。
model_rename=模型名称重复,请修改模型名称


@@ -1237,7 +1237,7 @@ model.manage.create_new_convert_task=创建模型转换任务
modelconvert.manage.create_error1=相同的名称模型转换任务已经存在。
modelconvert.manage.create_error2=只能创建一个正在运行的模型转换任务。
modelconvert.manage.model_not_exist=选择的模型不存在。
modelconvert.manage.no_operate_right=操作权限。
modelconvert.manage.no_operate_right=您没有操作权限。

grampus.train_job.ai_center=智算中心
grampus.dataset_path_rule = 训练脚本存储在/cache/code中,数据集存储在/cache/dataset中,训练输出请存储在/cache/output中以供后续下载。


+ 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."))


+ 54
- 30
routers/repo/cloudbrain.go View File

@@ -636,6 +636,7 @@ func CloudBrainTrainJobShow(ctx *context.Context) {
func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.JobType) {
ctx.Data["PageIsCloudBrain"] = true
debugListType := ctx.Query("debugListType")
cloudbrain.InitSpecialPool()

var task *models.Cloudbrain
var err error
@@ -647,22 +648,22 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo

if err != nil {
log.Info("error:" + err.Error())
ctx.Data["error"] = err.Error()
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}

result, err := cloudbrain.GetJob(task.JobID)
if err != nil {
log.Info("error:" + err.Error())
ctx.Data["error"] = err.Error()
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}
hasSpec := false
if task.JobType == string(models.JobTypeTrain) {
if cloudbrain.TrainResourceSpecs == nil {
json.Unmarshal([]byte(setting.TrainResourceSpecs), &cloudbrain.TrainResourceSpecs)
}
hasSpec := false
for _, tmp := range cloudbrain.TrainResourceSpecs.ResourceSpec {
if tmp.Id == task.ResourceSpecId {
hasSpec = true
@@ -670,24 +671,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
ctx.Data["CpuNum"] = tmp.CpuNum
ctx.Data["MemMiB"] = tmp.MemMiB
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB
}
}

if !hasSpec && cloudbrain.SpecialPools != nil {
for _, specialPool := range cloudbrain.SpecialPools.Pools {

if specialPool.ResourceSpec != nil {

for _, spec := range specialPool.ResourceSpec {
if task.ResourceSpecId == spec.Id {
ctx.Data["GpuNum"] = spec.GpuNum
ctx.Data["CpuNum"] = spec.CpuNum
ctx.Data["MemMiB"] = spec.MemMiB
ctx.Data["ShareMemMiB"] = spec.ShareMemMiB
break
}
}
}
break
}
}

@@ -697,10 +681,12 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
}
for _, tmp := range cloudbrain.InferenceResourceSpecs.ResourceSpec {
if tmp.Id == task.ResourceSpecId {
hasSpec = true
ctx.Data["GpuNum"] = tmp.GpuNum
ctx.Data["CpuNum"] = tmp.CpuNum
ctx.Data["MemMiB"] = tmp.MemMiB
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB
break
}
}
} else {
@@ -709,10 +695,32 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
}
for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec {
if tmp.Id == task.ResourceSpecId {
hasSpec = true
ctx.Data["GpuNum"] = tmp.GpuNum
ctx.Data["CpuNum"] = tmp.CpuNum
ctx.Data["MemMiB"] = tmp.MemMiB
ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB
break

}
}
}

if !hasSpec && cloudbrain.SpecialPools != nil {

for _, specialPool := range cloudbrain.SpecialPools.Pools {

if specialPool.ResourceSpec != nil {

for _, spec := range specialPool.ResourceSpec {
if task.ResourceSpecId == spec.Id {
ctx.Data["GpuNum"] = spec.GpuNum
ctx.Data["CpuNum"] = spec.CpuNum
ctx.Data["MemMiB"] = spec.MemMiB
ctx.Data["ShareMemMiB"] = spec.ShareMemMiB
break
}
}
}
}
}
@@ -731,14 +739,6 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
ctx.Data["resource_type"] = resourceType.Value
}
}
for _, specialPool := range cloudbrain.SpecialPools.Pools {

for _, resourceType := range specialPool.Pool {
if resourceType.Queue == jobRes.Config.GpuType {
ctx.Data["resource_type"] = resourceType.Value
}
}
}

} else if task.JobType == string(models.JobTypeInference) {
if inferenceGpuInfos == nil {
@@ -770,6 +770,16 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
}
}
}

if cloudbrain.SpecialPools != nil {
for _, specialPool := range cloudbrain.SpecialPools.Pools {
for _, resourceType := range specialPool.Pool {
if resourceType.Queue == jobRes.Config.GpuType {
ctx.Data["resource_type"] = resourceType.Value
}
}
}
}
taskRoles := jobRes.TaskRoles
taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{}))
ctx.Data["taskRes"] = taskRes
@@ -895,6 +905,20 @@ func CloudBrainCommitImageShow(ctx *context.Context) {
ctx.HTML(200, tplCloudBrainImageSubmit)
}

func GetImage(ctx *context.Context) {

var ID = ctx.Params(":id")
id, _ := strconv.ParseInt(ID, 10, 64)

image, err := models.GetImageByID(id)
if err != nil {
log.Error("GetImageByID failed:%v", err.Error())
ctx.JSON(http.StatusNotFound, nil)
}
ctx.JSON(http.StatusOK, image)

}

func CloudBrainImageEdit(ctx *context.Context) {
ctx.Data["PageIsImageEdit"] = true
ctx.Data["PageFrom"] = ctx.Params(":from")


+ 3
- 3
routers/repo/grampus.go View File

@@ -626,7 +626,7 @@ func GrampusTrainJobShow(ctx *context.Context) {
task, err := models.GetCloudbrainByJobIDWithDeleted(ctx.Params(":jobid"))
if err != nil {
log.Error("GetCloudbrainByJobID failed:" + err.Error())
ctx.ServerError("system error", err)
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}

@@ -634,8 +634,8 @@ func GrampusTrainJobShow(ctx *context.Context) {
result, err := grampus.GetJob(task.JobID)
if err != nil {
log.Error("GetJob failed:" + err.Error())
//ctx.ServerError("GetJob failed", err)
//return
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}

if result != nil {


+ 12
- 8
routers/repo/modelarts.go View File

@@ -257,15 +257,15 @@ func NotebookShow(ctx *context.Context) {
var ID = ctx.Params(":id")
task, err := models.GetCloudbrainByIDWithDeleted(ID)
if err != nil {
ctx.Data["error"] = err.Error()
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil)
log.Error("GET job error", err.Error())
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}

result, err := modelarts.GetNotebook2(task.JobID)
if err != nil {
ctx.Data["error"] = err.Error()
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil)
log.Error("GET job error", err.Error())
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}

@@ -276,8 +276,8 @@ func NotebookShow(ctx *context.Context) {
models.ParseAndSetDurationFromModelArtsNotebook(result, task)
err = models.UpdateJob(task)
if err != nil {
ctx.Data["error"] = err.Error()
ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil)
log.Error("GET job error", err.Error())
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}
}
@@ -1643,7 +1643,11 @@ func TrainJobShow(ctx *context.Context) {

if err != nil {
log.Error("GetVersionListTasks(%s) failed:%v", jobID, err.Error())
ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil)
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}
if len(VersionListTasks) == 0 {
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}
//设置权限
@@ -2297,7 +2301,7 @@ func InferenceJobShow(ctx *context.Context) {

if err != nil {
log.Error("GetInferenceTask(%s) failed:%v", jobID, err.Error())
ctx.RenderWithErr(err.Error(), tplModelArtsInferenceJobShow, nil)
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}
//设置权限


+ 1
- 0
routers/routes/routes.go View File

@@ -1016,6 +1016,7 @@ func RegisterRoutes(m *macaron.Macaron) {
}, context.RepoAssignment(), context.RepoMustNotBeArchived(), reqRepoAdmin)

m.Group("/image/:id", func() {
m.Get("", repo.GetImage)
m.Get("/:from", cloudbrain.AdminOrImageCreaterRight, repo.CloudBrainImageEdit)
m.Post("", cloudbrain.AdminOrImageCreaterRight, bindIgnErr(auth.EditImageCloudBrainForm{}), repo.CloudBrainImageEditPost)
m.Delete("", cloudbrain.AdminOrImageCreaterRight, repo.CloudBrainImageDelete)


+ 2
- 2
templates/admin/dataset/list.tmpl View File

@@ -35,7 +35,7 @@
{{range .Datasets}}
<tr>
<td>{{.ID}}</td>
<td style="display: flex;align-items: center;"><a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Alias}}/datasets">{{.Title}}</a>{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</td>
<td style="display: flex;align-items: center;"><a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/datasets">{{.Title}}</a>{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</td>
<td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td>
<td><span title="{{.CreatedUnix.FormatLong}}">{{.CreatedUnix.FormatShort}}</span></td>
<td>{{if .Recommend}}<span class="set_dataset" style="color: rgb(250, 140, 22);cursor: pointer;" data-url="{{$.Link}}/{{.ID}}/action/unrecommend">{{$.i18n.Tr "admin.datasets.unrecommend"}}</span>{{else}}<span class="set_dataset" style="color: rgb(19, 194, 141);cursor: pointer;" data-url="{{$.Link}}/{{.ID}}/action/recommend">{{$.i18n.Tr "admin.datasets.recommend"}}</span>{{end}}</td>
@@ -48,4 +48,4 @@
{{template "base/paginate" .}}
</div>
</div>
{{template "base/footer" .}}
{{template "base/footer" .}}

+ 8
- 5
templates/explore/dataset_list.tmpl View File

@@ -24,9 +24,9 @@
<div class="ui sixteen wide mobile ten wide tablet ten wide computer colum">
{{range .Datasets}}
<div class="item">
<div class="ui header">
<a class="name" href="{{.Repo.Link}}/datasets">
{{.Repo.OwnerName}} / {{.Repo.Alias}}
<div class="ui header" style="display: flex;">
<a class="name dataset-title-a" title="{{.Title}}" href="{{.Repo.Link}}/datasets">
{{.Title}}
</a>
<div class="ui right metas">
{{if .Task}}
@@ -40,7 +40,7 @@
</div>
<div class="description">
{{if .Description}}
<p class="has-emoji">{{.Description}}</p>
<p class="has-emoji" style="word-break: break-all;">{{.Description}}</p>
{{else if .Repo.DescriptionHTML}}
<p class="has-emoji">{{.Repo.DescriptionHTML}}</p>
{{end}}
@@ -53,4 +53,7 @@
</div>
{{end}}
</div>
</div>
</div>
<script>
console.log({{.Datasets}})
</script>

+ 1
- 1
templates/org/create.tmpl View File

@@ -48,7 +48,7 @@
<button class="ui green button">
{{.i18n.Tr "org.create_org"}}
</button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a>
<a class="ui button" href="javascript:history.go(-1)">{{.i18n.Tr "cancel"}}</a>
</div>
</div>
</form>


+ 9
- 1
templates/repo/cloudbrain/benchmark/show.tmpl View File

@@ -353,7 +353,15 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.Image}}
<span class="ui poping up clipboard" title="{{.Image}}" data-position="top center" id="clipboard-btn" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
{{.Image}}
</span>
</div>
</td>
</tr>


+ 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>

+ 9
- 1
templates/repo/cloudbrain/inference/show.tmpl View File

@@ -381,7 +381,15 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.Image}}
<span class="ui poping up clipboard" title="{{.Image}}" data-position="top center" id="clipboard-btn" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
{{.Image}}
</span>
</div>
</td>
</tr>


+ 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()


+ 9
- 1
templates/repo/cloudbrain/show.tmpl View File

@@ -390,7 +390,15 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.Image}}
<span class="ui poping up clipboard" title="{{.Image}}" data-position="top center" id="clipboard-btn" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
{{.Image}}
</span>
</div>
</td>
</tr>


+ 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>

+ 9
- 1
templates/repo/cloudbrain/trainjob/show.tmpl View File

@@ -384,7 +384,15 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.Image}}
<span class="ui poping up clipboard" title="{{.Image}}" data-position="top center" id="clipboard-btn" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
{{.Image}}
</span>
</div>
</td>
</tr>


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

@@ -176,7 +176,7 @@
<button class="ui green button" id="submit_reponame">
{{.i18n.Tr "repo.create_repo"}}
</button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a>
<a class="ui button" href="javascript:history.go(-1)">{{.i18n.Tr "cancel"}}</a>
</div>
</div>
</form>


+ 3
- 2
templates/repo/debugjob/index.tmpl View File

@@ -386,7 +386,7 @@
{{$.CsrfTokenHtml}}
{{if .CanDel}}
<a id="ai-stop-{{.Cloudbrain.ID}}"
class='ui basic ai_stop {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "STOPPING" "CREATING" "STARTING" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}}blue {{end}}button'
class='ui basic ai_stop {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "STOPPING" "CREATING" "STARTING" "SUCCEEDED" "CREATE_FAILED" "DELETED"}}disabled {{else}}blue {{end}}button'
data-repopath="{{$.RepoLink}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{.Cloudbrain.ID}}/stop"
data-jobid="{{.Cloudbrain.ID}}">
{{$.i18n.Tr "repo.stop"}}
@@ -405,7 +405,7 @@
{{$.CsrfTokenHtml}}
{{if .CanDel}}
<a id="ai-delete-{{.Cloudbrain.ID}}"
class='ui basic ai_delete {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "SUCCEEDED" "CREATE_FAILED"}}blue {{else}}disabled {{end}}button'
class='ui basic ai_delete {{if eq .Status "STOPPED" "FAILED" "START_FAILED" "SUCCEEDED" "CREATE_FAILED" "DELETED"}}blue {{else}}disabled {{end}}button'
style="border-radius: .28571429rem;">
{{$.i18n.Tr "repo.delete"}}
</a>
@@ -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>

+ 2
- 2
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"}}
@@ -102,7 +102,7 @@
<button class="ui green button" id="submit_reponame">
{{.i18n.Tr "repo.migrate_repo"}}
</button>
<a class="ui button" href="{{AppSubUrl}}/">{{.i18n.Tr "cancel"}}</a>
<a class="ui button" href="javascript:history.go(-1)">{{.i18n.Tr "cancel"}}</a>
</div>
</div>
</form>


+ 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()



+ 9
- 1
templates/repo/modelarts/notebook/show.tmpl View File

@@ -357,7 +357,15 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.Image}}
<span class="ui poping up clipboard" title="{{.Image}}" data-position="top center" id="clipboard-btn" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
{{.Image}}
</span>
</div>
</td>
</tr>


+ 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>

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

@@ -270,7 +270,7 @@
{{end}}

{{if .CanDel}}
<a class="ti-action-menu-item stop-show-version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED"}}disabled {{end}}"
<a class="ti-action-menu-item stop-show-version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED"}}disabled {{end}}"
id="{{.VersionName}}-stop"
data-jobid="{{.JobID}}"
data-repopath="{{$.RepoRelPath}}/modelarts/train-job"


+ 1
- 1
templates/repo/modelmanage/convertIndex.tmpl View File

@@ -478,7 +478,7 @@
}
function loadModelList(){
$.get(`${repolink}/modelmanage/query_model_for_predict?repoId=${repoId}`, (data) => {
$.get(`${repolink}/modelmanage/query_model_for_predict?repoId=${repoId}&type=-1`, (data) => {
modelData = data
let nameList = data.nameList
const n_length = nameList.length


+ 2
- 1
templates/repo/modelmanage/index.tmpl View File

@@ -6,7 +6,8 @@
text-align: right;
}
.inline .ui.dropdown .text {
color: rgba(0, 0, 0, .87) !important
color: rgba(0, 0, 0, .87) !important;
max-width: 360px;
}
.newtext{
left: 15px !important


+ 1
- 1
templates/user/dashboard/cloudbrains.tmpl View File

@@ -361,4 +361,4 @@
</div>
</div>
</div>
{{template "base/footer" .}}
{{template "base/footer" .}}

+ 9
- 7
web_src/js/components/Model.vue View File

@@ -6,7 +6,7 @@
ref="table"
:data="tableData"
style="min-width: 100%"
row-key="ID"
row-key="rowKey"
lazy
:load="load"
:tree-props="{children: 'Children', hasChildren: 'hasChildren'}"
@@ -171,6 +171,7 @@ export default {
tableData[i].EngineName = this.getEngineName(tableData[i])
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource
tableData[i].cName=tableData[i].Name
tableData[i].rowKey = tableData[i].ID + Math.random()
tableData[i].Name=''
tableData[i].VersionCount = ''
tableData[i].Children = true
@@ -310,18 +311,18 @@ export default {
const store = this.$refs.table.store
if(!this.loadNodeMap.get(row.cName)){
const parent = store.states.data
const index = parent.findIndex(child => child.ID == row.ID)
const index = parent.findIndex(child => child.rowKey == row.rowKey)
this.getModelList()
}else{
let {tree,treeNode,resolve} = this.loadNodeMap.get(row.cName)
const keys = Object.keys(store.states.lazyTreeNodeMap);
if(keys.includes(row.ID)){
if(keys.includes(row.rowKey)){
this.getModelList()
}else{
let parentRow = store.states.data.find(child => child.cName == row.cName);
let childrenIndex = store.states.lazyTreeNodeMap[parentRow.ID].findIndex(child => child.ID == row.ID)
let childrenIndex = store.states.lazyTreeNodeMap[parentRow.rowKey].findIndex(child => child.rowKey == row.rowKey)
parentRow.VersionCount = parentRow.VersionCount-1
const parent = store.states.lazyTreeNodeMap[parentRow.ID]
const parent = store.states.lazyTreeNodeMap[parentRow.rowKey]
if(parent.length===1){
this.getModelList()
}else{
@@ -379,8 +380,8 @@ export default {
}
},
getModelList(){
try {
this.$refs.table.store.states.lazyTreeNodeMap = {}
try {
this.loadNodeMap.clear();
this.$axios.get(location.href+'_api',{
params:this.params
}).then((res)=>{
@@ -391,6 +392,7 @@ export default {
for(let i=0;i<this.tableData.length;i++){
TrainTaskInfo = JSON.parse(this.tableData[i].TrainTaskInfo)
this.tableData[i].cName=this.tableData[i].Name
this.tableData[i].rowKey=this.tableData[i].ID + Math.random()
this.tableData[i].EngineName = this.getEngineName(this.tableData[i])
this.tableData[i].ComputeResource = TrainTaskInfo.ComputeResource
this.tableData[i].hasChildren = res.data.data[i].VersionCount===1 ? false : true


+ 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>



+ 26
- 12
web_src/js/features/clipboard.js View File

@@ -1,23 +1,37 @@
export default async function initClipboard() {
const els = document.querySelectorAll('.clipboard');
const els = document.querySelectorAll(".clipboard");
if (!els || !els.length) return;

const { default: ClipboardJS } = await import(/* webpackChunkName: "clipboard" */'clipboard');
const { default: ClipboardJS } = await import(
/* webpackChunkName: "clipboard" */ "clipboard"
);

const clipboard = new ClipboardJS(els);
clipboard.on('success', (e) => {
clipboard.on("success", (e) => {
e.clearSelection();

$(`#${e.trigger.getAttribute('id')}`).popup('destroy');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'));
$(`#${e.trigger.getAttribute('id')}`).popup('show');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'));
$(`#${e.trigger.getAttribute("id")}`).popup("destroy");
e.trigger.setAttribute(
"data-content",
e.trigger.getAttribute("data-success")
);
$(`#${e.trigger.getAttribute("id")}`).popup("show");
e.trigger.setAttribute(
"data-content",
e.trigger.getAttribute("data-original")
);
});

clipboard.on('error', (e) => {
$(`#${e.trigger.getAttribute('id')}`).popup('destroy');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'));
$(`#${e.trigger.getAttribute('id')}`).popup('show');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'));
clipboard.on("error", (e) => {
$(`#${e.trigger.getAttribute("id")}`).popup("destroy");
e.trigger.setAttribute(
"data-content",
e.trigger.getAttribute("data-error")
);
$(`#${e.trigger.getAttribute("id")}`).popup("show");
e.trigger.setAttribute(
"data-content",
e.trigger.getAttribute("data-original")
);
});
}

+ 14
- 7
web_src/js/features/cloudbrainShow.js View File

@@ -168,8 +168,8 @@ export default async function initCloudrainSow() {
let downloadFlag = $(this).data("download-flag") || "";
let gpuFlag = $(this).data("gpu-flag") || "";
let version_name = $(this).data("version");
let parents = $(this).data("parents") || "";
let filename = $(this).data("filename") || "";
let parents = $(this).data("parents");
let filename = $(this).data("filename");
let init = $(this).data("init") || "";
let path = $(this).data("path");
let url = `/api/v1/repos${path}?version_name=${version_name}&parentDir=${parents}`;
@@ -189,7 +189,7 @@ export default async function initCloudrainSow() {
htmlBread += "<div class='divider'> / </div>";
$(`#file_breadcrumb${version_name}`).append(htmlBread);
} else {
renderBrend(path, version_name, parents, filename, init);
renderBrend(path, version_name, parents, filename, init, downloadFlag);
}
}).fail(function (err) {
console.log(err, version_name);
@@ -217,7 +217,14 @@ export default async function initCloudrainSow() {
size = size.toFixed(0); //保留的小数位数
return size + unitArr[index];
}
function renderBrend(path, version_name, parents, filename, init) {
function renderBrend(
path,
version_name,
parents,
filename,
init,
downloadFlag
) {
if (init == "folder") {
let htmlBrend = "";
let sectionName = $(
@@ -227,11 +234,11 @@ export default async function initCloudrainSow() {
let filename1 = $(`input[name=modelback${version_name}]`).val();
if (parents1 === "") {
$(`#file_breadcrumb${version_name} .active.section`).replaceWith(
`<a class='section load-model-file' data-path='${path}' data-version='${version_name}' data-parents='${parents1}' data-filename='' data-init='init'>${sectionName}</a>`
`<a class='section load-model-file' data-download-flag='${downloadFlag}' data-path='${path}' data-version='${version_name}' data-parents='${parents1}' data-filename='' data-init='init'>${sectionName}</a>`
);
} else {
$(`#file_breadcrumb${version_name} .active.section`).replaceWith(
`<a class='section load-model-file' data-path='${path}' data-version='${version_name}' data-parents='${parents1}' data-filename='${filename1}'>${sectionName}</a>`
`<a class='section load-model-file' data-download-flag='${downloadFlag}' data-path='${path}' data-version='${version_name}' data-parents='${parents1}' data-filename='${filename1}'>${sectionName}</a>`
);
}

@@ -272,7 +279,7 @@ export default async function initCloudrainSow() {
html += "<span class='octicon octicon-file-directory'>";
html += "</span>";
if (data.Dirs[i].IsDir) {
html += `<a class='load-model-file' data-path='${path}' data-version='${version_name}' data-parents='${data.Dirs[i].ParenDir}' data-filename='${data.Dirs[i].FileName}' data-init='folder'>`;
html += `<a class='load-model-file' data-download-flag='${downloadFlag}' data-path='${path}' data-version='${version_name}' data-parents='${data.Dirs[i].ParenDir}' data-filename='${data.Dirs[i].FileName}' data-init='folder'>`;
html +=
"<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" +
data.Dirs[i].FileName +


+ 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(


+ 27
- 21
web_src/less/_dataset.less View File

@@ -140,27 +140,26 @@
border: 1px solid #ffffff;
}
}
}
}
}

.item {
border-bottom: 1px solid rgba(34,36,38,.15);
border-bottom: 1px solid rgba(34, 36, 38, 0.15);
.ui.buttons {
.button {
box-shadow: none !important;
}
}
}
.ui.grid > .row {
align-items: center;
}
.title {
font-size: 16px;
font-weight: bold;
margin: 0 6px;
margin: 0 6px;
overflow: hidden;
padding-right: 15px;
white-space: nowrap;
@@ -195,7 +194,15 @@
.name {
word-break: break-all;
}

.dataset-title-a {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
word-break: inherit !important;
margin-right: 3rem;
white-space: nowrap;
}
.metas {
color: #888888;
font-size: 14px;
@@ -222,7 +229,7 @@
}
}
}
.panel_creator_reponam{
.panel_creator_reponam {
display: inline-block;
border-radius: 4px;
padding: 4px;
@@ -231,29 +238,28 @@
background-color: rgba(161, 220, 255, 0.2);
color: #101010;
}
.panel_dataset_name{
.panel_dataset_name {
font-size: 15px;
color: #0366D6;
color: #0366d6;
text-align: center;
margin-left: 1rem;
}
.panel_datset_desc{
.panel_datset_desc {
white-space: nowrap;
display: inline-block;
overflow: hidden;
width: 90%;
text-overflow: ellipsis;
}
.el-dialog__body{
padding-top:0
.el-dialog__body {
padding-top: 0;
}
#dataset-base{
.active{
color: #0087f5!important;
border: 1px solid #0087f5!important;
#dataset-base {
.active {
color: #0087f5 !important;
border: 1px solid #0087f5 !important;
/* margin: -1px!important; */
background: #fff!important;
background: #fff !important;
}
}
}

+ 1
- 0
web_src/less/openi.less View File

@@ -311,6 +311,7 @@ footer .column {
}
.FAILED,
.START_FAILED,
.DELETED,
.CREATE_FAILED {
display: inline-block;
width: 18px;


Loading…
Cancel
Save