diff --git a/Makefile b/Makefile index abf0ba7f5..61df2ef76 100644 --- a/Makefile +++ b/Makefile @@ -498,7 +498,7 @@ check: test .PHONY: install $(TAGS_PREREQ) install: $(wildcard *.go) - $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' + $(GO) install -v -tags '$(TAGS)' -ldflags ' $(LDFLAGS)' .PHONY: build build: frontend backend @@ -514,7 +514,7 @@ generate: $(TAGS_PREREQ) CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES) $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) - $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ + $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags ' $(LDFLAGS)' -o $@ .PHONY: release release: frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check diff --git a/main b/main new file mode 100755 index 000000000..47de6c706 Binary files /dev/null and b/main differ diff --git a/models/file_chunk.go b/models/file_chunk.go index f9df3519f..e047b3317 100755 --- a/models/file_chunk.go +++ b/models/file_chunk.go @@ -11,7 +11,7 @@ const ( ) const ( - TypeCloudBrainOne = 0 + TypeCloudBrainOne = 0 TypeCloudBrainNotebook = 1 TypeCloudBrainTrainJob = 2 ) @@ -88,7 +88,7 @@ func InsertFileChunk(fileChunk *FileChunk) (_ *FileChunk, err error) { return fileChunk, nil } -// UpdateAttachment updates the given attachment in database +// UpdateFileChunk updates the given attachment in database func UpdateFileChunk(fileChunk *FileChunk) error { return updateFileChunk(x, fileChunk) } @@ -99,3 +99,13 @@ func updateFileChunk(e Engine, fileChunk *FileChunk) error { _, err := sess.Cols("is_uploaded").Update(fileChunk) return err } + +// DeleteFileChunk delete the given file_chunk in database +func DeleteFileChunk(fileChunk *FileChunk) error { + return deleteFileChunk(x, fileChunk) +} + +func deleteFileChunk(e Engine, fileChunk *FileChunk) error { + _, err := e.ID(fileChunk.ID).Delete(fileChunk) + return err +} diff --git a/public/self/test.js b/public/self/test.js new file mode 100644 index 000000000..2839c76ab --- /dev/null +++ b/public/self/test.js @@ -0,0 +1,28 @@ + +function displayDir(uuid){ + console.log('uuid 1=' + uuid); + + var html="\ + \ + \ + 数据集名称\ + 数据集类型\ + 数据集描述\ + 数据集创建者\ + "; + + for (var i=0;i<1;i++){ + var row = "\ + \ + "+uuid+"\ + " + uuid +"\ + 测试\ + 测试\ + 测试\ + "; + html=html+row; + } + + document.getElementById('dataset-files-table').innerHTML=html; + console.log('uuid 2=' + uuid); +} diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 19d6386e7..7c0ad1027 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -447,13 +447,22 @@ func GetSuccessChunks(ctx *context.Context) { if typeCloudBrain == models.TypeCloudBrainOne { chunks, err = storage.GetPartInfos(fileChunk.UUID, fileChunk.UploadID) if err != nil { - ctx.ServerError("GetPartInfos failed", err) - return + log.Error("GetPartInfos failed:%v", err.Error()) } } else { chunks, err = storage.GetObsPartInfos(fileChunk.UUID, fileChunk.UploadID) if err != nil { - ctx.ServerError("GetObsPartInfos failed", err) + log.Error("GetObsPartInfos failed:%v", err.Error()) + } + + if err != nil { + models.DeleteFileChunk(fileChunk) + ctx.JSON(200, map[string]string{ + "uuid": "", + "uploaded": "0", + "uploadID": "", + "chunks": "", + }) return } } diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 7ce9cfd40..f09b36c0b 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -1,14 +1,9 @@ package repo import ( - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/modelarts" - "code.gitea.io/gitea/modules/obs" - "code.gitea.io/gitea/modules/storage" "encoding/json" "errors" "fmt" - "github.com/unknwon/com" "io" "net/http" "os" @@ -17,6 +12,12 @@ import ( "strings" "time" + "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/modelarts" + "code.gitea.io/gitea/modules/obs" + "code.gitea.io/gitea/modules/storage" + "github.com/unknwon/com" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" diff --git a/templates/repo/cloudbrain/models/dir_list.tmpl b/templates/repo/cloudbrain/models/dir_list.tmpl new file mode 100755 index 000000000..a9683de77 --- /dev/null +++ b/templates/repo/cloudbrain/models/dir_list.tmpl @@ -0,0 +1,27 @@ +{{if .Dirs}} + + + {{range .Dirs}} + + + + + + {{end}} + +
+ + + + {{if .IsDir}} {{svg "octicon-file-directory" 16}}{{else}}{{svg "octicon-file" 16}}{{end}} {{.FileName}} + + + + + {{.Size | FileSize}} + + + {{.ModTime}} +
+ +{{end}} diff --git a/templates/repo/cloudbrain/models/index.tmpl b/templates/repo/cloudbrain/models/index.tmpl new file mode 100755 index 000000000..3b53ad78e --- /dev/null +++ b/templates/repo/cloudbrain/models/index.tmpl @@ -0,0 +1,29 @@ +{{template "base/head" .}} +
+ {{template "repo/header" .}} +
+
+
+
+

