-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
183 additions
and
200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,102 +76,83 @@ | |
<div class="-mr-2 flex md:hidden"> | ||
<!-- Mobile menu button --> | ||
<button | ||
phx-click={ | ||
JS.toggle( | ||
to: "#mobile-menu", | ||
in: {"transition ease-in duration-100", "opacity-0", "opacity-100"}, | ||
out: {"transition ease-in duration-100", "opacity-100", "opacity-0"} | ||
) | ||
} | ||
type="button" | ||
class="relative inline-flex items-center justify-center rounded-md bg-slate-800 p-2 text-slate-400 hover:bg-slate-700 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-slate-800" | ||
aria-controls="mobile-menu" | ||
aria-expanded="false" | ||
> | ||
<span class="absolute -inset-0.5"></span> | ||
<span class="sr-only">Open main menu</span> | ||
<span class="sr-only"><%= gettext("Open menu") %></span> | ||
<!-- Menu open: "hidden", Menu closed: "block" --> | ||
<svg | ||
class="block h-6 w-6" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" | ||
/> | ||
</svg> | ||
<!-- Menu open: "block", Menu closed: "hidden" --> | ||
<svg | ||
class="hidden h-6 w-6" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /> | ||
</svg> | ||
<.icon name="hero-bars-3" class="h-6 w-6" /> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<!-- Mobile menu, show/hide based on menu state. --> | ||
<div class="md:hidden" id="mobile-menu"> | ||
<div class="hidden" id="mobile-menu"> | ||
<div class="space-y-1 px-2 pb-3 pt-2 sm:px-3"> | ||
<!-- Current: "bg-slate-900 text-white", Default: "text-slate-300 hover:bg-slate-700 hover:text-white" --> | ||
<.link | ||
href={~p"/"} | ||
class="bg-slate-900 text-white block rounded-md px-3 py-2 text-base font-medium" | ||
class={ | ||
if assigns[:current_path] == ~p"/", | ||
do: "bg-slate-900 text-white block rounded-md px-3 py-2 text-base font-medium", | ||
else: | ||
"text-slate-300 hover:bg-slate-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium" | ||
} | ||
aria-current="page" | ||
> | ||
<%= gettext("Home") %> | ||
</.link> | ||
<.link | ||
href={~p"/dashboard"} | ||
class={ | ||
if assigns[:current_path] == ~p"/dashboard", | ||
do: "bg-slate-900 text-white block rounded-md px-3 py-2 text-base font-medium", | ||
else: | ||
"text-slate-300 hover:bg-slate-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium" | ||
} | ||
aria-current="page" | ||
> | ||
<%= gettext("Dashboard") %> | ||
</.link> | ||
</div> | ||
<div class="border-t border-slate-700 pb-3 pt-4"> | ||
<div class="flex items-center px-5"> | ||
<div class="ml-3"> | ||
<div class="text-base font-medium leading-none text-white">Tom Cook</div> | ||
<div class="text-sm font-medium leading-none text-slate-400">[email protected]</div> | ||
</div> | ||
<button | ||
type="button" | ||
class="relative ml-auto flex-shrink-0 rounded-full bg-slate-800 p-1 text-slate-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-slate-800" | ||
> | ||
<span class="absolute -inset-1.5"></span> | ||
<span class="sr-only">View notifications</span> | ||
<svg | ||
class="h-6 w-6" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke-width="1.5" | ||
stroke="currentColor" | ||
aria-hidden="true" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0" | ||
/> | ||
</svg> | ||
</button> | ||
</div> | ||
<div class="mt-3 space-y-1 px-2"> | ||
<a | ||
href="#" | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
Your Profile | ||
</a> | ||
<a | ||
href="#" | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
Settings | ||
</a> | ||
<a | ||
href="#" | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
Sign out | ||
</a> | ||
<%= if @current_user do %> | ||
<.link | ||
navigate={~p"/users/settings"} | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
<%= @current_user.email %> | ||
</.link> | ||
<.link | ||
navigate={~p"/users/log_out"} | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
<%= gettext("Log out") %> | ||
</.link> | ||
<% else %> | ||
<.link | ||
navigate={~p"/users/log_in"} | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
<%= gettext("Sign in") %> | ||
</.link> | ||
<.link | ||
navigate={~p"/users/register"} | ||
class="block rounded-md px-3 py-2 text-base font-medium text-slate-400 hover:bg-slate-700 hover:text-white" | ||
> | ||
<%= gettext("Register") %> | ||
</.link> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
|
@@ -186,12 +167,8 @@ | |
</header> | ||
<main> | ||
<.flash_group flash={@flash} /> | ||
<div class="mx-auto max-w-7xl"> | ||
<div class="py-10"> | ||
<div class="px-4 sm:px-6 lg:px-8"> | ||
<%= @inner_content %> | ||
</div> | ||
</div> | ||
<div class="mx-auto max-w-7xl py-10 sm:px-6 lg:px-8"> | ||
<%= @inner_content %> | ||
</div> | ||
</main> | ||
<footer> | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,105 @@ | ||
defmodule PolarWeb.RootLive do | ||
use PolarWeb, :live_view | ||
|
||
alias Polar.Streams | ||
|
||
def render(assigns) do | ||
~H""" | ||
<div class="sm:flex sm:items-center"> | ||
<div class="sm:flex-auto"> | ||
<h1 class="text-base font-semibold leading-6 text-white"> | ||
<%= gettext("Active Images") %> | ||
</h1> | ||
<p class="mt-2 text-sm text-slate-300"> | ||
<%= gettext("If you need something not available here please create an issue at the") %> | ||
<a | ||
href="https://github.com/upmaru/opsmaru-images" | ||
class="font-semibold text-brand hover:underline" | ||
target="_blank" | ||
> | ||
<%= gettext("opsmaru-images") %> | ||
</a> | ||
<%= gettext("repository.") %> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="mt-8 flow-root"> | ||
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"> | ||
<div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"> | ||
<table class="min-w-full divide-y divide-slate-700"> | ||
<thead> | ||
<tr> | ||
<th | ||
scope="col" | ||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-white sm:pl-0" | ||
> | ||
<%= gettext("Aliases") %> | ||
</th> | ||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-white"> | ||
<%= gettext("Arch") %> | ||
</th> | ||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-white"> | ||
<%= gettext("Variant") %> | ||
</th> | ||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-white"> | ||
<%= gettext("Published At") %> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody class="divide-y divide-slate-900"> | ||
<%= for {{os, release}, products} <- @grouped_products do %> | ||
<tr class="border-t border-slate-800"> | ||
<th | ||
colspan="5" | ||
scope="colgroup" | ||
class="bg-slate-900 py-2 pl-4 pr-3 text-left text-sm font-semibold text-slate-50 sm:pl-3" | ||
> | ||
<%= Phoenix.Naming.humanize(os) %> - <%= release %> | ||
</th> | ||
</tr> | ||
<%= for product <- products do %> | ||
<tr> | ||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-white sm:pl-0"> | ||
<%= for alias <- product.aliases do %> | ||
<span class="inline-flex items-center rounded-md bg-green-500/10 px-2 py-1 text-xs font-medium text-green-400 ring-1 ring-inset ring-green-500/20"> | ||
<%= alias %> | ||
</span> | ||
<% end %> | ||
</td> | ||
<td class="whitespace-nowrap px-3 py-4 text-sm text-slate-300"> | ||
<%= product.arch %> | ||
</td> | ||
<td class="whitespace-nowrap px-3 py-4 text-sm text-slate-300"> | ||
<%= product.variant %> | ||
</td> | ||
<td class="whitespace-nowrap px-3 py-4 text-sm text-slate-300"> | ||
<%= Calendar.strftime( | ||
product.latest_version.inserted_at, | ||
"%B %d, %Y %H:%M:%S" | ||
) %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
""" | ||
end | ||
|
||
def mount(_params, _session, socket) do | ||
products = | ||
Streams.list_products([:active, :with_latest_version]) | ||
|> Enum.group_by(fn p -> {p.os, p.release} end) | ||
|
||
socket = | ||
socket | ||
|> assign(:grouped_products, products) | ||
|> assign(:page_title, gettext("OpsMaru Images")) | ||
|> assign(:current_path, ~p"/") | ||
|
||
{:ok, socket} | ||
end | ||
end |
Oops, something went wrong.