Browse Source

add creator-name

tags/v1.21.12.1
lewis 3 years ago
parent
commit
f108202f65
4 changed files with 14 additions and 6 deletions
  1. +10
    -3
      models/cloudbrain.go
  2. +2
    -1
      routers/repo/cloudbrain.go
  3. +1
    -1
      templates/repo/cloudbrain/index.tmpl
  4. +1
    -1
      templates/repo/modelarts/index.tmpl

+ 10
- 3
models/cloudbrain.go View File

@@ -65,6 +65,11 @@ type Cloudbrain struct {
Repo *Repository `xorm:"-"`
}

type CloudbrainInfo struct {
Cloudbrain `xorm:"extends"`
User `xorm:"extends"`
}

type CloudBrainLoginResult struct {
Code string
Msg string
@@ -523,7 +528,7 @@ type NotebookDelResult struct {
InstanceID string `json:"instance_id"`
}

func Cloudbrains(opts *CloudbrainsOptions) ([]*Cloudbrain, int64, error) {
func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {
sess := x.NewSession()
defer sess.Close()

@@ -583,8 +588,10 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*Cloudbrain, int64, error) {
}

sess.OrderBy("cloudbrain.created_unix DESC")
cloudbrains := make([]*Cloudbrain, 0, setting.UI.IssuePagingNum)
if err := sess.Where(cond).Find(&cloudbrains); err != nil {
cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum)
if err := sess.Table(&Cloudbrain{}).Where(cond).
Join("left", "`user`", "cloudbrain.user_id = `user`.id").
Find(&cloudbrains); err != nil {
return nil, 0, fmt.Errorf("Find: %v", err)
}
sess.Close()


+ 2
- 1
routers/repo/cloudbrain.go View File

@@ -69,7 +69,8 @@ func CloudBrainIndex(ctx *context.Context) {

timestamp := time.Now().Unix()
for i, task := range ciTasks {
if task.Status == string(models.JobRunning) && (timestamp-int64(task.CreatedUnix) > 10) {
log.Info("", task.User.Name)
if task.Status == string(models.JobRunning) && (timestamp-int64(task.Cloudbrain.CreatedUnix) > 10) {
ciTasks[i].CanDebug = true
} else {
ciTasks[i].CanDebug = false


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

@@ -269,7 +269,7 @@
{{.Status}}
</span>
<!-- 任务创建时间 -->
<span class="">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
<span class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span>
</div>

<div class="seven wide column text right">


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

@@ -262,7 +262,7 @@
{{.Status}}
</span>
<!-- 任务创建时间 -->
<span class="">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
<span class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span>
</div>

<div class="seven wide column text right">


Loading…
Cancel
Save