~emersion/drmdb

a85c27af65ce9e831bcaf14da813dc24b495d376 — Simon Ser 4 months ago bd3e1f9
Filter capabilities by driver name
2 files changed, 8 insertions(+), 2 deletions(-)

M public/capabilities.html
M server.go
M public/capabilities.html => public/capabilities.html +2 -2
@@ 12,7 12,7 @@
          <tr>
              <th>Capability</th>
              {{range .Drivers}}
              <th>{{.}}</th>
              <th><a href="?driver={{.}}" title="Only show {{.}} capabilities">{{.}}</a></th>
              {{end}}
          </tr>
      </thead>


@@ 39,7 39,7 @@
          <tr>
              <th>Client capability</th>
              {{range .Drivers}}
              <th>{{.}}</th>
              <th><a href="?driver={{.}}" title="Only show {{.}} capabilities">{{.}}</a></th>
              {{end}}
          </tr>
      </thead>

M server.go => server.go +6 -0
@@ 258,11 258,17 @@ func New() *echo.Echo {
	})

	e.GET("/capabilities", func(c echo.Context) error {
		driverName := c.QueryParam("driver")

		var drivers []string
		caps := make(map[string]map[string]*uint64)
		clientCaps := make(map[string]map[string]bool)
		err := walkLatest(db, walkLatestDriver, func(k string, n *drmtree.Node) error {
			drv := n.Driver.Name
			if driverName != "" && drv != driverName {
				return nil
			}

			drivers = append(drivers, drv)

			for name, val := range n.Driver.Caps {