Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/andoriyaprashant/litmus i…
Browse files Browse the repository at this point in the history
…nto 1branch
  • Loading branch information
andoriyaprashant committed Jan 18, 2025
2 parents 8e1d3e9 + 220305e commit afc4314
Show file tree
Hide file tree
Showing 16 changed files with 10,680 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func GetProjectsByUserID(service services.ApplicationService) gin.HandlerFunc {
c.JSON(http.StatusOK, gin.H{
"message": "No projects found",
})
return
}
if err != nil {
log.Error(err)
Expand Down
12 changes: 6 additions & 6 deletions chaoscenter/graphql/server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/argoproj/argo-workflows/v3 v3.3.5
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/gin-gonic/gin v1.10.0
github.com/go-git/go-git/v5 v5.12.0
github.com/go-git/go-git/v5 v5.13.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
Expand All @@ -19,7 +19,7 @@ require (
github.com/mrz1836/go-sanitize v1.3.2
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.17.3
github.com/tidwall/sjson v1.2.5
github.com/vektah/gqlparser/v2 v2.5.16
Expand All @@ -37,7 +37,7 @@ require (
require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
Expand All @@ -46,14 +46,14 @@ require (
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-billy/v5 v5.6.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
Expand Down Expand Up @@ -87,7 +87,7 @@ require (
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/sosodev/duration v1.3.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
Expand Down
55 changes: 20 additions & 35 deletions chaoscenter/graphql/server/go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ func (c *ChaosExperimentHandler) StopExperimentRuns(ctx context.Context, project
if len(experimentRunsID) == 0 && experiment.CronSyntax == "" {
return false, fmt.Errorf("no running or timeout experiments found")
}
} else if experimentRunID != nil && *experimentRunID != "" {
} else if *experimentRunID != "" {
experimentRunsID = []string{*experimentRunID}
}

Expand Down
10 changes: 6 additions & 4 deletions chaoscenter/graphql/server/pkg/environment/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L
}

// Filtering based on given parameters
if request.Filter != nil {
if request != nil && request.Filter != nil {
// Filtering based on chaos_infra name
if request.Filter.Name != nil && *request.Filter.Name != "" {
matchInfraNameStage := bson.D{
Expand Down Expand Up @@ -280,7 +280,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L
var sortStage bson.D

switch {
case request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldTime:
case request != nil && request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldTime:
// Sorting based on created time
if request.Sort.Ascending != nil && *request.Sort.Ascending {
sortStage = bson.D{
Expand All @@ -295,7 +295,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L
}},
}
}
case request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldName:
case request != nil && request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldName:
// Sorting based on ExperimentName time
if request.Sort.Ascending != nil && *request.Sort.Ascending {
sortStage = bson.D{
Expand Down Expand Up @@ -324,7 +324,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L
sortStage,
}

if request.Pagination != nil {
if request != nil && request.Pagination != nil {
paginationSkipStage := bson.D{
{"$skip", request.Pagination.Page * request.Pagination.Limit},
}
Expand Down Expand Up @@ -353,6 +353,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L
pipeline = append(pipeline, facetStage)

cursor, err := e.EnvironmentOperator.GetAggregateEnvironments(pipeline)

if err != nil {
return nil, err
}
Expand All @@ -368,6 +369,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L
Environments: envs,
}, errors.New("error decoding environment cursor: " + err.Error())
}

if len(aggregatedEnvironments) == 0 {
return &model.ListEnvironmentResponse{
TotalNoOfEnvironments: 0,
Expand Down
3 changes: 1 addition & 2 deletions chaoscenter/graphql/server/pkg/gitops/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,11 @@ func (g *gitOpsService) updateExperiment(ctx context.Context, data, wfID, file s
}

revID := ""
updateRevision := false
input, wfType, err := g.chaosExperimentService.ProcessExperiment(ctx, &experimentData, config.ProjectID, revID)
if err != nil {
return err
}
return g.chaosExperimentService.ProcessExperimentUpdate(input, "git-ops", wfType, revID, updateRevision, config.ProjectID, dataStore.Store)
return g.chaosExperimentService.ProcessExperimentUpdate(input, "git-ops", wfType, revID, false, config.ProjectID, dataStore.Store)
}

// deleteExperiment helps in deleting experiment from DB during the SyncDBToGit operation
Expand Down
Loading

0 comments on commit afc4314

Please sign in to comment.