From 9b895507666b6412f3f6a31271ee0a118770c649 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Thu, 6 Aug 2026 19:32:50 +0200 Subject: [PATCH] warp_engine admin: CI Dashboard removed, Pipelines page with details sidebar, badge and Created fixes --- libs/ruby/warp_engine/README.md | 10 +++---- .../{ci_repositories.rb => pipelines.rb} | 27 ++++++++++++------- libs/ruby/warp_engine/app/admin/softwares.rb | 6 ++--- .../warp_engine/ci_pipeline_service.rb | 2 +- 4 files changed, 26 insertions(+), 19 deletions(-) rename libs/ruby/warp_engine/app/admin/{ci_repositories.rb => pipelines.rb} (81%) diff --git a/libs/ruby/warp_engine/README.md b/libs/ruby/warp_engine/README.md index 8931e23..9e9d7d7 100644 --- a/libs/ruby/warp_engine/README.md +++ b/libs/ruby/warp_engine/README.md @@ -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): -- **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 `Software` by name; repos that disappear from Woodpecker are deactivated. Platform and software links are editable by hand afterwards. -- **Pipeline history**: each CI repo's page lists its recent pipelines with - a manual *Trigger* action; the newest run refreshes the repo's cached - last-pipeline status shown on the CI Repos index. The software's admin - page links to its CI repo from the Quick Links sidebar. +- **Pipeline history**: each entry on the *Pipelines* page lists its recent + runs with a manual *Trigger* action; the newest run refreshes the cached + last-pipeline status shown on the Pipelines index. The software's admin + page links to its pipelines from the Quick Links sidebar. - **Secret provisioning**: database application tokens are pushed to the repos as the `application_token` Woodpecker secret — creating a token provisions it to its owner's repos (unrestricted tokens to all active diff --git a/libs/ruby/warp_engine/app/admin/ci_repositories.rb b/libs/ruby/warp_engine/app/admin/pipelines.rb similarity index 81% rename from libs/ruby/warp_engine/app/admin/ci_repositories.rb rename to libs/ruby/warp_engine/app/admin/pipelines.rb index 15197ba..62d4139 100644 --- a/libs/ruby/warp_engine/app/admin/ci_repositories.rb +++ b/libs/ruby/warp_engine/app/admin/pipelines.rb @@ -1,7 +1,7 @@ -ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do +ActiveAdmin.register WarpEngine::CiRepository, as: "Pipeline" do 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.batch_actions = false @@ -20,7 +20,7 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do column :repo_name column :platform 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| if 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 actions defaults: true do |repo| 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 @@ -51,23 +51,30 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do f.actions end - show do - attributes_table do + sidebar "Details", only: :show do + attributes_table_for resource do row :id row :woodpecker_repo_id row :repo_owner row :repo_name row :platform 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_at row :created_at row :updated_at end + end - if WarpEngine.woodpecker_configured? && resource.active - panel "Recent Pipelines" do + show 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 pipelines = WarpEngine::CiPipelineService.new.list_pipelines(resource, page: 1) 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 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 diff --git a/libs/ruby/warp_engine/app/admin/softwares.rb b/libs/ruby/warp_engine/app/admin/softwares.rb index c1ab2c3..e5224e3 100644 --- a/libs/ruby/warp_engine/app/admin/softwares.rb +++ b/libs/ruby/warp_engine/app/admin/softwares.rb @@ -55,9 +55,9 @@ ActiveAdmin.register WarpEngine::Software, as: "Software" do if resource.ci_repository 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 - span "🔧", style: "font-size:16px;" - text_node "CI Repository" + 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;" + text_node "Pipelines" end end end diff --git a/libs/ruby/warp_engine/app/services/warp_engine/ci_pipeline_service.rb b/libs/ruby/warp_engine/app/services/warp_engine/ci_pipeline_service.rb index 25b2064..c4075a1 100644 --- a/libs/ruby/warp_engine/app/services/warp_engine/ci_pipeline_service.rb +++ b/libs/ruby/warp_engine/app/services/warp_engine/ci_pipeline_service.rb @@ -9,7 +9,7 @@ module WarpEngine end # 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) pipelines = @client.list_pipelines(repo.woodpecker_repo_id, page: page) refresh_last_pipeline(repo, pipelines.first) if page == 1 && pipelines.is_a?(Array)