| @@ -1329,6 +1329,9 @@ func QueryModelTrainJobList(repoId int64) ([]*CloudbrainInfo, int, error) { | |||
| cond = cond.And( | |||
| builder.Eq{"job_type": "TRAIN"}, | |||
| ) | |||
| cond = cond.And( | |||
| builder.In("type", 0, 1), | |||
| ) | |||
| cloudbrains := make([]*CloudbrainInfo, 0) | |||
| if err := sess.Select("job_id,display_job_name").Table(&Cloudbrain{}).Where(cond).OrderBy("created_unix DESC"). | |||
| @@ -1795,3 +1798,44 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
| return cloudbrains, count, nil | |||
| } | |||
| func CloudbrainAllStatic(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
| sess := x.NewSession() | |||
| defer sess.Close() | |||
| var cond = builder.NewCond() | |||
| if (opts.Type) >= 0 { | |||
| cond = cond.And( | |||
| builder.Eq{"cloudbrain.type": opts.Type}, | |||
| ) | |||
| } | |||
| if opts.BeginTimeUnix > 0 && opts.EndTimeUnix > 0 { | |||
| cond = cond.And( | |||
| builder.And(builder.Gte{"cloudbrain.created_unix": opts.BeginTimeUnix}, builder.Lte{"cloudbrain.created_unix": opts.EndTimeUnix}), | |||
| ) | |||
| } | |||
| var count int64 | |||
| var err error | |||
| count, err = sess.Unscoped().Where(cond).Count(new(Cloudbrain)) | |||
| if err != nil { | |||
| return nil, 0, fmt.Errorf("Count: %v", err) | |||
| } | |||
| if opts.Page >= 0 && opts.PageSize > 0 { | |||
| var start int | |||
| if opts.Page == 0 { | |||
| start = 0 | |||
| } else { | |||
| start = (opts.Page - 1) * opts.PageSize | |||
| } | |||
| sess.Limit(opts.PageSize, start) | |||
| } | |||
| sess.OrderBy("cloudbrain.created_unix DESC") | |||
| cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) | |||
| if err := sess.Cols("status", "type", "job_type", "train_job_duration", "duration", "compute_resource", "created_unix", "start_time", "end_time").Table(&Cloudbrain{}).Unscoped().Where(cond). | |||
| Find(&cloudbrains); err != nil { | |||
| return nil, 0, fmt.Errorf("Find: %v", err) | |||
| } | |||
| return cloudbrains, count, nil | |||
| } | |||
| @@ -213,7 +213,7 @@ func GetWaittingTop() ([]*CloudbrainInfo, error) { | |||
| cond = cond.And( | |||
| builder.Eq{"cloudbrain.status": string(JobWaiting)}, | |||
| ) | |||
| sess.OrderBy("(cloudbrain.start_time-cloudbrain.created_unix) DESC limit 10") | |||
| sess.OrderBy("cloudbrain.created_unix ASC limit 10") | |||
| cloudbrains := make([]*CloudbrainInfo, 0, 10) | |||
| if err := sess.Table(&Cloudbrain{}).Where(cond). | |||
| Find(&cloudbrains); err != nil { | |||
| @@ -228,7 +228,7 @@ func GetRunningTop() ([]*CloudbrainInfo, error) { | |||
| cond = cond.And( | |||
| builder.Eq{"cloudbrain.status": string(JobRunning)}, | |||
| ) | |||
| sess.OrderBy("(cloudbrain.end_time-cloudbrain.start_time) DESC limit 10") | |||
| sess.OrderBy("cloudbrain.duration DESC limit 10") | |||
| cloudbrains := make([]*CloudbrainInfo, 0, 10) | |||
| if err := sess.Table(&Cloudbrain{}).Where(cond). | |||
| Find(&cloudbrains); err != nil { | |||
| @@ -15,13 +15,9 @@ type CustomMigrationStatic struct { | |||
| Migrate func(*xorm.Engine, *xorm.Engine) error | |||
| } | |||
| var customMigrations = []CustomMigration{ | |||
| {"Custom v1 Topic struct change to support chinese", syncTopicStruct}, | |||
| } | |||
| var customMigrations []CustomMigration | |||
| var customMigrationsStatic = []CustomMigrationStatic{ | |||
| {"update issue_fixed_rate to 1 if num_issues is 0 ", updateIssueFixedRate}, | |||
| } | |||
| var customMigrationsStatic []CustomMigrationStatic | |||
| func MigrateCustom(x *xorm.Engine) { | |||
| @@ -241,12 +241,12 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond { | |||
| } | |||
| } | |||
| if len(opts.DatasetIDs) > 0 { | |||
| if opts.StarByMe { | |||
| cond = cond.And(builder.In("dataset.id", opts.DatasetIDs)) | |||
| } else { | |||
| subCon := builder.NewCond() | |||
| subCon = subCon.And(builder.In("dataset.id", opts.DatasetIDs)) | |||
| subCon = generateFilterCond(opts, subCon) | |||
| cond = cond.Or(subCon) | |||
| } | |||
| } | |||
| @@ -6,7 +6,6 @@ | |||
| package models | |||
| import ( | |||
| "code.gitea.io/gitea/modules/blockchain" | |||
| "container/list" | |||
| "context" | |||
| "crypto/md5" | |||
| @@ -25,6 +24,8 @@ import ( | |||
| "time" | |||
| "unicode/utf8" | |||
| "code.gitea.io/gitea/modules/blockchain" | |||
| "code.gitea.io/gitea/modules/avatar" | |||
| "code.gitea.io/gitea/modules/base" | |||
| "code.gitea.io/gitea/modules/generate" | |||
| @@ -1498,6 +1499,17 @@ func GetUsersByIDs(ids []int64) (UserList, error) { | |||
| return ous, err | |||
| } | |||
| func GetUsersByNames(names []string) (UserList, error) { | |||
| ous := make([]*User, 0, len(names)) | |||
| if len(names) == 0 { | |||
| return ous, nil | |||
| } | |||
| err := x.In("name", names). | |||
| Asc("name"). | |||
| Find(&ous) | |||
| return ous, err | |||
| } | |||
| // GetUserIDsByNames returns a slice of ids corresponds to names. | |||
| func GetUserIDsByNames(names []string, ignoreNonExistent bool) ([]int64, error) { | |||
| ids := make([]int64, 0, len(names)) | |||
| @@ -1420,7 +1420,7 @@ issues.label_templates.helper=选择标签模板 | |||
| issues.label_templates.use=使用标签集 | |||
| issues.label_templates.fail_to_load_file=加载标签模板文件 '%s' 时发生错误:%v | |||
| issues.add_label_at=添加了标签 <div class="ui label" style="color: %s\; background-color: %s"> %s </div> %s | |||
| issues.remove_label_at=删除了 <div class="ui label" style="color: %s\; background-color: %s">%s</div> label %s 标签 | |||
| issues.remove_label_at=删除了标签 <div class="ui label" style="color: %s\; background-color: %s">%s </div> %s | |||
| issues.add_milestone_at=` %[2]s 添加了里程碑 <b>%[1]s</b>` | |||
| issues.change_milestone_at=`%[3]s 修改了里程碑从 <b>%[1]s</b> 到 <b>%[2]s</b>` | |||
| issues.remove_milestone_at=`%[2]s 删除了里程碑 <b>%[1]s</b>` | |||
| @@ -74,28 +74,30 @@ var swiperOrg = new Swiper(".homeorg-list", { | |||
| }, | |||
| }); | |||
| var output = document.getElementById("newmessage"); | |||
| var url = "ws://" + document.location.host + "/action/notification"; | |||
| if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){ | |||
| url = "wss://" + document.location.host + "/action/notification" | |||
| } | |||
| var socket = new WebSocket(url); | |||
| socket.onopen = function () { | |||
| messageQueue = []; | |||
| console.log("message has connected."); | |||
| }; | |||
| var maxSize = 20; | |||
| var html =document.documentElement; | |||
| var lang = html.attributes["lang"] | |||
| var isZh = true; | |||
| if(lang != null && lang.nodeValue =="en-US" ){ | |||
| isZh=false; | |||
| }else{ | |||
| } | |||
| socket.onmessage = function (e) { | |||
| document.onreadystatechange = function () { | |||
| queryRecommendData(); | |||
| var output = document.getElementById("newmessage"); | |||
| var url = "ws://" + document.location.host + "/action/notification"; | |||
| if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){ | |||
| url = "wss://" + document.location.host + "/action/notification" | |||
| } | |||
| var socket = new WebSocket(url); | |||
| socket.onopen = function () { | |||
| messageQueue = []; | |||
| console.log("message has connected."); | |||
| }; | |||
| socket.onmessage = function (e) { | |||
| var data =JSON.parse(e.data) | |||
| var html = ""; | |||
| if (data != null){ | |||
| @@ -176,7 +178,10 @@ socket.onmessage = function (e) { | |||
| output.innerHTML = html; | |||
| swiperNewMessage.updateSlides(); | |||
| swiperNewMessage.updateProgress(); | |||
| }; | |||
| }; | |||
| } | |||
| function getTaskLink(record){ | |||
| var re = getRepoLink(record); | |||
| @@ -217,9 +222,9 @@ function refresh3DInfo(record){ | |||
| //console.log("cloudbrain two line length=" + lines.length); | |||
| var span = $('.rotation3D__line').find("span")[1]; | |||
| //console.log(span); | |||
| span.innerText =record.RefName; | |||
| //$('.rotation3D__line').find("span").eq(1).text(record.RefName) | |||
| //lines[1].find("span").text(record.RefName); | |||
| if(span != null){ | |||
| span.innerText =record.RefName; | |||
| } | |||
| } | |||
| } | |||
| @@ -437,7 +442,9 @@ function getAction(opType,isZh){ | |||
| } | |||
| } | |||
| queryRecommendData(); | |||
| function queryRecommendData(){ | |||
| $.ajax({ | |||
| @@ -452,48 +459,12 @@ function queryRecommendData(){ | |||
| displayOrg(json.org); | |||
| displayRepo(json.repo); | |||
| displayActivity(json.image); | |||
| displayCloudBrain(json.cloudbrain) | |||
| }, | |||
| error:function(response) { | |||
| } | |||
| }); | |||
| // $.ajax({ | |||
| // type:"GET", | |||
| // url:"/recommend/repo", | |||
| // headers: { | |||
| // authorization:token, | |||
| // }, | |||
| // dataType:"json", | |||
| // async:false, | |||
| // success:function(json){ | |||
| // displayRepo(json); | |||
| // }, | |||
| // error:function(response) { | |||
| // } | |||
| // }); | |||
| // $.ajax({ | |||
| // type:"GET", | |||
| // url:"/recommend/imageinfo", | |||
| // headers: { | |||
| // authorization:token, | |||
| // }, | |||
| // dataType:"json", | |||
| // async:false, | |||
| // success:function(json){ | |||
| // displayActivity(json); | |||
| // }, | |||
| // error:function(response) { | |||
| // } | |||
| // }); | |||
| } | |||
| function displayCloudBrain(json){ | |||
| $('#completed_task').text(json.completed_task); | |||
| $('#running_task').text(json.running_task); | |||
| $('#wait_task').text(json.wait_task); | |||
| } | |||
| function displayActivity(json){ | |||
| var activityDiv = document.getElementById("recommendactivity"); | |||
| @@ -67,7 +67,7 @@ func GetAllCloudbrainsOverview(ctx *context.Context) { | |||
| pagesize := 1000 | |||
| count := pagesize | |||
| for count == pagesize && count != 0 { | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| ListOptions: models.ListOptions{ | |||
| Page: page, | |||
| PageSize: pagesize, | |||
| @@ -121,6 +121,13 @@ func GetAllCloudbrainsOverview(ctx *context.Context) { | |||
| } | |||
| } | |||
| cloudBrainTypeList := []int{0, 1, 2} | |||
| for _, v := range cloudBrainTypeList { | |||
| if _, ok := cloudBrainNum[v]; !ok { | |||
| cloudBrainNum[v] = 0 | |||
| } | |||
| } | |||
| todayRunningCount := todayStatusResult[string(models.JobRunning)] | |||
| todayCompletedCount := todayStatusResult[string(models.ModelArtsTrainJobCompleted)] + todayStatusResult[string(models.JobFailed)] + | |||
| todayStatusResult[string(models.ModelArtsStartFailed)] + todayStatusResult[string(models.JobStopped)] + todayStatusResult[string(models.JobSucceeded)] + todayStatusResult[string(models.ModelArtsTrainJobKilled)] | |||
| @@ -504,7 +511,7 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { | |||
| count := pagesize | |||
| //Each time a maximum of 1000 pieces of data are detected to the memory, batch processing | |||
| for count == pagesize && count != 0 { | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| ListOptions: models.ListOptions{ | |||
| Page: page, | |||
| PageSize: pagesize, | |||
| @@ -613,7 +620,7 @@ func GetCloudbrainsStatusAnalysis(ctx *context.Context) { | |||
| pagesize := 1000 | |||
| count := pagesize | |||
| for count == pagesize && count != 0 { | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| ListOptions: models.ListOptions{ | |||
| Page: page, | |||
| PageSize: pagesize, | |||
| @@ -1021,7 +1028,7 @@ func getCloudbrainCount(beginTime time.Time, endTime time.Time, cloudbrains []*m | |||
| func getDayCloudbrainNum(beginTime time.Time, endTime time.Time) ([]DateCloudbrainNum, error) { | |||
| var endTimeTemp time.Time | |||
| endTimeTemp = beginTime.AddDate(0, 0, 1) | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| Type: models.TypeCloudBrainAll, | |||
| BeginTimeUnix: beginTime.Unix(), | |||
| EndTimeUnix: endTime.Unix(), | |||
| @@ -1057,7 +1064,7 @@ func getMonthCloudbrainNum(beginTime time.Time, endTime time.Time) ([]DateCloudb | |||
| endTimeTemp = beginTime.AddDate(0, 1, 0) | |||
| endTimeTemp = time.Date(endTimeTemp.Year(), endTimeTemp.Month(), 1, 0, 0, 0, 0, now.Location()) | |||
| monthCloudbrainNum := make([]DateCloudbrainNum, 0) | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| Type: models.TypeCloudBrainAll, | |||
| BeginTimeUnix: beginTime.Unix(), | |||
| EndTimeUnix: endTime.Unix(), | |||
| @@ -1093,7 +1100,7 @@ func getDayCloudbrainInfo(beginTime time.Time, endTime time.Time) ([]DateCloudbr | |||
| if endTimeTemp.Equal(endTime) { | |||
| endTimeTemp = endTimeTemp.AddDate(0, 0, -1) | |||
| } | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| Type: models.TypeCloudBrainAll, | |||
| BeginTimeUnix: beginTime.Unix(), | |||
| EndTimeUnix: endTime.Unix(), | |||
| @@ -1124,7 +1131,7 @@ func getMonthCloudbrainInfo(beginTime time.Time, endTime time.Time) ([]DateCloud | |||
| if endTimeTemp.Equal(endTime) { | |||
| endTimeTemp = endTimeTemp.AddDate(0, -1, 0) | |||
| } | |||
| cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ | |||
| cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{ | |||
| Type: models.TypeCloudBrainAll, | |||
| BeginTimeUnix: beginTime.Unix(), | |||
| EndTimeUnix: endTime.Unix(), | |||
| @@ -7,7 +7,6 @@ package routers | |||
| import ( | |||
| "bytes" | |||
| "fmt" | |||
| "net/http" | |||
| "strconv" | |||
| "strings" | |||
| @@ -676,10 +675,19 @@ func getRecommendOrg() ([]map[string]interface{}, error) { | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| names := make([]string, 0) | |||
| for _, userName := range result { | |||
| names = append(names, userName) | |||
| } | |||
| users, _ := models.GetUsersByNames(names) | |||
| userMap := make(map[string]*models.User, 0) | |||
| for _, user := range users { | |||
| userMap[user.Name] = user | |||
| } | |||
| resultOrg := make([]map[string]interface{}, 0) | |||
| for _, userName := range result { | |||
| user, err := models.GetUserByName(userName) | |||
| if err == nil { | |||
| user := userMap[userName] | |||
| if user != nil { | |||
| userMap := make(map[string]interface{}) | |||
| userMap["Name"] = user.Name | |||
| userMap["Description"] = user.Description | |||
| @@ -692,7 +700,7 @@ func getRecommendOrg() ([]map[string]interface{}, error) { | |||
| userMap["NumMembers"] = user.NumMembers | |||
| resultOrg = append(resultOrg, userMap) | |||
| } else { | |||
| log.Info("query user error," + err.Error()) | |||
| log.Info("the user not exist," + userName) | |||
| } | |||
| } | |||
| return resultOrg, nil | |||
| @@ -761,15 +769,6 @@ func GetRankUser(index string) ([]map[string]interface{}, error) { | |||
| return resultOrg, nil | |||
| } | |||
| // func GetImageInfoFromPromote(ctx *context.Context) { | |||
| // imageInfo, err := GetImageInfo() | |||
| // if err != nil { | |||
| // ctx.ServerError("500", err) | |||
| // return | |||
| // } | |||
| // ctx.JSON(200, imageInfo) | |||
| // } | |||
| func GetUserRankFromPromote(ctx *context.Context) { | |||
| index := ctx.Params("index") | |||
| resultUserRank, err := GetRankUser(index) | |||
| @@ -793,45 +792,15 @@ func RecommendHomeInfo(ctx *context.Context) { | |||
| if err != nil { | |||
| log.Info("error." + err.Error()) | |||
| } | |||
| resultCloudBrain, err := getCloudbrainNums() | |||
| if err != nil { | |||
| log.Info("error." + err.Error()) | |||
| } | |||
| mapInterface := make(map[string]interface{}) | |||
| mapInterface["org"] = resultOrg | |||
| mapInterface["repo"] = resultRepo | |||
| mapInterface["image"] = resultImage | |||
| mapInterface["cloudbrain"] = resultCloudBrain | |||
| //mapInterface["cloudbrain"] = resultCloudBrain | |||
| ctx.JSON(http.StatusOK, mapInterface) | |||
| } | |||
| func getCloudbrainNums() (map[string]string, error) { | |||
| result := make(map[string]string) | |||
| cloudStatusMap := models.GetAllStatusCloudBrain() | |||
| result["completed_task"] = fmt.Sprint(cloudStatusMap["COMPLETED"]) | |||
| result["running_task"] = fmt.Sprint(cloudStatusMap["RUNNING"]) | |||
| result["wait_task"] = fmt.Sprint(cloudStatusMap["WAITING"]) | |||
| return result, nil | |||
| } | |||
| // func RecommendOrgFromPromote(ctx *context.Context) { | |||
| // resultOrg, err := GetRecommendOrg() | |||
| // if err != nil { | |||
| // ctx.ServerError("500", err) | |||
| // return | |||
| // } | |||
| // ctx.JSON(200, resultOrg) | |||
| // } | |||
| func RecommendRepoFromPromote(ctx *context.Context) { | |||
| result, err := repository.GetRecommendRepoFromPromote("projects") | |||
| if err != nil { | |||
| ctx.ServerError("500", err) | |||
| } else { | |||
| ctx.JSON(200, result) | |||
| } | |||
| } | |||
| func HomeTerm(ctx *context.Context) { | |||
| ctx.HTML(200, tplHomeTerm) | |||
| } | |||
| @@ -172,8 +172,8 @@ func DatasetIndex(ctx *context.Context) { | |||
| for _, attachment := range pageAttachments { | |||
| uploader, _ := models.GetUserByID(attachment.UploaderID) | |||
| attachment.Uploader = uploader | |||
| if !strings.HasSuffix(attachment.Name, ".zip") { | |||
| attachment.DecompressState = -1 //非zip文件 | |||
| if !strings.HasSuffix(attachment.Name, ".zip") && !strings.HasSuffix(attachment.Name, ".tar.gz") { | |||
| attachment.DecompressState = -1 //非压缩文件 | |||
| } | |||
| } | |||
| @@ -700,8 +700,14 @@ func DatasetIsCollaborator(ctx *context.Context, dataset *models.Dataset) bool { | |||
| repo.GetOwner() | |||
| if ctx.User != nil { | |||
| if repo.Owner.IsOrganization() { | |||
| if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { | |||
| for _, t := range repo.Owner.Teams { | |||
| org := repo.Owner | |||
| org.Teams, err = org.GetUserTeams(ctx.User.ID) | |||
| if err != nil { | |||
| log.Error("GetUserTeams error:", err.Error()) | |||
| return false | |||
| } | |||
| if org.IsUserPartOfOrg(ctx.User.ID) { | |||
| for _, t := range org.Teams { | |||
| if t.IsMember(ctx.User.ID) && t.HasRepository(repo.ID) { | |||
| return true | |||
| } | |||
| @@ -489,7 +489,7 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool, | |||
| if recordSource["avatar"] != nil { | |||
| avatarstr := recordSource["avatar"].(string) | |||
| if len(avatarstr) == 0 { | |||
| record["avatar"] = setting.RepositoryAvatarFallbackImage | |||
| // record["avatar"] = setting.RepositoryAvatarFallbackImage | |||
| } else { | |||
| record["avatar"] = setting.AppSubURL + "/repo-avatars/" + avatarstr | |||
| } | |||
| @@ -131,11 +131,6 @@ func GetRecommendRepoFromPromote(filename string) ([]map[string]interface{}, err | |||
| repoMap["ID"] = fmt.Sprint(repo.ID) | |||
| repoMap["Name"] = repo.Name | |||
| repoMap["Alias"] = repo.Alias | |||
| if repo.RepoType == models.RepoCourse { | |||
| //Load creator | |||
| repo.GetCreator() | |||
| repoMap["Creator"] = repo.Creator | |||
| } | |||
| repoMap["OwnerName"] = repo.OwnerName | |||
| repoMap["NumStars"] = repo.NumStars | |||
| @@ -1,38 +1,46 @@ | |||
| <style> | |||
| .ui.repository.list>.item{ | |||
| position: relative; | |||
| border: 1px solid #E1E3E6; | |||
| border-radius: 0.8rem; | |||
| margin-bottom: 1.0rem; | |||
| padding: 1.0rem !important; | |||
| } | |||
| .ui.repository.list>.item .header { | |||
| .ui.repository.list>.item { | |||
| position: relative; | |||
| border: 1px solid #E1E3E6; | |||
| border-radius: 0.8rem; | |||
| margin-bottom: 1.0rem; | |||
| padding: 1.0rem !important; | |||
| } | |||
| .ui.repository.list>.item .header { | |||
| font-size: 1.4rem !important; | |||
| font-weight: 200; | |||
| } | |||
| .ui.list>.item>.content{ | |||
| margin-left: 36px; | |||
| } | |||
| .ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content{ | |||
| width:calc(100% - 30px); | |||
| margin-left: 0; | |||
| } | |||
| .ui.repository.list>.item::before{ | |||
| position: absolute; | |||
| left: 0; | |||
| right: 0; | |||
| content: ""; | |||
| height: 1px; | |||
| background-color: #E1E3E6; | |||
| bottom: 2.8rem; | |||
| } | |||
| .repository .ui.mini.menu{ | |||
| font-weight: 200; | |||
| } | |||
| .ui.list>.item>.content { | |||
| margin-left: 36px; | |||
| } | |||
| .ui.list .list>.item>img.image+.content, | |||
| .ui.list>.item>img.image+.content { | |||
| width: calc(100% - 34px); | |||
| margin-left: 0; | |||
| } | |||
| .ui.repository.list>.item::before { | |||
| position: absolute; | |||
| left: 0; | |||
| right: 0; | |||
| content: ""; | |||
| height: 1px; | |||
| background-color: #E1E3E6; | |||
| bottom: 2.8rem; | |||
| } | |||
| .repository .ui.mini.menu { | |||
| font-size: .6rem; | |||
| } | |||
| .repository .ui.right.compact .item{ | |||
| padding-top: 0; | |||
| padding-bottom: 0; | |||
| } | |||
| .repository .ui.right.compact .item { | |||
| padding-top: 0; | |||
| padding-bottom: 0; | |||
| } | |||
| .ui.repository.list .item .time { | |||
| margin-top: 1.5rem; | |||
| } | |||
| @@ -40,20 +48,23 @@ | |||
| <div class="ui secondary pointing tabular top attached borderless menu navbar"> | |||
| {{if .PageIsExplore}} | |||
| <a class="{{if eq .SortType "hot"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=hot&tab={{$.TabName}}"> | |||
| <a class="{{if eq .SortType "hot"}}active{{end}} item" | |||
| href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=hot&tab={{$.TabName}}"> | |||
| <svg class="svg octicon-repo" width="16" height="16" aria-hidden="true"> | |||
| <use xlink:href="#octicon-repo" /> | |||
| </svg> | |||
| {{.i18n.Tr "explore.hot_repo"}} | |||
| </a> | |||
| <a class="{{if eq .SortType "active"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=active&tab={{$.TabName}}"> | |||
| <a class="{{if eq .SortType "active"}}active{{end}} item" | |||
| href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=active&tab={{$.TabName}}"> | |||
| <svg class="svg octicon-inbox" width="16" height="16" aria-hidden="true"> | |||
| <use xlink:href="#octicon-inbox" /> | |||
| </svg> | |||
| {{.i18n.Tr "explore.active_repo"}} | |||
| </a> | |||
| {{end}} | |||
| <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=recentupdate&tab={{$.TabName}}"> | |||
| <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" | |||
| href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=recentupdate&tab={{$.TabName}}"> | |||
| <svg class="svg octicon-organization" width="16" height="16" aria-hidden="true"> | |||
| <use xlink:href="#octicon-organization" /> | |||
| </svg> {{.i18n.Tr "repo.issues.filter_sort.recentupdate"}} | |||
| @@ -64,19 +75,29 @@ | |||
| <div class="ui right dropdown type jump item"> | |||
| <span class="text"> | |||
| {{.i18n.Tr "repo.issues.filter_sort"}} | |||
| <i class="dropdown icon"></i> | |||
| <i class="dropdown icon"></i> | |||
| </span> | |||
| <div class="menu"> | |||
| <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
| <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
| <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | |||
| <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | |||
| <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
| <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
| <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
| <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a> | |||
| <a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a> | |||
| <a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a> | |||
| <a class="{{if eq .SortType "newest"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=newest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
| <a class="{{if eq .SortType "oldest"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
| <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | |||
| <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | |||
| <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
| <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
| <a class="{{if eq .SortType "moststars"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
| <a class="{{if eq .SortType "feweststars"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a> | |||
| <a class="{{if eq .SortType "mostforks"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a> | |||
| <a class="{{if eq .SortType "fewestforks"}}active{{end}} item" | |||
| href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -84,81 +105,89 @@ | |||
| <div class="ui repository list"> | |||
| {{range .Repos}} | |||
| <div class="item"> | |||
| {{if .RelAvatarLink}} | |||
| <img class="ui avatar image" src="{{.RelAvatarLink}}"> | |||
| {{end}} | |||
| <div class="content"> | |||
| <div class="ui header"> | |||
| <div class="ui grid"> | |||
| <div class="ui sixteen wide mobile ten wide tablet twelve wide computer column"> | |||
| <a class="name" href="{{.Link}}"> | |||
| {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} <span>/</span> {{end}}{{end}}<strong>{{.DisplayName}}</strong> | |||
| {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}} | |||
| </a> | |||
| {{if .IsPrivate}} | |||
| <span class="middle text gold">{{svg "octicon-lock" 16}}</span> | |||
| {{else if .IsFork}} | |||
| <span class="middle">{{svg "octicon-repo-forked" 16}}</span> | |||
| {{else if .IsMirror}} | |||
| <span class="middle">{{svg "octicon-repo-clone" 16}}</span> | |||
| {{else if .Owner}} | |||
| {{if .Owner.Visibility.IsPrivate}} | |||
| <span class="text gold">{{svg "octicon-lock" 16}}</span> | |||
| {{end}} | |||
| {{end}} | |||
| </div> | |||
| <div class="ui sixteen wide mobile six wide tablet four wide computer column"> | |||
| <div class="ui mini right compact menu"> | |||
| <div class="item"> | |||
| {{if .RelAvatarLink}} | |||
| <img class="ui avatar image" style="width: 28px;height: 28px;" src="{{.RelAvatarLink}}"> | |||
| {{else}} | |||
| <img class="ui avatar image" style="width: 28px;height: 28px;" avatar="{{.Owner.Name}}"> | |||
| {{end}} | |||
| <div class="content"> | |||
| <div class="ui header"> | |||
| <div class="ui grid"> | |||
| <div class="ui sixteen wide mobile ten wide tablet twelve wide computer column"> | |||
| <a class="name" href="{{.Link}}"> | |||
| {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} | |||
| <span>/</span> {{end}}{{end}}<strong>{{.DisplayName}}</strong> | |||
| {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}} | |||
| </a> | |||
| {{if .IsPrivate}} | |||
| <span class="middle text gold">{{svg "octicon-lock" 16}}</span> | |||
| {{else if .IsFork}} | |||
| <span class="middle">{{svg "octicon-repo-forked" 16}}</span> | |||
| {{else if .IsMirror}} | |||
| <span class="middle">{{svg "octicon-repo-clone" 16}}</span> | |||
| {{else if .Owner}} | |||
| {{if .Owner.Visibility.IsPrivate}} | |||
| <span class="text gold">{{svg "octicon-lock" 16}}</span> | |||
| {{end}} | |||
| {{end}} | |||
| </div> | |||
| <div class="ui sixteen wide mobile six wide tablet four wide computer column"> | |||
| <div class="ui mini right compact menu"> | |||
| {{if eq $.SortType "hot"}} | |||
| <a class="item"> | |||
| <svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24"> | |||
| <path fill="currentColor" d="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z" /> | |||
| </svg> | |||
| {{.Hot}} | |||
| </a> | |||
| <a class="item"> | |||
| <svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24"> | |||
| <path fill="currentColor" | |||
| d="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z" /> | |||
| </svg> | |||
| {{.Hot}} | |||
| </a> | |||
| {{else if eq $.SortType "active"}} | |||
| <a class="item"> | |||
| <svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24"> | |||
| <path fill="currentColor" d="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z" /> | |||
| </svg> {{.Active}} | |||
| </a> | |||
| <a class="item"> | |||
| <svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24"> | |||
| <path fill="currentColor" | |||
| d="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z" /> | |||
| </svg> {{.Active}} | |||
| </a> | |||
| {{else}} | |||
| <a class="item"> | |||
| {{svg "octicon-eye" 16}} {{.NumWatches}} | |||
| </a> | |||
| <a class="item"> | |||
| {{svg "octicon-git-branch" 16}} {{.NumForks}} | |||
| </a> | |||
| <a class="item"> | |||
| {{svg "octicon-eye" 16}} {{.NumWatches}} | |||
| </a> | |||
| <a class="item"> | |||
| {{svg "octicon-git-branch" 16}} {{.NumForks}} | |||
| </a> | |||
| {{end}} | |||
| <a class="item"> | |||
| {{svg "octicon-star" 16}} {{.NumStars}} | |||
| </a> | |||
| </div> | |||
| <a class="item"> | |||
| {{svg "octicon-star" 16}} {{.NumStars}} | |||
| </a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="description"> | |||
| {{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}} | |||
| {{if .Topics }} | |||
| <div class="ui tags"> | |||
| {{range .Topics}} | |||
| {{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}"><div class="ui small label topic">{{.}}</div></a>{{end}} | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| <div class="description"> | |||
| {{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}} | |||
| {{if .Topics }} | |||
| <div class="ui tags"> | |||
| {{range .Topics}} | |||
| {{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}"> | |||
| <div class="ui small label topic">{{.}}</div> | |||
| </a>{{end}} | |||
| {{end}} | |||
| <p class="time"> | |||
| {{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}} | |||
| {{if .PrimaryLanguage }} | |||
| <span class="text grey"><i class="color-icon" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span> | |||
| {{end}} | |||
| </p> | |||
| </div> | |||
| {{end}} | |||
| <p class="time"> | |||
| {{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}} | |||
| {{if .PrimaryLanguage }} | |||
| <span class="text grey"><i class="color-icon" | |||
| style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span> | |||
| {{end}} | |||
| </p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{else}} | |||
| <div> | |||
| {{$.i18n.Tr "explore.repo_no_results"}} | |||
| </div> | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| @@ -1,5 +1,30 @@ | |||
| {{template "base/head" .}} | |||
| <style> | |||
| .unite { | |||
| font-family: SourceHanSansSC-medium !important; | |||
| color: rgba(16, 16, 16, 100) !important; | |||
| } | |||
| .title { | |||
| font-size: 16px !important; | |||
| padding-left: 3rem !important; | |||
| } | |||
| .min_title { | |||
| font-size: 14px !important; | |||
| padding-left: 6rem !important; | |||
| margin-bottom: 2rem !important; | |||
| } | |||
| .width { | |||
| width: 100% !important; | |||
| } | |||
| .width80 { | |||
| width: 80.7% !important; | |||
| margin-left: 10px; | |||
| } | |||
| .unite{ | |||
| font-family: SourceHanSansSC-medium !important; | |||
| @@ -64,13 +89,13 @@ | |||
| <div class="ui text loader">{{.i18n.Tr "loading"}}</div> | |||
| </div> --> | |||
| <div id="mask"> | |||
| <div id="loadingPage"> | |||
| <div class="rect1"></div> | |||
| <div class="rect2"></div> | |||
| <div class="rect3"></div> | |||
| <div class="rect4"></div> | |||
| <div class="rect5"></div> | |||
| </div> | |||
| <div id="loadingPage"> | |||
| <div class="rect1"></div> | |||
| <div class="rect2"></div> | |||
| <div class="rect3"></div> | |||
| <div class="rect4"></div> | |||
| <div class="rect5"></div> | |||
| </div> | |||
| </div> | |||
| <div class="repository"> | |||
| {{template "repo/header" .}} | |||
| @@ -91,20 +116,25 @@ | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| <a class="item" href="{{.RepoLink}}/cloudbrain/train-job/create"> | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z"/> | |||
| <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/> | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" | |||
| height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z" /> | |||
| <path | |||
| d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" /> | |||
| </svg> | |||
| CPU/GPU | |||
| </a> | |||
| <a class="active item" href="{{.RepoLink}}/modelarts/train-job/create"> | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z"/> | |||
| <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/> | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" | |||
| height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z" /> | |||
| <path | |||
| d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z" /> | |||
| </svg> | |||
| Ascend NPU</a> | |||
| </div> | |||
| </div> | |||
| <<<<<<< HEAD | |||
| <div class="required inline field"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | |||
| <input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="64"> | |||
| @@ -114,12 +144,32 @@ | |||
| <div class="inline field"> | |||
| <label class="label-fix-width" style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}</label> | |||
| <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="255" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)"></textarea> | |||
| ======= | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label> | |||
| <input style="width: 60%;" name="display_job_name" id="display_job_name" | |||
| placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" | |||
| tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required | |||
| maxlength="64"> | |||
| <span class="tooltips" style="display: block;">{{.i18n.Tr "cloudbrain.job_name_rule"}}</span> | |||
| </div> | |||
| <div class="unite min_title inline field"> | |||
| <label style="font-weight: normal;" | |||
| for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}} </label> | |||
| <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="255" | |||
| placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} | |||
| onchange="this.value=this.value.substring(0, 255)" | |||
| onkeydown="this.value=this.value.substring(0, 255)" | |||
| onkeyup="this.value=this.value.substring(0, 255)"></textarea> | |||
| >>>>>>> 54c17d894095057ffa220f257ddb415eb103d5a4 | |||
| </div> | |||
| <div class="ui divider"></div> | |||
| <h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.parameter_setting"}}:</h4> | |||
| <<<<<<< HEAD | |||
| <div class="required inline field"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.code_version"}}</label> | |||
| <select class="ui dropdown width80 left2" id="code_version" name="branch_name"> | |||
| @@ -139,31 +189,67 @@ | |||
| {{end}} | |||
| {{end}} | |||
| </select> | |||
| ======= | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.code_version"}}</label> | |||
| <select class="ui dropdown width80 left2" id="code_version" name="branch_name"> | |||
| {{if .branch_name}} | |||
| <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option> | |||
| {{range $k, $v :=.Branches}} | |||
| {{ if ne $v $.branch_name }} | |||
| <option name="branch_name" value="{{$v}}">{{$v}}</option> | |||
| {{end}} | |||
| {{end}} | |||
| {{else}} | |||
| <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option> | |||
| {{range $k, $v :=.Branches}} | |||
| {{ if ne $v $.branchName }} | |||
| <option name="branch_name" value="{{$v}}">{{$v}}</option> | |||
| {{end}} | |||
| {{end}} | |||
| {{end}} | |||
| </select> | |||
| >>>>>>> 54c17d894095057ffa220f257ddb415eb103d5a4 | |||
| </div> | |||
| <<<<<<< HEAD | |||
| <div class="required inline fields" style="width: 95%;"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.AI_driver"}}</label> | |||
| ======= | |||
| <div class="required unite min_title inline fields" style="width: 90%;"> | |||
| <label | |||
| style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.AI_driver"}} </label> | |||
| >>>>>>> 54c17d894095057ffa220f257ddb415eb103d5a4 | |||
| <div class="field" style="flex: 1.5;"> | |||
| <select class="ui dropdown width" id="trainjob_engines" > | |||
| <select class="ui dropdown width" id="trainjob_engines"> | |||
| {{range .engines}} | |||
| <option value="{{.Value}}">{{.Value}}</option> | |||
| <option value="{{.Value}}">{{.Value}}</option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| <div class="field" style="flex: 2;" id="engine_name"> | |||
| <<<<<<< HEAD | |||
| <select class="ui dropdown width" id="trainjob_engine_versions" name="engine_id"> | |||
| {{range .engine_versions}} | |||
| <option name="engine_id" value="{{.ID}}">{{.Value}}</option> | |||
| {{end}} | |||
| ======= | |||
| <select class="ui dropdown width" id="trainjob_engine_versions" style='width: 100%;' | |||
| name="engine_id"> | |||
| {{range .engine_versions}} | |||
| <option name="engine_id" value="{{.ID}}">{{.Value}}</option> | |||
| {{end}} | |||
| >>>>>>> 54c17d894095057ffa220f257ddb415eb103d5a4 | |||
| </select> | |||
| </div> | |||
| </div> | |||
| <<<<<<< HEAD | |||
| <div class="inline field required"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label> | |||
| {{if .bootFile}} | |||
| @@ -185,23 +271,52 @@ | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label> | |||
| <span id="add_run_para" style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span> | |||
| <input id="store_run_para" type="hidden" name="run_para_list"> | |||
| ======= | |||
| <div class="inline unite min_title field required"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label> | |||
| {{if .bootFile}} | |||
| <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="{{.bootFile}}" | |||
| tabindex="3" autofocus required maxlength="255"> | |||
| {{else}} | |||
| <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="" tabindex="3" | |||
| autofocus required maxlength="255"> | |||
| {{end}} | |||
| <span> | |||
| <i class="question circle icon link" | |||
| data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} | |||
| data-position="right center" data-variation="mini"></i> | |||
| </span> | |||
| <a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" | |||
| target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a> | |||
| </div> | |||
| {{template "custom/select_dataset_train" .}} | |||
| <span class="tooltips" | |||
| style="margin-left: 11.5rem;margin-bottom: 2rem;">{{.i18n.Tr "cloudbrain.dataset_path_rule"}}</span> | |||
| <div class="inline unite min_title field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label> | |||
| <span id="add_run_para" | |||
| style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i | |||
| class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span> | |||
| <input id="store_run_para" type="hidden" name="run_para_list"> | |||
| >>>>>>> 54c17d894095057ffa220f257ddb415eb103d5a4 | |||
| <div class="dynamic field" style="margin-top: 1rem;"> | |||
| {{if ne 0 (len .params)}} | |||
| {{if ne 0 (len .params)}} | |||
| {{range $k ,$v := .params}} | |||
| <div class="two fields width85" id="para{{$k}}"> | |||
| <div class="field"> | |||
| <input type="text" name="shipping_first-name" value={{$v.Label}} required> | |||
| </div> | |||
| <div class="field"> | |||
| <input type="text" name="shipping_last-name" value={{$v.Value}} required> | |||
| </div> | |||
| <span> | |||
| <i class="trash icon"></i> | |||
| </span> | |||
| <div class="two fields width85" id="para{{$k}}"> | |||
| <div class="field"> | |||
| <input type="text" name="shipping_first-name" value={{$v.Label}} required> | |||
| </div> | |||
| <div class="field"> | |||
| <input type="text" name="shipping_last-name" value={{$v.Value}} required> | |||
| </div> | |||
| <span> | |||
| <i class="trash icon"></i> | |||
| </span> | |||
| </div> | |||
| {{end}} | |||
| {{end}} | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| @@ -210,13 +325,14 @@ | |||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label> | |||
| <select class="ui dropdown" id="trainjob_resource_pool" style='width:385px' name="pool_id"> | |||
| {{range .resource_pools}} | |||
| <option value="{{.ID}}">{{.Value}}</option> | |||
| <option value="{{.ID}}">{{.Value}}</option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| <div class="required grouped fields" style="display: none;"> | |||
| <label style="font-weight: normal;" for="resource_type">{{.i18n.Tr "repo.modelarts.train_job.resource_type"}}</label> | |||
| <label style="font-weight: normal;" | |||
| for="resource_type">{{.i18n.Tr "repo.modelarts.train_job.resource_type"}}</label> | |||
| <div class="field"> | |||
| <div class="ui grid"> | |||
| <div class="column"> | |||
| @@ -235,22 +351,29 @@ | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label> | |||
| <select class="ui dropdown width48" id="trainjob-flavor" name="flavor"> | |||
| {{range .flavor_infos}} | |||
| <option name="flavor" value="{{.Code}}">{{.Value}}</option> | |||
| <option name="flavor" value="{{.Code}}">{{.Value}}</option> | |||
| {{end}} | |||
| </select> | |||
| </div> | |||
| <<<<<<< HEAD | |||
| <div class="inline required field"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}}</label> | |||
| ======= | |||
| <div class="inline required unite min_title field"> | |||
| <label | |||
| style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.amount_of_compute_node"}}</label> | |||
| >>>>>>> 54c17d894095057ffa220f257ddb415eb103d5a4 | |||
| <div class="ui labeled input" style="width: 5%;"> | |||
| <input style="border-radius: 0;text-align: center;"type="hidden" name="work_server_number" id="trainjob_work_server_num" tabindex="3" autofocus required maxlength="255" value="1" readonly> | |||
| <div class="field" id="trainjob_work_server_num_select" name="work_server_number_select"> | |||
| <select class="ui dropdown width" style='width: 100%;' name="work_server_id"> | |||
| <option name="server_id" value="1">1</option> | |||
| <option name="server_id" value="2">2</option> | |||
| </select> | |||
| </div> | |||
| <input style="border-radius: 0;text-align: center;" type="hidden" name="work_server_number" | |||
| id="trainjob_work_server_num" tabindex="3" autofocus required maxlength="255" value="1" | |||
| readonly> | |||
| <div class="field" id="trainjob_work_server_num_select" name="work_server_number_select"> | |||
| <select class="ui dropdown width" style='width: 100%;' name="work_server_id"> | |||
| <option name="server_id" value="1">1</option> | |||
| </select> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -258,7 +381,7 @@ | |||
| <div class="inline field" style="padding: 1rem 0;"> | |||
| <label class="label-fix-width"></label> | |||
| <button class="ui create_train_job green button"> | |||
| {{.i18n.Tr "repo.cloudbrain.new"}} | |||
| {{.i18n.Tr "repo.cloudbrain.new"}} | |||
| </button> | |||
| <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a> | |||
| </div> | |||
| @@ -273,7 +396,7 @@ | |||
| <script> | |||
| let url_href = window.location.pathname.split('create')[0] | |||
| $(".ui.button").attr('href',url_href) | |||
| $(".ui.button").attr('href', url_href) | |||
| $('select.dropdown') | |||
| .dropdown(); | |||
| @@ -295,182 +418,182 @@ | |||
| // } | |||
| // }) | |||
| // 参数增加、删除、修改、保存 | |||
| function Add_parameter(i){ | |||
| value = '<div class="two fields width85" id= "para'+ i +'">' + | |||
| '<div class="field">' + | |||
| '<input type="text" name="shipping_first-name" required placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}> ' + | |||
| '</div> ' + | |||
| '<div class="field"> ' + | |||
| '<input type="text" name="shipping_last-name" required placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}>' + | |||
| '</div>'+ | |||
| '<span>' + | |||
| '<i class="trash icon">' + | |||
| '</i>' + | |||
| '</span>' + | |||
| '</div>' | |||
| function Add_parameter(i) { | |||
| value = '<div class="two fields width85" id= "para' + i + '">' + | |||
| '<div class="field">' + | |||
| '<input type="text" name="shipping_first-name" required placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}> ' + | |||
| '</div> ' + | |||
| '<div class="field"> ' + | |||
| '<input type="text" name="shipping_last-name" required placeholder={{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}>' + | |||
| '</div>' + | |||
| '<span>' + | |||
| '<i class="trash icon">' + | |||
| '</i>' + | |||
| '</span>' + | |||
| '</div>' | |||
| $(".dynamic.field").append(value) | |||
| } | |||
| $('#add_run_para').click(function(){ | |||
| $('#add_run_para').click(function () { | |||
| var len = $(".dynamic.field .two.fields").length | |||
| Add_parameter(len) | |||
| }); | |||
| $(".dynamic.field").on("click",".trash.icon", function() { | |||
| $(".dynamic.field").on("click", ".trash.icon", function () { | |||
| var index = $(this).parent().parent().index() | |||
| $(this).parent().parent().remove() | |||
| var len = $(".dynamic.field .two.fields").length | |||
| $(".dynamic.field .two.fields").each(function(){ | |||
| $(".dynamic.field .two.fields").each(function () { | |||
| var cur_index = $(this).index() | |||
| $(this).attr('id', 'para' + cur_index) | |||
| }) | |||
| }); | |||
| $('.ui.parameter.green.button').click(function(){ | |||
| $('.ui.parameter.green.button').click(function () { | |||
| var parameters = []; | |||
| $('table tr').each(function() { | |||
| $(this).find('td:eq(1)').each(function(){ | |||
| $('table tr').each(function () { | |||
| $(this).find('td:eq(1)').each(function () { | |||
| parameters.push($(this).text()); | |||
| }) | |||
| $(this).find('input').each(function(){ | |||
| $(this).find('input').each(function () { | |||
| parameters.push($(this).text()) | |||
| }) | |||
| }); | |||
| $('.ui.parameter.modal') | |||
| .modal('hide'); | |||
| for(var i = 2; i < parameters.length; i++){ | |||
| switch(i) { | |||
| // 数据集uuid待完成 | |||
| // case (2): | |||
| // console.log(1) | |||
| // break; | |||
| // $("#trainjob_datasets").val(parameters[i]); | |||
| // console.log($("#trainjob_datasets").val()) | |||
| case (3): | |||
| $("input[name='boot_file']").val(parameters[i]); | |||
| break; | |||
| case (4): | |||
| var para = parameters[i].split(" ") | |||
| for(var j = 0; j < para.length; j++){ | |||
| var para_name = para[j].split('=')[0] | |||
| var para_value = para[j].split('=')[1] | |||
| var len = $(".dynamic.field .two.fields").length | |||
| Add_parameter(len) | |||
| var pid = 'para' + len | |||
| $(".dynamic.field"+ " #" + pid + "").find("input[name=shipping_first-name]").val(para_name) | |||
| $(".dynamic.field"+ " #" + pid + "").find("input[name=shipping_last-name]").val(para_value) | |||
| } | |||
| break; | |||
| // 数据集pool_id待完成 | |||
| // case (5): | |||
| // $("select[name='pool_id']").val(parameters[i]); | |||
| // break; | |||
| case (6): | |||
| // $("input[name='work_server_number']").val(parameters[i]); | |||
| break; | |||
| } | |||
| for (var i = 2; i < parameters.length; i++) { | |||
| switch (i) { | |||
| // 数据集uuid待完成 | |||
| // case (2): | |||
| // console.log(1) | |||
| // break; | |||
| // $("#trainjob_datasets").val(parameters[i]); | |||
| // console.log($("#trainjob_datasets").val()) | |||
| case (3): | |||
| $("input[name='boot_file']").val(parameters[i]); | |||
| break; | |||
| case (4): | |||
| var para = parameters[i].split(" ") | |||
| for (var j = 0; j < para.length; j++) { | |||
| var para_name = para[j].split('=')[0] | |||
| var para_value = para[j].split('=')[1] | |||
| var len = $(".dynamic.field .two.fields").length | |||
| Add_parameter(len) | |||
| var pid = 'para' + len | |||
| $(".dynamic.field" + " #" + pid + "").find("input[name=shipping_first-name]").val(para_name) | |||
| $(".dynamic.field" + " #" + pid + "").find("input[name=shipping_last-name]").val(para_value) | |||
| } | |||
| break; | |||
| // 数据集pool_id待完成 | |||
| // case (5): | |||
| // $("select[name='pool_id']").val(parameters[i]); | |||
| // break; | |||
| case (6): | |||
| // $("input[name='work_server_number']").val(parameters[i]); | |||
| break; | |||
| } | |||
| } | |||
| }) | |||
| $('.ui.save.checkbox').click(function(){ | |||
| $('.ui.save.checkbox').click(function () { | |||
| $(this).checkbox({ | |||
| onChange: function(){ | |||
| if ($('.ui.save.checkbox').checkbox('is checked')){ | |||
| onChange: function () { | |||
| if ($('.ui.save.checkbox').checkbox('is checked')) { | |||
| $('#save_para').removeClass("disabled") | |||
| }else{ | |||
| } else { | |||
| $('#save_para').addClass("disabled") | |||
| } | |||
| } | |||
| }); | |||
| }) | |||
| $('.question.circle.icon').hover(function(){ | |||
| $('.question.circle.icon').hover(function () { | |||
| $(this).popup('show') | |||
| }); | |||
| $(".item.active.parameter_config").click(function(){ | |||
| $(".item.active.parameter_config").click(function () { | |||
| $('.ui.parameter.modal') | |||
| .modal('setting', 'closable', false) | |||
| .modal('show'); | |||
| }) | |||
| $('.ui.deny.button').click(function(){ | |||
| $('.ui.deny.button').click(function () { | |||
| $('.ui.parameter.modal') | |||
| .modal('hide'); | |||
| }) | |||
| $('select.dropdown') | |||
| .dropdown(); | |||
| function validate(){ | |||
| function validate() { | |||
| $('.ui.form') | |||
| .form({ | |||
| on: 'blur', | |||
| fields: { | |||
| boot_file: { | |||
| identifier : 'boot_file', | |||
| rules: [ | |||
| { | |||
| type: 'regExp[/.+\.py$/g]', | |||
| } | |||
| ] | |||
| }, | |||
| display_job_name:{ | |||
| identifier : 'display_job_name', | |||
| rules: [ | |||
| { | |||
| type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||
| .form({ | |||
| on: 'blur', | |||
| fields: { | |||
| boot_file: { | |||
| identifier: 'boot_file', | |||
| rules: [ | |||
| { | |||
| type: 'regExp[/.+\.py$/g]', | |||
| } | |||
| ] | |||
| }, | |||
| display_job_name: { | |||
| identifier: 'display_job_name', | |||
| rules: [ | |||
| { | |||
| type: 'regExp[/^[a-zA-Z0-9-_]{1,64}[a-zA-Z0-9_]$/]', | |||
| } | |||
| ] | |||
| }, | |||
| attachment: { | |||
| identifier: 'attachment', | |||
| rules: [ | |||
| { | |||
| type: 'empty', | |||
| } | |||
| ] | |||
| }, | |||
| work_server_number: { | |||
| identifier: 'work_server_number', | |||
| rules: [ | |||
| { | |||
| type: 'integer[1..25]', | |||
| } | |||
| ] | |||
| } | |||
| ] | |||
| }, | |||
| attachment:{ | |||
| identifier : 'attachment', | |||
| rules: [ | |||
| { | |||
| type: 'empty', | |||
| } | |||
| ] | |||
| onSuccess: function () { | |||
| // $('.ui.page.dimmer').dimmer('show') | |||
| document.getElementById("mask").style.display = "block" | |||
| }, | |||
| work_server_number: { | |||
| identifier : 'work_server_number', | |||
| rules: [ | |||
| { | |||
| type : 'integer[1..25]', | |||
| } | |||
| ] | |||
| onFailure: function (e) { | |||
| return false; | |||
| } | |||
| }, | |||
| onSuccess: function(){ | |||
| // $('.ui.page.dimmer').dimmer('show') | |||
| document.getElementById("mask").style.display = "block" | |||
| }, | |||
| onFailure: function(e){ | |||
| return false; | |||
| } | |||
| }) | |||
| }) | |||
| } | |||
| document.onreadystatechange = function() { | |||
| document.onreadystatechange = function () { | |||
| if (document.readyState === "complete") { | |||
| document.getElementById("mask").style.display = "none" | |||
| } | |||
| } | |||
| function send_run_para(){ | |||
| function send_run_para() { | |||
| var run_parameters = [] | |||
| var msg = {} | |||
| $(".dynamic.field .two.fields").each(function(){ | |||
| $(".dynamic.field .two.fields").each(function () { | |||
| var para_name = $(this).find('input[name=shipping_first-name]').val() | |||
| var para_value = $(this).find('input[name=shipping_last-name]').val() | |||
| run_parameters.push({"label": para_name, "value": para_value}) | |||
| run_parameters.push({ "label": para_name, "value": para_value }) | |||
| }) | |||
| msg["parameter"] = run_parameters | |||
| msg = JSON.stringify(msg) | |||
| $('#store_run_para').val(msg) | |||
| } | |||
| function get_name(){ | |||
| let name1=$("#engine_name .text").text() | |||
| let name2=$("#flaver_name .text").text() | |||
| function get_name() { | |||
| let name1 = $("#engine_name .text").text() | |||
| let name2 = $("#flaver_name .text").text() | |||
| $("input#ai_engine_name").val(name1) | |||
| $("input#ai_flaver_name").val(name2) | |||
| @@ -479,9 +602,9 @@ | |||
| $("input#trainjob_work_server_num").val(val_server_num_select) | |||
| } | |||
| $('.ui.create_train_job.green.button').click(function(e) { | |||
| $('.ui.create_train_job.green.button').click(function (e) { | |||
| get_name() | |||
| send_run_para() | |||
| validate() | |||
| }) | |||
| </script> | |||
| </script> | |||
| @@ -597,8 +597,12 @@ | |||
| </div> | |||
| <div class="required inline field" id="verionname"> | |||
| <label>模型版本</label> | |||
| <input style="width: 45%;" id="version" name="Version" value="" readonly required | |||
| maxlength="255"> | |||
| <input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255"> | |||
| </div> | |||
| <div class="unite min_title inline field required"> | |||
| <label>模型框架</label> | |||
| <input type="hidden" id="Engine" name="Engine" required> | |||
| <input style="width: 45%;" id="Engine_name" name="Engine_name" readonly required maxlength="255"> | |||
| </div> | |||
| <div class="inline field"> | |||
| <label>模型标签</label> | |||
| @@ -671,6 +675,14 @@ | |||
| $('#JobName').val(obj.DisplayJobName).addClass('model_disabled') | |||
| $('input[name="JobId"]').val(obj.JobID) | |||
| $('input[name="VersionName"]').val(obj.VersionName).addClass('model_disabled') | |||
| if(obj.EngineID ==122 || obj.EngineID ==35){ | |||
| $('input[name="Engine_name"]').val("MindSpore").addClass('model_disabled'); | |||
| $('input[name="Engine"]').val(2); | |||
| } | |||
| if(obj.EngineID ==121){ | |||
| $('input[name="Engine_name"]').val("TensorFlow").addClass('model_disabled'); | |||
| $('input[name="Engine"]').val(1); | |||
| } | |||
| $('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" }) | |||
| createModelName() | |||
| }, | |||
| @@ -692,6 +704,8 @@ | |||
| type: 'POST', | |||
| data: data, | |||
| success: function (res) { | |||
| $('input[name="Engine_name"]').val(""); | |||
| $('input[name="Engine"]').val(""); | |||
| location.href = `/${userName}/${repoPath}/modelmanage/show_model` | |||
| $('.ui.modal.second').modal('hide') | |||
| }, | |||
| @@ -266,17 +266,20 @@ | |||
| $.get(`${repolink}/modelmanage/query_train_job?repoId=${repoId}`, (data) => { | |||
| const n_length = data.length | |||
| let train_html = '' | |||
| for (let i = 0; i < n_length; i++) { | |||
| train_html += `<div class="item" data-value="${data[i].JobID}">${data[i].DisplayJobName}</div>` | |||
| train_html += '</div>' | |||
| if(n_length > 0){ | |||
| let train_html = '' | |||
| for (let i = 0; i < n_length; i++) { | |||
| train_html += `<div class="item" data-value="${data[i].JobID}">${data[i].DisplayJobName}</div>` | |||
| train_html += '</div>' | |||
| } | |||
| $("#job-name").append(train_html) | |||
| $(".ui.dropdown.selection.search.width83").removeClass("loading") | |||
| $('#choice_model .default.text').text(data[0].DisplayJobName) | |||
| $('#choice_model input[name="JobId"]').val(data[0].JobID) | |||
| loadTrainVersion() | |||
| }else{ | |||
| $(".ui.dropdown.selection.search.width83").removeClass("loading") | |||
| } | |||
| $("#job-name").append(train_html) | |||
| $(".ui.dropdown.selection.search.width83").removeClass("loading") | |||
| $('#choice_model .default.text').text(data[0].DisplayJobName) | |||
| $('#choice_model input[name="JobId"]').val(data[0].JobID) | |||
| loadTrainVersion() | |||
| }) | |||
| } | |||
| function loadTrainVersion(value) { | |||
| @@ -298,7 +301,6 @@ | |||
| } | |||
| $('#choice_version .default.text').text(versionName) | |||
| $('#choice_version input[name="VersionName"]').val(versionName) | |||
| console.log("1111111111"); | |||
| setEngine(data[0]) | |||
| } | |||
| @@ -353,7 +353,7 @@ export default { | |||
| return "Pytorch"; | |||
| }else if(model.Engine == 1 || model.Engine == 121){ | |||
| return "TensorFlow"; | |||
| }else if(model.Engine == 2 || model.Engine == 122){ | |||
| }else if(model.Engine == 2 || model.Engine == 122 || model.Engine == 35){ | |||
| return "MindSpore"; | |||
| }else{ | |||
| return "Other" | |||