Browse Source

Merge branch 'V20210910' into merge_label_system

pull/371/head
zouap 3 years ago
parent
commit
099ccd42f6
32 changed files with 699 additions and 78 deletions
  1. +1
    -0
      models/models.go
  2. +65
    -0
      models/recommend_org.go
  3. +22
    -0
      models/repo.go
  4. +2
    -0
      models/repo_list.go
  5. +10
    -0
      modules/context/auth.go
  6. +1
    -1
      options/locale/locale_zh-CN.ini
  7. BIN
      public/img/loading.png
  8. BIN
      public/img/org-baai@2x-80.jpg
  9. BIN
      public/img/org-engineclub@2x-80.jpg
  10. BIN
      public/img/org-modelzoo@2x-80.jpg
  11. BIN
      public/img/org-openi@2x-80.jpg
  12. BIN
      public/img/org-platform@2x-80.jpg
  13. BIN
      public/img/org-tensorlayer@2x-80.jpg
  14. +21
    -1
      routers/home.go
  15. +64
    -0
      routers/operation/orgs.go
  16. +37
    -0
      routers/private/cmd.go
  17. +28
    -0
      routers/private/hook.go
  18. +1
    -0
      routers/private/internal.go
  19. +10
    -0
      routers/routes/routes.go
  20. +83
    -0
      templates/explore/repo_left.tmpl
  21. +143
    -59
      templates/explore/repo_list.tmpl
  22. +106
    -0
      templates/explore/repo_orgtop.tmpl
  23. +39
    -1
      templates/explore/repo_right.tmpl
  24. +1
    -1
      templates/explore/repo_search.tmpl
  25. +5
    -4
      templates/explore/repos.tmpl
  26. +11
    -2
      templates/repo/cloudbrain/index.tmpl
  27. +13
    -1
      templates/repo/datasets/index.tmpl
  28. +2
    -4
      templates/repo/header.tmpl
  29. +11
    -2
      templates/repo/modelarts/index.tmpl
  30. +21
    -2
      templates/repo/modelarts/new.tmpl
  31. +1
    -0
      web_src/js/components/MinioUploader.vue
  32. +1
    -0
      web_src/js/components/ObsUploader.vue

+ 1
- 0
models/models.go View File

@@ -129,6 +129,7 @@ func init() {
new(Cloudbrain), new(Cloudbrain),
new(FileChunk), new(FileChunk),
new(BlockChain), new(BlockChain),
new(RecommendOrg),
) )


gonicNames := []string{"SSL", "UID"} gonicNames := []string{"SSL", "UID"}


+ 65
- 0
models/recommend_org.go View File

@@ -0,0 +1,65 @@
package models

import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/timeutil"
)

