Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/501tags/v1.21.12.1
| @@ -65,6 +65,11 @@ type Cloudbrain struct { | |||||
| Repo *Repository `xorm:"-"` | Repo *Repository `xorm:"-"` | ||||
| } | } | ||||
| type CloudbrainInfo struct { | |||||
| Cloudbrain `xorm:"extends"` | |||||
| User `xorm:"extends"` | |||||
| } | |||||
| type CloudBrainLoginResult struct { | type CloudBrainLoginResult struct { | ||||
| Code string | Code string | ||||
| Msg string | Msg string | ||||
| @@ -523,7 +528,7 @@ type NotebookDelResult struct { | |||||
| InstanceID string `json:"instance_id"` | InstanceID string `json:"instance_id"` | ||||
| } | } | ||||
| func Cloudbrains(opts *CloudbrainsOptions) ([]*Cloudbrain, int64, error) { | |||||
| func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||||
| sess := x.NewSession() | sess := x.NewSession() | ||||
| defer sess.Close() | defer sess.Close() | ||||
| @@ -583,8 +588,10 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*Cloudbrain, int64, error) { | |||||
| } | } | ||||
| sess.OrderBy("cloudbrain.created_unix DESC") | 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) | return nil, 0, fmt.Errorf("Find: %v", err) | ||||
| } | } | ||||
| sess.Close() | sess.Close() | ||||
| @@ -573,7 +573,7 @@ authorized_oauth2_applications_description = You've granted access to your perso | |||||
| revoke_key = Revoke | revoke_key = Revoke | ||||
| revoke_oauth2_grant = Revoke Access | revoke_oauth2_grant = Revoke Access | ||||
| revoke_oauth2_grant_description = Revoking access for this third party application will prevent this application from accessing your data. Are you sure? | revoke_oauth2_grant_description = Revoking access for this third party application will prevent this application from accessing your data. Are you sure? | ||||
| revoke_oauth2_grant_success = You've revoked access successfully. | |||||
| revoke_oauth2_grant_success = You have revoked access successfully. | |||||
| twofa_desc = Two-factor authentication enhances the security of your account. | twofa_desc = Two-factor authentication enhances the security of your account. | ||||
| twofa_is_enrolled = Your account is currently <strong>enrolled</strong> in two-factor authentication. | twofa_is_enrolled = Your account is currently <strong>enrolled</strong> in two-factor authentication. | ||||
| @@ -770,6 +770,7 @@ cloudbrain_selection = select cloudbrain | |||||
| cloudbrain_platform_selection = Select the cloudbrain platform you want to use: | cloudbrain_platform_selection = Select the cloudbrain platform you want to use: | ||||
| confirm_choice = confirm | confirm_choice = confirm | ||||
| cloudbran1_tips = Only data in zip format can create cloudbrain tasks | cloudbran1_tips = Only data in zip format can create cloudbrain tasks | ||||
| cloudbrain_creator=Creator | |||||
| template.items = Template Items | template.items = Template Items | ||||
| template.git_content = Git Content (Default Branch) | template.git_content = Git Content (Default Branch) | ||||
| @@ -772,6 +772,7 @@ cloudbrain_selection=云脑选择 | |||||
| cloudbrain_platform_selection=选择您准备使用的云脑平台: | cloudbrain_platform_selection=选择您准备使用的云脑平台: | ||||
| confirm_choice=确定 | confirm_choice=确定 | ||||
| cloudbran1_tips=只有zip格式的数据集才能发起云脑任务 | cloudbran1_tips=只有zip格式的数据集才能发起云脑任务 | ||||
| cloudbrain_creator=创建者 | |||||
| template.items=模板选项 | template.items=模板选项 | ||||
| template.git_content=Git数据(默认分支) | template.git_content=Git数据(默认分支) | ||||
| @@ -69,7 +69,8 @@ func CloudBrainIndex(ctx *context.Context) { | |||||
| timestamp := time.Now().Unix() | timestamp := time.Now().Unix() | ||||
| for i, task := range ciTasks { | 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 | ciTasks[i].CanDebug = true | ||||
| } else { | } else { | ||||
| ciTasks[i].CanDebug = false | ciTasks[i].CanDebug = false | ||||
| @@ -262,10 +262,10 @@ | |||||
| <div class="row"> | <div class="row"> | ||||
| <!-- 任务名 --> | <!-- 任务名 --> | ||||
| <div class="six wide column"> | |||||
| <a class="title" href="{{$.Link}}/{{.JobID}}"> | |||||
| <div class="five wide column"> | |||||
| <a class="title" href="{{$.Link}}/{{.JobID}}" title="{{.JobName}}"> | |||||
| <span class="fitted">{{svg "octicon-tasklist" 16}}</span> | <span class="fitted">{{svg "octicon-tasklist" 16}}</span> | ||||
| <span class="fitted">{{.JobName}}</span> | |||||
| <span class="fitted text_over" style="width: 90%;">{{.JobName}}</span> | |||||
| </a> | </a> | ||||
| </div> | </div> | ||||
| @@ -285,10 +285,14 @@ | |||||
| {{end}} | {{end}} | ||||
| <!-- 任务创建时间 --> | <!-- 任务创建时间 --> | ||||
| <span class="time-show">{{TimeSinceUnix .CreatedUnix $.Lang}}</span> | |||||
| <span class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | |||||
| </div> | </div> | ||||
| <div class="seven wide column text right"> | |||||
| <div class="two wide column"> | |||||
| <span style="display: block;">{{$.i18n.Tr "repo.cloudbrain_creator"}}</span><span class="text_over" title="{{.User.Name}}">{{.User.Name}}</span> | |||||
| </div> | |||||
| <div class="six wide column text right"> | |||||
| <div class="ui compact buttons" style="margin-right:10px;"> | <div class="ui compact buttons" style="margin-right:10px;"> | ||||
| {{if and (ne .Status "WAITING") (ne .JobType "DEBUG")}} | {{if and (ne .Status "WAITING") (ne .JobType "DEBUG")}} | ||||
| <a class="ui basic button" href="{{$.Link}}/{{.JobID}}/rate" target="_blank"> | <a class="ui basic button" href="{{$.Link}}/{{.JobID}}/rate" target="_blank"> | ||||
| @@ -262,7 +262,7 @@ | |||||
| {{.Status}} | {{.Status}} | ||||
| </span> | </span> | ||||
| <!-- 任务创建时间 --> | <!-- 任务创建时间 --> | ||||
| <span class="">{{TimeSinceUnix .CreatedUnix $.Lang}}</span> | |||||
| <span class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | |||||
| </div> | </div> | ||||
| <div class="seven wide column text right"> | <div class="seven wide column text right"> | ||||
| @@ -232,4 +232,13 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} | |||||
| .i-bg-used{background-position: -514px -52px;} | .i-bg-used{background-position: -514px -52px;} | ||||
| .icon-bind{background-position: -550px -52px;} | .icon-bind{background-position: -550px -52px;} | ||||
| .icon-unbind{background-position: -568px -52px;} | .icon-unbind{background-position: -568px -52px;} | ||||
| .showCircle{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} | |||||
| .showCircle{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} | |||||
| .text_over{ | |||||
| overflow: hidden; | |||||
| text-overflow: ellipsis; | |||||
| -o-text-overflow: ellipsis; | |||||
| white-space: nowrap; | |||||
| display: inline-block; | |||||
| width: 100%; | |||||
| } | |||||