fixed reposyncer jobs 分组

This commit is contained in:
“xxq250” 2022-08-04 17:02:25 +08:00
parent 4fb2003f64
commit 72a4549fe9
2 changed files with 8 additions and 2 deletions

View File

@ -44,7 +44,13 @@ class ObRepositorySyncsController < ApplicationController
tip_exception "该项目未创建同步任务" if @ob_repository_sync.blank?
service = ObRepositorySync::ApiService.new(@ob_repository_sync.name)
res = service.get_projects_jobs
render_ok(count: res["data"]["total"], data: res["data"]["list"])
data = res["data"]["list"]
if params[:type] && params[:type].to_s.downcase == "github"
data = data.select { |row| row["github_branch"].present? }
elsif params[:type] && params[:type].to_s.downcase == "gitee"
data = data.select { |row| row["gitee_branch"].present? }
end
render_ok(count: res["data"]["total"], data: data)
end
def create_jobs

View File

@ -43,7 +43,7 @@ class ObRepositorySync::ApiService < ApplicationService
end
def get_projects_jobs
url = URI("#{domain}/cerobot/projects/#{@project_name}/jobs")
url = URI("#{domain}/cerobot/projects/#{@project_name}/jobs?pageSize=100&pageNum=1")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"