~emersion/drmdb

8122e062f3db2ea9a03700cdbcbf7c8714025c79 — Simon Ser 29 days ago 6186466
Add driver filter to device list
2 files changed, 9 insertions(+), 1 deletions(-)

M public/devices.html
M server.go
M public/devices.html => public/devices.html +3 -1
@@ 31,7 31,9 @@
            {{else}}
            <td class="status-unknown">?</td>
            {{end}}
            <td class="pre">{{.Driver}}</td>
            <td class="pre">
                <a href="?driver={{.Driver}}" title="Only show {{.Driver}} devices">{{.Driver}}</a>
            </td>
        </tr>
        {{end}}
    </tbody>

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

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

		type deviceData struct {
			Key     string
			BusID   string


@@ 140,6 142,10 @@ func New() *echo.Echo {

		var devices []deviceData
		err := walkLatest(walkLatestDevice, func(k string, n *drmtree.Node) error {
			if driverFilter != "" && n.Driver.Name != driverFilter {
				return nil
			}

			data := deviceData{
				Key:     k,
				BusID:   n.Device.BusID(),