jobs: rename /delayed_jobs to /jobs.
Rename the /delayed_jobs endpoint to just /jobs since it's no longer based on DelayedJob.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DelayedJobsController < ApplicationController
|
class JobsController < ApplicationController
|
||||||
respond_to :html, :xml, :json, :js
|
respond_to :html, :xml, :json, :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="c-delayed-jobs">
|
<div id="c-jobs">
|
||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Delayed Jobs</h1>
|
<h1>Jobs</h1>
|
||||||
|
|
||||||
<%= table_for @jobs, class: "striped autofit" do |t| %>
|
<%= table_for @jobs, class: "striped autofit" do |t| %>
|
||||||
<% t.column "Name" do |job| %>
|
<% t.column "Name" do |job| %>
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
|
|
||||||
<% t.column column: "control" do |job| %>
|
<% t.column column: "control" do |job| %>
|
||||||
<% if GoodJobPolicy.new(CurrentUser.user, job).update? %>
|
<% if GoodJobPolicy.new(CurrentUser.user, job).update? %>
|
||||||
<%= link_to "Run", run_delayed_job_path(job), method: :put, remote: true %> |
|
<%= link_to "Run", run_job_path(job), method: :put, remote: true %> |
|
||||||
<%= link_to "Retry", retry_delayed_job_path(job), method: :put, remote: true %> |
|
<%= link_to "Retry", retry_job_path(job), method: :put, remote: true %> |
|
||||||
<%= link_to "Cancel", cancel_delayed_job_path(job), method: :put, remote: true %> |
|
<%= link_to "Cancel", cancel_job_path(job), method: :put, remote: true %> |
|
||||||
<%= link_to "Delete", delayed_job_path(job), method: :delete, remote: true %>
|
<%= link_to "Delete", job_path(job), method: :delete, remote: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<li><%= link_to("News Updates", news_updates_path) %></li>
|
<li><%= link_to("News Updates", news_updates_path) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<li><%= link_to("Jobs", delayed_jobs_path) %></li>
|
<li><%= link_to("Jobs", jobs_path) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ Rails.application.routes.draw do
|
|||||||
get :posts
|
get :posts
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :delayed_jobs, :only => [:index, :destroy] do
|
resources :jobs, only: [:index, :destroy] do
|
||||||
member do
|
member do
|
||||||
put :run
|
put :run
|
||||||
put :retry
|
put :retry
|
||||||
@@ -337,6 +337,7 @@ Rails.application.routes.draw do
|
|||||||
get "/static/dtext_help" => "static#dtext_help", :as => "dtext_help"
|
get "/static/dtext_help" => "static#dtext_help", :as => "dtext_help"
|
||||||
get "/static/terms_of_service", to: redirect("/terms_of_service")
|
get "/static/terms_of_service", to: redirect("/terms_of_service")
|
||||||
get "/user_upgrade/new", to: redirect("/user_upgrades/new")
|
get "/user_upgrade/new", to: redirect("/user_upgrades/new")
|
||||||
|
get "/delayed_jobs", to: redirect("/jobs")
|
||||||
|
|
||||||
get "/mock/recommender/recommend/:user_id" => "mock_services#recommender_recommend", as: "mock_recommender_recommend"
|
get "/mock/recommender/recommend/:user_id" => "mock_services#recommender_recommend", as: "mock_recommender_recommend"
|
||||||
get "/mock/recommender/similiar/:post_id" => "mock_services#recommender_similar", as: "mock_recommender_similar"
|
get "/mock/recommender/similiar/:post_id" => "mock_services#recommender_similar", as: "mock_recommender_similar"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class DelayedJobsControllerTest < ActionDispatch::IntegrationTest
|
class JobsControllerTest < ActionDispatch::IntegrationTest
|
||||||
context "The delayed jobs controller" do
|
context "The jobs controller" do
|
||||||
setup do
|
setup do
|
||||||
@user = create(:admin_user)
|
@user = create(:admin_user)
|
||||||
@job = create(:good_job)
|
@job = create(:good_job)
|
||||||
@@ -9,7 +9,7 @@ class DelayedJobsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
context "index action" do
|
context "index action" do
|
||||||
should "render" do
|
should "render" do
|
||||||
get delayed_jobs_path
|
get jobs_path
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -17,7 +17,7 @@ class DelayedJobsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
context "cancel action" do
|
context "cancel action" do
|
||||||
should "work" do
|
should "work" do
|
||||||
GoodJob::ActiveJobJob.any_instance.stubs(:status).returns(:queued)
|
GoodJob::ActiveJobJob.any_instance.stubs(:status).returns(:queued)
|
||||||
put_auth cancel_delayed_job_path(@job), @user, xhr: true
|
put_auth cancel_job_path(@job), @user, xhr: true
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -26,7 +26,7 @@ class DelayedJobsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
should "work" do
|
should "work" do
|
||||||
@job.head_execution.active_job.class.stubs(:queue_adapter).returns(GoodJob::Adapter.new)
|
@job.head_execution.active_job.class.stubs(:queue_adapter).returns(GoodJob::Adapter.new)
|
||||||
GoodJob::ActiveJobJob.any_instance.stubs(:status).returns(:discarded)
|
GoodJob::ActiveJobJob.any_instance.stubs(:status).returns(:discarded)
|
||||||
put_auth retry_delayed_job_path(@job), @user, xhr: true
|
put_auth retry_job_path(@job), @user, xhr: true
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -34,14 +34,14 @@ class DelayedJobsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
context "run action" do
|
context "run action" do
|
||||||
should "work" do
|
should "work" do
|
||||||
GoodJob::ActiveJobJob.any_instance.stubs(:status).returns(:queued)
|
GoodJob::ActiveJobJob.any_instance.stubs(:status).returns(:queued)
|
||||||
put_auth run_delayed_job_path(@job), @user, xhr: true
|
put_auth run_job_path(@job), @user, xhr: true
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "destroy action" do
|
context "destroy action" do
|
||||||
should "work" do
|
should "work" do
|
||||||
delete_auth delayed_job_path(@job), @user, xhr: true
|
delete_auth job_path(@job), @user, xhr: true
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user