Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ unit-test: mock unit-test-only python-unit-test

unit-test-only:
set -e;\
exit_code=0;\
for m in $$(go list ./... | egrep -v 'test|models|e2e'); do \
echo $$m; go test -timeout 60s -v $$m || exit_code=$$?; \
echo $$m; \
if ! go test -timeout 60s -v $$m; then \
exit $$?; \
fi \
done; \
exit $$exit_code

build-pydevlake:
poetry install -C python/pydevlake
Expand Down
1 change: 1 addition & 0 deletions backend/core/plugin/plugin_scope_abstract.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Scope interface {

type ToolLayerScope interface {
Scope
ScopeFullName() string
ScopeParams() interface{}
}

Expand Down
11 changes: 7 additions & 4 deletions backend/helpers/pluginhelper/api/remote_api_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type RemoteScopesChild struct {
ParentId *string `json:"parentId"`
Id string `json:"id"`
Name string `json:"name"`
FullName string `json:"fullName"`
Data interface{} `json:"data"`
}

Expand Down Expand Up @@ -211,10 +212,11 @@ func (r *RemoteApiHelper[Conn, Scope, ApiScope, Group]) GetScopesFromRemote(inpu
for _, project := range resBody {
scope := project.ConvertApiScope()
child := RemoteScopesChild{
Type: TypeProject,
Id: scope.ScopeId(),
Name: scope.ScopeName(),
Data: &scope,
Type: TypeProject,
Id: scope.ScopeId(),
Name: scope.ScopeName(),
FullName: scope.ScopeFullName(),
Data: &scope,
}
child.ParentId = &gid
if *child.ParentId == "" {
Expand Down Expand Up @@ -307,6 +309,7 @@ func (r *RemoteApiHelper[Conn, Scope, ApiScope, Group]) SearchRemoteScopes(input
Id: scope.ScopeId(),
ParentId: nil,
Name: scope.ScopeName(),
FullName: scope.ScopeFullName(),
Data: scope,
}

Expand Down
8 changes: 8 additions & 0 deletions backend/helpers/pluginhelper/api/scope_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func (t TestFakeGitlabRepo) ScopeName() string {
return ""
}

func (t TestFakeGitlabRepo) ScopeFullName() string {
return ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return t.FullName?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter, beside, there is no such field in the test case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

}

func (t TestFakeGitlabRepo) TableName() string {
return ""
}
Expand Down Expand Up @@ -89,6 +93,10 @@ func (r TestFakeGithubRepo) ScopeName() string {
return r.Name
}

func (r TestFakeGithubRepo) ScopeFullName() string {
return r.Name
}

func (r TestFakeGithubRepo) ScopeParams() interface{} {
return nil
}
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/bamboo/models/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func (p BambooProject) ScopeName() string {
return p.Name
}

func (p BambooProject) ScopeFullName() string {
return p.Name
}

func (p BambooProject) ScopeParams() interface{} {
return &BambooApiParams{
ConnectionId: p.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/bitbucket/models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (p BitbucketRepo) ScopeName() string {
return p.Name
}

func (p BitbucketRepo) ScopeFullName() string {
return p.BitbucketId
}

func (p BitbucketRepo) ScopeParams() interface{} {
return &BitbucketApiParams{
ConnectionId: p.ConnectionId,
Expand Down
5 changes: 5 additions & 0 deletions backend/plugins/gitee/models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
package models

import (
"fmt"
"strconv"
"time"

Expand Down Expand Up @@ -51,6 +52,10 @@ func (r GiteeRepo) ScopeName() string {
return r.Name
}

func (r GiteeRepo) ScopeFullName() string {
return fmt.Sprintf("%v/%v", r.OwnerLogin, r.Name)
}

func (r GiteeRepo) ScopeParams() interface{} {
return &GiteeApiParams{
ConnectionId: r.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/github/models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func (r GithubRepo) ScopeName() string {
return r.Name
}

func (r GithubRepo) ScopeFullName() string {
return r.FullName
}

func (r GithubRepo) ScopeParams() interface{} {
return &GithubApiParams{
ConnectionId: r.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/gitlab/models/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func (p GitlabProject) ScopeName() string {
return p.Name
}

func (p GitlabProject) ScopeFullName() string {
return p.PathWithNamespace
}

func (p GitlabProject) ScopeParams() interface{} {
return &GitlabApiParams{
ConnectionId: p.ConnectionId,
Expand Down
3 changes: 3 additions & 0 deletions backend/plugins/jenkins/models/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func (j JenkinsJob) ScopeId() string {
func (j JenkinsJob) ScopeName() string {
return j.Name
}
func (j JenkinsJob) ScopeFullName() string {
return j.FullName
}

func (j JenkinsJob) ScopeParams() interface{} {
return &JenkinsApiParams{
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/jira/models/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func (b JiraBoard) ScopeName() string {
return b.Name
}

func (b JiraBoard) ScopeFullName() string {
return b.Name
}

func (b JiraBoard) ScopeParams() interface{} {
return &JiraApiParams{
ConnectionId: b.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/pagerduty/models/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (s Service) ScopeName() string {
return s.Name
}

func (s Service) ScopeFullName() string {
return s.Name
}

func (s Service) ScopeParams() interface{} {
return &PagerDutyParams{
ConnectionId: s.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/sonarqube/models/sonarqube_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (p SonarqubeProject) ScopeName() string {
return p.Name
}

func (p SonarqubeProject) ScopeFullName() string {
return p.Name
}

func (p SonarqubeProject) ScopeParams() interface{} {
return SonarqubeApiParams{
ConnectionId: p.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/tapd/models/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func (w TapdWorkspace) ScopeName() string {
return w.Name
}

func (w TapdWorkspace) ScopeFullName() string {
return w.Name
}

func (w TapdWorkspace) ScopeParams() interface{} {
return &TapdApiParams{
ConnectionId: w.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/trello/models/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func (b TrelloBoard) ScopeName() string {
return b.Name
}

func (b TrelloBoard) ScopeFullName() string {
return b.Name
}

func (b TrelloBoard) ScopeParams() interface{} {
return &TrelloApiParams{
ConnectionId: b.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/plugins/zentao/models/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ func (p ZentaoProject) ScopeName() string {
return p.Name
}

func (p ZentaoProject) ScopeFullName() string {
return p.Name
}

func (p ZentaoProject) ScopeParams() interface{} {
return &ZentaoApiParams{
ConnectionId: p.ConnectionId,
Expand Down
4 changes: 4 additions & 0 deletions backend/server/services/remote/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ func (d DynamicScopeModel) ScopeName() string {
return reflect.ValueOf(d.DynamicTabler.Unwrap()).Elem().FieldByName("Name").String()
}

func (d DynamicScopeModel) ScopeFullName() string {
return d.ScopeName()
}

func (d DynamicScopeModel) ScopeParams() interface{} {
return &ApiParams{
ConnectionId: d.ConnectionId(),
Expand Down