+ {{ range $index, $item := .Path }}{{ $item }}/{{ end }} +

+
+
+
+ +
+
+
+
+ {{template "repo/cloudbrain/models/dir_list" .}} +
+
+
+
+
+
+ + + +{{template "base/footer" .}} diff --git a/templates/repo/modelarts/index.tmpl b/templates/repo/modelarts/index.tmpl new file mode 100755 index 000000000..1c00c103c --- /dev/null +++ b/templates/repo/modelarts/index.tmpl @@ -0,0 +1,479 @@ + +{{template "base/head" .}} + + + + +
+
+
+
+
+
+
+
+
+ + +
+ +
+ {{template "repo/header" .}} + +
+ + +
+
+

{{.i18n.Tr "repo.cloudbrain2"}}

+
+ +
+
+ +
+ {{if .Permission.CanWrite $.UnitTypeCloudBrain}} + {{.i18n.Tr "repo.cloudbrain.new"}} {{end}} +
+
+ + +
+ + +
+
+
+ + +
+
+
+
+
+ +
+
+
+ + +
+ {{range .Tasks}} +
+
+ + + + + +
+ {{.Status}} +
+ + +
+ {{svg "octicon-flame" 16}} {{TimeSinceUnix .CreatedUnix $.Lang}} +
+ + +
+ + + 查看 + + +
+ + +
+
+
+ {{$.CsrfTokenHtml}} + 删除 +
+
+
+ + +
+ +
+ + +
+
+
+ {{$.CsrfTokenHtml}} + 停止 +
+
+
+ + + + +
+
+ {{end}} {{template "base/paginate" .}} +
+ +
+
+
+ +
+ +
+ + + + + +
+ +
+ + +{{template "base/footer" .}} + + \ No newline at end of file diff --git a/templates/repo/modelarts/new.tmpl b/templates/repo/modelarts/new.tmpl new file mode 100755 index 000000000..bb52e3585 --- /dev/null +++ b/templates/repo/modelarts/new.tmpl @@ -0,0 +1,184 @@ +{{template "base/head" .}} + + +
+
+
+
+
+
+
+
+
+
+ {{template "repo/header" .}} +
+
+ {{template "base/alert" .}} +
+ {{.CsrfTokenHtml}} +

+ {{.i18n.Tr "repo.cloudbrain.new"}} +

+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + {{.i18n.Tr "repo.cloudbrain.cancel"}} +
+
+
+
+
+
+{{template "base/footer" .}} + + \ No newline at end of file diff --git a/templates/repo/modelarts/show.tmpl b/templates/repo/modelarts/show.tmpl new file mode 100755 index 000000000..3f914b56d --- /dev/null +++ b/templates/repo/modelarts/show.tmpl @@ -0,0 +1,122 @@ +{{template "base/head" .}} +
+{{template "repo/header" .}} +
+
+ {{template "base/alert" .}} + +

+ 返回 +

+
+
+ {{with .task}} +

任务名称: {{.JobName}}

+ {{end}} +
+
+

任务结果:

+ {{with .result}} + + + + + + + + + + + + + + + +
状态 {{.Status}}
开始时间 {{.CreateTime}}
最后更新时间 {{.LatestUpdateTime}}
+ {{end}} +
+
+ {{with .result}} + + + + + + + + + + + + + + +
配置信息
开发环境类型 {{.Profile.DeType}}
硬件类型 {{.Profile.FlavorType}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
机器规格详情
机器规格 {{.Flavor}}
规格名称 {{.FlavorDetails.Name}}
规格销售状态 {{.FlavorDetails.Status}}
排队个数 {{.FlavorDetails.QueuingNum}}
排到队的剩余时间(秒) {{.FlavorDetails.QueueLeftTime}}
自动停止时间(秒) {{.FlavorDetails.Duration}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
排队信息
实例状态 {{.QueuingInfo.Status}}
实例排队的开始时间 {{.QueuingInfo.BeginTime}}
排到队的剩余时间(秒) {{.QueuingInfo.RemainTime}}
实例排队的预计停止时间 {{.QueuingInfo.EndTime}}
实例在队列中的排位 {{.QueuingInfo.Rank}}
+ {{end}} +
+
+ +
+
+
+{{template "base/footer" .}}