diff --git a/chaoscenter/graphql/server/pkg/chaos_experiment/ops/service.go b/chaoscenter/graphql/server/pkg/chaos_experiment/ops/service.go index 8ace51f40b2..e8131a7d3ab 100644 --- a/chaoscenter/graphql/server/pkg/chaos_experiment/ops/service.go +++ b/chaoscenter/graphql/server/pkg/chaos_experiment/ops/service.go @@ -251,7 +251,9 @@ func (c *chaosExperimentService) ProcessExperimentUpdate(workflow *model.ChaosEx {"description", workflow.ExperimentDescription}, {"is_custom_experiment", workflow.IsCustomExperiment}, {"updated_at", time.Now().UnixMilli()}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }}, {"$push", bson.D{ {"revision", workflowRevision}, @@ -267,7 +269,9 @@ func (c *chaosExperimentService) ProcessExperimentUpdate(workflow *model.ChaosEx update = bson.D{ {"$set", bson.D{ {"updated_at", time.Now().UnixMilli()}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, {"revision.$.updated_at", time.Now().UnixMilli()}, {"revision.$.experiment_manifest", workflow.ExperimentManifest}, }}, @@ -313,7 +317,9 @@ func (c *chaosExperimentService) ProcessExperimentDelete(query bson.D, workflow update := bson.D{ {"$set", bson.D{ {"is_removed", true}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, {"updated_at", time.Now().UnixMilli()}, }}, } diff --git a/chaoscenter/graphql/server/pkg/chaos_experiment_run/handler/handler.go b/chaoscenter/graphql/server/pkg/chaos_experiment_run/handler/handler.go index cd8ccb07aaf..50a7bf3c916 100644 --- a/chaoscenter/graphql/server/pkg/chaos_experiment_run/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/chaos_experiment_run/handler/handler.go @@ -1225,7 +1225,9 @@ func (c *ChaosExperimentRunHandler) ChaosExperimentRunEvent(event model.Experime {"recent_experiment_run_details.notify_id", event.NotifyID}, } } - + updatedByModel := mongodb.UserDetailResponse{ + Username: string(updatedBy), + } update := bson.D{ { "$set", bson.D{ @@ -1235,7 +1237,7 @@ func (c *ChaosExperimentRunHandler) ChaosExperimentRunEvent(event model.Experime {"recent_experiment_run_details.$.probes", probes}, {"recent_experiment_run_details.$.resiliency_score", workflowRunMetrics.ResiliencyScore}, {"recent_experiment_run_details.$.updated_at", currentTime.UnixMilli()}, - {"recent_experiment_run_details.$.updated_by", string(updatedBy)}, + {"recent_experiment_run_details.$.updated_by", updatedByModel}, }, }, } diff --git a/chaoscenter/graphql/server/pkg/chaos_experiment_run/service.go b/chaoscenter/graphql/server/pkg/chaos_experiment_run/service.go index 5cb6976b003..cd4a72b4ca3 100644 --- a/chaoscenter/graphql/server/pkg/chaos_experiment_run/service.go +++ b/chaoscenter/graphql/server/pkg/chaos_experiment_run/service.go @@ -7,6 +7,8 @@ import ( "strings" "time" + "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb" + "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaos_infrastructure" dbChaosExperimentRun "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run" @@ -49,7 +51,9 @@ func (c *chaosExperimentRunService) ProcessExperimentRunDelete(ctx context.Conte {"$set", bson.D{ {"is_removed", experimentRun.IsRemoved}, {"updated_at", time.Now().UnixMilli()}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }}, } diff --git a/chaoscenter/graphql/server/pkg/chaos_infrastructure/service.go b/chaoscenter/graphql/server/pkg/chaos_infrastructure/service.go index 7441c7ce563..ff26764c161 100644 --- a/chaoscenter/graphql/server/pkg/chaos_infrastructure/service.go +++ b/chaoscenter/graphql/server/pkg/chaos_infrastructure/service.go @@ -215,7 +215,9 @@ func (in *infraService) DeleteInfra(ctx context.Context, projectID string, infra {"$set", bson.D{ {"is_removed", true}, {"updated_at", time.Now().UnixMilli()}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }}, } err = in.infraOperator.UpdateInfra(context.TODO(), query, update) diff --git a/chaoscenter/graphql/server/pkg/chaoshub/service.go b/chaoscenter/graphql/server/pkg/chaoshub/service.go index d26aeafbd15..62239175d8f 100644 --- a/chaoscenter/graphql/server/pkg/chaoshub/service.go +++ b/chaoscenter/graphql/server/pkg/chaoshub/service.go @@ -383,7 +383,9 @@ func (c *chaosHubService) UpdateChaosHub(ctx context.Context, chaosHub model.Upd {"ssh_private_key", chaosHub.SSHPrivateKey}, {"ssh_public_key", chaosHub.SSHPublicKey}, {"updated_at", time}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }, }, } @@ -419,7 +421,9 @@ func (c *chaosHubService) DeleteChaosHub(ctx context.Context, hubID string, proj {"$set", bson.D{ {"is_removed", true}, {"updated_at", time.Now().UnixMilli()}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }, }, } diff --git a/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go b/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go index 2aa9e5dc25e..61cdb9bb084 100644 --- a/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go +++ b/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go @@ -37,13 +37,13 @@ type Probes struct { } type ExecutionHistory struct { - ExperimentID string `bson:"experiment_id"` - ExperimentName string `bson:"experiment_name"` - UpdatedBy string `bson:"updated_by"` - ExecutionData string `bson:"execution_data"` - UpdatedAt int `bson:"updated_at"` - Probes []Probes `bson:"probes"` - Phase model.ExperimentRunStatus `bson:"phase"` + ExperimentID string `bson:"experiment_id"` + ExperimentName string `bson:"experiment_name"` + UpdatedBy mongodb.UserDetailResponse `bson:"updated_by"` + ExecutionData string `bson:"execution_data"` + UpdatedAt int `bson:"updated_at"` + Probes []Probes `bson:"probes"` + Phase model.ExperimentRunStatus `bson:"phase"` } type ProbeWithExecutionHistory struct { diff --git a/chaoscenter/graphql/server/pkg/environment/handler/handler.go b/chaoscenter/graphql/server/pkg/environment/handler/handler.go index 27d50ddc06b..3ae2ee9368f 100644 --- a/chaoscenter/graphql/server/pkg/environment/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/environment/handler/handler.go @@ -114,7 +114,9 @@ func (e *EnvironmentService) UpdateEnvironment(ctx context.Context, projectID st updateQuery = append(updateQuery, bson.E{ Key: "$set", Value: bson.D{ {"updated_at", time.Now().UnixMilli()}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }, }) if request.Name != nil { @@ -176,7 +178,9 @@ func (e *EnvironmentService) DeleteEnvironment(ctx context.Context, projectID st {"$set", bson.D{ {"is_removed", true}, {"updated_at", currTime}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }}, } err = e.EnvironmentOperator.UpdateEnvironment(context.TODO(), query, update) diff --git a/chaoscenter/graphql/server/pkg/probe/respository.go b/chaoscenter/graphql/server/pkg/probe/respository.go index 1a149269464..bce537605d4 100644 --- a/chaoscenter/graphql/server/pkg/probe/respository.go +++ b/chaoscenter/graphql/server/pkg/probe/respository.go @@ -741,7 +741,9 @@ func (p *probe) DeleteProbe(ctx context.Context, probeName string) (bool, error) {"$set", bson.D{ {"is_removed", true}, {"updated_at", Time}, - {"updated_by", username}, + {"updated_by", mongodb.UserDetailResponse{ + Username: username, + }}, }}, } @@ -884,7 +886,7 @@ func (p *probe) GetProbeReference(ctx context.Context, probeName string) (*model ExperimentName: runs.ExperimentName, UpdatedAt: runs.UpdatedAt, UpdatedBy: &model.UserDetails{ - Username: runs.UpdatedBy, + Username: runs.UpdatedBy.Username, }, }, }) diff --git a/chaoscenter/web/src/views/Gitops/Gitops.tsx b/chaoscenter/web/src/views/Gitops/Gitops.tsx index 928d9f0a4b7..7be5be1f010 100644 --- a/chaoscenter/web/src/views/Gitops/Gitops.tsx +++ b/chaoscenter/web/src/views/Gitops/Gitops.tsx @@ -132,7 +132,7 @@ export default function GitopsView({ return ( + +