forgeplus/app/views/api/v1/projects/actions/runs/index.json.jbuilder

29 lines
991 B
Ruby

if @has_file
json.total_data @result_object[:total_data].to_i
if @result_object[:data]["Runs"].present?
json.runs @result_object[:data]["Runs"].each_with_index.to_a do |run, index|
json.num @result_object[:total_data].to_i - @begin_num - index
json.workflow run["WorkflowID"]
json.index run["Index"]
json.title run["Title"]
json.trigger_user do
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(run['TriggerUser']), name: run['TriggerUser']['Name'] }
end
if run["Ref"].starts_with?("refs/tags")
json.ref run["Ref"].gsub!("/refs/tags/", "")
else
json.ref run["Ref"].gsub!("refs/heads/", "")
end
json.status run["Status"]
json.time_ago time_from_now(run["Created"])
json.holding_time run["Status"] == 6 ? Time.now.to_i - run["Created"] : run["Stopped"] - run["Created"]
end
else
json.runs []
end
else
json.total_data 0
json.runs []
end