流水线启用状态,流水线设计时 id
This commit is contained in:
parent
f8f525bf91
commit
f738dbed24
|
@ -4,6 +4,8 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
|||
@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)
|
||||
disabled_config = Gitea::RepoUnit.where(repo_id: @project.gpid, type: 10)&.first&.config
|
||||
disabled_workflows = disabled_config.present? ? JSON.parse(disabled_config)["DisabledWorkflows"] : []
|
||||
@action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present?
|
||||
@action_runs = @action_runs.where(workflow_id: @workflows) if params[:workflows].present?
|
||||
group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count
|
||||
|
@ -14,6 +16,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
|||
end
|
||||
last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first
|
||||
last_action_run_json = last_action_run.present? ? {
|
||||
pipeline_id: Action::Pipeline.find_by(pipeline_name: file, project_id: @project.id),
|
||||
id: last_action_run.id,
|
||||
schedule: last_action_run.schedule_id > 0,
|
||||
title: last_action_run.title,
|
||||
|
@ -47,6 +50,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
|||
end
|
||||
@result << {
|
||||
filename: file,
|
||||
disabled: disabled_workflows.include?(file.to_s),
|
||||
name: file.to_s.gsub(".yml","").gsub(".yaml","") ,
|
||||
branch: last_action_run.present? ? last_action_run.ref.gsub("refs/heads/","") : @project.default_branch,
|
||||
pipeline_type: pipeline_type,
|
||||
|
|
|
@ -35,7 +35,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
|||
end
|
||||
|
||||
def save_yaml
|
||||
@pipeline = Action::Pipeline.new(pipeline_name: params[:pipeline_name], project_id: @project.id)
|
||||
@pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: params[:pipeline_name], project_id: @project.id)
|
||||
@pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml"
|
||||
@pipeline.branch = params[:branch] || @project.default_branch
|
||||
@pipeline.json = params[:pipeline_json].to_json
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class Gitea::RepoUnit < Gitea::Base
|
||||
self.inheritance_column = nil # FIX The single-table inheritance mechanism failed
|
||||
# establish_connection :gitea_db
|
||||
|
||||
self.table_name = "repo_unit"
|
||||
|
||||
# belongs_to :user, class_name: '::User', primary_key: :gitea_uid, foreign_key: :owner_id, optional: true
|
||||
|
||||
end
|
Loading…
Reference in New Issue