Update DBIServer's Index and Show to allow moderators to read.
This commit is contained in:
@@ -61,7 +61,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.FormComponent do
|
||||
socket =
|
||||
socket
|
||||
|> put_flash(:info, "Server #{socket.assigns.form.source.type}d successfully")
|
||||
|> push_navigate(to: patch_url(socket.assigns.action, dbi_server.id))
|
||||
|> redirect(to: patch_url(socket.assigns.action, dbi_server.id))
|
||||
|
||||
{:noreply, socket}
|
||||
|
||||
|
||||
@@ -4,26 +4,30 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Index do
|
||||
alias DecentralisedBookIndex.Metadata
|
||||
alias DecentralisedBookIndex.SyncTasks.SyncServerTask
|
||||
|
||||
alias DecentralisedBookIndex.Accounts.Role
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<.header>
|
||||
Listing Servers
|
||||
<:actions>
|
||||
<div class="flex flex-row gap-2">
|
||||
<%= if @current_user != nil and Role.can_administrate?(@current_user.role) do %>
|
||||
<div class="flex flex-row gap-2">
|
||||
<.primary_button phx-click="sync">
|
||||
Sync now
|
||||
</.primary_button>
|
||||
</div>
|
||||
<div class="flex flex-row gap-2">
|
||||
<.link patch={~p"/oban"}>
|
||||
<.primary_button>
|
||||
Task dashboard
|
||||
<div class="flex flex-row gap-2">
|
||||
<.primary_button phx-click="sync">
|
||||
Sync now
|
||||
</.primary_button>
|
||||
</.link>
|
||||
</div>
|
||||
<div class="flex flex-row gap-2">
|
||||
<.link patch={~p"/oban"}>
|
||||
<.primary_button>
|
||||
Task dashboard
|
||||
</.primary_button>
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
@@ -63,7 +67,9 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Index do
|
||||
<.link navigate={~p"/servers/#{dbi_server}"}>Show</.link>
|
||||
</div>
|
||||
|
||||
<.link patch={~p"/servers/#{dbi_server}/edit"}>Edit</.link>
|
||||
<%= if @current_user != nil and Role.can_administrate?(@current_user.role) do %>
|
||||
<.link patch={~p"/servers/#{dbi_server}/edit"}>Edit</.link>
|
||||
<% end %>
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
defmodule DecentralisedBookIndexWeb.DbiServerLive.Show do
|
||||
use DecentralisedBookIndexWeb, :live_view
|
||||
|
||||
alias DecentralisedBookIndex.Accounts.Role
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
@@ -8,7 +10,7 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Show do
|
||||
{@dbi_server.name}
|
||||
|
||||
<:actions>
|
||||
<%= if is_nil(@dbi_server.dbi_server) do %>
|
||||
<%= if is_nil(@dbi_server.dbi_server) and @current_user != nil and Role.can_administrate?(@current_user.role) do %>
|
||||
<.link patch={~p"/servers/#{@dbi_server}/edit"} phx-click={JS.push_focus()}>
|
||||
<.edit_button>
|
||||
Edit
|
||||
@@ -18,7 +20,6 @@ defmodule DecentralisedBookIndexWeb.DbiServerLive.Show do
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
|
||||
<div>
|
||||
<dl>
|
||||
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Url</dt>
|
||||
|
||||
Reference in New Issue
Block a user