diff --git a/sqle/api/controller/v1/pipeline.go b/sqle/api/controller/v1/pipeline.go index 5cb554835..7a026811a 100644 --- a/sqle/api/controller/v1/pipeline.go +++ b/sqle/api/controller/v1/pipeline.go @@ -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() } @@ -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{ diff --git a/sqle/server/pipeline/pipeline.go b/sqle/server/pipeline/pipeline.go index c5814ba2a..bec68bf66 100644 --- a/sqle/server/pipeline/pipeline.go +++ b/sqle/server/pipeline/pipeline.go @@ -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 { @@ -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 }