fixed 节点名称带上id,方便运行中状态读取,节点读取错误
This commit is contained in:
		
							parent
							
								
									46796095cf
								
							
						
					
					
						commit
						2792c172d5
					
				| 
						 | 
					@ -102,13 +102,12 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
 | 
				
			||||||
      node = Action::Node.find_by(name: job["data"]["name"])
 | 
					      node = Action::Node.find_by(name: job["data"]["name"])
 | 
				
			||||||
      next if node.blank?
 | 
					      next if node.blank?
 | 
				
			||||||
      node.label = job["data"]["label"] if job["data"]["label"].present?
 | 
					      node.label = job["data"]["label"] if job["data"]["label"].present?
 | 
				
			||||||
      node.node_id = job["data"]["id"] if job["data"]["id"].present?
 | 
					      node.node_id = job["id"] if job["id"].present?
 | 
				
			||||||
      next_edge_nodes = JSON.parse(demo2.to_json)["edges"].select { |edge| edge["source"]["cell"].include?(job["id"]) }
 | 
					      next_edge_nodes = JSON.parse(demo2.to_json)["edges"].select { |edge| edge["source"]["cell"].include?(job["id"]) }
 | 
				
			||||||
      node_ids = next_edge_nodes.map { |t| t["target"]["cell"] }
 | 
					      node_ids = next_edge_nodes.map { |t| t["target"]["cell"] }
 | 
				
			||||||
      next_step_node = JSON.parse(demo2.to_json)["nodes"].select { |node| node_ids.include?(node["data"]["id"]) && !node["data"]["name"].to_s.include?("job") }&.first
 | 
					      next_step_node = JSON.parse(demo2.to_json)["nodes"].select { |node| node_ids.include?(node["id"]) && !node["data"]["name"].to_s.include?("job") }&.first
 | 
				
			||||||
      node.sub_nodes = []
 | 
					      node.sub_nodes = []
 | 
				
			||||||
      get_all_child_nodes(node, next_step_node) if next_step_node.present?
 | 
					      get_all_child_nodes(node, next_step_node) if next_step_node.present?
 | 
				
			||||||
      Rails.logger.info "node.sub_nodes=========================#{node.sub_nodes}"
 | 
					 | 
				
			||||||
      @job_nodes.push(node)
 | 
					      @job_nodes.push(node)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    yaml = ERB.new(File.read(File.join(Rails.root, "app/views/api/v1/projects/pipelines", "build_pipeline.yaml.erb"))).result(binding)
 | 
					    yaml = ERB.new(File.read(File.join(Rails.root, "app/views/api/v1/projects/pipelines", "build_pipeline.yaml.erb"))).result(binding)
 | 
				
			||||||
| 
						 | 
					@ -152,7 +151,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
 | 
				
			||||||
      node = Action::Node.find_by(name: input_node["data"]["name"])
 | 
					      node = Action::Node.find_by(name: input_node["data"]["name"])
 | 
				
			||||||
      next if node.blank?
 | 
					      next if node.blank?
 | 
				
			||||||
      node.label = input_node["data"]["label"] if input_node["data"]["label"].present?
 | 
					      node.label = input_node["data"]["label"] if input_node["data"]["label"].present?
 | 
				
			||||||
      node.node_id = input_node["data"]["id"] if input_node["data"]["id"].present?
 | 
					      node.node_id = input_node["id"] if input_node["id"].present?
 | 
				
			||||||
      run_values = {}
 | 
					      run_values = {}
 | 
				
			||||||
      input_values = {}
 | 
					      input_values = {}
 | 
				
			||||||
      if input_node["data"]["inputs"].present?
 | 
					      if input_node["data"]["inputs"].present?
 | 
				
			||||||
| 
						 | 
					@ -185,7 +184,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
 | 
				
			||||||
    node = Action::Node.find_by(name: input_node["data"]["name"])
 | 
					    node = Action::Node.find_by(name: input_node["data"]["name"])
 | 
				
			||||||
    return nil if node.blank?
 | 
					    return nil if node.blank?
 | 
				
			||||||
    node.label = input_node["data"]["label"] if input_node["data"]["label"].present?
 | 
					    node.label = input_node["data"]["label"] if input_node["data"]["label"].present?
 | 
				
			||||||
    node.node_id = input_node["data"]["id"] if input_node["data"]["id"].present?
 | 
					    node.node_id = input_node["id"] if input_node["id"].present?
 | 
				
			||||||
    run_values = {}
 | 
					    run_values = {}
 | 
				
			||||||
    input_values = {}
 | 
					    input_values = {}
 | 
				
			||||||
    if input_node["data"]["inputs"].present?
 | 
					    if input_node["data"]["inputs"].present?
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue