Browse Source

Merge remote-tracking branch 'origin/V20220314' into zouap_static

tags/V1.22.3.1^2
zouap 3 years ago
parent
commit
0f604bf94c
16 changed files with 145 additions and 48 deletions
  1. +1
    -1
      custom/public/css/git.openi.css
  2. +2
    -2
      models/org.go
  3. +13
    -0
      models/topic.go
  4. +2
    -0
      modules/modelarts/resty.go
  5. +6
    -0
      modules/repository/fork.go
  6. +10
    -5
      options/locale/locale_en-US.ini
  7. +6
    -2
      options/locale/locale_zh-CN.ini
  8. +1
    -1
      routers/admin/cloudbrains.go
  9. +7
    -0
      routers/org/home.go
  10. +5
    -5
      routers/repo/modelarts.go
  11. +1
    -1
      routers/routes/routes.go
  12. +1
    -0
      templates/admin/cloudbrain/search.tmpl
  13. +48
    -3
      templates/org/home.tmpl
  14. +4
    -24
      templates/org/home_courses.tmpl
  15. +3
    -3
      templates/user/settings/profile.tmpl
  16. +35
    -1
      web_src/less/openi.less

+ 1
- 1
custom/public/css/git.openi.css View File

@@ -185,7 +185,7 @@
.homenews .ui.list>.item>.content{
color: #E8E8E8;
line-height: 1.8em;
width: calc(100% - 3.25em) !important;
width: calc(100% - 3.75em) !important;
}
.homenews .ui.list>.item{
padding: 0;


+ 2
- 2
models/org.go View File

@@ -180,8 +180,8 @@ func CreateOrganization(org, owner *User) (err error) {

// Add initial creator to organization and owner team.
if _, err = sess.Insert(&OrgUser{
UID: owner.ID,
OrgID: org.ID,
UID: owner.ID,
OrgID: org.ID,
IsPublic: setting.Service.DefaultOrgMemberVisible,
}); err != nil {
return fmt.Errorf("insert org-user relation: %v", err)


+ 13
- 0
models/topic.go View File

@@ -324,3 +324,16 @@ func SaveTopics(repoID int64, topicNames ...string) error {

return sess.Commit()
}

func GetOrgTopics(orgId int64) ([]Topic, error) {
result := make([]Topic, 0)
sql := "select distinct(t.*) from repository r " +
"inner join repo_topic rt on rt.repo_id = r.id " +
"inner join topic t on rt.topic_id = t.id " +
"where r.owner_id = ? order by repo_count desc limit 50"
if e := x.SQL(sql, orgId).Find(&result); e != nil {
return nil, e
}

return result, nil
}

+ 2
- 0
modules/modelarts/resty.go View File

@@ -35,6 +35,8 @@ const (
//error code
modelartsIllegalToken = "ModelArts.6401"
NotebookNotFound = "ModelArts.6404"
NotebookNoPermission = "ModelArts.6407"
NotebookInvalid = "ModelArts.6400"
)

func getRestyClient() *resty.Client {


+ 6
- 0
modules/repository/fork.go View File

@@ -86,5 +86,11 @@ func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name,
if err := models.CopyLanguageStat(oldRepo, repo); err != nil {
log.Error("Copy language stat from oldRepo failed")
}
//inherit parent repo's topics
if len(oldRepo.Topics) > 0 {
if err := models.SaveTopics(repo.ID, oldRepo.Topics...); err != nil {
log.Error("SaveTopics failed when fork,e=%v", err)
}
}
return repo, models.CopyLFS(ctx, repo, oldRepo)
}

+ 10
- 5
options/locale/locale_en-US.ini View File

@@ -235,7 +235,7 @@ page_recommend_org_more=More Organizations
page_recommend_repo=Recommended Projects
page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here,
page_recommend_repo_commit=Click here to submit.
page_recommend_repo_go=Click here to
page_recommend_repo_go=Click here to
page_recommend_repo_more=explore more projects.
page_dev_env=Collaborative Development Environment
page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms.
@@ -493,11 +493,12 @@ account_link = Linked Accounts
organization = Organizations
uid = Uid
u2f = Security Keys
bind_weChat = Bind WeChat
bind_wechat = Bind WeChat
wechat_bind = WeChat Binding
bind_account_information = Bind account information
bind_time = Bind Time
wechat = Wechat
Unbind = Unbind
unbind_wc = Unbind
unbind_wechat = Are you sure you want to unbind WeChat?
unbind_computing = After unbundling, the qizhi computing power environment will not be available

@@ -1253,6 +1254,7 @@ issues.filter_sort.moststars = Most stars
issues.filter_sort.feweststars = Fewest stars
issues.filter_sort.mostforks = Most forks
issues.filter_sort.fewestforks = Fewest forks
issues.filter_sort.downloadtimes = Most downloaded
issues.action_open = Open
issues.action_close = Close
issues.action_label = Label
@@ -2087,14 +2089,17 @@ team_unit_disabled = (Disabled)
selected_couse=Selected Courses
release_course = Publish Course
all_keywords=All keywords
all_org_topics=All
max_selectedPro= Select up to 9 public projects
custom_select_courses = Customize selected courses
custom_select_courses = Customize selected courses
recommend_remain_pro = Remain
save_fail_tips = The upper limit is exceeded
select_again = Select more than 9, please select again!
custom_select_projects = Customize selected projects
custom_select_projects = Customize selected projects
customize = Customize
selected_project=Selected Projects
fold = Fold
unfold = Unfold

form.name_reserved = The organization name '%s' is reserved.
form.name_pattern_not_allowed = The pattern '%s' is not allowed in an organization name.


+ 6
- 2
options/locale/locale_zh-CN.ini View File

@@ -496,11 +496,12 @@ account_link=已绑定帐户
organization=组织
uid=用户 ID
u2f=安全密钥
bind_weChat = 微信绑定
wechat_bind = 微信绑定
bind_wechat = 绑定微信
bind_account_information = 绑定账号信息
bind_time = 绑定时间
wechat = 微信
unbind = 解除绑定
unbind_wc = 解除绑定
unbind_wechat = 确定要解绑微信?
unbind_computing = 解绑后将无法使用启智算力环境

@@ -2095,6 +2096,7 @@ team_unit_disabled=(已禁用)
selected_couse=精选课程
release_course = 发布课程
all_keywords=全部关键字
all_org_topics=全部
max_selectedPro= 最多可选9个公开项目
custom_select_courses = 自定义精选课程
recommend_remain_pro = 还能推荐
@@ -2103,6 +2105,8 @@ select_again = 选择超过9个,请重新选择!
custom_select_projects = 自定义精选项目
customize = 自定义
selected_project=精选项目
fold = 折叠
unfold = 展开

form.name_reserved=组织名称 '%s' 是被保留的。
form.name_pattern_not_allowed=组织名称中不允许使用 "%s"。


+ 1
- 1
routers/admin/cloudbrains.go View File

@@ -62,7 +62,7 @@ func CloudBrains(ctx *context.Context) {
jobStatusNot = true
jobStatuses = append(jobStatuses, string(models.ModelArtsTrainJobWaiting), string(models.ModelArtsTrainJobFailed), string(models.ModelArtsRunning), string(models.ModelArtsTrainJobCompleted),
string(models.ModelArtsStarting), string(models.ModelArtsRestarting), string(models.ModelArtsStartFailed),
string(models.ModelArtsStopping), string(models.ModelArtsStopped))
string(models.ModelArtsStopping), string(models.ModelArtsStopped), string(models.JobSucceeded))
} else if jobStatus != "all" && jobStatus != "" {
jobStatuses = append(jobStatuses, jobStatus)
}


+ 7
- 0
routers/org/home.go View File

@@ -94,6 +94,13 @@ func Home(ctx *context.Context) {
recommendCourseKeyWords, _ := repository.GetRecommendCourseKeyWords()
ctx.Data["CoursesKeywords"] = recommendCourseKeyWords

} else {
orgTopics, err := models.GetOrgTopics(org.ID)
if err != nil {
ctx.Error(500, "GetOrgTopics failed")
return
}
ctx.Data["OrgTopics"] = orgTopics
}

repos, count, err = models.SearchRepository(&models.SearchRepoOptions{


+ 5
- 5
routers/repo/modelarts.go View File

@@ -313,7 +313,7 @@ func NotebookDebug2(ctx *context.Context) {
return
}

ctx.Redirect(result.Url)
ctx.Redirect(result.Url + "?token=" + result.Token)
}

func NotebookManage(ctx *context.Context) {
@@ -431,24 +431,24 @@ func NotebookDel(ctx *context.Context) {

if task.Status != string(models.ModelArtsCreateFailed) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsStopped) {
log.Error("the job(%s) has not been stopped", task.JobName)
ctx.ServerError("the job has not been stopped", errors.New("the job has not been stopped"))
ctx.RenderWithErr("the job has not been stopped", tplDebugJobIndex, nil)
return
}

_, err := modelarts.DelNotebook2(jobID)
if err != nil {
log.Error("DelNotebook2(%s) failed:%v", task.JobName, err.Error())
if strings.Contains(err.Error(), modelarts.NotebookNotFound) {
if strings.Contains(err.Error(), modelarts.NotebookNotFound) || strings.Contains(err.Error(), modelarts.NotebookNoPermission) || strings.Contains(err.Error(), modelarts.NotebookInvalid){
log.Info("old notebook version")
} else {
ctx.ServerError("DelNotebook2 failed", err)
ctx.RenderWithErr(err.Error(), tplDebugJobIndex, nil)
return
}
}

err = models.DeleteJob(task)
if err != nil {
ctx.ServerError("DeleteJob failed", err)
ctx.RenderWithErr(err.Error(), tplDebugJobIndex, nil)
return
}



+ 1
- 1
routers/routes/routes.go View File

@@ -993,7 +993,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("", reqRepoCloudBrainReader, repo.CloudBrainShow)
})
m.Group("/:jobid", func() {
m.Get("/debug", reqWechatBind, cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDebug)
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)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainDel)


+ 1
- 0
templates/admin/cloudbrain/search.tmpl View File

@@ -35,6 +35,7 @@
<div class="menu">
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=" data-value='{{.i18n.Tr "admin.cloudbrain.all_status"}}'>{{.i18n.Tr "admin.cloudbrain.all_status"}}</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STARTING" data-value="STARTING">STARTING</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=RUNNING" data-value="RUNNING">RUNNING</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=RESTARTING" data-value="RESTARTING">RESTARTING </a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=START_FAILED" data-value="START_FAILED">START_FAILED</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPING" data-value="STOPPING">STOPPING</a>


+ 48
- 3
templates/org/home.tmpl View File

@@ -22,22 +22,51 @@
<div class="ui container">
{{template "org/navber" .}}
{{template "org/select_pro" .}}
<div class="ui stackable grid">
<div class="ui sixteen wide computer column">
<div class="ui mobile reversed stackable grid">
<div class="ui sixteen wide tablet sixteen wide computer column margin-top20 pad-botom maxheight" id='key_tag'>
{{if .OrgTopics}}
<a class="{{if eq $.Keyword "" }} tag_bg {{end}} tag_key ui small tag_lable topic omit" href="{{$.Link}}?" >{{$.i18n.Tr "org.all_org_topics"}}</span></a>
{{end}}

{{range .OrgTopics}}
{{if ne .Name ""}}
<a class="{{if eq $.Keyword .Name }} tag_bg {{end}} tag_key ui small tag_lable topic omit" href="{{$.Link}}?q={{.Name}}" >
{{.Name}}
</a>
{{end}}
{{end}}
</div>
<div style="width: 100%;margin:5px 5px 10px;">
<a class="text-right" onclick="isUnfold()" id="icon_btn"><i class="ri-arrow-down-s-line" style="display:inline-block;vertical-align:top"></i>&nbsp{{.i18n.Tr "org.unfold"}}</a>
</div>
</div>
</div>
</div>
<div class="ui stackable grid">
<div class="ui sixteen wide computer column">
<div class="ui mobile reversed stackable grid">
<div class="ui ten wide tablet eleven wide computer column">
{{if .CanCreateOrgRepo}}
<!-- {{if .CanCreateOrgRepo}}
<div class="text right">
<a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{.i18n.Tr "new_repo"}}</a>
</div>
{{end}}
{{end}} -->
{{template "org/repo_list" .}}
{{template "base/paginate" .}}
</div>

<div class="ui sixteen wide mobile six wide tablet five wide computer column">
<h4 class="ui top attached header">
{{if .CanCreateOrgRepo}}
<div class="text right">
<a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{.i18n.Tr "new_repo"}}</a>
</div>
{{end}}
<h4 class="ui top attached header" style="margin-top: 10px;">
<strong>{{.i18n.Tr "org.people"}}</strong>
<div class="ui right">
<a class="text grey" href="{{.OrgLink}}/members">{{.MembersTotal}} {{svg "octicon-chevron-right" 16}}</a>
@@ -99,3 +128,19 @@
</div>
</div>
{{template "base/footer" .}}

<script>

function isUnfold(){
var isContain= document.querySelector("#key_tag").classList.contains("maxheight");
if(isContain){
document.querySelector("#key_tag").classList.remove("maxheight");
document.getElementById("icon_btn").innerHTML="<i class=\"ri-arrow-up-s-line\" style=\"display:inline-block;vertical-align:top\"></i> &nbsp {{.i18n.Tr "org.fold"}}"
}else{
document.querySelector("#key_tag").classList.add("maxheight");
document.getElementById("icon_btn").innerHTML="<i class=\"ri-arrow-down-s-line\" style=\"display:inline-block;vertical-align:top\"></i> &nbsp {{.i18n.Tr "org.unfold"}}"


}
}
</script>

+ 4
- 24
templates/org/home_courses.tmpl View File

@@ -32,27 +32,13 @@
.organization-info >.container {
padding-bottom:0px !important;
}
.tag_bg{
background-color: #0366D6 !important;
color:#FFFFFF !important;
}
.course{
padding:10px 0 15px !important;
}
.course_color{
color: #FA8C16;
}
.tag_lable{
border: 1px solid rgba(232, 232, 232, 100) ;
border-radius: 4px;
color: rgba(65, 80, 88, 100);
font-family: Microsoft Yahei;
font-size: 14px;
padding: 0.3em 0.5em;
height: 30px;
text-align: center;
margin: 0.2em;
}
.tag_lable_first{
border: 1px solid rgba(232, 232, 232, 100) ;
border-radius: 4px;
@@ -65,17 +51,11 @@
margin: 0.2em;
margin-left: none;
}
.tag_key{
max-width:100%;
margin: 3px 3px;
display:inline-flex;
}

.bpadding{
padding:10px 40px
}
.omit{
overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.noborder{
border: none !important;
}
@@ -83,7 +63,7 @@
text-align: center;
margin-top: 5px;
margin-top: 10px;
}
}
</style>


