-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from oltarasenko/get_spider_loggs
Add support for spider logs
- Loading branch information
Showing
14 changed files
with
144 additions
and
34 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,18 @@ | ||
defmodule CrawlyUI.Manager.Log do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "logs" do | ||
field :message, :string | ||
field :job_id, :id | ||
|
||
timestamps() | ||
end | ||
|
||
@doc false | ||
def changeset(log, attrs) do | ||
log | ||
|> cast(attrs, [:job_id, :message]) | ||
|> validate_required([:job_id, :message]) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule CrawlyUIWeb.LogController do | ||
use CrawlyUIWeb, :controller | ||
|
||
alias CrawlyUI.Manager | ||
|
||
def index(conn, %{"job_id" => id} = params) do | ||
page = Manager.list_logs(id, params) | ||
|
||
render(conn, "index.html", | ||
id: id, | ||
current_page: page.page_number, | ||
items: page.entries, | ||
page: page, | ||
total_pages: page.total_pages | ||
) | ||
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<main role="main" class="container"> | ||
<p class="alert alert-info"><%= live_flash(@flash, :info) %></p>. | ||
<%= @inner_content %> | ||
</main> |
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,22 @@ | ||
<h1>Logs</h1> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Timestamp</th> | ||
<th>Message</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= for item <- @items do %> | ||
<tr> | ||
<td><%= item.inserted_at %></td> | ||
<td><%= item.message %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<nav> | ||
<ul class="pagination"> | ||
<li><a href="/logs/<%= @id %>/list/?page=<%= @current_page + 1 %>">Next page</a></li> | ||
</ul> | ||
</nav> |
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,3 @@ | ||
defmodule CrawlyUIWeb.LogView do | ||
use CrawlyUIWeb, :view | ||
end |
Oops, something went wrong.