Files
directory/app/views/admin/machines/index.erb
T

139 lines
7.1 KiB
Plaintext
Raw Normal View History

2026-06-12 15:40:12 -04:00
<form action="/admin/machines" method="POST">
<div class="text-4xl mb-10">
Network Machines
</div>
2026-06-17 22:30:32 -04:00
<% unless @editing %>
2026-06-12 15:40:12 -04:00
<div class="w-2/3 flex flex-none items-center justify-between ml-5 mb-2">
2026-06-17 22:30:32 -04:00
<div class="flex-none text-xl text-[#<%= @accent_hex %>]">Edit</div>
<div class="grow h-[1px] mt-1 bg-[#<%= @accent_hex %>]"></div>
2026-06-12 15:40:12 -04:00
</div>
<% end %>
<div class="flex flex-col ml-10 space-y-2">
<% @machines.each_with_index do |mach, index| %>
<div class="flex space-x-2">
<input type="hidden" name="machines[][id]" value="<%= mach.id %>">
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
2026-06-12 15:40:12 -04:00
id="mach_<%= index %>_name"
name="machines[][name]"
value="<%= mach.name %>"
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
2026-06-12 15:40:12 -04:00
<% if index == @machines.length - 1 %>
2026-06-17 22:30:32 -04:00
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Name</div>
2026-06-12 15:40:12 -04:00
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
2026-06-12 15:40:12 -04:00
id="mach_<%= index %>_domain"
name="machines[][domain]"
value="<%= mach.domain %>"
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
2026-06-12 15:40:12 -04:00
<% if index == @machines.length - 1 %>
2026-06-17 22:30:32 -04:00
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Domain</div>
2026-06-12 15:40:12 -04:00
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
2026-06-12 15:40:12 -04:00
id="mach_<%= index %>_local_ip_octet"
name="machines[][local_ip_octet]"
value="<%= mach.local_ip_octet %>"
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
2026-06-12 15:40:12 -04:00
<% if index == @machines.length - 1 %>
2026-06-17 22:30:32 -04:00
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Local IP Octet</div>
2026-06-12 15:40:12 -04:00
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
2026-06-12 15:40:12 -04:00
id="mach_<%= index %>_tailscale_ip"
name="machines[][tailscale_ip]"
value="<%= mach.tailscale_ip %>"
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
2026-06-12 15:40:12 -04:00
<% if index == @machines.length - 1 %>
2026-06-17 22:30:32 -04:00
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Tailscale IP</div>
2026-06-12 15:40:12 -04:00
<% end %>
</div>
</div>
<% end %>
</div>
<div class="flex flex-col space-y-2 mt-10">
2026-06-17 22:30:32 -04:00
<% if @editing %>
<div class="w-2/3 flex ml-10 space-x-5">
<a href="/admin/machines/edit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#<%= @light_hex %>] border-2 border-[#<%= @light_hex %>] rounded-lg hover:text-[#<%= @accent_hex %>] hover:bg-[#<%= @dark_hex %>] hover:border-[#<%= @accent_hex %>] transition-colors duration-200">
2026-06-12 15:40:12 -04:00
Edit/Add Machines
</a>
2026-06-17 22:30:32 -04:00
<a href="/admin" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#F80800] border-2 border-[#F80800] rounded-lg hover:text-[#F80800] hover:bg-[#<%= @dark_hex %>] hover:border-[#F80800] transition-colors duration-200">
Back To Admin
</a>
2026-06-12 15:40:12 -04:00
</div>
<% else %>
<div class="w-2/3 flex flex-none items-center justify-between ml-5 mb-2">
2026-06-17 22:30:32 -04:00
<div class="flex-none text-xl text-[#<%= @accent_hex %>]">New</div>
<div class="grow h-[1px] mt-1 bg-[#<%= @accent_hex %>]"></div>
2026-06-12 15:40:12 -04:00
</div>
<div class="flex space-x-2 mb-10 ml-10">
<input type="hidden" name="machines[][id]" value="">
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
2026-06-12 15:40:12 -04:00
id="mach_new_name"
name="machines[][name]"
value=""
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
<label for="mach_new_name" class="text-[#<%= @accent_hex %>]">Name</label>
2026-06-12 15:40:12 -04:00
</div>
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
2026-06-12 15:40:12 -04:00
id="mach_new_domain"
name="machines[][domain]"
value=""
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
<label for="mach_new_domain" class="text-[#<%= @accent_hex %>]">Domain</label>
2026-06-12 15:40:12 -04:00
</div>
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
2026-06-12 15:40:12 -04:00
id="mach_new_local_ip_octet"
name="machines[][local_ip_octet]"
value=""
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
<label for="mach_new_local_ip_octet" class="text-[#<%= @accent_hex %>]">Local IP Octet</label>
2026-06-12 15:40:12 -04:00
</div>
<div class="flex flex-col items-center">
<input type="text"
2026-06-17 22:30:32 -04:00
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
2026-06-12 15:40:12 -04:00
id="mach_new_tailscale_ip"
name="machines[][tailscale_ip]"
value=""
2026-06-17 22:30:32 -04:00
<%= 'readonly' if @editing %> >
<label for="mach_new_tailscale_ip" class="text-[#<%= @accent_hex %>]">Tailscale IP</label>
2026-06-12 15:40:12 -04:00
</div>
</div>
2026-06-17 22:30:32 -04:00
<div class="w-2/3 flex ml-10 space-x-5">
<button type="submit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#<%= @light_hex %>] border-2 border-[#<%= @light_hex %>] rounded-lg hover:text-[#<%= @accent_hex %>] hover:bg-[#<%= @dark_hex %>] hover:border-[#<%= @accent_hex %>] transition-colors duration-200">
2026-06-12 15:40:12 -04:00
Save Machines
</button>
2026-06-17 22:30:32 -04:00
<a href="/admin/machines" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#F80800] border-2 border-[#F80800] rounded-lg hover:text-[#F80800] hover:bg-[#<%= @dark_hex %>] hover:border-[#F80800] transition-colors duration-200">
2026-06-12 15:40:12 -04:00
Cancel
</a>
</div>
<% end %>
</div>
</form>