feat(console): lite backend command-reference modal
Give the lite console the parity analog of the full-node RPC command reference: the same searchable two-pane modal (browse/search, detail pane, examples, Insert / Insert & run, destructive confirm), driven by the lite backend's own command set instead of daemon RPC. - ConsoleCommandExecutor::commandReference() returns the category table (full node = consoleCommandCategories(); lite = new liteConsoleCommandCategories() -- 25 backend verbs in 5 categories). The shared renderCommandsPopup reads the table from the executor. - The Commands button now shows for both variants (gated on commandReference()!=nullptr); title/tooltip/arg-quoting branch on hasRpcReference() (clarified to mean "speaks JSON-RPC / full node"). - Lite args are bare tokens (the backend takes one unsplit arg string and does not strip quotes), so the param-builder's JSON string auto-quoting is disabled for lite -- Insert & run emits runnable bare commands. send uses the JSON-array form (its positional form is unreachable via the single-arg transport); new uses zs/R; import takes just the key (the backend hardcodes birthday=0). Adds 7 i18n keys across all 8 languages (additive). Full-node behavior is unchanged. Adversarially reviewed (data vs the backend registry, plumbing/regression, i18n) with all findings fixed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,10 +44,11 @@ public:
|
||||
void render(ConsoleCommandExecutor& exec);
|
||||
|
||||
/**
|
||||
* @brief Render the RPC Command Reference popup at top-level scope.
|
||||
* Must be called outside any child window so the modal blocks all input.
|
||||
* @brief Render the command-reference popup at top-level scope.
|
||||
* Must be called outside any child window so the modal blocks all input. `exec` supplies the
|
||||
* reference table (full-node RPC vs lite backend verbs); may be null (no console yet) -> no-op.
|
||||
*/
|
||||
void renderCommandsPopupModal();
|
||||
void renderCommandsPopupModal(ConsoleCommandExecutor* exec);
|
||||
|
||||
// Debug/UI-sweep hook: force the RPC command-reference popup open/closed so the full UI sweep
|
||||
// can capture it (the popup is otherwise opened only by a toolbar button).
|
||||
@@ -115,8 +116,9 @@ private:
|
||||
// Format a completed command result (JSON role -> channel) into console lines.
|
||||
void addFormattedResult(const std::string& result, bool is_error);
|
||||
void renderStatusHeader(ConsoleCommandExecutor& exec);
|
||||
void renderCommandsPopup();
|
||||
void renderCommandDetail(const ConsoleCommandEntry& cmd, const char* catLabel); // right pane
|
||||
void renderCommandsPopup(ConsoleCommandExecutor& exec);
|
||||
// right pane; jsonArgs=true (full-node RPC) auto-quotes string args, false (lite) inserts bare
|
||||
void renderCommandDetail(const ConsoleCommandEntry& cmd, const char* catLabel, bool jsonArgs);
|
||||
void insertCommandToInput(const ConsoleCommandEntry& cmd); // fill input + close the modal
|
||||
|
||||
// renderToolbar() draws the top bar; these are its sub-steps:
|
||||
@@ -186,10 +188,11 @@ private:
|
||||
// consumed by the renderer + hit-testing.
|
||||
mutable ConsoleLayout layout_;
|
||||
|
||||
// Commands popup (RPC command explorer)
|
||||
// Commands popup (command explorer) — indexes into the active executor's commandReference()
|
||||
// table (full-node RPC commands or the lite backend verbs), not always the full-node one.
|
||||
bool show_commands_popup_ = false;
|
||||
char command_search_[128] = {0}; // RPC-reference search filter (cleared when the modal opens)
|
||||
int cmd_sel_cat_ = -1; // detail-pane selection: category index into consoleCommandCategories()
|
||||
char command_search_[128] = {0}; // reference search filter (cleared when the modal opens)
|
||||
int cmd_sel_cat_ = -1; // detail-pane selection: category index into that table
|
||||
int cmd_sel_idx_ = -1; // detail-pane selection: command index within that category
|
||||
std::string pending_submit_; // command to run next frame (deferred so the modal needs no executor)
|
||||
const ConsoleCommandEntry* run_confirm_cmd_ = nullptr; // destructive "Insert & run" awaiting confirmation
|
||||
|
||||
Reference in New Issue
Block a user