You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ma...@apache.org on 2023/03/31 09:47:03 UTC
[incubator-devlake] branch release-v0.16 updated: feat: convert issue_repo_commit for tapd (#4824) (#4830)
This is an automated email from the ASF dual-hosted git repository.
mappjzc pushed a commit to branch release-v0.16
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.16 by this push:
new e44b86d68 feat: convert issue_repo_commit for tapd (#4824) (#4830)
e44b86d68 is described below
commit e44b86d684d109f217ef480de1cd544bbf32ba33
Author: Likyh <ya...@meri.co>
AuthorDate: Fri Mar 31 17:46:57 2023 +0800
feat: convert issue_repo_commit for tapd (#4824) (#4830)
---
backend/plugins/tapd/tasks/bug_commit_converter.go | 29 +++++++++++++++++++---
.../plugins/tapd/tasks/story_commit_converter.go | 29 +++++++++++++++++++---
.../plugins/tapd/tasks/task_commit_converter.go | 29 +++++++++++++++++++---
config-ui/src/plugins/register/zentao/config.ts | 2 +-
4 files changed, 76 insertions(+), 13 deletions(-)
diff --git a/backend/plugins/tapd/tasks/bug_commit_converter.go b/backend/plugins/tapd/tasks/bug_commit_converter.go
index a7cc3186e..a5550e8d4 100644
--- a/backend/plugins/tapd/tasks/bug_commit_converter.go
+++ b/backend/plugins/tapd/tasks/bug_commit_converter.go
@@ -25,7 +25,9 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/tapd/models"
+ "net/url"
"reflect"
+ "strings"
)
func ConvertBugCommit(taskCtx plugin.SubTaskContext) errors.Error {
@@ -49,14 +51,33 @@ func ConvertBugCommit(taskCtx plugin.SubTaskContext) errors.Error {
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
toolL := inputRow.(*models.TapdBugCommit)
- domainL := &crossdomain.IssueCommit{
+ results := make([]interface{}, 0, 2)
+ issueCommit := &crossdomain.IssueCommit{
IssueId: issueIdGen.Generate(data.Options.ConnectionId, toolL.BugId),
CommitSha: toolL.CommitId,
}
+ results = append(results, issueCommit)
+ if toolL.WebURL != `` {
+ u, err := errors.Convert01(url.Parse(toolL.WebURL))
+ if err != nil {
+ return nil, err
+ }
+ repoUrl := toolL.WebURL
+ if !strings.HasSuffix(repoUrl, `.git`) {
+ repoUrl = repoUrl + `.git`
+ }
+ issueRepoCommit := &crossdomain.IssueRepoCommit{
+ IssueId: issueIdGen.Generate(data.Options.ConnectionId, toolL.BugId),
+ RepoUrl: repoUrl,
+ CommitSha: toolL.CommitId,
+ Host: u.Host,
+ Namespace: strings.Split(u.Path, `/`)[1],
+ RepoName: toolL.HookProjectName,
+ }
+ results = append(results, issueRepoCommit)
+ }
- return []interface{}{
- domainL,
- }, nil
+ return results, nil
},
})
if err != nil {
diff --git a/backend/plugins/tapd/tasks/story_commit_converter.go b/backend/plugins/tapd/tasks/story_commit_converter.go
index 9b2cb2b28..cf9c1e622 100644
--- a/backend/plugins/tapd/tasks/story_commit_converter.go
+++ b/backend/plugins/tapd/tasks/story_commit_converter.go
@@ -25,7 +25,9 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/tapd/models"
+ "net/url"
"reflect"
+ "strings"
)
func ConvertStoryCommit(taskCtx plugin.SubTaskContext) errors.Error {
@@ -47,14 +49,33 @@ func ConvertStoryCommit(taskCtx plugin.SubTaskContext) errors.Error {
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
toolL := inputRow.(*models.TapdStoryCommit)
- domainL := &crossdomain.IssueCommit{
+ results := make([]interface{}, 0, 2)
+ issueCommit := &crossdomain.IssueCommit{
IssueId: issueIdGen.Generate(data.Options.ConnectionId, toolL.StoryId),
CommitSha: toolL.CommitId,
}
+ results = append(results, issueCommit)
+ if toolL.WebURL != `` {
+ u, err := errors.Convert01(url.Parse(toolL.WebURL))
+ if err != nil {
+ return nil, err
+ }
+ repoUrl := toolL.WebURL
+ if !strings.HasSuffix(repoUrl, `.git`) {
+ repoUrl = repoUrl + `.git`
+ }
+ issueRepoCommit := &crossdomain.IssueRepoCommit{
+ IssueId: issueIdGen.Generate(data.Options.ConnectionId, toolL.StoryId),
+ RepoUrl: repoUrl,
+ CommitSha: toolL.CommitId,
+ Host: u.Host,
+ Namespace: strings.Split(u.Path, `/`)[1],
+ RepoName: toolL.HookProjectName,
+ }
+ results = append(results, issueRepoCommit)
+ }
- return []interface{}{
- domainL,
- }, nil
+ return results, nil
},
})
if err != nil {
diff --git a/backend/plugins/tapd/tasks/task_commit_converter.go b/backend/plugins/tapd/tasks/task_commit_converter.go
index 744699777..53efe46aa 100644
--- a/backend/plugins/tapd/tasks/task_commit_converter.go
+++ b/backend/plugins/tapd/tasks/task_commit_converter.go
@@ -25,7 +25,9 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/tapd/models"
+ "net/url"
"reflect"
+ "strings"
)
func ConvertTaskCommit(taskCtx plugin.SubTaskContext) errors.Error {
@@ -50,14 +52,33 @@ func ConvertTaskCommit(taskCtx plugin.SubTaskContext) errors.Error {
Input: cursor,
Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
toolL := inputRow.(*models.TapdTaskCommit)
- domainL := &crossdomain.IssueCommit{
+ results := make([]interface{}, 0, 2)
+ issueCommit := &crossdomain.IssueCommit{
IssueId: issueIdGen.Generate(data.Options.ConnectionId, toolL.TaskId),
CommitSha: toolL.CommitId,
}
+ results = append(results, issueCommit)
+ if toolL.WebURL != `` {
+ u, err := errors.Convert01(url.Parse(toolL.WebURL))
+ if err != nil {
+ return nil, err
+ }
+ repoUrl := toolL.WebURL
+ if !strings.HasSuffix(repoUrl, `.git`) {
+ repoUrl = repoUrl + `.git`
+ }
+ issueRepoCommit := &crossdomain.IssueRepoCommit{
+ IssueId: issueIdGen.Generate(data.Options.ConnectionId, toolL.TaskId),
+ RepoUrl: repoUrl,
+ CommitSha: toolL.CommitId,
+ Host: u.Host,
+ Namespace: strings.Split(u.Path, `/`)[1],
+ RepoName: toolL.HookProjectName,
+ }
+ results = append(results, issueRepoCommit)
+ }
- return []interface{}{
- domainL,
- }, nil
+ return results, nil
},
})
if err != nil {
diff --git a/config-ui/src/plugins/register/zentao/config.ts b/config-ui/src/plugins/register/zentao/config.ts
index 2547c53bd..b75b36a3e 100644
--- a/config-ui/src/plugins/register/zentao/config.ts
+++ b/config-ui/src/plugins/register/zentao/config.ts
@@ -34,7 +34,7 @@ export const ZenTaoConfig: PluginConfigType = {
'name',
{
key: 'endpoint',
- subLabel: 'Provide the Zentao instance API endpoint (Opensource v16+). E.g. http://<host>:<port>/api.php/v1',
+ subLabel: 'Provide the Zentao instance API endpoint (Opensource v16+). E.g. http://<host>:<port>/api.php/v1 or http://<host>:<port>/zentao/api.php/v1',
},
'username',
'password',