-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open source Web UI filtering (#6052)
* Move filtering into OSS so we can use it with Metrics too * extract english strings * changes * wording * minor bump * Modify inline testing's client override so as to not conflict with batch's client override, fixes #6057 * Previous commit fixes #6054 * tweaks
- Loading branch information
Showing
6 changed files
with
135 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require_relative "helper" | ||
require "sidekiq/web" | ||
require "rack/test" | ||
|
||
class WebWorker | ||
include Sidekiq::Worker | ||
|
||
def perform(a, b) | ||
a + b | ||
end | ||
end | ||
|
||
describe "filtering" do | ||
before do | ||
@config = reset! | ||
end | ||
|
||
include Rack::Test::Methods | ||
|
||
def app | ||
Sidekiq::Web | ||
end | ||
|
||
it "can filter jobs" do | ||
jid1 = WebWorker.perform_in(5, "bob", "tammy") | ||
jid2 = WebWorker.perform_in(5, "mike", "jim") | ||
|
||
get "/scheduled" | ||
assert_equal 200, last_response.status | ||
assert_match(/#{jid1}/, last_response.body) | ||
assert_match(/#{jid2}/, last_response.body) | ||
|
||
post "/filter/scheduled", substr: "tammy" | ||
assert_equal 200, last_response.status | ||
assert_match(/#{jid1}/, last_response.body) | ||
refute_match(/#{jid2}/, last_response.body) | ||
|
||
post "/filter/scheduled", substr: "" | ||
assert_equal 302, last_response.status | ||
get "/filter/scheduled" | ||
assert_equal 302, last_response.status | ||
get "/filter/retries" | ||
assert_equal 302, last_response.status | ||
get "/filter/dead" | ||
assert_equal 302, last_response.status | ||
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="sm-col-3 pull-right" style="display: inline; margin: 25px 15px 0 0;"> | ||
<%= t('Filter') %>: | ||
<form method="POST" action='<%= root_path %>filter/<%= which %>' style="display: inline-block"> | ||
<%= csrf_tag %> | ||
<input class="search" type="search" name="substr" value="<%= h params[:substr] %>" placeholder="<%= t('AnyJobContent') %>"/> | ||
</form> | ||
</div> |