139 lines
7.1 KiB
Plaintext
139 lines
7.1 KiB
Plaintext
<form action="/admin/machines" method="POST">
|
|
|
|
<div class="text-4xl mb-10">
|
|
Network Machines
|
|
</div>
|
|
<% unless @editing %>
|
|
<div class="w-2/3 flex flex-none items-center justify-between ml-5 mb-2">
|
|
<div class="flex-none text-xl text-[#<%= @accent_hex %>]">Edit</div>
|
|
<div class="grow h-[1px] mt-1 bg-[#<%= @accent_hex %>]"></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-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
|
|
id="mach_<%= index %>_name"
|
|
name="machines[][name]"
|
|
value="<%= mach.name %>"
|
|
<%= 'readonly' if @editing %> >
|
|
<% if index == @machines.length - 1 %>
|
|
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Name</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<input type="text"
|
|
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
|
|
id="mach_<%= index %>_domain"
|
|
name="machines[][domain]"
|
|
value="<%= mach.domain %>"
|
|
<%= 'readonly' if @editing %> >
|
|
<% if index == @machines.length - 1 %>
|
|
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Domain</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<input type="text"
|
|
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
|
|
id="mach_<%= index %>_local_ip_octet"
|
|
name="machines[][local_ip_octet]"
|
|
value="<%= mach.local_ip_octet %>"
|
|
<%= 'readonly' if @editing %> >
|
|
<% if index == @machines.length - 1 %>
|
|
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Local IP Octet</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<input type="text"
|
|
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
|
|
id="mach_<%= index %>_tailscale_ip"
|
|
name="machines[][tailscale_ip]"
|
|
value="<%= mach.tailscale_ip %>"
|
|
<%= 'readonly' if @editing %> >
|
|
<% if index == @machines.length - 1 %>
|
|
<div class='<%= "text-[##{@accent_hex}]" if @editing %>'>Tailscale IP</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
|
|
<div class="flex flex-col space-y-2 mt-10">
|
|
<% 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">
|
|
Edit/Add Machines
|
|
</a>
|
|
<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>
|
|
</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-[#<%= @accent_hex %>]">New</div>
|
|
<div class="grow h-[1px] mt-1 bg-[#<%= @accent_hex %>]"></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-[#<%= @light_hex %>] rounded-lg text-center"
|
|
id="mach_new_name"
|
|
name="machines[][name]"
|
|
value=""
|
|
<%= 'readonly' if @editing %> >
|
|
<label for="mach_new_name" class="text-[#<%= @accent_hex %>]">Name</label>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<input type="text"
|
|
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
|
|
id="mach_new_domain"
|
|
name="machines[][domain]"
|
|
value=""
|
|
<%= 'readonly' if @editing %> >
|
|
<label for="mach_new_domain" class="text-[#<%= @accent_hex %>]">Domain</label>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<input type="text"
|
|
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
|
|
id="mach_new_local_ip_octet"
|
|
name="machines[][local_ip_octet]"
|
|
value=""
|
|
<%= 'readonly' if @editing %> >
|
|
<label for="mach_new_local_ip_octet" class="text-[#<%= @accent_hex %>]">Local IP Octet</label>
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<input type="text"
|
|
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
|
|
id="mach_new_tailscale_ip"
|
|
name="machines[][tailscale_ip]"
|
|
value=""
|
|
<%= 'readonly' if @editing %> >
|
|
<label for="mach_new_tailscale_ip" class="text-[#<%= @accent_hex %>]">Tailscale IP</label>
|
|
</div>
|
|
</div>
|
|
<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">
|
|
Save Machines
|
|
</button>
|
|
<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">
|
|
Cancel
|
|
</a>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
</form>
|