wireplanner/templates/device.html

40 lines
2.0 KiB
HTML

{{define "content"}}
<h1>{{.Device.Name}}</h1>
{{if .Error}}<div class="alert alert-error">{{.Error}}</div>{{end}}
<div class="device-meta">
{{if .Device.Model}}<p><strong>Model:</strong> {{.Device.Model.Manufacturer}} {{.Device.Model.Name}}</p>{{end}}
{{if .Device.UsageDescription}}<p><strong>Usage:</strong> {{.Device.UsageDescription}}</p>{{end}}
{{if .Device.Location}}<p><strong>Location:</strong> {{.Device.Location}}</p>{{end}}
{{if .Device.Comment}}<p><strong>Comment:</strong> {{.Device.Comment}}</p>{{end}}
{{if .Device.Rack}}
<p><strong>Rack:</strong> <a href="/racks/{{.Device.Rack.ID}}">{{.Device.Rack.Name}}</a>
{{if .Device.RackUnitStart}} U{{.Device.RackUnitStart}} {{.Device.RackSide}}{{end}}
</p>
{{end}}
</div>
<div class="device-toolbar">
<form method="POST" action="/devices/{{.Device.ID}}/delete" onsubmit="return confirm('Delete this device?')" style="display:inline">
<button class="btn-danger">Delete Device</button>
</form>
<details style="display:inline">
<summary>Edit</summary>
<form method="POST" action="/devices/{{.Device.ID}}/edit" class="inline-form">
<label>Name <input name="name" value="{{.Device.Name}}" required></label>
<label>Usage <input name="usage_description" value="{{.Device.UsageDescription}}"></label>
<label>Comment <input name="comment" value="{{.Device.Comment}}"></label>
<label>Location <input name="location" value="{{.Device.Location}}"></label>
{{if .Device.Rack}}
<label>Unit Start <input type="number" name="rack_unit_start" value="{{.Device.RackUnitStart}}"></label>
<label>Side <select name="rack_side"><option value="front" {{if eq .Device.RackSide "front"}}selected{{end}}>Front</option><option value="back" {{if eq .Device.RackSide "back"}}selected{{end}}>Back</option></select></label>
{{end}}
<button type="submit">Update</button>
</form>
</details>
</div>
<h3>Ports</h3>
{{template "port_list" .}}
{{end}}