~emersion/drmdb

bd3e1f90e7eaa1c7c0c91f817df19705f39c02ef — Simon Ser 4 months ago e08b971
Filter properties by driver name
2 files changed, 7 insertions(+), 1 deletions(-)

M public/properties.html
M server.go
M public/properties.html => public/properties.html +1 -1
@@ 12,7 12,7 @@
              <th>Type</th>
              <th>Attached to</th>
              {{range $name, $_ := .Drivers}}
              <th>{{$name}}</th>
              <th><a href="?driver={{$name}}" title="Only show {{$name}} properties">{{$name}}</a></th>
              {{end}}
          </tr>
      </thead>

M server.go => server.go +6 -0
@@ 308,10 308,16 @@ func New() *echo.Echo {
			}
		}

		driverName := c.QueryParam("driver")

		drivers := make(map[string]struct{})
		props := make(map[string]propertyData)
		err := db.Walk(func(k string, n *drmtree.Node) error {
			drv := n.Driver.Name
			if driverName != "" && drv != driverName {
				return nil
			}

			drivers[drv] = struct{}{}

			return walkNodeProps(n, func(obj drm.AnyID, name string, prop *drmtree.Property) error {