mirror of
https://github.com/MeshTender/MeshTender.git
synced 2026-09-09 05:13:45 +00:00
85 lines
3.9 KiB
HTML
85 lines
3.9 KiB
HTML
{{define "title"}}Configuration · {{.Org.Name}} · MeshTender{{end}}
|
|
{{define "header"}}{{template "org-header" .}}{{end}}
|
|
{{define "content"}}
|
|
{{template "org-tabs" .Nav}}
|
|
|
|
{{if not .Config.HasConfig}}
|
|
<div class="card"><div class="card-body text-secondary">
|
|
This organization hasn't defined any configuration yet.{{if .CanEdit}} Use <strong>Edit</strong> to add a profile or region.{{end}}
|
|
</div></div>
|
|
{{else}}
|
|
<div class="row row-cards">
|
|
<!-- Main: selected profile's base settings + regions (only what's defined) -->
|
|
<div class="col-lg-8">
|
|
{{if .Config.Profiles}}
|
|
<div class="card">
|
|
<div class="card-header"><h2 class="card-title">{{.Config.Selected}} · base settings</h2></div>
|
|
<div class="card-body">{{template "step-list" .Config.SelectedSteps}}</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .Config.PreviewActive}}
|
|
<div class="card{{if .Config.Profiles}} mt-3{{end}}">
|
|
<div class="card-header"><h2 class="card-title">Regions</h2></div>
|
|
{{if .Config.RegionDef}}
|
|
<div class="card-body"><pre class="mb-0"><code>{{range .Config.RegionDef}}{{.}}
|
|
{{end}}</code></pre></div>
|
|
{{else}}
|
|
<div class="card-body text-secondary">No regions cover this location.</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
|
|
<!-- Sidebar: profile selector (if profiles) + a click-to-preview location map -->
|
|
<div class="col-lg-4">
|
|
{{if .Config.Profiles}}
|
|
<div class="card">
|
|
<div class="card-header"><h2 class="card-title">Profile</h2></div>
|
|
<div class="card-body">
|
|
<form method="get" action="/orgs/{{.Org.Slug}}/config">
|
|
<select class="form-select" name="profile" aria-label="Choose a configuration profile" data-autosubmit>
|
|
{{range .Config.Profiles}}<option value="{{.Name}}"{{if eq .Name $.Config.Selected}} selected{{end}}>{{.Name}}</option>{{end}}
|
|
</select>
|
|
{{if .PreviewLat}}<input type="hidden" name="lat" value="{{.PreviewLat}}">{{end}}
|
|
{{if .PreviewLon}}<input type="hidden" name="lon" value="{{.PreviewLon}}">{{end}}
|
|
</form>
|
|
<p class="text-secondary small mt-2 mb-0">
|
|
Pick the profile matching your hardware to see its base settings.{{if .Config.HasRegions}} A repeater's regions are assigned separately, by location.{{end}}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .Config.HasRegionShapes}}
|
|
<div class="card{{if .Config.Profiles}} mt-3{{end}}">
|
|
<div class="card-header"><h2 class="card-title">Preview a location</h2></div>
|
|
<div class="card-body p-2">
|
|
<link rel="stylesheet" href="{{ asset "/static/leaflet.css" }}">
|
|
<div id="region-map" style="height:240px" role="region" aria-label="Click the map to preview a repeater's region config"></div>
|
|
<script src="{{ asset "/static/leaflet.js" }}"></script>
|
|
<script src="{{ asset "/static/regionmap.js" }}"></script>
|
|
<script nonce="{{.Nonce}}">
|
|
regionMapView('region-map', {
|
|
pickURL: '/orgs/{{.Org.Slug}}/config?{{if .Config.Profiles}}profile={{.Config.Selected | urlquery}}&{{end}}',
|
|
{{if .Config.PreviewActive}}preview: {lat: {{.PreviewLat}}, lon: {{.PreviewLon}}},{{end}}
|
|
{{if .Config.MapBounds}}bounds: [[{{index .Config.MapBounds 0}}, {{index .Config.MapBounds 1}}], [{{index .Config.MapBounds 2}}, {{index .Config.MapBounds 3}}]]{{end}}
|
|
});
|
|
</script>
|
|
{{if .Config.PreviewActive}}
|
|
<div class="text-secondary small mt-2 text-center">{{template "icon-map-pin" "me-1"}}<span class="font-monospace">{{.PreviewLat}}, {{.PreviewLon}}</span></div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{/* step-list renders a sequence of ConfigStep as a copy-pasteable block. */}}
|
|
{{define "step-list"}}
|
|
{{if .}}<pre class="mb-0"><code>{{range .}}{{if .IsComment}}# {{.Comment}}{{else}}{{.CommandLine}}{{end}}
|
|
{{end}}</code></pre>{{else}}<div class="text-secondary">No steps.</div>{{end}}
|
|
{{end}}
|