This commit is contained in:
2026-06-12 15:40:12 -04:00
commit 521653e5de
53 changed files with 8635 additions and 0 deletions
+135
View File
@@ -0,0 +1,135 @@
<form action="/admin/machines" method="POST">
<div class="text-4xl mb-10">
Network Machines
</div>
<% unless @is_readonly %>
<div class="w-2/3 flex flex-none items-center justify-between ml-5 mb-2">
<div class="flex-none text-xl text-[#2FD400]">Edit</div>
<div class="grow h-[1px] mt-1 bg-[#2FD400]"></div>
</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"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_<%= index %>_name"
name="machines[][name]"
value="<%= mach.name %>"
<%= 'readonly' if @is_readonly %> >
<% if index == @machines.length - 1 %>
<div class="text-[#2FD400]">Name</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_<%= index %>_domain"
name="machines[][domain]"
value="<%= mach.domain %>"
<%= 'readonly' if @is_readonly %> >
<% if index == @machines.length - 1 %>
<div class="text-[#2FD400]">Domain</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_<%= index %>_local_ip_octet"
name="machines[][local_ip_octet]"
value="<%= mach.local_ip_octet %>"
<%= 'readonly' if @is_readonly %> >
<% if index == @machines.length - 1 %>
<div class="text-[#2FD400]">Local IP Octet</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_<%= index %>_tailscale_ip"
name="machines[][tailscale_ip]"
value="<%= mach.tailscale_ip %>"
<%= 'readonly' if @is_readonly %> >
<% if index == @machines.length - 1 %>
<div class="text-[#2FD400]">Tailscale IP</div>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="flex flex-col space-y-2 mt-10">
<% if @is_readonly %>
<div class="w-2/3 flex justify-end space-x-5">
<a href="/admin/machines/edit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#140029] bg-[#8000FF] border-2 border-[#8000FF] rounded-lg hover:text-[#2FD400] hover:bg-[#140029] hover:border-[#2FD400] transition-colors duration-200">
Edit/Add Machines
</a>
</div>
<% else %>
<div class="w-2/3 flex flex-none items-center justify-between ml-5 mb-2">
<div class="flex-none text-xl text-[#2FD400]">New</div>
<div class="grow h-[1px] mt-1 bg-[#2FD400]"></div>
</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"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_new_name"
name="machines[][name]"
value=""
<%= 'readonly' if @is_readonly %> >
<label for="mach_new_name" class="text-[#2FD400]">Name</label>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_new_domain"
name="machines[][domain]"
value=""
<%= 'readonly' if @is_readonly %> >
<label for="mach_new_domain" class="text-[#2FD400]">Domain</label>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_new_local_ip_octet"
name="machines[][local_ip_octet]"
value=""
<%= 'readonly' if @is_readonly %> >
<label for="mach_new_local_ip_octet" class="text-[#2FD400]">Local IP Octet</label>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
id="mach_new_tailscale_ip"
name="machines[][tailscale_ip]"
value=""
<%= 'readonly' if @is_readonly %> >
<label for="mach_new_tailscale_ip" class="text-[#2FD400]">Tailscale IP</label>
</div>
</div>
<div class="w-2/3 flex justify-end space-x-5">
<button type="submit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#140029] bg-[#8000FF] border-2 border-[#8000FF] rounded-lg hover:text-[#2FD400] hover:bg-[#140029] hover:border-[#2FD400] transition-colors duration-200">
Save Machines
</button>
<a href="/admin/machines" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#140029] bg-[#F80800] border-2 border-[#F80800] rounded-lg hover:text-[#F80800] hover:bg-[#140029] hover:border-[#F80800] transition-colors duration-200">
Cancel
</a>
</div>
<% end %>
</div>
</form>