Skip to content

Commit

Permalink
Switch buttons to input attributes, so they get the JS listener that …
Browse files Browse the repository at this point in the history
…provides (#5881)

the confirmation dialog.
  • Loading branch information
shevaun committed Apr 18, 2023
1 parent ae6ca11 commit ec84676
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions test/web_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ def job_params(job, score)
assert_match(/WebJob/, last_response.body)
end

it "can quiet all processes" do
identity = "identity"
signals_key = "#{identity}-signals"
@config.redis do |conn|
conn.sadd("processes", [identity])
conn.hmset(identity, "info", Sidekiq.dump_json("hostname" => "foo", "identity" => identity), "at", Time.now.to_f, "busy", 0)
end

assert_nil @config.redis { |c| c.lpop signals_key }
post "/busy", "quiet" => "Quiet All"
assert_equal 302, last_response.status
assert_equal "TSTP", @config.redis { |c| c.lpop signals_key }
end

it "can quiet a process" do
identity = "identity"
signals_key = "#{identity}-signals"
Expand Down
4 changes: 2 additions & 2 deletions web/views/busy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<form method="POST" class="warning-messages">
<%= csrf_tag %>
<div class="btn-group pull-right flip">
<button class="btn btn-warn" type="submit" name="quiet" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('QuietAll') %></button>
<button class="btn btn-danger" type="submit" name="stop" value="1" data-confirm="<%= t('AreYouSure') %>"><%= t('StopAll') %></button>
<input class="btn btn-warn" type="submit" name="quiet" value="<%= t('QuietAll') %>" data-confirm="<%= t('AreYouSure') %>"/>
<input class="btn btn-danger" type="submit" name="stop" value="<%= t('StopAll') %>" data-confirm="<%= t('AreYouSure') %>"/>
</div>
</form>
</div>
Expand Down

0 comments on commit ec84676

Please sign in to comment.