webui_messages.go RawHistoryFolder

1package port
2
3// WebUI message types exchanged between internal pages and Go handlers.
4// Both the handler registries and the systemviews bridge use these names,
5// so a rename or a new message only has to be declared here.
6const (
7	MsgHistoryTimeline         = "history_timeline"
8	MsgHistoryTimelineByDomain = "history_timeline_by_domain"
9	MsgHistoryTimelineWindow   = "history_timeline_window"
10	MsgHistorySearchFTS        = "history_search_fts"
11	MsgHistoryDeleteEntry      = "history_delete_entry"
12	MsgHistoryDeleteRange      = "history_delete_range"
13	MsgHistoryClearAll         = "history_clear_all"
14	MsgHistoryStats            = "history_stats"
15	MsgHistoryAnalytics        = "history_analytics"
16	MsgHistoryDomainStats      = "history_domain_stats"
17	MsgHistoryDeleteDomain     = "history_delete_domain"
18
19	MsgFavoriteList          = "favorite_list"
20	MsgFavoriteCreate        = "favorite_create"
21	MsgFavoriteUpdate        = "favorite_update"
22	MsgFavoriteDelete        = "favorite_delete"
23	MsgFavoriteSetShortcut   = "favorite_set_shortcut"
24	MsgFavoriteGetByShortcut = "favorite_get_by_shortcut"
25
26	MsgTagList   = "tag_list"
27	MsgTagCreate = "tag_create"
28	MsgTagDelete = "tag_delete"
29	MsgTagUpdate = "tag_update"
30	MsgTagAssign = "tag_assign"
31	MsgTagRemove = "tag_remove"
32
33	MsgSaveConfig          = "save_config"
34	MsgGetKeybindings      = "get_keybindings"
35	MsgSetKeybinding       = "set_keybinding"
36	MsgResetKeybinding     = "reset_keybinding"
37	MsgResetAllKeybindings = "reset_all_keybindings"
38)
39
40// WebUICallbacks names the JS functions that receive a message's result.
41type WebUICallbacks struct {
42	Success string
43	Failure string
44}
45
46// Homepage callbacks shared by every history, favorite and tag message.
47var homepageCallbacks = WebUICallbacks{Success: "__dumber_homepage_response", Failure: "__dumber_error"}
48
49// WebUIMessageCallbacks is the single source of truth for which JS callbacks
50// answer each WebUI message. Handlers register with these callbacks and the
51// systemviews bridge waits on them.
52var WebUIMessageCallbacks = map[string]WebUICallbacks{
53	MsgHistoryTimeline:         homepageCallbacks,
54	MsgHistoryTimelineByDomain: homepageCallbacks,
55	MsgHistoryTimelineWindow:   homepageCallbacks,
56	MsgHistorySearchFTS:        homepageCallbacks,
57	MsgHistoryDeleteEntry:      homepageCallbacks,
58	MsgHistoryDeleteRange:      homepageCallbacks,
59	MsgHistoryClearAll:         homepageCallbacks,
60	MsgHistoryStats:            homepageCallbacks,
61	MsgHistoryAnalytics:        homepageCallbacks,
62	MsgHistoryDomainStats:      homepageCallbacks,
63	MsgHistoryDeleteDomain:     homepageCallbacks,
64
65	MsgFavoriteList:          homepageCallbacks,
66	MsgFavoriteCreate:        homepageCallbacks,
67	MsgFavoriteUpdate:        homepageCallbacks,
68	MsgFavoriteDelete:        homepageCallbacks,
69	MsgFavoriteSetShortcut:   homepageCallbacks,
70	MsgFavoriteGetByShortcut: homepageCallbacks,
71
72	MsgTagList:   homepageCallbacks,
73	MsgTagCreate: homepageCallbacks,
74	MsgTagDelete: homepageCallbacks,
75	MsgTagUpdate: homepageCallbacks,
76	MsgTagAssign: homepageCallbacks,
77	MsgTagRemove: homepageCallbacks,
78
79	MsgSaveConfig:          {Success: "__dumber_config_saved", Failure: "__dumber_config_error"},
80	MsgGetKeybindings:      {Success: "__dumber_keybindings_loaded", Failure: "__dumber_keybindings_error"},
81	MsgSetKeybinding:       {Success: "__dumber_keybinding_set", Failure: "__dumber_keybinding_set_error"},
82	MsgResetKeybinding:     {Success: "__dumber_keybinding_reset", Failure: "__dumber_keybinding_reset_error"},
83	MsgResetAllKeybindings: {Success: "__dumber_keybindings_reset_all", Failure: "__dumber_keybindings_reset_all_error"},
84}
85
86// RegisterWebUIMessage registers handler for msgType using the callbacks
87// declared in WebUIMessageCallbacks, in the main world.
88func RegisterWebUIMessage(router WebUIHandlerRouter, msgType string, handler WebUIMessageHandler) error {
89	cb, ok := WebUIMessageCallbacks[msgType]
90	if !ok {
91		return &UnknownWebUIMessageError{Type: msgType}
92	}
93	return router.RegisterHandlerWithCallbacks(msgType, cb.Success, cb.Failure, "", handler)
94}
95
96// UnknownWebUIMessageError reports a message type missing from the contract.
97type UnknownWebUIMessageError struct{ Type string }
98
99func (e *UnknownWebUIMessageError) Error() string {
100	return "unknown webui message type: " + e.Type
101}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close