diff --git a/models/ai_model_manage.go b/models/ai_model_manage.go index 712e72d98..581b19a9c 100644 --- a/models/ai_model_manage.go +++ b/models/ai_model_manage.go @@ -135,7 +135,7 @@ func QueryModelByName(name string, repoId int64) []*AiModelManage { sess := x.NewSession() defer sess.Close() sess.Select("*").Table("ai_model_manage"). - Where("name='" + name + "' and repo_id=" + fmt.Sprint(repoId)).OrderBy("version desc") + Where("name='" + name + "' and repo_id=" + fmt.Sprint(repoId)).OrderBy("created_unix desc") aiModelManageList := make([]*AiModelManage, 0) sess.Find(&aiModelManageList) return aiModelManageList diff --git a/models/issue.go b/models/issue.go index 7457fcd45..19f00d5f3 100755 --- a/models/issue.go +++ b/models/issue.go @@ -1397,6 +1397,8 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats, if opts.MilestoneID > 0 { sess.And("issue.milestone_id = ?", opts.MilestoneID) + } else if opts.MilestoneID == -1 { //only search for issues do not have milestone + sess.And("issue.milestone_id = ?", 0) } if opts.AssigneeID > 0 { diff --git a/models/repo.go b/models/repo.go index a4417e4bd..8070d7442 100755 --- a/models/repo.go +++ b/models/repo.go @@ -2470,6 +2470,12 @@ func GetBlockChainUnSuccessRepos() ([]*Repository, error) { Find(&repos) } +func (repo *Repository) UpdateBlockChain() error { + + _, err := x.Exec("UPDATE `repository` SET block_chain_status = ?, contract_address=? WHERE id = ?", repo.BlockChainStatus, repo.ContractAddress, repo.ID) + return err +} + func (repo *Repository) IncreaseCloneCnt() { sess := x.NewSession() defer sess.Close() diff --git a/modules/git/repo.go b/modules/git/repo.go index 772f1d149..f72f5df7e 100644 --- a/modules/git/repo.go +++ b/modules/git/repo.go @@ -445,8 +445,12 @@ type Contributor struct { Email string } -func GetContributors(repoPath string) ([]Contributor, error){ - cmd := NewCommand("shortlog", "-sne", "--all") +func GetContributors(repoPath string, branchOrTag ...string) ([]Contributor, error) { + targetBranchOrTag := "HEAD" + if len(branchOrTag) > 0 && branchOrTag[0] != "" { + targetBranchOrTag = branchOrTag[0] + } + cmd := NewCommand("shortlog", "-sne", targetBranchOrTag) stdout, err := cmd.RunInDir(repoPath) if err != nil { return nil, err @@ -462,9 +466,9 @@ func GetContributors(repoPath string) ([]Contributor, error){ } number := oneCount[0:strings.Index(oneCount, "\t")] commitCnt, _ := strconv.Atoi(number) - committer := oneCount[strings.Index(oneCount, "\t")+1:strings.LastIndex(oneCount, " ")] + committer := oneCount[strings.Index(oneCount, "\t")+1 : strings.LastIndex(oneCount, " ")] committer = strings.Trim(committer, " ") - email := oneCount[strings.Index(oneCount, "<")+1:strings.Index(oneCount, ">")] + email := oneCount[strings.Index(oneCount, "<")+1 : strings.Index(oneCount, ">")] contributorsInfo[i] = Contributor{ commitCnt, committer, email, } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 48a010b73..d58a61756 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -778,8 +778,6 @@ datasets = Datasets datasets.desc = Enable Dataset cloudbrain_helper=Use GPU/NPU resources to open notebooks, model training tasks, etc. -model_manager = Model - debug=Debug stop=Stop delete=Delete @@ -897,7 +895,7 @@ model.manage.Accuracy = Accuracy model.manage.F1 = F1 model.manage.Precision = Precision model.manage.Recall = Recall - +model.manage.sava_model = Sava Model template.items = Template Items template.git_content = Git Content (Default Branch) diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 1eee752a1..45cabda8f 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -907,6 +907,7 @@ model.manage.Accuracy = 准确率 model.manage.F1 = F1值 model.manage.Precision = 精确率 model.manage.Recall = 召回率 +model.manage.sava_model = 保存模型 template.items=模板选项 template.git_content=Git数据(默认分支) diff --git a/routers/repo/blockchain.go b/routers/repo/blockchain.go index dc3fcd848..6bd546ce6 100755 --- a/routers/repo/blockchain.go +++ b/routers/repo/blockchain.go @@ -72,7 +72,7 @@ func HandleBlockChainInitNotify(ctx *context.Context) { repo.BlockChainStatus = models.RepoBlockChainSuccess repo.ContractAddress = req.ContractAddress - if err = models.UpdateRepositoryCols(repo, "block_chain_status", "contract_address"); err != nil { + if err = repo.UpdateBlockChain(); err != nil { log.Error("UpdateRepositoryCols failed:%v", err.Error(), ctx.Data["msgID"]) ctx.JSON(200, map[string]string{ "code": "-1", diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 77ed0251d..7aa8151da 100755 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -193,6 +193,8 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB var mileIDs []int64 if milestoneID > 0 { mileIDs = []int64{milestoneID} + } else if milestoneID == -1 { //only search no milestone + mileIDs = []int64{0} } var issues []*models.Issue @@ -355,7 +357,7 @@ func Issues(ctx *context.Context) { var err error // Get milestones. - ctx.Data["Milestones"], err = models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateType(ctx.Query("state")), models.ListOptions{}) + ctx.Data["Milestones"], err = models.GetMilestonesByRepoID(ctx.Repo.Repository.ID, api.StateAll, models.ListOptions{}) if err != nil { ctx.ServerError("GetAllRepoMilestones", err) return diff --git a/routers/repo/view.go b/routers/repo/view.go index a5f2e1477..b08243240 100755 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -605,7 +605,7 @@ func getContributorInfo(contributorInfos []*ContributorInfo, email string) *Cont func Home(ctx *context.Context) { if len(ctx.Repo.Units) > 0 { //get repo contributors info - contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath()) + contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath(), ctx.Repo.BranchName) if err == nil && contributors != nil { startTime := time.Now() var contributorInfos []*ContributorInfo @@ -924,7 +924,9 @@ func ContributorsAPI(ctx *context.Context) { count := 0 errorCode := 0 errorMsg := "" - contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath()) + + branchOrTag := ctx.Query("name") + contributors, err := git.GetContributors(ctx.Repo.Repository.RepoPath(), branchOrTag) var contributorInfos []*ContributorInfo if err == nil && contributors != nil { contributorInfoHash := make(map[string]*ContributorInfo) diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index c794e8215..d56a94c9d 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -114,7 +114,7 @@
- +
@@ -123,7 +123,7 @@
@@ -169,6 +169,7 @@ $('#choice_model').dropdown('clear') $('#choice_version').dropdown('clear') $('.ui.dimmer').css({"background-color":""}) + $('.ui.error.message').text() $('.ui.error.message').css('display','none') } @@ -211,7 +212,6 @@ } $("#job-name").append(train_html) $(".ui.dropdown.selection.search.width83").removeClass("loading") - $('#choice_model .default.text').text(data[0].JobName) $('#choice_model input[name="JobId"]').val(data[0].JobID) loadTrainVersion() @@ -227,10 +227,13 @@ train_html += `
${data[i].VersionName}
` train_html += '
' } - $("#job-version").append(train_html) - $(".ui.dropdown.selection.search.width70").removeClass("loading") - $('#choice_version .default.text').text(data[0].VersionName) - $('#choice_version input[name="VersionName"]').val(data[0].VersionName) + if(data.length){ + $("#job-version").append(train_html) + $(".ui.dropdown.selection.search.width70").removeClass("loading") + $('#choice_version .default.text').text(data[0].VersionName) + $('#choice_version input[name="VersionName"]').val(data[0].VersionName) + } + }) } diff --git a/templates/repo/modelmanage/showinfo.tmpl b/templates/repo/modelmanage/showinfo.tmpl index f416347d3..0ce08d899 100644 --- a/templates/repo/modelmanage/showinfo.tmpl +++ b/templates/repo/modelmanage/showinfo.tmpl @@ -221,6 +221,7 @@ function tranSize(value){ function editorFn(context){ let id= context.dataset.id let text = context.dataset.desc + console.log(id,text) $('#edit-td').replaceWith("
"); } diff --git a/web_src/js/components/Model.vue b/web_src/js/components/Model.vue index f87c78a36..783f43ce0 100644 --- a/web_src/js/components/Model.vue +++ b/web_src/js/components/Model.vue @@ -95,8 +95,8 @@ min-width="6.75%" > @@ -104,7 +104,7 @@