From 44ef461b256ce0d88de235cd64ca0d26c6444437 Mon Sep 17 00:00:00 2001 From: erda-bot <81558540+erda-bot@users.noreply.github.com> Date: Fri, 26 Nov 2021 19:03:26 +0800 Subject: [PATCH] Fix auto test scene filetree edit scene (#3199) (#3200) Co-authored-by: shuofan --- .../auto-test-scenes/leftPage/fileFormModal/model.go | 2 ++ .../auto-test-scenes/leftPage/fileFormModal/render.go | 6 ++++-- .../fileConfig/scenesSetConfig/scenesStages/model.go | 1 + .../fileConfig/scenesSetConfig/scenesStages/operation.go | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/model.go b/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/model.go index 6fb49ce14b6..a5b0cc5d294 100644 --- a/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/model.go +++ b/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/model.go @@ -18,6 +18,7 @@ import ( "github.com/erda-project/erda-infra/providers/component-protocol/cptype" "github.com/erda-project/erda/apistructs" "github.com/erda-project/erda/bundle" + "github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/common/gshelper" autotestv2 "github.com/erda-project/erda/modules/dop/services/autotest_v2" "github.com/erda-project/erda/modules/openapi/component-protocol/components/base" ) @@ -30,6 +31,7 @@ type ComponentFileFormModal struct { Props Props `json:"props"` State State `json:"state"` Operations map[string]interface{} `json:"operations"` + gsHelper *gshelper.GSHelper } type State struct { diff --git a/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/render.go b/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/render.go index b8fd0567fb6..bc16dff5f01 100644 --- a/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/render.go +++ b/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileFormModal/render.go @@ -25,6 +25,7 @@ import ( "github.com/erda-project/erda-infra/providers/component-protocol/utils/cputil" "github.com/erda-project/erda/apistructs" "github.com/erda-project/erda/bundle" + "github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/common/gshelper" "github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/leftPage/fileTree" "github.com/erda-project/erda/modules/dop/component-protocol/types" autotestv2 "github.com/erda-project/erda/modules/dop/services/autotest_v2" @@ -40,6 +41,7 @@ func (a *ComponentFileFormModal) Render(ctx context.Context, c *cptype.Component a.bdl = ctx.Value(types.GlobalCtxKeyBundle).(*bundle.Bundle) a.sdk = cputil.SDK(ctx) a.atTestPlan = ctx.Value(types.AutoTestPlanService).(*autotestv2.Service) + a.gsHelper = gshelper.NewGSHelper(gs) err = a.unmarshal(c) if err != nil { return err @@ -357,7 +359,7 @@ func (a *ComponentFileFormModal) GetSceneSet() error { } func (a *ComponentFileFormModal) GetScene(inParams fileTree.InParams) error { - id := a.State.SceneId + id := a.gsHelper.GetFileTreeSceneID() req := apistructs.AutotestSceneRequest{ SceneID: id, } @@ -502,7 +504,7 @@ func (a *ComponentFileFormModal) UpdateSceneSet(inParams fileTree.InParams) erro func (a *ComponentFileFormModal) UpdateScene(inParams fileTree.InParams) error { formData := a.State.FormData - id := a.State.SceneId + id := a.gsHelper.GetFileTreeSceneID() req := apistructs.AutotestSceneSceneUpdateRequest{ Name: formData.Name, Description: formData.Description, diff --git a/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/model.go b/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/model.go index 264876640d9..b3e48d1b886 100644 --- a/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/model.go +++ b/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/model.go @@ -145,6 +145,7 @@ func (s *SceneStage) initFromProtocol(ctx context.Context, c *cptype.Component, s.State.Visible = false s.State.ActionType = "" s.State.IsAddParallel = false + s.State.IsClickFolderTableRow = false return nil } diff --git a/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/operation.go b/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/operation.go index 89e0485c68e..7259b30fc92 100644 --- a/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/operation.go +++ b/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStages/operation.go @@ -254,6 +254,7 @@ func RenderEdit(s *SceneStage) error { s.State.Visible = true s.State.SceneID = meta.ID s.State.SceneSetKey = s.gsHelper.GetGlobalSelectedSetID() + s.gsHelper.SetFileTreeSceneID(s.State.SceneID) return nil }