type RecommendOrg struct {
ID int64 `xorm:"pk autoincr"`
Order int64 `xorm:"INDEX NOT NULL unique"`
OrgID int64 `xorm:"INDEX NOT NULL unique"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
}

type RecommendOrgInfo struct {
RecommendOrg `xorm:"extends"`
User `xorm:"extends"`
}

type RecommendOrgList []*RecommendOrg
type RecommendOrgInfoList []*RecommendOrgInfo

func getRecommendOrgs(e Engine) (RecommendOrgList, error) {
orgs := make(RecommendOrgList, 0, 10)
err := e.Asc("order").
Find(&orgs)
return orgs, err
}

func GetRecommendOrgs() (RecommendOrgList, error) {
return getRecommendOrgs(x)
}

func getRecommendOrgInfos(e Engine) (RecommendOrgInfoList, error) {
orgs := make(RecommendOrgInfoList, 0, 10)
if err := e.Table(&RecommendOrg{}).Join("INNER", "`user`", "`user`.id = `recommend_org`.org_id").
OrderBy("recommend_org.order").Find(&orgs); err != nil {
return orgs, err
}
return orgs, nil
}

func GetRecommendOrgInfos() (RecommendOrgInfoList, error) {
return getRecommendOrgInfos(x)
}

func delRecommendOrgs(e Engine) error {
sql := "delete from recommend_org"
_, err := e.Exec(sql)
return err
}

func UpdateRecommendOrgs(orgs RecommendOrgList) error {
if err := delRecommendOrgs(x); err != nil {
log.Error("delRecommendOrgs failed:%v", err.Error())
return err
}

if _, err := x.Insert(&orgs); err != nil {
log.Error("Insert failed:%v", err.Error())
return err
}

return nil
}

+ 22
- 0
models/repo.go View File

@@ -175,6 +175,7 @@ type Repository struct {
NumMilestones int `xorm:"NOT NULL DEFAULT 0"` NumMilestones int `xorm:"NOT NULL DEFAULT 0"`
NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"` NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"`
NumOpenMilestones int `xorm:"-"` NumOpenMilestones int `xorm:"-"`
NumCommit int64 `xorm:"NOT NULL DEFAULT 0"`


IsPrivate bool `xorm:"INDEX"` IsPrivate bool `xorm:"INDEX"`
IsEmpty bool `xorm:"INDEX"` IsEmpty bool `xorm:"INDEX"`
@@ -213,6 +214,9 @@ type Repository struct {


CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`

Hot int64 `xorm:"-"`
Active int64 `xorm:"-"`
} }


// SanitizedOriginalURL returns a sanitized OriginalURL // SanitizedOriginalURL returns a sanitized OriginalURL
@@ -1411,6 +1415,15 @@ func GetRepositoriesByForkID(forkID int64) ([]*Repository, error) {
return getRepositoriesByForkID(x, forkID) return getRepositoriesByForkID(x, forkID)
} }


func getALLRepositories(e Engine) ([]*Repository, error) {
repos := make([]*Repository, 0, 1000)
return repos, e.Find(&repos)
}

func GetAllRepositories() ([]*Repository, error) {
return getALLRepositories(x)
}

func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) { func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) {
repo.LowerName = strings.ToLower(repo.Name) repo.LowerName = strings.ToLower(repo.Name)


@@ -2413,6 +2426,7 @@ func updateRepositoryCols(e Engine, repo *Repository, cols ...string) error {
} }


// UpdateRepositoryCols updates repository's columns // UpdateRepositoryCols updates repository's columns
// Notice: it will update the updated_unix automatically, be careful to use this
func UpdateRepositoryCols(repo *Repository, cols ...string) error { func UpdateRepositoryCols(repo *Repository, cols ...string) error {
return updateRepositoryCols(x, repo, cols...) return updateRepositoryCols(x, repo, cols...)
} }
@@ -2442,3 +2456,11 @@ func (repo *Repository) IncreaseCloneCnt() {


return return
} }

func UpdateRepositoryCommitNum(repo *Repository) error {
if _,err := x.Exec("UPDATE `repository` SET num_commit = ? where id = ?", repo.NumCommit, repo.ID); err != nil {
return err
}

return nil
}

+ 2
- 0
models/repo_list.go View File

@@ -198,6 +198,8 @@ const (
SearchOrderByForks SearchOrderBy = "num_forks ASC" SearchOrderByForks SearchOrderBy = "num_forks ASC"
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC" SearchOrderByForksReverse SearchOrderBy = "num_forks DESC"
SearchOrderByDownloadTimes SearchOrderBy = "download_times DESC" SearchOrderByDownloadTimes SearchOrderBy = "download_times DESC"
SearchOrderByHot SearchOrderBy = "(num_watches + num_stars + num_forks + clone_cnt) DESC"
SearchOrderByActive SearchOrderBy = "(num_issues + num_pulls + num_commit) DESC"
) )


// SearchRepositoryCondition creates a query condition according search repository options // SearchRepositoryCondition creates a query condition according search repository options


+ 10
- 0
modules/context/auth.go View File

@@ -26,6 +26,7 @@ type ToggleOptions struct {
AdminRequired bool AdminRequired bool
DisableCSRF bool DisableCSRF bool
BasicAuthRequired bool BasicAuthRequired bool
OperationRequired bool
} }


// Toggle returns toggle options as middleware // Toggle returns toggle options as middleware
@@ -142,6 +143,15 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return return
} }
} }

if options.OperationRequired {
//todo: add isOperator judgement
if !ctx.User.IsAdmin {
ctx.Error(403)
return
}
ctx.Data["PageIsOperation"] = true
}
} }
} }




+ 1
- 1
options/locale/locale_zh-CN.ini View File

@@ -335,7 +335,7 @@ SSPIDefaultLanguage=默认语言


require_error=不能为空。 require_error=不能为空。
alpha_dash_error=应该只包含字母数字、破折号 ('-') 和下划线 ('_') 字符。 alpha_dash_error=应该只包含字母数字、破折号 ('-') 和下划线 ('_') 字符。
alpha_dash_dot_error=' 应该只包含字母数字, 破折号 ('-'), 下划线 ('_') 和点 ('. ') 。
alpha_dash_dot_error=应该只包含字母数字, 破折号 ('-'), 下划线 ('_') 和点 ('. ') 。
git_ref_name_error=` 必须是格式良好的 git 引用名称。` git_ref_name_error=` 必须是格式良好的 git 引用名称。`
size_error=长度必须为 %s。 size_error=长度必须为 %s。
min_size_error=长度最小为 %s 个字符。 min_size_error=长度最小为 %s 个字符。


BIN
public/img/loading.png View File

Before After
Width: 332  |  Height: 206  |  Size: 13 kB Width: 320  |  Height: 380  |  Size: 70 kB

BIN
public/img/org-baai@2x-80.jpg View File

Before After
Width: 401  |  Height: 121  |  Size: 15 kB

BIN
public/img/org-engineclub@2x-80.jpg View File

Before After
Width: 401  |  Height: 121  |  Size: 20 kB

BIN
public/img/org-modelzoo@2x-80.jpg View File

Before After
Width: 401  |  Height: 121  |  Size: 12 kB

BIN
public/img/org-openi@2x-80.jpg View File

Before After
Width: 401  |  Height: 121  |  Size: 21 kB

BIN
public/img/org-platform@2x-80.jpg View File

Before After
Width: 401  |  Height: 121  |  Size: 15 kB

BIN
public/img/org-tensorlayer@2x-80.jpg View File

Before After
Width: 402  |  Height: 122  |  Size: 12 kB

+ 21
- 1
routers/home.go View File

@@ -7,6 +7,7 @@ package routers


import ( import (
"bytes" "bytes"
"net/http"
"strings" "strings"


"code.gitea.io/gitea/models" "code.gitea.io/gitea/models"
@@ -136,11 +137,17 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
orderBy = models.SearchOrderByForksReverse orderBy = models.SearchOrderByForksReverse
case "fewestforks": case "fewestforks":
orderBy = models.SearchOrderByForks orderBy = models.SearchOrderByForks
case "hot":
orderBy = models.SearchOrderByHot
case "active":
orderBy = models.SearchOrderByActive

default: default:
ctx.Data["SortType"] = "recentupdate" ctx.Data["SortType"] = "recentupdate"
orderBy = models.SearchOrderByRecentUpdated orderBy = models.SearchOrderByRecentUpdated
} }


//todo:support other topics
keyword := strings.Trim(ctx.Query("q"), " ") keyword := strings.Trim(ctx.Query("q"), " ")
topicOnly := ctx.QueryBool("topic") topicOnly := ctx.QueryBool("topic")
ctx.Data["TopicOnly"] = topicOnly ctx.Data["TopicOnly"] = topicOnly
@@ -164,6 +171,11 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
ctx.ServerError("SearchRepository", err) ctx.ServerError("SearchRepository", err)
return return
} }

for _, repo := range repos {
repo.Hot = int64(repo.NumWatches) + int64(repo.NumStars) + int64(repo.NumForks) + int64(repo.CloneCnt)
repo.Active = int64(repo.NumIssues) + int64(repo.NumPulls) + int64(repo.NumCommit)
}
ctx.Data["Keyword"] = keyword ctx.Data["Keyword"] = keyword
ctx.Data["Total"] = count ctx.Data["Total"] = count
ctx.Data["Repos"] = repos ctx.Data["Repos"] = repos
@@ -174,7 +186,15 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
pager.AddParam(ctx, "topic", "TopicOnly") pager.AddParam(ctx, "topic", "TopicOnly")
ctx.Data["Page"] = pager ctx.Data["Page"] = pager


ctx.HTML(200, opts.TplName)
recommendOrgs, err := models.GetRecommendOrgInfos()
if err != nil {
log.Error("GetRecommendOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"])
ctx.ServerError("GetRecommendOrgInfos", err)
return
}
ctx.Data["RecommendOrgs"] = recommendOrgs

ctx.HTML(http.StatusOK, opts.TplName)
} }


// ExploreRepos render explore repositories page // ExploreRepos render explore repositories page


+ 64
- 0
routers/operation/orgs.go View File

@@ -0,0 +1,64 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2020 The Gitea Authors.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package operation

import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/routers"
)

const (
tplOrgs base.TplName = "admin/org/list"
)

type UpdateRecommendOrgs struct {
OrgInfos string `binding:"required"`
}

type OrgInfo struct {
OrgID int64 `json:"org_id"`
Order int64 `json:"order"`
}

type OrgInfos struct {
OrgInfo []OrgInfo `json:"org_infos"`
}

// Organizations show all the organizations recommended
func Organizations(ctx *context.Context) {
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminOrganizations"] = true

routers.RenderUserSearch(ctx, &models.SearchUserOptions{
Type: models.UserTypeOrganization,
ListOptions: models.ListOptions{
PageSize: setting.UI.Admin.OrgPagingNum,
},
Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate},
}, tplOrgs)
}

// UpdateRecommendOrganizations update the organizations recommended
func UpdateRecommendOrganizations(ctx *context.Context, req OrgInfos) {
orgs := make(models.RecommendOrgList, 0, 10)
for _, org := range req.OrgInfo {
orgs = append(orgs, &models.RecommendOrg{
OrgID: org.OrgID,
Order: org.Order,
})
}

if err := models.UpdateRecommendOrgs(orgs); err != nil {
log.Error("UpdateRecommendOrgs failed:%v", err.Error(), ctx.Data["MsgID"])
ctx.ServerError("UpdateRecommendOrgs failed", err)
return
}
}

+ 37
- 0
routers/private/cmd.go View File

@@ -0,0 +1,37 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package private

import (
"gitea.com/macaron/macaron"
"net/http"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
)

func UpdateAllRepoCommitCnt(ctx *macaron.Context) {
repos, err := models.GetAllRepositories()
if err != nil {
log.Error("GetAllRepositories failed:%v", err.Error(), ctx.Data["MsgID"])
ctx.JSON(http.StatusInternalServerError, map[string]string{
"error_msg": "GetAllRepositories failed",
})
return
}

for i, repo := range repos {
log.Info("%d:begin updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
if err = updateRepoCommitCnt(ctx, repo); err != nil {
log.Error("updateRepoCommitCnt(id = %d, name = %s) failed:%v", repo.ID, repo.Name, err.Error(), ctx.Data["MsgID"])
continue
}
log.Info("%d:finish updateRepoCommitCnt(id = %d, name = %s)", i, repo.ID, repo.Name)
}

ctx.JSON(http.StatusOK, map[string]string{
"error_msg": "",
})
}

+ 28
- 0
routers/private/hook.go View File

@@ -520,12 +520,40 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
} }
} }
} }

if err := updateRepoCommitCnt(ctx, repo); err != nil {
log.Error("updateRepoCommitCnt failed:%v", err.Error(), ctx.Data["MsgID"])
}

ctx.JSON(http.StatusOK, private.HookPostReceiveResult{ ctx.JSON(http.StatusOK, private.HookPostReceiveResult{
Results: results, Results: results,
RepoWasEmpty: wasEmpty, RepoWasEmpty: wasEmpty,
}) })
} }


func updateRepoCommitCnt(ctx *macaron.Context, repo *models.Repository) error {
gitRepo, err := git.OpenRepository(repo.RepoPath())
if err != nil {
log.Error("OpenRepository failed:%v", err.Error(), ctx.Data["MsgID"])
return err
}
defer gitRepo.Close()

count, err := gitRepo.GetAllCommitsCount()
if err != nil {
log.Error("GetAllCommitsCount failed:%v", err.Error(), ctx.Data["MsgID"])
return err
}

repo.NumCommit = count
if err = models.UpdateRepositoryCommitNum(repo); err != nil {
log.Error("UpdateRepositoryCommitNum failed:%v", err.Error(), ctx.Data["MsgID"])
return err
}

return nil
}

// SetDefaultBranch updates the default branch // SetDefaultBranch updates the default branch
func SetDefaultBranch(ctx *macaron.Context) { func SetDefaultBranch(ctx *macaron.Context) {
ownerName := ctx.Params(":owner") ownerName := ctx.Params(":owner")


+ 1
- 0
routers/private/internal.go View File

@@ -42,6 +42,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/manager/shutdown", Shutdown) m.Post("/manager/shutdown", Shutdown)
m.Post("/manager/restart", Restart) m.Post("/manager/restart", Restart)
m.Post("/manager/flush-queues", bind(private.FlushOptions{}), FlushQueues) m.Post("/manager/flush-queues", bind(private.FlushOptions{}), FlushQueues)
m.Post("/cmd/update_all_repo_commit_cnt", UpdateAllRepoCommitCnt)


}, CheckInternalToken) }, CheckInternalToken)
} }

+ 10
- 0
routers/routes/routes.go View File

@@ -6,6 +6,7 @@ package routes


import ( import (
"bytes" "bytes"
"code.gitea.io/gitea/routers/operation"
"encoding/gob" "encoding/gob"
"net/http" "net/http"
"path" "path"
@@ -539,6 +540,15 @@ func RegisterRoutes(m *macaron.Macaron) {
}, adminReq) }, adminReq)
// ***** END: Admin ***** // ***** END: Admin *****


operationReq := context.Toggle(&context.ToggleOptions{SignInRequired: true, OperationRequired: true})

// ***** START: Operation *****
m.Group("/operation", func() {
m.Get("/config/recommend_org", operation.Organizations)
m.Post("/config/recommend_org", bindIgnErr(operation.OrgInfos{}), operation.UpdateRecommendOrganizations)
}, operationReq)
// ***** END: Operation *****

m.Group("", func() { m.Group("", func() {
m.Get("/:username", user.Profile) m.Get("/:username", user.Profile)
}, ignSignIn) }, ignSignIn)


+ 83
- 0
templates/explore/repo_left.tmpl View File

@@ -0,0 +1,83 @@
<style>
.leftnav.ui.vertical.menu .active.item {
background: #5BB973;
color: #FFF;
}
</style>

<div class="ui sixteen wide mobile four wide tablet three wide computer column">
<div class="leftnav ui fluid vertical menu">
<a class="active item" href="/explore/repos?sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M16,20H20V16H16M16,14H20V10H16M10,8H14V4H10M16,8H20V4H16M10,14H14V10H10M4,14H8V10H4M4,20H8V16H4M10,20H14V16H10M4,8H8V4H4V8Z" />
</svg>
全部领域
</a>
<a class="item" href="/explore/repos?q=大模型&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M19 3H5C3.89 3 3 3.89 3 5V19C3 20.11 3.9 21 5 21H19C20.11 21 21 20.11 21 19V5C21 3.89 20.1 3 19 3M16.1 15.9C15.07 15.9 14.09 15.5 13.35 14.76L12.71 14.12L14.13 12.71L14.76 13.34C15.12 13.7 15.6 13.9 16.11 13.9C17.15 13.9 18 13.05 18 12S17.15 10.1 16.1 10.1C15.6 10.1 15.12 10.3 14.76 10.66L10.65 14.76C9.91 15.5 8.94 15.9 7.9 15.9C5.75 15.9 4 14.15 4 12S5.75 8.1 7.9 8.1C8.94 8.1 9.91 8.5 10.65 9.24L11.29 9.88L9.87 11.3L9.24 10.66C8.88 10.3 8.4 10.1 7.9 10.1C6.85 10.1 6 10.95 6 12S6.85 13.9 7.9 13.9C8.4 13.9 8.88 13.7 9.24 13.34L13.35 9.24C14.09 8.5 15.06 8.1 16.1 8.1C18.25 8.1 20 9.85 20 12S18.25 15.9 16.1 15.9Z" />
</svg>
大模型
</a>
<a class="item" href="/explore/repos?q=AI开发工具&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M11 8H9V10C9 11.1 8.1 12 7 12C8.1 12 9 12.9 9 14V16H11V18H9C7.9 18 7 17.1 7 16V15C7 13.9 6.1 13 5 13V11C6.1 11 7 10.1 7 9V8C7 6.9 7.9 6 9 6H11V8M19 13C17.9 13 17 13.9 17 15V16C17 17.1 16.1 18 15 18H13V16H15V14C15 12.9 15.9 12 17 12C15.9 12 15 11.1 15 10V8H13V6H15C16.1 6 17 6.9 17 8V9C17 10.1 17.9 11 19 11V13Z" />
</svg>
AI开发工具
</a>
<a class="item" href="/explore/repos?q=计算机视觉&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
</svg>
计算机视觉
</a>
<a class="item" href="/explore/repos?q=自然语言处理&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M9,5A4,4 0 0,1 13,9A4,4 0 0,1 9,13A4,4 0 0,1 5,9A4,4 0 0,1 9,5M9,15C11.67,15 17,16.34 17,19V21H1V19C1,16.34 6.33,15 9,15M16.76,5.36C18.78,7.56 18.78,10.61 16.76,12.63L15.08,10.94C15.92,9.76 15.92,8.23 15.08,7.05L16.76,5.36M20.07,2C24,6.05 23.97,12.11 20.07,16L18.44,14.37C21.21,11.19 21.21,6.65 18.44,3.63L20.07,2Z" />
</svg>
自然语言处理
</a>
<a class="item" href="/explore/repos?q=机器学习&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M19,12V13.5A4,4 0 0,1 23,17.5C23,18.32 22.75,19.08 22.33,19.71L21.24,18.62C21.41,18.28 21.5,17.9 21.5,17.5A2.5,2.5 0 0,0 19,15V16.5L16.75,14.25L19,12M19,23V21.5A4,4 0 0,1 15,17.5C15,16.68 15.25,15.92 15.67,15.29L16.76,16.38C16.59,16.72 16.5,17.1 16.5,17.5A2.5,2.5 0 0,0 19,20V18.5L21.25,20.75L19,23M12,3C16.42,3 20,4.79 20,7C20,9.21 16.42,11 12,11C7.58,11 4,9.21 4,7C4,4.79 7.58,3 12,3M4,9C4,11.21 7.58,13 12,13C13.11,13 14.17,12.89 15.14,12.68C14.19,13.54 13.5,14.67 13.18,15.96L12,16C7.58,16 4,14.21 4,12V9M20,9V11H19.5L18.9,11.03C19.6,10.43 20,9.74 20,9M4,14C4,16.21 7.58,18 12,18L13,17.97C13.09,19.03 13.42,20 13.95,20.88L12,21C7.58,21 4,19.21 4,17V14Z" />
</svg>
机器学习
</a>
<a class="item" href="/explore/repos?q=神经网络&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M13 3C9.23 3 6.19 5.95 6 9.66L4.08 12.19C3.84 12.5 4.08 13 4.5 13H6V16C6 17.11 6.89 18 8 18H9V21H16V16.31C18.37 15.19 20 12.8 20 10C20 6.14 16.88 3 13 3M17.06 9.57L15.1 10.09L16.54 11.54C16.89 11.88 16.89 12.46 16.54 12.81C16.19 13.16 15.61 13.16 15.27 12.81L13.81 11.37L13.3 13.33C13.18 13.82 12.68 14.1 12.21 13.97C11.72 13.84 11.44 13.35 11.57 12.87L12.1 10.9L10.13 11.43C9.65 11.56 9.15 11.28 9.03 10.79C8.9 10.32 9.18 9.82 9.67 9.7L11.63 9.19L10.19 7.73C9.84 7.39 9.84 6.82 10.19 6.46C10.54 6.11 11.12 6.11 11.46 6.46L12.91 7.9L13.43 5.94C13.55 5.46 14.04 5.18 14.5 5.3C15 5.43 15.28 5.92 15.16 6.41L14.63 8.37L16.59 7.84C17.08 7.72 17.57 8 17.7 8.5C17.82 8.96 17.54 9.45 17.06 9.57Z" />
</svg>
神经网络
</a>
<a class="item" href="/explore/repos?q=自动驾驶&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M5,14H19L17.5,9.5H6.5L5,14M17.5,19A1.5,1.5 0 0,0 19,17.5A1.5,1.5 0 0,0 17.5,16A1.5,1.5 0 0,0 16,17.5A1.5,1.5 0 0,0 17.5,19M6.5,19A1.5,1.5 0 0,0 8,17.5A1.5,1.5 0 0,0 6.5,16A1.5,1.5 0 0,0 5,17.5A1.5,1.5 0 0,0 6.5,19M18.92,9L21,15V23A1,1 0 0,1 20,24H19A1,1 0 0,1 18,23V22H6V23A1,1 0 0,1 5,24H4A1,1 0 0,1 3,23V15L5.08,9C5.28,8.42 5.85,8 6.5,8H17.5C18.15,8 18.72,8.42 18.92,9M12,0C14.12,0 16.15,0.86 17.65,2.35L16.23,3.77C15.11,2.65 13.58,2 12,2C10.42,2 8.89,2.65 7.77,3.77L6.36,2.35C7.85,0.86 9.88,0 12,0M12,4C13.06,4 14.07,4.44 14.82,5.18L13.4,6.6C13.03,6.23 12.53,6 12,6C11.5,6 10.97,6.23 10.6,6.6L9.18,5.18C9.93,4.44 10.94,4 12,4Z" />
</svg>
自动驾驶
</a>
<a class="item" href="/explore/repos?q=机器人&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M12,2A2,2 0 0,1 14,4C14,4.74 13.6,5.39 13,5.73V7H14A7,7 0 0,1 21,14H22A1,1 0 0,1 23,15V18A1,1 0 0,1 22,19H21V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V19H2A1,1 0 0,1 1,18V15A1,1 0 0,1 2,14H3A7,7 0 0,1 10,7H11V5.73C10.4,5.39 10,4.74 10,4A2,2 0 0,1 12,2M7.5,13A2.5,2.5 0 0,0 5,15.5A2.5,2.5 0 0,0 7.5,18A2.5,2.5 0 0,0 10,15.5A2.5,2.5 0 0,0 7.5,13M16.5,13A2.5,2.5 0 0,0 14,15.5A2.5,2.5 0 0,0 16.5,18A2.5,2.5 0 0,0 19,15.5A2.5,2.5 0 0,0 16.5,13Z" />
</svg>
机器人
</a>
<a class="item" href="/explore/repos?q=联邦学习&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M3 11H11V3H3M5 5H9V9H5M13 21H21V13H13M15 15H19V19H15M3 21H11V13H3M5 15H9V19H5M13 3V11H21V3M19 9H15V5H19Z" />
</svg>
联邦学习
</a>
<a class="item" href="/explore/repos?q=数据挖掘&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M18.36,2.64C20,2.64 21.36,4 21.36,5.64C21.36,7.29 20,8.64 18.36,8.64C16.71,8.64 15.36,7.29 15.36,5.64C15.36,5.34 15.41,5.06 15.5,4.8C14.43,4.29 13.25,4 12,4A8,8 0 0,0 4,12L4.04,12.84L2.05,13.05L2,12A10,10 0 0,1 12,2C13.69,2 15.28,2.42 16.67,3.16C17.16,2.83 17.74,2.64 18.36,2.64M18.36,4.64A1,1 0 0,0 17.36,5.64A1,1 0 0,0 18.36,6.64C18.92,6.64 19.36,6.19 19.36,5.64C19.36,5.08 18.92,4.64 18.36,4.64M5.64,15.36C7.29,15.36 8.64,16.71 8.64,18.36C8.64,18.66 8.59,18.94 8.5,19.2C9.57,19.71 10.75,20 12,20A8,8 0 0,0 20,12L19.96,11.16L21.95,10.95L22,12A10,10 0 0,1 12,22C10.31,22 8.72,21.58 7.33,20.84C6.84,21.17 6.26,21.36 5.64,21.36C4,21.36 2.64,20 2.64,18.36C2.64,16.71 4,15.36 5.64,15.36M5.64,17.36C5.08,17.36 4.64,17.81 4.64,18.36C4.64,18.92 5.08,19.36 5.64,19.36A1,1 0 0,0 6.64,18.36A1,1 0 0,0 5.64,17.36M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8Z" />
</svg>
数据挖掘
</a>
<a class="item" href="/explore/repos?q=RISC-V&topic=1&sort={{.SortType}}">
<svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
<path fill="currentColor" d="M17,17H7V7H17M21,11V9H19V7C19,5.89 18.1,5 17,5H15V3H13V5H11V3H9V5H7C5.89,5 5,5.89 5,7V9H3V11H5V13H3V15H5V17A2,2 0 0,0 7,19H9V21H11V19H13V21H15V19H17A2,2 0 0,0 19,17V15H21V13H19V11M13,13H11V11H13M15,9H9V15H15V9Z" />
</svg>
RISC-V开发
</a>
</div>
</div>

+ 143
- 59
templates/explore/repo_list.tmpl View File

@@ -1,70 +1,154 @@
<h2 class="ui left floated medium header">
{{.i18n.Tr "explore.repos"}}
</h2>
<div class="ui right floated secondary filter menu">
<!-- Sort -->
<div class="ui right dropdown type jump item">
<span class="text">
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
</span>
<div class="menu">
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&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}}&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}}&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}}&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}}&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}}&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}}&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}}&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}}&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}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
</div>
</div>
</div>
<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 {
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-size: .6rem;
}
.repository .ui.right.compact .item{
padding-top: 0;
padding-bottom: 0;
}
.ui.repository.list .item .time {
margin-top: 1.5rem;
}
</style>

<div class="ui secondary pointing tabular top attached borderless menu navbar">
<a class="{{if eq .SortType "hot"}}active{{end}} item" href="{{$.Link}}?sort=hot&q=&tab=">
<svg class="svg octicon-repo" width="16" height="16" aria-hidden="true">
<use xlink:href="#octicon-repo" />
</svg>
热门{{.i18n.Tr "explore.repos"}}
</a>
<a class="{{if eq .SortType "active"}}active{{end}} item" href="{{$.Link}}?sort=active&q=&tab=">
<svg class="svg octicon-inbox" width="16" height="16" aria-hidden="true">
<use xlink:href="#octicon-inbox" />
</svg>
活跃{{.i18n.Tr "explore.repos"}}
</a>


<div class="ui clearing divider"></div>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&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"}}
</a>

<div class="ui right floated secondary filter menu">
<!-- Sort -->
<div class="ui right dropdown type jump item">
<span class="text">
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
</span>
<div class="menu">
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&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}}&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}}&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}}&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}}&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}}&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}}&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}}&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}}&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}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
</div>
</div>
</div>
</div>


<div class="ui repository list"> <div class="ui repository list">
{{range .Repos}} {{range .Repos}}
<div class="item"> <div class="item">
<div class="ui header">
{{if .RelAvatarLink}}
<img class="ui avatar image" src="{{.RelAvatarLink}}">
{{end}}
<a class="name" href="{{.Link}}">
{{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} <span>/</span> {{end}}{{end}}<strong>{{.Name}}</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>
{{if .RelAvatarLink}}
<img class="ui avatar image" src="{{.RelAvatarLink}}">
{{end}}
<div class="content">
<div class="ui header">
<a class="name" href="{{.Link}}">
{{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} <span>/</span> {{end}}{{end}}<strong>{{.Name}}</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}} {{end}}
{{end}}
<div class="ui right metas">
{{if .PrimaryLanguage }}
<span class="text grey"><i class="color-icon" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
{{end}}
<span class="text grey">{{svg "octicon-star" 16}} {{.NumStars}}</span>
<span class="text grey">{{svg "octicon-git-branch" 16}} {{.NumForks}}</span>

<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>
{{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>
{{else}}
<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>
</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=1"><div class="ui small label topic">{{.}}</div></a>{{end}}
<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=1"><div class="ui small label topic">{{.}}</div></a>{{end}}
{{end}}
</div>
{{end}} {{end}}
</div>
{{end}}
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}</p>
<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>
</div> </div>
{{else}} {{else}}


+ 106
- 0
templates/explore/repo_orgtop.tmpl View File

@@ -0,0 +1,106 @@
<script src="https://cdn.bootcdn.net/ajax/libs/Swiper/6.8.0/swiper-bundle.min.js"></script>
<link href="https://cdn.bootcdn.net/ajax/libs/Swiper/6.8.0/swiper-bundle.min.css" rel="stylesheet">
<style>
.explore .repos--seach{
border-bottom:none;
}
.repos--orgtop {
margin-top: -21px;
}

.repos--orgtop .ui.card {
box-shadow: none;
border: 1px solid #DFE9F0;
}

.repos--orgtop .ui.card .content {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.repos--orgtop .swiper-pagination {
position: relative;
bottom: 0;
}
</style>

<div class="repos--seach repos--orgtop">
<div class="ui container">
<h3>这些优秀的组织正在使用:</h3>
<!-- Swiper -->
<div class="ui container swiper-container">
<div class="swiper-wrapper">
<!--{{range .RecommendOrgs}}
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="{{$.HomeLink}}/{{.User.Name}}">
<img class="ui avatar image" src="{{.User.RelAvatarLink}}" alt="{{.User.Name}}" title="{{.User.Name}}">
</a>
</div>
</div>
{{end}}-->
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/OpenI">
<img src="/img/org-openi@2x-80.jpg" alt="OpenI 启智社区" title="OpenI 启智社区">
</a>
</div>
</div>
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/TensorLayer">
<img src="/img/org-tensorlayer@2x-80.jpg" alt="TensorLayer" title="TensorLayer">
</a>
</div>
</div>
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/PCL-Platform.Intelligence">
<img src="/img/org-platform@2x-80.jpg" alt="PCL-Platform.Intelligence" title="PCL-Platform.Intelligence">
</a>
</div>
</div>
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/BAAI">
<img src="/img/org-baai@2x-80.jpg" alt="BAAI" title="BAAI">
</a>
</div>
</div>
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/OpenModelZoo">
<img src="/img/org-modelzoo@2x-80.jpg" alt="OpenModelZoo" title="OpenModelZoo">
</a>
</div>
</div>
<div class="swiper-slide">
<div class="ui card">
<a class="image" href="https://git.openi.org.cn/PCL_EngineClub">
<img src="/img/org-engineclub@2x-80.jpg" alt="PCL_EngineClub" title="PCL_EngineClub">
</a>
</div>
</div>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination"></div>
</div>
</div>
</div>
<!-- Initialize Swiper -->

<script>
var swiper = new Swiper('.swiper-container', {
slidesPerView: 5,
spaceBetween: 30,
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
</script>

+ 39
- 1
templates/explore/repo_right.tmpl View File

@@ -1 +1,39 @@
<a href="https://openi.org.cn/html/2020/qimengxingdong_0813/450.html" target="_blank"><img class="ui mini image" src="/img/banner-qimen-4X3.jpg" style="width:100%;"></a>
<a href="https://openi.org.cn/html/2020/qimengxingdong_0813/450.html" target="_blank"><img class="ui mini image" src="/img/banner-qimen-4X3.jpg" style="width:100%;"></a>

<div class="ui secondary pointing menu">
<div class="active item">
推荐百科
</div>
</div>
<div class="ui relaxed list">
<div class="item">
<i class="sticky note outline icon"></i>
<div class="content">
<div ><a href="https://git.openi.org.cn/OpenI/aiforge/wiki">启智AI开发协同平台使用说明</a></div>
</div>
</div>
<div class="item">
<i class="sticky note outline icon"></i>
<div class="content">
<div ><a href="https://git.openi.org.cn/OpenI/Paddle/wiki">启智飞桨 Paddle 2.0 项目手册</a></div>
</div>
</div>
<div class="item">
<i class="sticky note outline icon"></i>
<div class="content">
<div ><a href="https://git.openi.org.cn/OpenI/aiforge/wiki/cloudbrain">启智社区使用云脑计算资源进行调试说明</a></div>
</div>
</div>
<div class="item">
<i class="sticky note outline icon"></i>
<div class="content">
<div ><a href="https://git.openi.org.cn/PCL-Federated.Learning.Middleware/HiStar/wiki">海星HiStar:联邦深度学习中间件帮助文档</a></div>
</div>
</div>
<div class="item">
<i class="sticky note outline icon"></i>
<div class="content">
<div ><a href="https://git.openi.org.cn/OpenI/octopus/wiki/启智章鱼">启智章鱼开源项目文档</a></div>
</div>
</div>
</div>

+ 1
- 1
templates/explore/repo_search.tmpl View File

@@ -6,7 +6,7 @@
<input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus> <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
<input type="hidden" name="tab" value="{{$.TabName}}"> <input type="hidden" name="tab" value="{{$.TabName}}">
<input type="hidden" name="sort" value="{{$.SortType}}"> <input type="hidden" name="sort" value="{{$.SortType}}">
<button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
<button class="ui green button">{{.i18n.Tr "explore.search"}}</button>
</div> </div>
</form> </form>
</div> </div>


+ 5
- 4
templates/explore/repos.tmpl View File

@@ -2,16 +2,17 @@
<div class="explore repositories"> <div class="explore repositories">


{{template "explore/repo_search" .}} {{template "explore/repo_search" .}}

{{template "explore/repo_orgtop" .}}
<div class="ui container"> <div class="ui container">
<div class="ui grid"> <div class="ui grid">
{{template "explore/navbar" .}}
{{template "explore/repo_left" .}}


<div class="ui sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui sixteen wide mobile twelve wide tablet ten wide computer column">
{{template "explore/repo_list" .}} {{template "explore/repo_list" .}}
{{template "base/paginate" .}} {{template "base/paginate" .}}
</div> </div>
<div class="ui sixteen wide mobile six wide tablet three wide computer column">
<div class="computer only ui three wide computer column">
{{template "explore/repo_right" .}} {{template "explore/repo_right" .}}
</div> </div>
</div> </div>


+ 11
- 2
templates/repo/cloudbrain/index.tmpl View File

@@ -2,6 +2,12 @@
{{template "base/head" .}} {{template "base/head" .}}


<style> <style>
.selectcloudbrain .active.item{
color: #0087f5 !important;
border: 1px solid #0087f5;
margin: -1px;
background: #FFF !important;
}
#deletemodel { #deletemodel {
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -210,8 +216,11 @@
</div> </div>
</div> </div>


<!-- 中间分割线 -->
<div class="ui divider"></div>
<p>使用鹏城云脑计算资源进行调试,云脑1提供CPU / GPU资源,云脑2提供Ascend NPU资源;调试使用的数据集也需要上传到对应的环境。</p>
<div class="ui blue mini menu selectcloudbrain">
<a class="active item" href="{{.RepoLink}}/cloudbrain">{{svg "octicon-server" 16}} CPU / GPU</a>
<a class="item" href="{{.RepoLink}}/modelarts">{{svg "octicon-server" 16}} Ascend NPU</a>
</div>


<!-- 中下列表展示区 --> <!-- 中下列表展示区 -->
<div class="ui grid"> <div class="ui grid">


+ 13
- 1
templates/repo/datasets/index.tmpl View File

@@ -1,4 +1,12 @@
{{template "base/head" .}} {{template "base/head" .}}
<style>
.selectcloudbrain .active.item{
color: #0087f5 !important;
border: 1px solid #0087f5;
margin: -1px;
background: #FFF !important;
}
</style>
<div class="repository release dataset-list view"> <div class="repository release dataset-list view">
{{template "repo/header" .}} {{template "repo/header" .}}
<script> <script>
@@ -62,7 +70,11 @@
</div> </div>
</div> </div>


<div class="ui divider"></div>
<div class="ui blue mini menu selectcloudbrain">
<a class="{{if eq .Type 0}}active {{end}}item" href="{{.RepoLink}}/datasets?type=0">{{svg "octicon-server" 16}} CPU / GPU</a>
<a class="{{if eq .Type 1}}active {{end}}item" href="{{.RepoLink}}/datasets?type=1">{{svg "octicon-server" 16}} Ascend NPU</a>
</div>
<div class="ui stackable grid"> <div class="ui stackable grid">
<div class="twelve wide column"> <div class="twelve wide column">
<div class="ui sixteen wide column"> <div class="ui sixteen wide column">


+ 2
- 4
templates/repo/header.tmpl View File

@@ -98,9 +98,8 @@
{{end}} {{end}}


{{if .Permission.CanRead $.UnitTypeDatasets}} {{if .Permission.CanRead $.UnitTypeDatasets}}
<a class="{{if .PageIsDataset}}active{{end}} item dataset" >
<a class="{{if .PageIsDataset}}active{{end}} item" href="{{.RepoLink}}/datasets?type=0">
{{svg "octicon-inbox" 16}} {{.i18n.Tr "datasets"}} {{svg "octicon-inbox" 16}} {{.i18n.Tr "datasets"}}
<span style="display:none" class="dataset_link">{{.RepoLink}}</span>
</a> </a>
{{end}} {{end}}


@@ -141,9 +140,8 @@
{{end}} {{end}}


{{if .Permission.CanRead $.UnitTypeCloudBrain}} {{if .Permission.CanRead $.UnitTypeCloudBrain}}
<a class="{{if .PageIsCloudBrain}}active{{end}} item cloudbrain">
<a class="{{if .PageIsCloudBrain}}active{{end}} item" href="{{.RepoLink}}/cloudbrain">
{{svg "octicon-server" 16}} {{.i18n.Tr "repo.cloudbrain"}} {{svg "octicon-server" 16}} {{.i18n.Tr "repo.cloudbrain"}}
<span style="display:none" class="cloudbrain_link">{{.RepoLink}}</span>
</a> </a>
{{end}} {{end}}




+ 11
- 2
templates/repo/modelarts/index.tmpl View File

@@ -2,6 +2,12 @@
{{template "base/head" .}} {{template "base/head" .}}


<style> <style>
.selectcloudbrain .active.item{
color: #0087f5 !important;
border: 1px solid #0087f5;
margin: -1px;
background: #FFF !important;
}
#deletemodel { #deletemodel {
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -210,8 +216,11 @@
</div> </div>
</div> </div>


<!-- 中间分割线 -->
<div class="ui divider"></div>
<p>使用鹏城云脑计算资源进行调试,云脑1提供CPU / GPU资源,云脑2提供Ascend NPU资源;调试使用的数据集也需要上传到对应的环境。</p>
<div class="ui blue mini menu selectcloudbrain">
<a class="item" href="{{.RepoLink}}/cloudbrain">{{svg "octicon-server" 16}} CPU / GPU</a>
<a class="active item" href="{{.RepoLink}}/modelarts">{{svg "octicon-server" 16}} Ascend NPU</a>
</div>


<!-- 中下列表展示区 --> <!-- 中下列表展示区 -->
<div class="ui grid"> <div class="ui grid">


+ 21
- 2
templates/repo/modelarts/new.tmpl View File

@@ -114,13 +114,13 @@


<div class="inline field"> <div class="inline field">
<label>数据集</label> <label>数据集</label>
<input type="text" list="cloudbrain_dataset" placeholder="选择数据集" name="attachment" autofocus maxlength="36">
<input type="text" list="cloudbrain_dataset" placeholder="选择数据集" name="" id="answerInput" autofocus maxlength="36">
<datalist id="cloudbrain_dataset" class="ui search" style='width:385px' name="attachment"> <datalist id="cloudbrain_dataset" class="ui search" style='width:385px' name="attachment">
{{range .attachments}} {{range .attachments}}
<option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option> <option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option>

{{end}} {{end}}
</datalist> </datalist>
<input type="hidden" name="attachment" id="answerInput-hidden">
</div> </div>


<div class="inline required field"> <div class="inline required field">
@@ -187,4 +187,23 @@
} }
}) })
}) })
document.querySelector('input[list]').addEventListener('input',function(e){
var input = e.target,
list = input.getAttribute('list'),
options = document.querySelectorAll('#'+list+' option'),
hiddenInput = document.getElementById(input.getAttribute('id')+'-hidden'),
inputValue = input.value;
hiddenInput.value = inputValue;
for (let i=0;i<options.length;i++){
var option = options[i]
if(option.innerText===inputValue){
hiddenInput.value = option.getAttribute('data-value');
break
}
}


})
</script> </script>

+ 1
- 0
web_src/js/components/MinioUploader.vue View File

@@ -11,6 +11,7 @@
{{ file_status_text }} {{ file_status_text }}
<span class="success">{{ status }}</span> <span class="success">{{ status }}</span>
</p> </p>
<p>云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。</p>
</div> </div>
</template> </template>




+ 1
- 0
web_src/js/components/ObsUploader.vue View File

@@ -8,6 +8,7 @@
{{ file_status_text }} {{ file_status_text }}
<span class="success">{{ status }}</span> <span class="success">{{ status }}</span>
</p> </p>
<p>云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。</p>
</div> </div>
</template> </template>




Loading…
Cancel
Save