-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adde button to remove failed batch (#4)
* Added button to remove failed batch * Fix dependency * Added feature to README * Fix rubocop warning
- Loading branch information
Showing
15 changed files
with
79 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
require "sidekiq/web/helpers" | ||
|
||
module Sidekiq | ||
module Belt | ||
module Pro | ||
module FailedBatchRemove | ||
module SidekiqFailedBatchRemove | ||
REMOVE_BUTTON = <<~ERB | ||
<form action="<%= root_path %>batches/<%= bid %>/remove" method="post"> | ||
<%= csrf_tag %> | ||
<input class="btn btn-danger" type="submit" name="remove" value="<%= t('Remove') %>" | ||
data-confirm="Do you want to remove batch <%= bid %>? <%= t('AreYouSure') %>" /> | ||
</form> | ||
ERB | ||
|
||
def self.registered(app) | ||
app.replace_content("/batches") do |content| | ||
content.gsub!("</th>\n <%", "</th><th><%= t('Delete') %></th>\n <%") | ||
|
||
content.gsub!( | ||
"</td>\n </tr>\n <% end %>", | ||
"</td>\n<td>#{REMOVE_BUTTON}</td>\n </tr>\n <% end %>" | ||
) | ||
end | ||
|
||
app.post("/batches/:bid/remove") do | ||
Sidekiq::Batch::Status.new(params[:bid]).delete | ||
|
||
return redirect "#{root_path}batches" | ||
end | ||
end | ||
end | ||
|
||
def self.use! | ||
require("sidekiq/web") | ||
|
||
Sidekiq::Web.register(Sidekiq::Belt::Pro::FailedBatchRemove::SidekiqFailedBatchRemove) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Sidekiq | ||
module Belt | ||
VERSION = "0.2.0" | ||
VERSION = "0.3.0" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters