-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modify message controller * Create get_failing_messages method * Show messages error in template * Remove a lot of warnings * Show messages in menu * Change keys of logging * Improve menu name * Create pagination * Add remaining tests * Refactor * Render buttons in templates Co-authored-by: Emilio Carrión <[email protected]>
- Loading branch information
1 parent
ce88f20
commit 62f8540
Showing
18 changed files
with
173 additions
and
28 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
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,45 @@ | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<%= if @page_number >= 10 do%> | ||
<span> | ||
<%= link "Prev Page", | ||
class: "btn btn-primary btn-round", | ||
to: Routes.message_path(@conn, :index, page: @page_number - 1, page_size: 100) %> | ||
</span> | ||
<% end %> | ||
<%= if @page_number < @total_pages do%> | ||
<span> | ||
<%= link "Next Page", | ||
class: "btn btn-primary btn-round", | ||
to: Routes.message_path(@conn, :index, page: @page_number + 1, page_size: 100) %> | ||
</span> | ||
<% end %> | ||
<span> | ||
<p class="font-weight-bold">Pages: <%= @page_number %>/<%= @total_pages %></p> | ||
</span> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Attemps</th> | ||
<th scope="col">Max attempts</th> | ||
<th scope="col">Last error</th> | ||
<th scope="col">Scheduled at</th> | ||
<th scope="col">Args</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= for message <- @messages do %> | ||
<tr> | ||
<td><%= message.id %></td> | ||
<td><%= message.attempt %></td> | ||
<td><%= message.max_attempts %></td> | ||
<td><%= message.attempted_at%></td> | ||
<td><%= message.scheduled_at%></td> | ||
<td><%= Poison.encode!(message.args)%></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
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
28 changes: 28 additions & 0 deletions
28
test/postoffice_web/controllers/message_controller_test.exs
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,28 @@ | ||
defmodule PostofficeWeb.MessageControllerTest do | ||
use PostofficeWeb.ConnCase, async: true | ||
|
||
alias Postoffice.Fixtures | ||
|
||
setup do | ||
{:ok, conn: Phoenix.ConnTest.build_conn()} | ||
end | ||
|
||
describe "list failed message" do | ||
test "can access to messages list", %{conn: conn} do | ||
failing_job = Fixtures.create_failing_message(%{id: 1, user_id: 2}) | ||
second_failing_job = Fixtures.create_failing_message(%{id: 23, user_id: 2}) | ||
|
||
response = conn | ||
|> get(Routes.message_path(conn, :index, %{page: 1, page_size: 1})) | ||
|
||
assert html_response(response, 200) =~ to_string(failing_job.id) | ||
refute html_response(response, 200) =~ to_string(second_failing_job.id) | ||
|
||
response = conn | ||
|> get(Routes.message_path(conn, :index, %{page: 2, page_size: 1})) | ||
|
||
refute html_response(response, 200) =~ to_string(failing_job.id) | ||
assert html_response(response, 200) =~ to_string(second_failing_job.id) | ||
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