mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-22 23:08:50 +08:00
Redesign the memory info chart on home (#918)
This commit is contained in:
parent
a5845c65b7
commit
c2feceba37
1 changed files with 18 additions and 9 deletions
|
@ -33,10 +33,11 @@ defmodule LivebookWeb.HomeLive.SessionListComponent do
|
||||||
def render(assigns) do
|
def render(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<div>
|
<div>
|
||||||
<div class="mb-4 flex items-end justify-between">
|
<div class="mb-4 flex items-center md:items-end justify-between">
|
||||||
<h2 class="uppercase font-semibold text-gray-500">
|
<h2 class="uppercase font-semibold text-gray-500 text-sm md:text-base">
|
||||||
Running sessions (<%= length(@sessions) %>)
|
Running sessions (<%= length(@sessions) %>)
|
||||||
</h2>
|
</h2>
|
||||||
|
<div class="flex flex-row">
|
||||||
<.memory_info />
|
<.memory_info />
|
||||||
<.menu id="sessions-order-menu">
|
<.menu id="sessions-order-menu">
|
||||||
<:toggle>
|
<:toggle>
|
||||||
|
@ -56,6 +57,7 @@ defmodule LivebookWeb.HomeLive.SessionListComponent do
|
||||||
<% end %>
|
<% end %>
|
||||||
</:content>
|
</:content>
|
||||||
</.menu>
|
</.menu>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<.session_list sessions={@sessions} socket={@socket} show_autosave_note?={@show_autosave_note?} />
|
<.session_list sessions={@sessions} socket={@socket} show_autosave_note?={@show_autosave_note?} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -151,14 +153,21 @@ defmodule LivebookWeb.HomeLive.SessionListComponent do
|
||||||
assigns = assign(assigns, free: free, used: used, total: total, percentage: percentage)
|
assigns = assign(assigns, free: free, used: used, total: total, percentage: percentage)
|
||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<span class="tooltip top" data-tooltip={"#{format_bytes(@free)} available"}>
|
<div class="pr-4">
|
||||||
<div class="text-sm text-gray-500 font-medium">
|
<span class="tooltip top" data-tooltip={"#{format_bytes(@free)} available"}>
|
||||||
<span><%= format_bytes(@used) %> / <%= format_bytes(@total) %></span>
|
<svg viewbox="-10 5 50 25" width="30" height="30" xmlns="http://www.w3.org/2000/svg">
|
||||||
<div class="w-32 md:w-64 h-4 bg-gray-200">
|
<circle cx="16.91549431" cy="16.91549431" r="15.91549431"
|
||||||
<div class="h-4 bg-blue-600" style={"width: #{@percentage}%"}></div>
|
stroke="#E0E8F0" stroke-width="13" fill="none" />
|
||||||
</div>
|
<circle cx="16.91549431" cy="16.91549431" r="15.91549431"
|
||||||
|
stroke="#3E64FF" stroke-dasharray={"#{@percentage},100"} stroke-width="13" fill="none" />
|
||||||
|
</svg>
|
||||||
|
<div class="hidden md:flex">
|
||||||
|
<span class="px-2 py-1 text-sm text-gray-500 font-medium">
|
||||||
|
<%= format_bytes(@used) %> / <%= format_bytes(@total) %>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue