Browse Source

提交测试代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/1036/head
zouap 3 years ago
parent
commit
c56b5ec87b
3 changed files with 65 additions and 4 deletions
  1. +5
    -3
      routers/repo/ai_model_manage.go
  2. +59
    -0
      templates/repo/modelmanage/download.tmpl
  3. +1
    -1
      templates/repo/modelmanage/index.tmpl

+ 5
- 3
routers/repo/ai_model_manage.go View File

@@ -16,8 +16,9 @@ import (
) )


const ( const (
Model_prefix = "aimodels/"
tplModelManageIndex = "repo/modelmanage/index"
Model_prefix = "aimodels/"
tplModelManageIndex = "repo/modelmanage/index"
tplModelManageDownload = "repo/modelmanage/download"
) )


func SaveModelByParameters(jobId string, name string, version string, label string, description string, userId int64) error { func SaveModelByParameters(jobId string, name string, version string, label string, description string, userId int64) error {
@@ -210,6 +211,7 @@ func ShowSingleModel(ctx *context.Context) {
ctx.Data["Dirs"] = models ctx.Data["Dirs"] = models
ctx.Data["task"] = task ctx.Data["task"] = task
ctx.Data["ID"] = id ctx.Data["ID"] = id
ctx.HTML(200, tplModelManageDownload)


} }


@@ -240,7 +242,7 @@ func ShowModelPageInfo(ctx *context.Context) {
ctx.Data["Page"] = pager ctx.Data["Page"] = pager
ctx.Data["PageIsCloudBrain"] = true ctx.Data["PageIsCloudBrain"] = true
ctx.Data["Tasks"] = modelResult ctx.Data["Tasks"] = modelResult
ctx.HTML(200, tplModelManageIndex)
} }


func ModifyModel(id string, description string) error { func ModifyModel(id string, description string) error {


+ 59
- 0
templates/repo/modelmanage/download.tmpl View File

@@ -0,0 +1,59 @@
{{template "base/head" .}}
<div class="repository dataset dir-list view">
{{template "repo/header" .}}
<form class="ui container">
<div class="ui stackable grid {{if .Error}}hide{{end}}" id="dir-content">
<div class="row">
<div class="column sixteen wide">
<p>
{{ range $index, $item := .Path }}<a href='{{$.Link}}/?parentDir={{if gt $index 0}}{{DatasetPathJoin $.Path $index "/"}}{{else}}{{end}}'>{{ $item }}</a><span class="directory-seperator">/</span>{{ end }}
</p>
</div>
</div>
</div>

<div class="ui grid">
<div class="row">
<div class="ui sixteen wide column">
<div class="dir list">
<a class="title" href="{{$.RepoLink}}/modelmanage/downloadall?id={{.ID}}">
下载所有
</a>
{{if .Dirs}}
<table id="repo-files-table" class="ui single line table">
<tbody>
{{range .Dirs}}
<tr>
<td class="name four wide">
<span class="truncate">
<span class="octicon octicon-file-directory"></span>
<a class="title" href="{{if .IsDir}}{{$.RepoLink}}/modelmanage/downloadsingle?id={{$.ID}}&parentDir={{.ParenDir}}{{else}}{{$.RepoLink}}/modelmanage/downloadsingle?id={{$.ID}}&parentDir={{.ParenDir}}&fileName={{.FileName}}{{end}}">
<span class="fitted">{{if .IsDir}} {{svg "octicon-file-directory" 16}}{{else}}{{svg "octicon-file" 16}}{{end}}</span> {{.FileName}}
</a>
</span>
</td>
<td class="message nine wide">
<span class="truncate has-emoji">
{{.Size | FileSize}}
</span>
</td>
<td class="text right age three wide">
<span class="time-since poping up">{{.ModTime}}</span>
</td>
</tr>
{{end}}
</tbody>
</table>

{{end}}

</div>
</div>
</div>
</div>
</form>
</div>



{{template "base/footer" .}}

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

@@ -308,7 +308,7 @@
<div class="ui compact buttons" style="margin-right:10px;"> <div class="ui compact buttons" style="margin-right:10px;">
<!-- 模型下载 --> <!-- 模型下载 -->
<a class="ui basic blue button" href="{{$.Link}}/{{.ID}}/modelmanage" target="_blank">
<a class="ui basic blue button" href="{{$.Link}}/{{.ID}}" target="_blank">
{{$.i18n.Tr "repo.model_download"}} {{$.i18n.Tr "repo.model_download"}}
</a> </a>


Loading…
Cancel
Save