+ 3
- 3
templates/user/settings/profile.tmpl View File

@@ -104,11 +104,11 @@
</form>
</div>
<h4 class="ui top attached header">
{{$.i18n.Tr "settings.bind_weChat"}}
{{$.i18n.Tr "settings.wechat_bind"}}
</h4>
{{if not .SignedUser.IsBindWechat}}
<div class="ui attached segment">
<a href="/authentication/wechat/bind?redirect_to=/user/settings" class="ui green button">{{$.i18n.Tr "settings.bind_weChat"}}</a>
<a href="/authentication/wechat/bind?redirect_to=/user/settings" class="ui green button">{{$.i18n.Tr "settings.bind_wechat"}}</a>
</div>
{{else}}
<div class="ui attached segment">
@@ -132,7 +132,7 @@
{{TimeSinceUnix1 .SignedUser.WechatBindUnix}}
<td class="center aligned">
<div>
<a class="ui inverted orange button " onclick="showcreate(this)" href="javascript: void(0)">{{$.i18n.Tr "settings.unbind"}}</a>
<a class="ui inverted orange button " onclick="showcreate(this)" href="javascript: void(0)">{{$.i18n.Tr "settings.unbind_wc"}}</a>
</div>
</td>
</tbody>


+ 35
- 1
web_src/less/openi.less View File

@@ -734,4 +734,38 @@ display: block;
}
.el-pagination.is-background .el-pager li:hover {
color: #5bb973 !important;
}
}

.tag_key{
max-width:100%;
margin: 3px 3px;
display:inline-flex;
}
.tag_lable{
border: 1px solid rgba(232, 232, 232, 100) ;
border-radius: 4px;
color: rgba(65, 80, 88, 100);
font-family: Microsoft Yahei;
font-size: 14px;
padding: 0.3em 0.5em;
height: 30px;
text-align: center;
margin: 0.2em;
}
.omit{
overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.tag_bg{
background-color: #0366D6 !important;
color:#FFFFFF !important;
}
.margin-top20{
margin-top: 20px;
}
.maxheight{
max-height: 88px;
overflow: hidden;
}
.pad-botom{
padding-bottom:0px !important;
}

Loading…
Cancel
Save