-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phoenix html 4 compatibility #147
Changes from all commits
691fa40
4daca9d
dbeed76
e9fe5fd
daacb64
1550207
1f10267
85bf399
3ffa8b8
1f0acdf
821401e
4db77fb
98a6c34
036b33f
1fdf887
2938e5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import Config | ||
|
||
# Print only warnings and errors during test | ||
config :logger, level: :warn | ||
config :logger, level: :warning | ||
|
||
config :exq_ui, DemoWeb.Endpoint, | ||
config :exq_ui_fork, DemoWeb.Endpoint, | ||
secret_key_base: "JUrii8hEdYZjAo/LHUziUO1xx0ViDK+I1yYDVvNrLpcYWH93l4kSBvWsbfGwJRu5", | ||
live_view: [signing_salt: "jhwmDSe0"], | ||
pubsub_server: ExqUI.PubSub |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,9 @@ defmodule ExqUIWeb do | |
defp view_helpers do | ||
quote do | ||
# Use all HTML functionality (forms, tags, etc) | ||
use Phoenix.HTML | ||
import Phoenix.HTML | ||
import Phoenix.HTML.Form | ||
use PhoenixHTMLHelpers | ||
Comment on lines
-58
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to provide backwards compability with phoenix_html 3.3 through the helpers package |
||
|
||
import Phoenix.Component | ||
# Import LiveView helpers (live_render, live_component, live_patch, etc) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,11 @@ | |
<tr> | ||
<td> | ||
<div class="d-flex align-items-center"> | ||
<span class="me-2"><%= node.identity %></span> | ||
<%= form_for :signal, "#", [id: "node-#{node.identity}", phx_auto_recover: :ignore, phx_change: :signal, class: "mb-0 form-check form-switch form-check-inline"], fn f -> %> | ||
<span class="me-2"> | ||
<%= node.identity %> | ||
</span> | ||
<%= form_for :signal, "#" , [id: "node-#{node.identity}" , phx_auto_recover: :ignore, phx_change: :signal, | ||
class: "mb-0 form-check form-switch form-check-inline" ], fn f -> %> | ||
<%= hidden_input(f, :name, value: "TSTP") %> | ||
<%= hidden_input(f, :node_id, value: node.identity) %> | ||
<%= checkbox(f, :quiet, | ||
|
@@ -26,10 +29,15 @@ | |
) %> | ||
<% end %> | ||
</div> | ||
<span><b>Queues: </b><%= Enum.join(node.queues, ", ") %></span> | ||
<span><b>Queues: </b> | ||
<%= Enum.join(node.queues, ", ") %></span> | ||
</td> | ||
<td> | ||
<%= human_time(node.started_at) %> | ||
</td> | ||
<td> | ||
<%= node.busy %> | ||
</td> | ||
<td><%= human_time(node.started_at) %></td> | ||
<td><%= node.busy %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
|
@@ -50,18 +58,29 @@ | |
<tbody> | ||
<%= for job <- @jobs do %> | ||
<tr> | ||
<td><%= job.host %></td> | ||
<td><%= job.pid %></td> | ||
<td><%= job.payload.jid %></td> | ||
<td> | ||
<%= live_redirect(job.queue, | ||
class: "nounderline", | ||
to: Routes.queue_show_path(@socket, job.queue) | ||
) %> | ||
<%= job.host %> | ||
</td> | ||
<td> | ||
<%= job.pid %> | ||
</td> | ||
<td> | ||
<%= job.payload.jid %> | ||
</td> | ||
<td> | ||
<.link navigate={Routes.queue_show_path(@socket, job.queue)} class="nounderline"> | ||
<%= job.queue %> | ||
</.link> | ||
Comment on lines
+70
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got rid of the warning to that |
||
</td> | ||
<td> | ||
<%= job.payload.class %> | ||
</td> | ||
<td> | ||
<%= inspect(job.payload.args) %> | ||
</td> | ||
<td> | ||
<%= human_time(job.run_at) %> | ||
</td> | ||
<td><%= job.payload.class %></td> | ||
<td><%= inspect(job.payload.args) %></td> | ||
<td><%= human_time(job.run_at) %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
</div> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<%= form_for :table, "#", [phx_submit: :action], fn f -> %> | ||
<%= form_for :table, "#" , [phx_submit: :action], fn f -> %> | ||
<button type="submit" class="btn btn-primary js-submit-button" style="display:none"> | ||
Submit | ||
</button> | ||
|
@@ -31,7 +31,9 @@ | |
<input class="form-check-input js-select-all-rows" type="checkbox" value="" /> | ||
</th> | ||
<%= for %{header: header} <- @columns do %> | ||
<th scope="col"><%= header %></th> | ||
<th scope="col"> | ||
<%= header %> | ||
</th> | ||
<% end %> | ||
</tr> | ||
</thead> | ||
|
@@ -45,8 +47,19 @@ | |
class: "form-check-input js-select-row" | ||
) %> | ||
</td> | ||
<%= for %{accessor: accessor} = column <- @columns do %> | ||
<td class={column[:text_break] && "text-break"}><%= accessor.(item) %></td> | ||
<%= for column <- @columns do %> | ||
<td class={column[:text_break] && "text-break"}> | ||
<%= if column[:link] do %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the nav_link approach before, to cator for the least amount of changes, I allowed colums to provide an optional field :link to determind whether it is one. |
||
<.link | ||
navigate={column.accessor.(item)[:link]} | ||
class={column.accessor.(item)[:class]} | ||
> | ||
<%= column.accessor.(item)[:text] %> | ||
</.link> | ||
<% else %> | ||
<%= column.accessor.(item) %> | ||
<% end %> | ||
</td> | ||
<% end %> | ||
</tr> | ||
<% end %> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This specifically deals with the warning