mirror of
https://github.com/MeshTender/MeshTender.git
synced 2026-09-17 00:44:20 +00:00
Get rid of recommended config from console page
This commit is contained in:
@@ -486,39 +486,3 @@ func regionViews(regions []store.Region) []configRegionView {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// repeaterProfiles is an org's region-def commands resolved for a specific
|
||||
// repeater's location, for the console reference block. Base-settings profiles are
|
||||
// a viewing choice on the org config page, so they aren't auto-applied here.
|
||||
type repeaterProfiles struct {
|
||||
OrgName string
|
||||
OrgSlug string
|
||||
Commands []string
|
||||
}
|
||||
|
||||
// resolvedProfilesForRepeater returns, for each org the repeater is contributed to
|
||||
// whose regions cover the repeater's location, the `region def`/`region save`
|
||||
// commands to apply that region hierarchy.
|
||||
func (s *Handlers) resolvedProfilesForRepeater(r *http.Request, rep *store.Repeater) []repeaterProfiles {
|
||||
orgs, err := s.Store.ListRepeaterOrgs(r.Context(), rep.ID)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
var out []repeaterProfiles
|
||||
for _, o := range orgs {
|
||||
regions, err := s.Store.ListRegions(r.Context(), o.OrgID)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
rootAllow, err := s.Store.RootAllowFlood(r.Context(), o.OrgID)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
cmds := store.RegionDefCommands(regions, rootAllow, rep.Latitude, rep.Longitude)
|
||||
if len(cmds) == 0 {
|
||||
continue
|
||||
}
|
||||
out = append(out, repeaterProfiles{OrgName: o.OrgName, OrgSlug: o.OrgSlug, Commands: cmds})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -156,9 +156,6 @@ func (s *Handlers) pageConsole(w http.ResponseWriter, r *http.Request) {
|
||||
s.Render(w, r, "console.html", map[string]any{
|
||||
"Repeater": rep,
|
||||
"Commands": allowed,
|
||||
// Recommended configuration from each org this repeater is contributed to,
|
||||
// resolved for the repeater's location (region commands vary by lat/lon).
|
||||
"Profiles": s.resolvedProfilesForRepeater(r, rep),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -53,22 +53,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .Profiles}}
|
||||
{{range .Profiles}}
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Recommended configuration · {{.OrgName}}</h3>
|
||||
<a class="card-subtitle ms-auto" href="/orgs/{{.OrgSlug}}/config">View profile</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="text-secondary">These are the commands {{.OrgName}} recommends for this repeater's location. Copy them into the console above.</p>
|
||||
<pre class="mb-0"><code>{{range .Commands}}{{.}}
|
||||
{{end}}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<a class="back-link mt-3" href="/">{{template "icon-arrow-left" "me-1"}}Back to dashboard</a>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user