feat: update sidekiq tasks manager for clarity
- Rename task label from 'Batch Generate Weather Arts' to 'Generate Weather Arts' for better understanding. - Add a new button for manual task execution of 'BatchGenerateWeatherArts'. - Update task value in form submissions to be more descriptive, enhancing maintainability. These changes improve the usability of the Sidekiq tasks management interface, making it more intuitive for users to identify and execute tasks. The renamed button and the clear distinction between tasks aim to reduce confusion and assist in better workflow management.
This commit is contained in:
parent
8cd4c50024
commit
2a0226eb68
@ -1,16 +1,17 @@
|
|||||||
# app/admin/sidekiq_tasks.rb
|
# app/admin/sidekiq_tasks.rb
|
||||||
ActiveAdmin.register_page "Sidekiq Tasks" do
|
ActiveAdmin.register_page "Sidekiq Tasks" do
|
||||||
menu label: "Sidekiq Tasks", priority: 99
|
# menu label: "Sidekiq Tasks", priority: 99
|
||||||
|
menu label: "Sidekiq Tasks Manager", parent: "系统管理"
|
||||||
|
|
||||||
content title: "Sidekiq Tasks Management" do
|
content title: "Sidekiq Tasks Management" do
|
||||||
div class: "sidekiq-tasks" do
|
div class: "sidekiq-tasks" do
|
||||||
panel "Manual Task Execution" do
|
panel "Manual Task Execution" do
|
||||||
div class: "task-buttons" do
|
div class: "task-buttons" do
|
||||||
div class: "task-button" do
|
div class: "task-button" do
|
||||||
h3 "Batch Generate Weather Arts"
|
h3 "Generate Weather Arts"
|
||||||
form action: admin_sidekiq_tasks_run_task_path, method: :post do
|
form action: admin_sidekiq_tasks_run_task_path, method: :post do
|
||||||
input type: "hidden", name: "authenticity_token", value: form_authenticity_token
|
input type: "hidden", name: "authenticity_token", value: form_authenticity_token
|
||||||
input type: "hidden", name: "task", value: "BatchGenerateWeatherArtsWorker"
|
input type: "hidden", name: "task", value: "GenerateWeatherArtsWorker"
|
||||||
select name: "city_id" do
|
select name: "city_id" do
|
||||||
City.all.map do |city|
|
City.all.map do |city|
|
||||||
option city.name, value: city.id
|
option city.name, value: city.id
|
||||||
@ -20,6 +21,15 @@ ActiveAdmin.register_page "Sidekiq Tasks" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
div class: "task-button" do
|
||||||
|
h3 "Batch Generate Weather Arts"
|
||||||
|
form action: admin_sidekiq_tasks_run_task_path, method: :post do
|
||||||
|
input type: "hidden", name: "authenticity_token", value: form_authenticity_token
|
||||||
|
input type: "hidden", name: "task", value: "BatchGenerateWeatherArts"
|
||||||
|
input type: "submit", value: "Run Task", class: "button"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
div class: "task-button" do
|
div class: "task-button" do
|
||||||
h3 "Refresh Sitemap"
|
h3 "Refresh Sitemap"
|
||||||
form action: admin_sidekiq_tasks_run_task_path, method: :post do
|
form action: admin_sidekiq_tasks_run_task_path, method: :post do
|
||||||
@ -75,7 +85,9 @@ ActiveAdmin.register_page "Sidekiq Tasks" do
|
|||||||
city_id = params[:city_id]
|
city_id = params[:city_id]
|
||||||
|
|
||||||
case task_name
|
case task_name
|
||||||
when "BatchGenerateWeatherArtsWorker"
|
when "BatchGenerateWeatherArts"
|
||||||
|
BatchGenerateWeatherArtsWorker.perform_async
|
||||||
|
when "GenerateWeatherArtsWorker"
|
||||||
GenerateWeatherArtWorker.perform_async(city_id)
|
GenerateWeatherArtWorker.perform_async(city_id)
|
||||||
when "RefreshSitemapWorker"
|
when "RefreshSitemapWorker"
|
||||||
RefreshSitemapWorker.perform_async
|
RefreshSitemapWorker.perform_async
|
||||||
|
Loading…
Reference in New Issue
Block a user