[#1223] lens/tui: Update help

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-08-14 11:19:22 +03:00
parent 79563454c9
commit 358083a539
No known key found for this signature in database
6 changed files with 82 additions and 58 deletions

View file

@ -0,0 +1 @@
[green::b]DESCRIPTION[-::-]

View file

@ -1 +1 @@
[green::b]Development[white::-] (Work in Progress)
[green::b]DEVELOPMENT[-::-]

View file

@ -0,0 +1,38 @@
[green::b]HOTKEYS[-::-]
[green::b]Navigation[-::-]
[yellow::b]Down Arrow[-::-] / [yellow::b]j[-::-]
Scroll down.
[yellow::b]Up Arrow[-::-] / [yellow::b]k[-::-]
Scroll up.
[yellow::b]Page Down[-::-] / [yellow::b]Ctrl-f[-::-]
Scroll down by a full page.
[yellow::b]Page Up[-::-] / [yellow::b]Ctrl-b[-::-]
Scroll up by a full page.
[green::b]Actions[-::-]
[yellow::b]Enter[-::-]
Perform actions based on the current context:
- In Buckets View:
- Expand/collapse the selected bucket to show/hide its nested buckets.
- If no nested buckets exist, navigate to the selected bucket's records.
- In Records View: Open the detailed view of the selected record.
[yellow::b]Escape[-::-]
Return to the previous page, opposite of [yellow::b]Enter[-::-].
Refer to the [green::b]SEARCHING[-::-] section for more specific actions.
[green::b]Alternative Action Hotkeys[-::-]
[yellow::b]Ctrl-r[-::-]
Directly navigate to the selected bucket's records.
[yellow::b]Ctrl-d[-::-]
Access the detailed view of the selected bucket.

View file

@ -1,27 +0,0 @@
[green::b]General Navigation[white::-]
[yellow::b]Down Arrow[white::-] / [yellow::b]j[white::-]
Scroll down.
[yellow::b]Up Arrow[white::-] / [yellow::b]k[white::-]
Scroll up.
[yellow::b]Page Down[white::-] / [yellow::b]Ctrl-f[white::-]
Scroll down by a full page.
[yellow::b]Page Up[white::-] / [yellow::b]Ctrl-b[white::-]
Scroll up by a full page.
[yellow::b]Enter[white::-]
Navigate to a nested view:
- In Buckets View: Navigate to the selected bucket's records.
- In Records View: Navigate to the selected record's detailed view.
[yellow::b]Escape[white::-]
Return to the previous page, opposite of [yellow::b]Enter[white::-].
[green::b]Buckets View Interactions[white::-]
[yellow::b]Space[white::-]
Expand or collapse the selected bucket to show or hide its nested buckets.

View file

@ -1,22 +1,26 @@
[green::b]Searching[white::-]
[green::b]SEARCHING[-::-]
[yellow::b]/[white::-]
Initiate the search prompt. The prompt follows this syntax: [yellow::b]<tag>:<args>[white::-].
- Any leading and trailing whitespace will be ignored.
- An empty prompt will return all results with no filters applied.
- Refer to the [green::b]Available Search Filters[white::-] section below for a list of valid filter tags.
[green::b]Hotkeys[-::-]
[yellow::b]Enter[white::-]
Execute the search based on the entered prompt.
- If the prompt is invalid, an error message will be displayed.
[yellow::b]/[-::-]
Initiate the search prompt.
- The prompt follows this syntax: [yellow::b]<tag>:<args>[-::-].
- Any leading and trailing whitespace will be ignored.
- An empty prompt will return all results with no filters applied.
- Refer to the [green::b]Available Search Filters[-::-] section below for a list of valid filter tags.
[yellow::b]Escape[white::-]
Exit the search prompt without performing a search.
[yellow::b]Enter[-::-]
Execute the search based on the entered prompt.
- If the prompt is invalid, an error message will be displayed.
[yellow::b]Down Arrow[white::-], [yellow::b]Up Arrow[white::-]
Scroll through the search history.
[yellow::b]Escape[-::-]
Exit the search prompt without performing a search.
[green::b]Available Search Filters[white::-]
[yellow::b]Down Arrow[-::-], [yellow::b]Up Arrow[-::-]
Scroll through the search history.
[green::b]Available Search Filters[-::-]
%s
To define a new filter, please refer to the [green::b]Development[white::-] section.
To define a new filter, please refer to the [green::b]DEVELOPMENT[-::-] section.

View file

@ -10,8 +10,11 @@ import (
)
var (
//go:embed help-pages/navigation.txt
navigationHelpText string
//go:embed help-pages/description.txt
descriptionHelpText string
//go:embed help-pages/hotkeys.txt
hotkeysHelpText string
//go:embed help-pages/searching.txt
searchingHelpText string
@ -36,19 +39,24 @@ func NewHelpPage(filters []string, hints map[string]string) *HelpPage {
filterHints: hints,
}
page := tview.NewTextView()
page.SetDynamicColors(true)
page.SetText(navigationHelpText)
page := tview.NewTextView().
SetDynamicColors(true).
SetText(descriptionHelpText)
hp.addPage(page)
page = tview.NewTextView()
page.SetDynamicColors(true)
page.SetText(fmt.Sprintf(searchingHelpText, hp.getFiltersText()))
page = tview.NewTextView().
SetDynamicColors(true).
SetText(hotkeysHelpText)
hp.addPage(page)
page = tview.NewTextView()
page.SetDynamicColors(true)
page.SetText(developmentHelpText)
page = tview.NewTextView().
SetDynamicColors(true).
SetText(fmt.Sprintf(searchingHelpText, hp.getFiltersText()))
hp.addPage(page)
page = tview.NewTextView().
SetDynamicColors(true).
SetText(developmentHelpText)
hp.addPage(page)
return hp
@ -60,7 +68,7 @@ func (hp *HelpPage) addPage(page *tview.TextView) {
func (hp *HelpPage) getFiltersText() string {
if len(hp.filters) == 0 {
return "\tNo filters defined.\n"
return "\t\tNo filters defined.\n"
}
filtersText := strings.Builder{}
@ -70,12 +78,12 @@ func (hp *HelpPage) getFiltersText() string {
for _, filter := range hp.filters {
tagMaxWidth = max(tagMaxWidth, len(filter))
}
filtersText.WriteString("\t[yellow::b]Tag")
filtersText.WriteString("\t\t[yellow::b]Tag")
filtersText.WriteString(strings.Repeat(" ", gapSize))
filtersText.WriteString("\tArgs[white::-]\n\n")
filtersText.WriteString("\tArgs[-::-]\n\n")
for _, filter := range hp.filters {
filtersText.WriteRune('\t')
filtersText.WriteString("\t\t")
filtersText.WriteString(filter)
filtersText.WriteString(strings.Repeat(" ", tagMaxWidth-len(filter)+gapSize))
filtersText.WriteString(hp.filterHints[filter])