新增:分支列表分支查询以及排序等

This commit is contained in:
yystopf 2024-04-18 16:14:39 +08:00
parent 6f458e0e79
commit 565c1c1cab
3 changed files with 4 additions and 2 deletions

View File

@ -52,7 +52,8 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
def branches
return render_error("请输入正确的同步项目ID") unless params[:sync_repository_ids].present?
@sync_repository_branches = SyncRepositoryBranch.where(sync_repository_id: params[:sync_repository_ids].split(","))
@sync_repository_branches = SyncRepositoryBranch.where(sync_repository_id: params[:sync_repository_ids].split(",")).order(updated_at: :desc)
@sync_repository_branches = @sync_repository_branches.ransack(gitlink_branch_name_or_external_branch_name_cont: params[:branch_name]).result if params[:branch_name].present?
@group_sync_repository_branch = @sync_repository_branches.group(:gitlink_branch_name, :external_branch_name).count
end

View File

@ -348,7 +348,7 @@ class ApplicationController < ActionController::Base
User.current = User.find 8686
elsif params[:debug] == 'admin'
logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....."
user = User.find 36480
user = User.find 102
User.current = user
cookies.signed[:user_id] = user.id
end

View File

@ -4,6 +4,7 @@ json.sync_repository_branches @group_sync_repository_branch.each do |key|
json.external_branch_name key[0][1]
branches = @sync_repository_branches.where(gitlink_branch_name: key[0][0], external_branch_name: key[0][1]).order(updated_at: :desc)
branch = branches.first
json.type branch&.sync_repository&.type
json.sync_time branch.sync_time
json.sync_status branch.sync_status
json.enable branch.enable