Skip to content

Commit

Permalink
Merge pull request #144 from amazeeio/production-env
Browse files Browse the repository at this point in the history
Add production env to list projects
  • Loading branch information
shreddedbacon authored Jul 13, 2020
2 parents 80b2e39 + a2255bd commit 1857007
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
)

var deleteCmd = &cobra.Command{
Use: "delete",
Use: "delete",
Aliases: []string{"del"},
Short: "Delete a project, or delete notifications and variables from projects or environments",
Short: "Delete a project, or delete notifications and variables from projects or environments",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
validateToken(viper.GetString("current")) // get a new token if the current one is invalid
},
Expand Down
1 change: 1 addition & 0 deletions pkg/graphql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ var AllProjectsFragment = `fragment Project on Project {
gitUrl
name,
developmentEnvironmentsLimit,
productionEnvironment,
environments {
environmentType,
route
Expand Down
3 changes: 2 additions & 1 deletion pkg/lagoon/projects/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func processAllProjects(allProjects []byte) ([]byte, error) {
data = append(data, projectData)
}
dataMain := output.Table{
Header: []string{"ID", "ProjectName", "GitURL", "DevEnvironments"},
Header: []string{"ID", "ProjectName", "GitURL", "ProductionEnvironment", "DevEnvironments"},
Data: data,
}
return json.Marshal(dataMain)
Expand All @@ -104,6 +104,7 @@ func processProject(project api.Project) []string {
fmt.Sprintf("%v", project.ID),
fmt.Sprintf("%v", project.Name),
fmt.Sprintf("%v", project.GitURL),
fmt.Sprintf("%v", project.ProductionEnvironment),
fmt.Sprintf("%v/%v", currentDevEnvironments, project.DevelopmentEnvironmentsLimit),
}
return data
Expand Down
2 changes: 1 addition & 1 deletion pkg/lagoon/projects/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestAllProjects(t *testing.T) {
"gitUrl":"test","id":18,"name":"high-cotton"},
{"developmentEnvironmentsLimit":5,"environments":[],"gitUrl":"ssh://[email protected]:2222/git/api.git","id":21,"name":"ci-api"}
]`
var allProjectsSuccess = `{"header":["ID","ProjectName","GitURL","DevEnvironments"],"data":[["1","credentialstest-project1","ssh://[email protected]:2222/git/project1.git","0/5"],["2","credentialstest-project2","ssh://[email protected]:2222/git/project2.git","0/5"],["3","ci-github","ssh://[email protected]:2222/git/github.git","0/5"],["4","ci-gitlab","ssh://[email protected]:2222/git/gitlab.git","0/5"],["11","ci-nginx","ssh://[email protected]:2222/git/nginx.git","0/5"],["12","ci-features","ssh://[email protected]:2222/git/features.git","0/5"],["13","lagoon","[email protected]:amazeeio/lagoon.git","0/5"],["17","ci-features-subfolder","ssh://[email protected]:2222/git/features-subfolder.git","0/5"],["18","high-cotton","test","4/5"],["21","ci-api","ssh://[email protected]:2222/git/api.git","0/5"]]}`
var allProjectsSuccess = `{"header":["ID","ProjectName","GitURL","ProductionEnvironment","DevEnvironments"],"data":[["1","credentialstest-project1","ssh://[email protected]:2222/git/project1.git","","0/5"],["2","credentialstest-project2","ssh://[email protected]:2222/git/project2.git","","0/5"],["3","ci-github","ssh://[email protected]:2222/git/github.git","","0/5"],["4","ci-gitlab","ssh://[email protected]:2222/git/gitlab.git","","0/5"],["11","ci-nginx","ssh://[email protected]:2222/git/nginx.git","","0/5"],["12","ci-features","ssh://[email protected]:2222/git/features.git","","0/5"],["13","lagoon","[email protected]:amazeeio/lagoon.git","","0/5"],["17","ci-features-subfolder","ssh://[email protected]:2222/git/features-subfolder.git","","0/5"],["18","high-cotton","test","","4/5"],["21","ci-api","ssh://[email protected]:2222/git/api.git","","0/5"]]}`

returnResult, err := processAllProjects([]byte(allProjects))
if err != nil {
Expand Down

0 comments on commit 1857007

Please sign in to comment.