Skip to content

Commit ec9b67f

Browse files
committed
Add refer sceneset
1 parent 7956c61 commit ec9b67f

File tree

6 files changed

+77
-4
lines changed

6 files changed

+77
-4
lines changed

conf/dop/dop.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,4 @@ component-protocol.components.auto-test-scenes.scenesStages:
278278
component-protocol.components.auto-test-scenes.scenesStagesOperations:
279279
component-protocol.components.auto-test-scenes.addScenesButton:
280280
component-protocol.components.auto-test-scenes.exportScenesButton:
281-
281+
component-protocol.components.auto-test-scenes.referSceneSetButton:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) 2021 Terminus, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package referSceneSetButton
16+
17+
import (
18+
"context"
19+
20+
"github.com/erda-project/erda-infra/base/servicehub"
21+
"github.com/erda-project/erda-infra/providers/component-protocol/cptype"
22+
"github.com/erda-project/erda/apistructs"
23+
"github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/common/gshelper"
24+
"github.com/erda-project/erda/modules/openapi/component-protocol/components/base"
25+
)
26+
27+
func init() {
28+
base.InitProviderWithCreator("auto-test-scenes", "referSceneSetButton", func() servicehub.Provider {
29+
return &ComponentAction{}
30+
})
31+
}
32+
33+
type ComponentAction struct {
34+
base.DefaultProvider
35+
}
36+
37+
func (ca *ComponentAction) Render(ctx context.Context, c *cptype.Component, scenario cptype.Scenario, event cptype.ComponentEvent, gs *cptype.GlobalStateData) error {
38+
h := gshelper.NewGSHelper(gs)
39+
switch event.Operation {
40+
case cptype.OperationKey(apistructs.RefSceneSetOperationKey):
41+
c.State = map[string]interface{}{
42+
"actionType": "addRefSceneSet",
43+
"visible": true,
44+
"sceneSetKey": h.GetGlobalSelectedSetID(),
45+
}
46+
case cptype.InitializeOperation, cptype.RenderingOperation:
47+
c.Type = "Button"
48+
c.Props = map[string]interface{}{
49+
"text": "引用场景集",
50+
}
51+
c.Operations = map[string]interface{}{
52+
"click": map[string]interface{}{
53+
"key": apistructs.RefSceneSetOperationKey.String(),
54+
"reload": true,
55+
},
56+
}
57+
}
58+
return nil
59+
}

modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/tabExecuteButton/executeButton.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func (a *ComponentAction) handleClick(event cptype.ComponentEvent, gs *cptype.Gl
354354
req.ClusterName = metaData.Env
355355
req.ConfigManageNamespaces = metaData.ConfigEnv
356356
req.UserID = a.sdk.Identity.UserID
357-
pipeline, err := a.AutoTestSvc.ExecuteDiceAutotestSceneSet(req)
357+
pipeline, err := a.AutoTestSvc.ExecuteAutotestSceneSet(req)
358358
if err != nil {
359359
(*gs)[protocol.GlobalInnerKeyError.String()] = err.Error()
360360
} else {

modules/dop/component-protocol/components/auto-test-scenes/scenario.go

+1
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,6 @@ import (
9595
_ "github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileExecute/resultDrawer/resultPreview"
9696

9797
// button
98+
_ "github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/fileConfig/scenesSetConfig/scenesStagesOperations/referSceneSetButton"
9899
_ "github.com/erda-project/erda/modules/dop/component-protocol/components/auto-test-scenes/rightPage/fileDetail/tabExecuteButton"
99100
)

modules/dop/component-protocol/scenarios/auto-test-scenes.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ hierarchy:
5050
scenesStagesOperations:
5151
- addScenesButton
5252
- exportScenesButton
53+
- referSceneSetButton
5354
fileInfoHead:
5455
left: fileInfoTitle
5556
# right: fileHistory
@@ -332,6 +333,9 @@ components:
332333
type: Button
333334
exportScenesButton:
334335
type: Button
336+
referSceneSetButton:
337+
type: Button
338+
335339
rendering:
336340
# 前端触发组件
337341
# 先渲染前端触发组件,再渲染关联组件
@@ -660,4 +664,13 @@ rendering:
660664
- name: "visible"
661665
value: "{{ addScenesButton.visible }}"
662666
- name: "sceneSetKey"
663-
value: "{{ addScenesButton.sceneSetKey }}"
667+
value: "{{ addScenesButton.sceneSetKey }}"
668+
referSceneSetButton:
669+
- name: fileFormModal
670+
state:
671+
- name: "actionType"
672+
value: "{{ referSceneSetButton.actionType }}"
673+
- name: "visible"
674+
value: "{{ referSceneSetButton.visible }}"
675+
- name: "sceneSetKey"
676+
value: "{{ referSceneSetButton.sceneSetKey }}"

modules/dop/services/autotest_v2/sceneset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func mapping(s *dao.SceneSet) *apistructs.SceneSet {
130130
}
131131
}
132132

133-
func (svc *Service) ExecuteDiceAutotestSceneSet(req apistructs.AutotestExecuteSceneSetRequest) (*apistructs.PipelineDTO, error) {
133+
func (svc *Service) ExecuteAutotestSceneSet(req apistructs.AutotestExecuteSceneSetRequest) (*apistructs.PipelineDTO, error) {
134134
var spec pipelineyml.Spec
135135
spec.Version = "1.1"
136136
var stagesValue []*pipelineyml.Stage

0 commit comments

Comments
 (0)