diff --git a/custom/public/css/git.openi.css b/custom/public/css/git.openi.css index 502ba8d88..8e2c25b2d 100644 --- a/custom/public/css/git.openi.css +++ b/custom/public/css/git.openi.css @@ -44,6 +44,12 @@ -webkit-line-clamp: 2; -webkit-box-orient: vertical; } +.ui.label{ + font-weight: normal; +} +.active { + color: #0366D6 !important; +} .opacity5{ opacity:0.5;} .radius15{ border-radius:1.5rem !important; } @@ -250,9 +256,13 @@ box-shadow: none !important; } .homeorg-list .card .ui.small.header .content{ - width: calc(100% - 3.25em); + width: calc(100% - 3.75em); } -.homepro-list{ +.homepro-tit{ + z-index: 9; + position: relative; +} +.homepro-list, .homeorg-list{ position: relative; z-index: 9; padding: 1.0em 1.0em 3.0em; @@ -261,42 +271,156 @@ .homepro-list .ui.card{ border-radius: 15px; background-color: #FFF; - box-shadow: 0px 5px 10px 0px rgba(105, 192, 255, 30); - border: 1px solid rgba(105, 192, 255, 40); + box-shadow: 0px 5px 10px 0px rgba(105, 192, 255, .3); + border: 1px solid rgba(105, 192, 255, .4); min-height: 10.8em; } .homepro-list .ui.card>.content>.header{ line-height: 40px !important; } -.homepro-list .swiper-pagination-bullet-active{ +.homepro-list .swiper-pagination-bullet-active, .homeorg-list .swiper-pagination-bullet-active{ width: 40px; - border-radius: 4px; + border-radius: 4px; } .i-env > div{ position: relative; } +/**seach**/ +/**搜索导航条适配窄屏**/ +.seachnav{ + overflow-x: auto; + overflow-y: hidden; + scrollbar-width: none; /* firefox */ + -ms-overflow-style: none; /* IE 10+ */ +} +.seachnav::-webkit-scrollbar { + display: none; /* Chrome Safari */ +} +.ui.green.button, .ui.green.buttons .button{ + background-color: #5BB973; +} +.seach .repos--seach{ + padding-bottom: 0; + border-bottom: none; +} +.seach .ui.secondary.pointing.menu{ + border-bottom: none; +} +.seach .ui.secondary.pointing.menu .item > i{ + margin-right: 5px; +} +.seach .ui.secondary.pointing.menu .active.item{ + border-bottom-width: 2px; + margin: 0 0 -1px; +} +.seach .ui.menu .active.item>.label { + background: #1684FC; + color: #FFF; +} +.seach .ui.menu .item>.label:not(.active.item>.label) { + background: #e8e8e8; + color: rgba(0,0,0,.6); +} + +.highlight{ + color: red; +} +.ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content { + width: calc(100% - 3.0em); + margin-left: 0; +} + +.seach .ui.list .list>.item .header, .seach .ui.list>.item .header{ + margin-bottom: 0.5em; + font-size: 1.4rem !important; + font-weight: normal; +} +.seach .time, .seach .time a{ + font-size: 12px; + color: grey; +} + +.seach .list .item.members .ui.avatar.image { + width: 3.2em; + height: 3.2em; +} +.ui.list .list>.item.members>img.image+.content, .ui.list>.item.members>img.image+.content { + width: calc(100% - 4.0em); + margin-left: 0; +} + @media only screen and (max-width: 767px) { .am-mt-30{ margin-top: 1.5rem !important;} .ui.secondary.hometop.segment{ - margin-bottom: 2.0rem; + margin-bottom: 5.0rem; } - .bannerpic, .i-code-pic{ + .bannerpic{ display: none; } - .i-code h2::before { - left: calc(-5.0rem + 6px); + #homenews{ + bottom: -3em; } - .i-code h2.am-bw::before{ - left: calc(-4.0rem + 6px); + #homenews > p { + margin-left: 1.0em; + } + .homenews{ + padding-left: 1.3em !important; + border-radius: 1.5em; + } + .homenews::before{ + left: 2em; + } + .homepro-tit > p{ + background: #FFF; + } + .homeorg{ + padding-left: 3.5em; + } + .homeorg-tit::after { + left: -2.3em; + } + .homeorg-list{ + margin: 0 0 2.0em !important; + } + .homeorg-list > .column{ + width: 3em !important; + margin-left: -0.5em; + padding: 0.5rem 0 0 !important; + } + .homeorg-list .card{ + background: none !important; + } + .homeorg-list .card > .content{ + padding: 0 !important; + } + + .homeorg-list > .column .card .ui.header>img{ + width: 3.0em; + height: 3.0em; + border-radius: 2.0em; + border: 2px solid #FFF; + } + .homeorg-list > .column .card .ui.header > .content{ + display: none; } .leftline01{ - width: calc(50% - 4.0rem); + width: 4.0em; + bottom: 4em; + border-radius: 0 0 0 3.0em; } - .leftline02{ - left: calc(50% - 1.0rem); - top: calc(-3.5rem - 2px); + .leftline02, .leftline02-2{ + left: 6.0em; + top: calc(-4.0em - 2px); + border-radius: 0 3.0em 3.0em 0; + width: calc(50% - 6.0em); + } + .leftline02-2 { + width: calc(50% - 8.0em); + } + .i-env .ui.cards>.card>.content .description{ + display: none; } } diff --git a/models/attachment.go b/models/attachment.go index fd1df9e43..c322d391b 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -88,12 +88,25 @@ func (a *Attachment) APIFormat() *api.Attachment { Size: a.Size, UUID: a.UUID, DownloadURL: a.DownloadURL(), + S3DownloadURL: a.S3DownloadURL(), } } // DownloadURL returns the download url of the attached file func (a *Attachment) DownloadURL() string { - return fmt.Sprintf("%sattachments/%s", setting.AppURL, a.UUID) + return fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) +} + +// S3DownloadURL returns the s3 download url of the attached file +func (a *Attachment) S3DownloadURL() string { + url := "" + if a.Type == TypeCloudBrainOne { + url, _ = storage.Attachments.PresignedGetURL(setting.Attachment.Minio.BasePath+AttachmentRelativePath(a.UUID), a.Name) + } else if a.Type == TypeCloudBrainTwo { + url, _ = storage.ObsGetPreSignedUrl(a.UUID, a.Name) + } + + return url } // AttachmentRelativePath returns the relative path diff --git a/models/repo_statistic.go b/models/repo_statistic.go index d3eb65c30..809cb26c4 100755 --- a/models/repo_statistic.go +++ b/models/repo_statistic.go @@ -12,6 +12,7 @@ type RepoStatistic struct { ID int64 `xorm:"pk autoincr" json:"-"` RepoID int64 `xorm:"unique(s) NOT NULL" json:"repo_id"` Name string `xorm:"INDEX" json:"name"` + Alias string `xorm:"INDEX" json:"alias"` OwnerName string `json:"ownerName"` IsPrivate bool `json:"isPrivate"` IsMirror bool `json:"isMirror"` @@ -63,6 +64,13 @@ type RepoStatistic struct { UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated" json:"-"` } +func (repo *RepoStatistic) DisplayName() string { + if repo.Alias == "" { + return repo.Name + } + return repo.Alias +} + func DeleteRepoStatDaily(date string) error { sess := xStatistic.NewSession() defer sess.Close() diff --git a/modules/context/auth.go b/modules/context/auth.go index 61a7b029b..dba2c3269 100755 --- a/modules/context/auth.go +++ b/modules/context/auth.go @@ -6,12 +6,14 @@ package context import ( + "encoding/base64" + "net/http" + "strings" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" - "encoding/base64" - "net/http" "gitea.com/macaron/csrf" "gitea.com/macaron/macaron" @@ -94,7 +96,14 @@ func Toggle(options *ToggleOptions) macaron.Handler { return } - ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL) + tempUrl := ctx.Req.URL.RequestURI() + + if strings.Contains(tempUrl, "action/star?") || strings.Contains(tempUrl, "action/watch?") { + redirectForStarAndWatch(ctx, tempUrl) + + } else { + ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL) + } ctx.Redirect(setting.AppSubURL + "/user/login") return } else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { @@ -159,6 +168,17 @@ func Toggle(options *ToggleOptions) macaron.Handler { } } +func redirectForStarAndWatch(ctx *Context, tempUrl string) { + splits := strings.Split(tempUrl, "?") + if len(splits) > 1 { + redirectArguments := strings.Split(splits[1], "=") + + if len(redirectArguments) > 0 && redirectArguments[0] == "redirect_to" { + ctx.SetCookie("redirect_to", setting.AppSubURL+strings.Replace(redirectArguments[1], "%2f", "/", -1), 0, setting.AppSubURL) + } + } +} + func basicAuth(ctx *Context) bool { var siteAuth = base64.StdEncoding.EncodeToString([]byte(setting.CBAuthUser + ":" + setting.CBAuthPassword)) auth := ctx.Req.Header.Get("Authorization") diff --git a/modules/structs/attachment.go b/modules/structs/attachment.go old mode 100644 new mode 100755 index 7becd9433..0f3c2ed6a --- a/modules/structs/attachment.go +++ b/modules/structs/attachment.go @@ -16,9 +16,10 @@ type Attachment struct { Size int64 `json:"size"` DownloadCount int64 `json:"download_count"` // swagger:strfmt date-time - Created time.Time `json:"created_at"` - UUID string `json:"uuid"` - DownloadURL string `json:"browser_download_url"` + Created time.Time `json:"created_at"` + UUID string `json:"uuid"` + DownloadURL string `json:"browser_download_url"` + S3DownloadURL string } // EditAttachmentOptions options for editing attachments diff --git a/public/home/home.js b/public/home/home.js index f49c8248b..7d5cbe4b1 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -6,7 +6,6 @@ if(isEmpty(token)){ token = meta.attr("content"); } } - var swiperNewMessage = new Swiper(".newslist", { direction: "vertical", slidesPerView: 10, @@ -17,7 +16,7 @@ var swiperNewMessage = new Swiper(".newslist", { }, }); var swiperRepo = new Swiper(".homepro-list", { - slidesPerView: 3, + slidesPerView: 1, slidesPerColumn: 2, slidesPerColumnFill:'row', spaceBetween: 30, @@ -29,6 +28,37 @@ var swiperRepo = new Swiper(".homepro-list", { delay: 2500, disableOnInteraction: false, }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 1024: { + slidesPerView: 3, + }, + }, +}); + +var swiperOrg = new Swiper(".homeorg-list", { + slidesPerView: 1, + slidesPerColumn: 4, + slidesPerColumnFill:'row', + spaceBetween: 15, + pagination: { + el: ".swiper-pagination", + clickable: true, + }, + autoplay: { + delay: 4500, + disableOnInteraction: false, + }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 1024: { + slidesPerView: 3, + }, + }, }); var output = document.getElementById("newmessage"); @@ -392,7 +422,7 @@ function displayOrg(json){ if (json != null && json.length > 0){ for(var i = 0; i < json.length;i++){ var record = json[i] - html += "
"; + html += "
"; html += " "; html += "
"; html += "
"; @@ -408,4 +438,5 @@ function displayOrg(json){ } } orgDiv.innerHTML = html; + swiperOrg.updateSlides(); } diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 72a68a6d3..c6c5703b3 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -878,7 +878,8 @@ func RegisterRoutes(m *macaron.Macaron) { }, reqAdmin()) }, reqAnyRepoReader()) m.Group("/cloudbrain", func() { - m.Get("/:jobid", repo.GetCloudbrainTask) + // m.Get("/:jobid", repo.GetCloudbrainTask) + m.Get("/:jobname", repo.GetCloudbrainTask) m.Get("/:jobid/log", repo.CloudbrainGetLog) }, reqRepoReader(models.UnitTypeCloudBrain)) m.Group("/modelarts", func() { diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index dd468783d..35044a894 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -6,11 +6,12 @@ package repo import ( - "code.gitea.io/gitea/modules/log" "net/http" "sort" "time" + "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/cloudbrain" "code.gitea.io/gitea/modules/context" @@ -48,14 +49,12 @@ func GetCloudbrainTask(ctx *context.APIContext) { err error ) - jobID := ctx.Params(":jobid") - repoID := ctx.Repo.Repository.ID - job, err := models.GetRepoCloudBrainByJobID(repoID, jobID) + jobName := ctx.Params(":jobname") + job, err := models.GetCloudbrainByName(jobName) if err != nil { - ctx.NotFound(err) - return + ctx.Data["error"] = err.Error() } - jobResult, err := cloudbrain.GetJob(jobID) + jobResult, err := cloudbrain.GetJob(job.JobID) if err != nil { ctx.NotFound(err) return @@ -84,7 +83,7 @@ func GetCloudbrainTask(ctx *context.APIContext) { } ctx.JSON(http.StatusOK, map[string]interface{}{ - "JobID": result.Config.JobID, + "JobName": result.Config.JobName, "JobStatus": result.JobStatus.State, "SubState": result.JobStatus.SubState, "CreatedTime": time.Unix(result.JobStatus.CreatedTime/1000, 0).Format("2006-01-02 15:04:05"), @@ -104,7 +103,7 @@ func CloudbrainGetLog(ctx *context.Context) { var hits []models.Hits result, err := cloudbrain.GetJobLog(jobID) - if err != nil{ + if err != nil { log.Error("GetJobLog failed: %v", err, ctx.Data["MsgID"]) ctx.ServerError(err.Error(), err) return @@ -115,7 +114,7 @@ func CloudbrainGetLog(ctx *context.Context) { if len(result.Hits.Hits) >= cloudbrain.LogPageSize { for { resultNext, err := cloudbrain.GetJobAllLog(result.ScrollID) - if err != nil{ + if err != nil { log.Error("GetJobAllLog failed: %v", err, ctx.Data["MsgID"]) } else { for _, hit := range resultNext.Hits.Hits { @@ -142,8 +141,8 @@ func CloudbrainGetLog(ctx *context.Context) { } ctx.JSON(http.StatusOK, map[string]interface{}{ - "JobID": jobID, - "Content": content, + "JobID": jobID, + "Content": content, }) return diff --git a/routers/api/v1/repo/modelarts.go b/routers/api/v1/repo/modelarts.go index c9f8761c9..27df10e16 100755 --- a/routers/api/v1/repo/modelarts.go +++ b/routers/api/v1/repo/modelarts.go @@ -77,6 +77,7 @@ func GetModelArtsNotebook2(ctx *context.APIContext) { ctx.JSON(http.StatusOK, map[string]interface{}{ "JobID": jobID, + "JobName": job.JobName, "JobStatus": result.Status, }) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index 46596330f..959fb4c9f 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -297,7 +297,7 @@ func allProjectsPeroidHeader(ctx *context.Context) map[string]string { } func allProjectsPeroidValues(row int, rs *models.RepoStatistic, ctx *context.Context) map[string]string { - return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.Name, getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), + return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), getCellName("F", row): strconv.FormatInt(rs.NumVisits, 10), getCellName("G", row): strconv.FormatInt(rs.NumDownloads, 10), getCellName("H", row): strconv.FormatInt(rs.NumPulls, 10), getCellName("I", row): strconv.FormatInt(rs.NumCommits, 10), getCellName("J", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("K", row): strconv.FormatInt(rs.NumStars, 10), getCellName("L", row): strconv.FormatInt(rs.NumForks, 10), getCellName("M", row): strconv.FormatInt(rs.NumIssues, 10), getCellName("N", row): strconv.FormatInt(rs.NumClosedIssues, 10), getCellName("O", row): strconv.FormatInt(rs.NumContributor, 10), @@ -317,7 +317,7 @@ func allProjectsOpenIHeader() map[string]string { func allProjectsOpenIValues(row int, rs *models.RepoStatistic, ctx *context.Context) map[string]string { - return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.Name, getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), + return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), getCellName("F", row): strconv.FormatFloat(rs.Impact, 'f', 2, 64), getCellName("G", row): strconv.FormatFloat(rs.Completeness, 'f', 2, 64), getCellName("H", row): strconv.FormatFloat(rs.Liveness, 'f', 2, 64), getCellName("I", row): strconv.FormatFloat(rs.ProjectHealth, 'f', 2, 64), getCellName("J", row): strconv.FormatFloat(rs.TeamHealth, 'f', 2, 64), getCellName("K", row): strconv.FormatFloat(rs.Growth, 'f', 2, 64), getCellName("L", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("M", row): strconv.FormatInt(rs.NumStars, 10), getCellName("N", row): strconv.FormatInt(rs.NumForks, 10), getCellName("O", row): strconv.FormatInt(rs.NumDownloads, 10), @@ -466,10 +466,10 @@ func generateCountSql(beginTime time.Time, endTime time.Time, latestDate string, countSql := "SELECT count(*) FROM " + "(SELECT repo_id FROM repo_statistic where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) + " group by repo_id) A," + - "(SELECT repo_id,name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + + "(SELECT repo_id,name,alias,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - countSql = countSql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" + countSql = countSql + " and LOWER(B.alias) like '%" + strings.ToLower(q) + "%'" } return countSql } @@ -482,22 +482,22 @@ func generateOpenICountSql(latestDate string) string { } func generateTypeAllSql(beginTime time.Time, endTime time.Time, latestDate string, q string, orderBy string, page int, pageSize int) string { - sql := "SELECT A.repo_id,name,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + + sql := "SELECT A.repo_id,name,alias,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + "(SELECT repo_id,sum(num_visits) as num_visits " + " FROM repo_statistic where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) + " group by repo_id) A," + - "(SELECT repo_id,name,owner_name,is_private,radar_total,num_watches,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor from public.repo_statistic where date='" + latestDate + "') B" + + "(SELECT repo_id,name,alias,owner_name,is_private,radar_total,num_watches,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and LOWER(name) like '%" + strings.ToLower(q) + "%'" + sql = sql + " and LOWER(alias) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql } func generateTypeAllOpenISql(latestDate string, page int, pageSize int) string { - sql := "SELECT id, repo_id, date, num_watches, num_stars, num_forks, num_downloads, num_comments, num_visits, num_closed_issues, num_versions, num_dev_months, repo_size, dataset_size, num_models, num_wiki_views, num_commits, num_issues, num_pulls, issue_fixed_rate, num_contributor, num_key_contributor, num_contributors_growth, num_commits_growth, num_commit_lines_growth, num_issues_growth, num_comments_growth, impact, completeness, liveness, project_health, team_health, growth, radar_total, name, is_private, owner_name FROM " + + sql := "SELECT id, repo_id, date, num_watches, num_stars, num_forks, num_downloads, num_comments, num_visits, num_closed_issues, num_versions, num_dev_months, repo_size, dataset_size, num_models, num_wiki_views, num_commits, num_issues, num_pulls, issue_fixed_rate, num_contributor, num_key_contributor, num_contributors_growth, num_commits_growth, num_commit_lines_growth, num_issues_growth, num_comments_growth, impact, completeness, liveness, project_health, team_health, growth, radar_total, name,alias, is_private, owner_name FROM " + " public.repo_statistic where date='" + latestDate + "'" sql = sql + " order by radar_total desc,repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) @@ -506,14 +506,14 @@ func generateTypeAllOpenISql(latestDate string, page int, pageSize int) string { func generatePageSql(beginTime time.Time, endTime time.Time, latestDate string, q string, orderBy string, page int, pageSize int) string { - sql := "SELECT A.repo_id,name,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + + sql := "SELECT A.repo_id,name,alias,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + "(SELECT repo_id,sum(num_watches_added) as num_watches,sum(num_visits) as num_visits, sum(num_downloads_added) as num_downloads,sum(num_pulls_added) as num_pulls,sum(num_commits_added) as num_commits,sum(num_stars_added) as num_stars,sum(num_forks_added) num_forks,sum(num_issues_added) as num_issues,sum(num_closed_issues_added) as num_closed_issues,sum(num_contributor_added) as num_contributor " + " FROM repo_statistic where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) + " group by repo_id) A," + - "(SELECT repo_id,name,owner_name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + + "(SELECT repo_id,name,alias,owner_name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" + sql = sql + " and LOWER(B.alias) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,A.repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 0599fb03f..d26b8f08c 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -351,13 +351,13 @@ func CloudBrainShow(ctx *context.Context) { func cloudBrainShow(ctx *context.Context, tpName base.TplName) { ctx.Data["PageIsCloudBrain"] = true - var jobID = ctx.Params(":jobid") - task, err := models.GetCloudbrainByJobID(jobID) + var jobName = ctx.Params(":jobname") + task, err := models.GetCloudbrainByName(jobName) if err != nil { ctx.Data["error"] = err.Error() } - result, err := cloudbrain.GetJob(jobID) + result, err := cloudbrain.GetJob(task.JobID) if err != nil { ctx.Data["error"] = err.Error() } @@ -422,7 +422,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { ctx.Data["duration"] = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000) ctx.Data["task"] = task - ctx.Data["jobID"] = jobID + // ctx.Data["jobID"] = task.JobID ctx.Data["jobName"] = task.JobName version_list_task := make([]*models.Cloudbrain, 0) version_list_task = append(version_list_task, task) @@ -582,12 +582,13 @@ func logErrorAndUpdateJobStatus(err error, taskInfo *models.Cloudbrain) { } func CloudBrainDel(ctx *context.Context) { + var listType = ctx.Query("debugListType") if err := deleteCloudbrainJob(ctx); err != nil { log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"]) ctx.ServerError(err.Error(), err) return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=" + listType) } func deleteCloudbrainJob(ctx *context.Context) error { diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 9dea34c82..647afb0d0 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -268,6 +268,7 @@ func NotebookShow(ctx *context.Context) { ctx.Data["task"] = task ctx.Data["jobID"] = jobID + ctx.Data["jobName"] = task.JobName ctx.Data["result"] = result ctx.HTML(200, tplModelArtsNotebookShow) } @@ -417,6 +418,7 @@ func NotebookManage(ctx *context.Context) { func NotebookDel(ctx *context.Context) { var jobID = ctx.Params(":jobid") + var listType = ctx.Query("debugListType") task := ctx.Cloudbrain if task.Status != string(models.ModelArtsCreateFailed) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsStopped) { @@ -442,7 +444,7 @@ func NotebookDel(ctx *context.Context) { return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=" + listType) } func TrainJobIndex(ctx *context.Context) { diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index d9545f696..06f45e608 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -106,7 +106,8 @@ func RepoStatisticDaily(date string) { repoStat := models.RepoStatistic{ RepoID: repo.ID, Date: date, - Name: repo.Alias, + Name: repo.Name, + Alias: repo.Alias, IsPrivate: repo.IsPrivate, IsMirror: repo.IsMirror, OwnerName: repo.OwnerName, diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index e71e8cb3a..b4adfc347 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -63,11 +63,13 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac _, count := models.QueryUserStaticDataByTableName(1, 1, tableName, queryObj, userName) var indexTotal int64 indexTotal = 0 + row := 1 for { re, _ := models.QueryUserStaticDataByTableName(int(indexTotal), PAGE_SIZE, tableName, queryObj, "") log.Info("return count=" + fmt.Sprint(count)) - for i, userRecord := range re { - rows := fmt.Sprint(i + 2) + for _, userRecord := range re { + row++ + rows := fmt.Sprint(row) xlsx.SetCellValue(sheetName, "A"+rows, userRecord.ID) xlsx.SetCellValue(sheetName, "B"+rows, userRecord.Name) xlsx.SetCellValue(sheetName, "C"+rows, userRecord.CodeMergeCount) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index aa85b8f2b..de355352f 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -974,8 +974,10 @@ func RegisterRoutes(m *macaron.Macaron) { }, context.RepoRef()) m.Group("/cloudbrain", func() { - m.Group("/:jobid", func() { + m.Group("/:jobname", func() { m.Get("", reqRepoCloudBrainReader, repo.CloudBrainShow) + }) + m.Group("/:jobid", func() { m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDebug) m.Post("/commit_image", cloudbrain.AdminOrJobCreaterRight, bindIgnErr(auth.CommitImageCloudBrainForm{}), repo.CloudBrainCommitImage) m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop) diff --git a/routers/user/notification.go b/routers/user/notification.go index 9724c8108..0fd6df007 100644 --- a/routers/user/notification.go +++ b/routers/user/notification.go @@ -132,7 +132,7 @@ func getNotifications(c *context.Context) { } c.Data["Title"] = c.Tr("notifications") - c.Data["Keyword"] = keyword + //c.Data["Keyword"] = keyword c.Data["Status"] = status c.Data["Notifications"] = notifications diff --git a/templates/home.tmpl b/templates/home.tmpl index f43639a14..d21197602 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -20,7 +20,7 @@

* {{.page_only_dynamic}}

-
+
-
+
+
+ +
+
@@ -78,7 +82,7 @@

{{.page_dev_env}}

{{.page_dev_env_desc}}

-
+
@@ -158,4 +162,4 @@ -{{template "base/footer" .}} \ No newline at end of file +{{template "base/footer" .}} diff --git a/templates/repo/datasets/dataset_list.tmpl b/templates/repo/datasets/dataset_list.tmpl index e0c69c745..7ea420fa0 100755 --- a/templates/repo/datasets/dataset_list.tmpl +++ b/templates/repo/datasets/dataset_list.tmpl @@ -14,7 +14,7 @@
{{svg "octicon-flame" 16}} {{(.DownloadCount | PrettyNumber)}} - + {{svg "octicon-file" 16}} {{svg "octicon-file-binary" 16}}
{{if eq .DecompressState 1}} diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index f7773cf2d..a6df8e2ed 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -287,13 +287,13 @@
- + {{.Status}}
@@ -366,7 +366,7 @@
- + {{$.CsrfTokenHtml}} {{if .CanDel}} @@ -607,6 +607,7 @@ function loadJobStatus() { $(".job-status").each((index, job) => { const jobID = job.dataset.jobid; + const jobName = job.dataset.jobname; const repoPath = job.dataset.repopath; const computeResource = job.dataset.resource const initArray = ['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED','UNAVAILABLE','DELETED','RESIZE_FAILED'] @@ -615,38 +616,39 @@ return } const diffResource = computeResource == "NPU" ? 'modelarts/notebook' : 'cloudbrain' - $.get(`/api/v1/repos/${repoPath}/${diffResource}/${jobID}`, (data) => { - const jobID = data.JobID + const diffApi = computeResource == "NPU" ? jobID : jobName + $.get(`/api/v1/repos/${repoPath}/${diffResource}/${diffApi}`, (data) => { + const jobName = data.JobName const status = data.JobStatus if (status != job.textContent.trim()) { - $('#' + jobID+'-icon').removeClass().addClass(status) - $('#' + jobID+ '-text').text(status) + $('#' + jobName+'-icon').removeClass().addClass(status) + $('#' + jobName+ '-text').text(status) } if(status==="RUNNING"){ - $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") - $('#model-image-'+jobID).removeClass('disabled').addClass('blue') + $('#model-debug-'+jobName).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") + $('#model-image-'+jobName).removeClass('disabled').addClass('blue') } if(status!=="RUNNING"){ // $('#model-debug-'+jobID).removeClass('blue') // $('#model-debug-'+jobID).addClass('disabled') - $('#model-image-'+jobID).removeClass('blue').addClass('disabled') + $('#model-image-'+jobName).removeClass('blue').addClass('disabled') } if(["CREATING","STOPPING","WAITING","STARTING"].includes(status)){ - $('#model-debug-'+jobID).removeClass('blue').addClass('disabled') + $('#model-debug-'+jobName).removeClass('blue').addClass('disabled') } if(['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED'].includes(status)){ - $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") + $('#model-debug-'+jobName).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") } if(["RUNNING","WAITING"].includes(status)){ - $('#stop-model-debug-'+jobID).removeClass('disabled').addClass('blue') + $('#stop-model-debug-'+jobName).removeClass('disabled').addClass('blue') } if(["CREATING","STOPPING","STARTING","STOPPED","FAILED","START_FAILED","SUCCEEDED"].includes(status)){ - $('#stop-model-debug-'+jobID).removeClass('blue').addClass('disabled') + $('#stop-model-debug-'+jobName).removeClass('blue').addClass('disabled') } if(status==="STOPPED" || status==="FAILED"|| status==="START_FAILED"){ - $('#model-delete-'+jobID).removeClass('disabled').addClass('blue') + $('#model-delete-'+jobName).removeClass('disabled').addClass('blue') }else{ - $('#model-delete-'+jobID).removeClass('blue').addClass('disabled') + $('#model-delete-'+jobName).removeClass('blue').addClass('disabled') } }).fail(function(err) { console.log(err); diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index c9edff0c3..235634897 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -255,9 +255,9 @@ {{end}}
-
-

简介

- +
+

简介

+

{{if .Repository.DescriptionHTML}} {{.Repository.DescriptionHTML}} diff --git a/web_src/js/components/EditAboutInfo.vue b/web_src/js/components/EditAboutInfo.vue index 425cf4bcc..f9bb872ad 100644 --- a/web_src/js/components/EditAboutInfo.vue +++ b/web_src/js/components/EditAboutInfo.vue @@ -1,7 +1,7 @@