warp_engine admin: CI Dashboard removed, Pipelines page with details sidebar, badge and Created fixes

This commit is contained in:
2026-08-06 19:32:50 +02:00
parent 161f923dc8
commit 05beb6230b
4 changed files with 26 additions and 19 deletions
+5 -5
View File
@@ -304,14 +304,14 @@ c.woodpecker_repo_owner = ENV["WOODPECKER_REPO_OWNER"] # forge org the game repo
What it unlocks (all surfaced in the admin): What it unlocks (all surfaced in the admin):
- **Repo sync** (*CI Repos → Sync from Woodpecker*): mirrors the Woodpecker - **Repo sync** (*Pipelines → Sync from Woodpecker*): mirrors the Woodpecker
repo list into `CiRepository` records, auto-matching each repo to a catalog repo list into `CiRepository` records, auto-matching each repo to a catalog
`Software` by name; repos that disappear from Woodpecker are deactivated. `Software` by name; repos that disappear from Woodpecker are deactivated.
Platform and software links are editable by hand afterwards. Platform and software links are editable by hand afterwards.
- **Pipeline history**: each CI repo's page lists its recent pipelines with - **Pipeline history**: each entry on the *Pipelines* page lists its recent
a manual *Trigger* action; the newest run refreshes the repo's cached runs with a manual *Trigger* action; the newest run refreshes the cached
last-pipeline status shown on the CI Repos index. The software's admin last-pipeline status shown on the Pipelines index. The software's admin
page links to its CI repo from the Quick Links sidebar. page links to its pipelines from the Quick Links sidebar.
- **Secret provisioning**: database application tokens are pushed to the - **Secret provisioning**: database application tokens are pushed to the
repos as the `application_token` Woodpecker secret — creating a token repos as the `application_token` Woodpecker secret — creating a token
provisions it to its owner's repos (unrestricted tokens to all active provisions it to its owner's repos (unrestricted tokens to all active
@@ -1,7 +1,7 @@
ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do ActiveAdmin.register WarpEngine::CiRepository, as: "Pipeline" do
actions :index, :show, :edit, :update actions :index, :show, :edit, :update
menu parent: "🌀 WarpEngine", priority: 10, label: "🔧 CI Repos" menu parent: "🌀 WarpEngine", priority: 10, label: "🚀 Pipelines"
config.sort_order = "repo_name_asc" config.sort_order = "repo_name_asc"
config.batch_actions = false config.batch_actions = false
@@ -20,7 +20,7 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
column :repo_name column :repo_name
column :platform column :platform
column("Software") { |r| r.software ? link_to(r.software.title, admin_software_path(r.software)) : "-" } column("Software") { |r| r.software ? link_to(r.software.title, admin_software_path(r.software)) : "-" }
column(:active) { |r| status_tag(r.active ? "active" : "inactive", class: r.active ? "ok" : "warning") } column(:active) { |r| status_tag(r.active ? "active" : "inactive", class: r.active ? "yes" : "no") }
column("Pipeline") { |r| column("Pipeline") { |r|
if r.last_pipeline_status if r.last_pipeline_status
status_tag r.last_pipeline_status, status_tag r.last_pipeline_status,
@@ -32,7 +32,7 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
column :last_pipeline_at column :last_pipeline_at
actions defaults: true do |repo| actions defaults: true do |repo|
if repo.active && WarpEngine.woodpecker_configured? if repo.active && WarpEngine.woodpecker_configured?
item "Trigger", trigger_admin_ci_repository_path(repo), method: :post, class: "member_link" item "Trigger", trigger_admin_pipeline_path(repo), method: :post, class: "member_link"
end end
end end
end end
@@ -51,23 +51,30 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
f.actions f.actions
end end
show do sidebar "Details", only: :show do
attributes_table do attributes_table_for resource do
row :id row :id
row :woodpecker_repo_id row :woodpecker_repo_id
row :repo_owner row :repo_owner
row :repo_name row :repo_name
row :platform row :platform
row("Software") { |r| r.software ? link_to(r.software.title, admin_software_path(r.software)) : "-" } row("Software") { |r| r.software ? link_to(r.software.title, admin_software_path(r.software)) : "-" }
row(:active) { |r| status_tag(r.active ? "active" : "inactive") } row(:active) { |r| status_tag(r.active ? "active" : "inactive", class: r.active ? "yes" : "no") }
row :last_pipeline_status row :last_pipeline_status
row :last_pipeline_at row :last_pipeline_at
row :created_at row :created_at
row :updated_at row :updated_at
end end
end
if WarpEngine.woodpecker_configured? && resource.active show do
panel "Recent Pipelines" do panel "Pipelines" do
if !WarpEngine.woodpecker_configured?
para "Woodpecker is not configured. Set woodpecker_url and woodpecker_api_token in the WarpEngine initializer.",
style: "color:#999;"
elsif !resource.active
para "This repository is inactive.", style: "color:#999;"
else
begin begin
pipelines = WarpEngine::CiPipelineService.new.list_pipelines(resource, page: 1) pipelines = WarpEngine::CiPipelineService.new.list_pipelines(resource, page: 1)
if pipelines.is_a?(Array) && pipelines.any? if pipelines.is_a?(Array) && pipelines.any?
@@ -107,7 +114,7 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
action_item :sync_repos, only: :index do action_item :sync_repos, only: :index do
if WarpEngine.woodpecker_configured? if WarpEngine.woodpecker_configured?
link_to "Sync from Woodpecker", sync_admin_ci_repositories_path, method: :post link_to "Sync from Woodpecker", sync_admin_pipelines_path, method: :post
end end
end end
+3 -3
View File
@@ -55,9 +55,9 @@ ActiveAdmin.register WarpEngine::Software, as: "Software" do
if resource.ci_repository if resource.ci_repository
div style: "margin-bottom:8px;" do div style: "margin-bottom:8px;" do
a href: admin_ci_repository_path(resource.ci_repository), style: "display:inline-flex;align-items:center;gap:6px;font-weight:bold;color:#5850ec;" do a href: admin_pipeline_path(resource.ci_repository), style: "display:inline-flex;align-items:center;gap:6px;font-weight:bold;color:#5850ec;" do
span "🔧", style: "font-size:16px;" span "🚀", style: "font-size:16px;"
text_node "CI Repository" text_node "Pipelines"
end end
end end
end end
@@ -9,7 +9,7 @@ module WarpEngine
end end
# Fetches one page of a repo's pipelines; the newest one refreshes the # Fetches one page of a repo's pipelines; the newest one refreshes the
# repo's cached last_pipeline_* columns (CI Repos index and the CI API). # repo's cached last_pipeline_* columns (Pipelines index and the CI API).
def list_pipelines(repo, page: 1) def list_pipelines(repo, page: 1)
pipelines = @client.list_pipelines(repo.woodpecker_repo_id, page: page) pipelines = @client.list_pipelines(repo.woodpecker_repo_id, page: page)
refresh_last_pipeline(repo, pipelines.first) if page == 1 && pipelines.is_a?(Array) refresh_last_pipeline(repo, pipelines.first) if page == 1 && pipelines.is_a?(Array)