Skip to content

Commit

Permalink
Merge pull request #2600 from actiontech/add-project-name
Browse files Browse the repository at this point in the history
pipelione: add project name as a part of command
  • Loading branch information
ColdWaterLW authored Sep 12, 2024
2 parents 141b8a1 + d6c4323 commit 7386b1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions sqle/api/controller/v1/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ type pipelineNodeDetail struct {
pipelineNodeBase
}

func (p *pipelineNodeDetail) fillWith(ctx context.Context, node *pipeline.PipelineNode) {
func (p *pipelineNodeDetail) fillWith(ctx context.Context, node *pipeline.PipelineNode, projectName string) {
if node == nil {
return
}
integrationInfo, err := node.IntegrationInfo(ctx)
integrationInfo, err := node.IntegrationInfo(ctx, projectName)
if err != nil {
integrationInfo = err.Error()
}
Expand Down Expand Up @@ -269,7 +269,7 @@ func GetPipelineDetail(c echo.Context) error {
pipelineDetail.fillWith(pipe)
nodeDetails := make([]pipelineNodeDetail, len(pipe.PipelineNodes))
for i, node := range pipe.PipelineNodes {
nodeDetails[i].fillWith(c.Request().Context(), node)
nodeDetails[i].fillWith(c.Request().Context(), node, c.Param("project_name"))
}

return c.JSON(http.StatusOK, &GetPipelineDetailResV1{
Expand Down
22 changes: 13 additions & 9 deletions sqle/server/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (pipe Pipeline) NodeCount() uint32 {
return uint32(len(pipe.PipelineNodes))
}

func (node PipelineNode) IntegrationInfo(ctx context.Context) (string, error) {
func (node PipelineNode) IntegrationInfo(ctx context.Context, projectName string) (string, error) {
dmsAddr := controller.GetDMSServerAddress()
parsedURL, err := url.Parse(dmsAddr)
if err != nil {
Expand Down Expand Up @@ -66,14 +66,18 @@ func (node PipelineNode) IntegrationInfo(ctx context.Context) (string, error) {
if err != nil {
return "", err
}
cmd, err = sqlfile.GenCommand("./scannerd", map[string]string{
scannerCmd.FlagHost: ip,
scannerCmd.FlagPort: port,
scannerCmd.FlagToken: node.Token,
scannerCmd.FlagDirectory: node.ObjectPath,
scannerCmd.FlagDbType: node.InstanceType,
scannerCmd.FlagInstanceName: node.InstanceName,
})
params := map[string]string{
scannerCmd.FlagHost: ip,
scannerCmd.FlagPort: port,
scannerCmd.FlagToken: node.Token,
scannerCmd.FlagDirectory: node.ObjectPath,
scannerCmd.FlagDbType: node.InstanceType,
scannerCmd.FlagProject: projectName,
}
if node.InstanceName != "" {
params[scannerCmd.FlagInstanceName] = node.InstanceName
}
cmd, err = sqlfile.GenCommand("./scannerd", params)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 7386b1d

Please sign in to comment.