gadget-bot / gadget-bot/gadget

Admin UI: Routes, Groups, Users, and Config pages

Open
#74 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
2
Forks
2
Avg merge
21d 49m
Merged PRs (30d)
1

Description

Parent: #69
Depends on: #70, #72

## Scope

### Routes page (`GET /admin/routes`)

**Data:** Calls existing `router.RegisteredRoutes()` (`router/router.go:255`) which returns `[]RegisteredRoute` already sorted by priority then name. No DB query needed.

**Table columns:** Type (mention/channel_message/slash_command), Name, Pattern (monospace), Description, Permissions (badges), Priority

```go
type RoutesData struct {
PageTitle string
ActivePage string
Routes []router.RegisteredRoute // reuse existing type
}
```

### Groups page (`GET /admin/groups`)

**Data:** `db.Preload("Members").Find(&groups)` — single query with eager load.

Member expansion uses native `/` HTML elements — no JavaScript needed, progressive disclosure.

```go
type GroupView struct {
ID uint
Name string
MemberCount int
Members []MemberView
CreatedAt time.Time
}

type MemberView struct {
ID uint
Uuid string // Slack user ID
}
```

### Users page (`GET /admin/users`)

**Data:** `db.Preload("Groups").Find(&users)` — single query with eager load.

Group names rendered as inline badge/pill elements.

```go
type UserView struct {
ID uint
Uuid string // Slack user ID
Groups []string // group names
CreatedAt time.Time
}
```

### Config page (`GET /admin/config`)

**Data:** Reads known env vars via `os.Getenv()`. Does NOT read arbitrary env vars.

```go
type ConfigEntry struct {
Key string
Value string
Sensitive bool
}
```

**Sensitive keys** (show only "••••••" + set/unset status):
- `SLACK_OAUTH_TOKEN`
- `SLACK_SIGNING_SECRET`
- `GADGET_DB_PASS`
- `GADGET_ADMIN_TOKEN`
- `GADGET_ADMIN_CLIENT_SECRET`

**Non-sensitive keys** (show actual value):
- `GADGET_LISTEN_PORT`
- `GADGET_LOG_LEVEL`
- `GADGET_DB_HOST`
- `GADGET_DB_NAME`
- `GADGET_DB_USER`
- `GADGET_GLOBAL_ADMINS`
- `GADGET_ADMIN_CLIENT_ID`

Table layout: Key, Value, Status (set/unset indicator)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading parent issue #69 and dependencies #70 and #72, then inspect router/router.go:255 for the Routes page data source. Implement the four listed admin endpoints and verify that each table matches the specified fields, eager loads groups or members where required, and masks the five sensitive configuration keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.