Skip to content

Commit 412ec50

Browse files
Merge pull request #68 from mihaichitic/ND-7534
[ND-7534] - envs & components list filter by git info
2 parents 46b05fa + 7c6e3a3 commit 412ec50

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
# other
88
.DS_Store
99
.vscode
10+
/.idea
1011
__debug_bin
12+
/.dev

cmd/template/validate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ func getSource(validateSource ValidateSource, validateOptions template.ValidateO
169169

170170
if validateOptions.WithComponents {
171171
source.SetValidateComponents(true)
172+
source.SetValidateForOrganizationId(validateOptions.Organization)
172173
}
173174

174175
action := sdk.ValidateSourceStringAsTemplateValidateActionSource(source)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ toolchain go1.23.2
77
replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16
88

99
require (
10-
bunnyshell.com/dev v0.7.0
11-
bunnyshell.com/sdk v0.20.0
10+
bunnyshell.com/dev v0.7.1
11+
bunnyshell.com/sdk v0.20.1
1212
github.com/AlecAivazis/survey/v2 v2.3.7
1313
github.com/MakeNowJust/heredoc v1.0.0
1414
github.com/avast/retry-go/v4 v4.6.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
bunnyshell.com/dev v0.7.0 h1:O66E0uTWSjx5ARI4Gyb19hmk9NX4uhFoyEP/nm/8kHY=
2-
bunnyshell.com/dev v0.7.0/go.mod h1:+Xk46UXX9AW0nHrFMdO/IwpUPfALrck1/qI+LIXsDmE=
3-
bunnyshell.com/sdk v0.20.0 h1:xcoDn0x1JqexMy5vYGqTBK4DGdY3juc+5DU7vb1yFeA=
4-
bunnyshell.com/sdk v0.20.0/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138=
1+
bunnyshell.com/dev v0.7.1 h1:mNLF0h2bbrTi9LNr2e2zFUC2fGg8TUh/9SM5rTXkzDI=
2+
bunnyshell.com/dev v0.7.1/go.mod h1:+Xk46UXX9AW0nHrFMdO/IwpUPfALrck1/qI+LIXsDmE=
3+
bunnyshell.com/sdk v0.20.1 h1:YxmYrW8UXGNNtLe+l6pXFKyndgwyEyQtdX0f5rHV1fE=
4+
bunnyshell.com/sdk v0.20.1/go.mod h1:RfgfUzZ4WHZGCkToUfu2/hoQS6XsQc8IdPTVAlpS138=
55
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
66
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
77
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=

pkg/api/component/list.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ type ListOptions struct {
2020
Name string
2121
ClusterStatus string
2222
OperationStatus string
23+
24+
GitRepository string
25+
GitBranch string
2326
}
2427

2528
func NewListOptions() *ListOptions {
@@ -32,6 +35,8 @@ func (lo *ListOptions) UpdateFlagSet(flags *pflag.FlagSet) {
3235
flags.StringVar(&lo.ClusterStatus, "clusterStatus", lo.ClusterStatus, "Filter by Cluster Status")
3336
flags.StringVar(&lo.OperationStatus, "operationStatus", lo.OperationStatus, "Filter by Operation Status")
3437
flags.StringVar(&lo.Name, "componentName", lo.OperationStatus, "Filter by Name")
38+
flags.StringVar(&lo.GitRepository, "gitRepo", lo.GitRepository, "Filter by Git Repository")
39+
flags.StringVar(&lo.GitBranch, "gitBranch", lo.GitBranch, "Filter by Git Branch")
3540

3641
lo.ListOptions.UpdateFlagSet(flags)
3742
}
@@ -89,5 +94,13 @@ func applyOptions(request sdk.ApiComponentListRequest, options *ListOptions) sdk
8994
request = request.Name(options.Name)
9095
}
9196

97+
if options.GitRepository != "" {
98+
request = request.GitRepository(options.GitRepository)
99+
}
100+
101+
if options.GitBranch != "" {
102+
request = request.GitBranch(options.GitBranch)
103+
}
104+
92105
return request
93106
}

pkg/api/environment/list.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ type ListOptions struct {
2121
ClusterStatus string
2222
OperationStatus string
2323

24+
ComponentGitRepository string
25+
ComponentGitBranch string
26+
2427
Search string
2528

2629
Labels map[string]string
@@ -38,6 +41,8 @@ func (lo *ListOptions) UpdateFlagSet(flags *pflag.FlagSet) {
3841
flags.StringVar(&lo.OperationStatus, "operationStatus", lo.OperationStatus, "Filter by Operation Status")
3942
flags.StringVar(&lo.KubernetesIntegration, "k8sCluster", lo.KubernetesIntegration, "Filter by K8SIntegrationID")
4043
flags.StringVar(&lo.Search, "search", lo.Search, "Search by name")
44+
flags.StringVar(&lo.ComponentGitRepository, "componentGitRepo", lo.ComponentGitRepository, "Filter by Component Git Repository")
45+
flags.StringVar(&lo.ComponentGitBranch, "componentGitBranch", lo.ComponentGitBranch, "Filter by Component Git Branch")
4146

4247
flags.StringToStringVar(&lo.Labels, "label", lo.Labels, "Filter by label (key=value)")
4348

@@ -101,6 +106,14 @@ func applyOptions(request sdk.ApiEnvironmentListRequest, options *ListOptions) s
101106
request = request.Type_(options.Type)
102107
}
103108

109+
if options.ComponentGitRepository != "" {
110+
request = request.ComponentGitRepository(options.ComponentGitRepository)
111+
}
112+
113+
if options.ComponentGitBranch != "" {
114+
request = request.ComponentGitBranch(options.ComponentGitBranch)
115+
}
116+
104117
if len(options.Labels) > 0 {
105118
request = request.Labels(options.Labels)
106119
}

0 commit comments

Comments
 (0)