Browse Source

新增:流水线列表搜索名称

pull/347/head
yystopf 1 year ago
parent
commit
98a2bc5b4a
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      app/controllers/api/v1/projects/actions/actions_controller.rb

+ 5
- 1
app/controllers/api/v1/projects/actions/actions_controller.rb View File

@@ -2,12 +2,16 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions


def new_index def new_index
@files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows") rescue [] @files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows") rescue []
@workflows = params[:workflows].split(",") if params[:workflows].present?
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid) @action_runs = Gitea::ActionRun.where(repo_id: @project.gpid)
@action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present? @action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present?
@action_runs = @action_runs.where(workflow_id: params[:workflow_ids].split(",")) if params[:workflow_ids].present?
@action_runs = @action_runs.where(workflows: @workflows) if params[:workflows].present?
group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count
@result = [] @result = []
@files.map{|i|i['name']}.each do |file| @files.map{|i|i['name']}.each do |file|
if @workflows.present?
next !@workflows.include?(file)
end
last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first
last_action_run_json = last_action_run.present? ? { last_action_run_json = last_action_run.present? ? {
id: last_action_run.id, id: last_action_run.id,


Loading…
Cancel
Save