64 lines
3.0 KiB
HTML
64 lines
3.0 KiB
HTML
{{define "content"}}
|
|
<h1>{{.Device.Name}}</h1>
|
|
{{if .Error}}<div class="alert alert-error">{{.Error}}</div>{{end}}
|
|
|
|
{{if .Device.Rack}}
|
|
<p class="rack-backlink"><a href="/racks/{{.Device.Rack.ID}}">← Back to {{.Device.Rack.Name}}</a></p>
|
|
{{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>
|
|
{{if .Device.Model}}{{if or .Device.Model.FrontImage .Device.Model.BackImage}}
|
|
<div class="device-images">
|
|
{{if .Device.Model.FrontImage}}<div><strong>Front</strong><br><img src="/{{.Device.Model.FrontImage}}" alt="Front" class="device-img"></div>{{end}}
|
|
{{if .Device.Model.BackImage}}<div><strong>Back</strong><br><img src="/{{.Device.Model.BackImage}}" alt="Back" class="device-img"></div>{{end}}
|
|
</div>
|
|
{{end}}{{end}}
|
|
{{template "port_list" .}}
|
|
|
|
<details style="margin-top:1em">
|
|
<summary>Rename Ports</summary>
|
|
<form method="POST" action="/devices/{{.Device.ID}}/ports/rename">
|
|
{{range .Device.Ports}}
|
|
<div class="port-entry">
|
|
<input name="port_id" type="hidden" value="{{.ID}}">
|
|
<input name="port_name" value="{{.Name}}" style="width:16em">
|
|
<span class="muted" style="font-size:0.8em">{{.Side}}</span>
|
|
</div>
|
|
{{end}}
|
|
<button type="submit">Update Ports</button>
|
|
</form>
|
|
</details>
|
|
{{end}}
|