2013-08-01 23:24:33 +01:00
|
|
|
now = Time.now.utc
|
2013-08-30 14:52:51 +01:00
|
|
|
users, projects, platforms, repositories = [], [], [], []
|
2013-08-01 23:24:33 +01:00
|
|
|
json.build_lists @build_lists do |build_list|
|
2013-08-29 18:46:11 +01:00
|
|
|
json.(build_list, :id, :status, :project_id, :project_version, :save_to_platform_id, :save_to_repository_id, :user_id, :project_id, :build_for_platform_id, :arch_id, :group_id)
|
2016-02-08 14:47:15 +00:00
|
|
|
json.commit_hash build_list.commit_hash.to_s.first(5)
|
2013-08-02 21:13:59 +01:00
|
|
|
json.last_published_commit_hash build_list.last_published_commit_hash.first(5) if build_list.last_published_commit_hash
|
2013-08-01 23:24:33 +01:00
|
|
|
|
|
|
|
if BuildList::HUMAN_STATUSES[build_list.status].in? [:build_pending, :build_started, :build_publish]
|
|
|
|
json.duration Time.diff(now, build_list.updated_at, '%h:%m')[:diff]
|
|
|
|
json.average_build_time build_list.formatted_average_build_time if build_list.build_started? && (build_list.average_build_time > 0)
|
|
|
|
end
|
|
|
|
|
2013-08-02 15:04:16 +01:00
|
|
|
json.version_release get_version_release(build_list)
|
2014-11-07 16:15:31 +00:00
|
|
|
|
|
|
|
json.updated_at build_list.updated_at
|
|
|
|
json.updated_at_utc build_list.updated_at.strftime('%Y-%m-%d %H:%M:%S UTC')
|
|
|
|
|
2013-08-30 14:52:51 +01:00
|
|
|
users |= [build_list.user]
|
|
|
|
projects |= [build_list.project]
|
|
|
|
platforms |= [build_list.build_for_platform, build_list.save_to_platform]
|
|
|
|
repositories |= [build_list.save_to_repository]
|
2013-08-03 11:47:23 +01:00
|
|
|
end
|
2013-08-01 23:24:33 +01:00
|
|
|
|
2013-08-03 11:47:23 +01:00
|
|
|
json.dictionary do
|
2013-08-30 14:52:51 +01:00
|
|
|
json.users users.compact do |user|
|
2013-08-03 11:47:23 +01:00
|
|
|
json.(user, :id, :uname, :fullname)
|
|
|
|
end
|
2013-08-30 14:52:51 +01:00
|
|
|
json.projects projects.compact do |project|
|
2013-08-05 18:38:48 +01:00
|
|
|
json.(project, :id, :name)
|
|
|
|
json.owner project.name_with_owner.gsub(/\/.*/, '')
|
2013-08-03 11:47:23 +01:00
|
|
|
end
|
2013-08-30 14:52:51 +01:00
|
|
|
json.platforms platforms.compact do |platform|
|
2013-08-03 11:47:23 +01:00
|
|
|
json.(platform, :id, :name)
|
|
|
|
json.personal platform.personal?
|
|
|
|
end
|
2013-08-30 14:52:51 +01:00
|
|
|
json.repositories repositories.compact do |repository|
|
2013-08-03 11:47:23 +01:00
|
|
|
json.(repository, :id, :name)
|
|
|
|
end
|
|
|
|
json.arches Arch.all do |arch|
|
|
|
|
json.(arch, :id, :name)
|
2013-08-01 23:24:33 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-30 17:06:14 +00:00
|
|
|
json.server_status @build_server_status
|
|
|
|
json.filter @filter.try(:options)
|
|
|
|
json.page params[:page]
|
|
|
|
json.total_items @bls.count
|