fixed 组织流水线按仓库分页
This commit is contained in:
		
							parent
							
								
									9c593b1271
								
							
						
					
					
						commit
						b4da913f2b
					
				| 
						 | 
					@ -67,7 +67,8 @@ class Api::Pm::PipelinesController < Api::Pm::BaseController
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    # Rails.logger.info("@run_result======#{@run_result}")
 | 
					    # Rails.logger.info("@run_result======#{@run_result}")
 | 
				
			||||||
    @disabled_workflows = Gitea::RepoUnit.where(repo_id: project_gpids, type: 10).where("config is not null")
 | 
					    @disabled_workflows = Gitea::RepoUnit.where(repo_id: project_gpids, type: 10).where("config is not null")
 | 
				
			||||||
    @pipelines = Action::Pipeline.where(project_id: @project_ids).order(updated_at: :desc)
 | 
					    @pipelines = Action::Pipeline.select("distinct project_id,max(updated_at) as updated_at")
 | 
				
			||||||
 | 
					                                 .where(project_id: @project_ids).group(:project_id).order(updated_at: :desc)
 | 
				
			||||||
    @pipelines =  @pipelines.where("pipeline_name like ?", "%#{params[:pipeline_name]}%") if params[:pipeline_name].present?
 | 
					    @pipelines =  @pipelines.where("pipeline_name like ?", "%#{params[:pipeline_name]}%") if params[:pipeline_name].present?
 | 
				
			||||||
    @pipelines =  @pipelines.where(pipeline_type: params[:pipeline_type]) if params[:pipeline_type].present?
 | 
					    @pipelines =  @pipelines.where(pipeline_type: params[:pipeline_type]) if params[:pipeline_type].present?
 | 
				
			||||||
    @pipelines = kaminari_paginate(@pipelines)
 | 
					    @pipelines = kaminari_paginate(@pipelines)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,8 @@ json.projects @pipelines.map(&:project_id).uniq.each do |project_id|
 | 
				
			||||||
    json.identifier project.identifier
 | 
					    json.identifier project.identifier
 | 
				
			||||||
    json.name project.name
 | 
					    json.name project.name
 | 
				
			||||||
    json.url "#{Rails.application.config_for(:configuration)['platform_url']}/#{project.owner.name}/#{project.identifier}"
 | 
					    json.url "#{Rails.application.config_for(:configuration)['platform_url']}/#{project.owner.name}/#{project.identifier}"
 | 
				
			||||||
    json.pipelines @pipelines.select { |p| p.project_id == project_id }.each do |pipeline|
 | 
					    json.pipelines @pipelines.select { |p| p.project_id == project_id }.each do |id|
 | 
				
			||||||
 | 
					      pipeline = Action::Pipeline.find_by(id: id)
 | 
				
			||||||
      json.extract! pipeline, :id, :project_id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design,
 | 
					      json.extract! pipeline, :id, :project_id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design,
 | 
				
			||||||
                    :repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at
 | 
					                    :repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at
 | 
				
			||||||
      repo_config = @disabled_workflows.select { |config| config.repo_id = pipeline.project.gpid }
 | 
					      repo_config = @disabled_workflows.select { |config| config.repo_id = pipeline.project.gpid }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue