DB & Dev Tools · Databases: connections, schemas, queries, structure, Redis
A new chapter, src/devtools. ConnectionManager lists saved connections with their engine and address, or why one failed, and connects on Enter; ConnectionForm fills a connection with a port checked from 1 to 65535, tests it and saves it. SchemaTree shows schemas, tables, views and fields with keys marked; ERDiagram draws tables and their foreign keys on NodeGraph, whose fixed wires show only the sockets that hold one. QueryHistory finds past runs and runs one again; QueryPlanViewer shows each step's share of the cost. TableStructureEditor edits fields in place; IndexManager lists and draws up indexes; RedisKeyBrowser finds keys by glob and lays out each type. QueryEditor is editor::CodeEditor, whose lexer now knows SQL's words, and QueryResultGrid is tables::DataGrid. lists::row_action keeps a row's button its own.
This commit is contained in:
1 parent
56ae76664f
commit
c137ddb0f7
20 files changed
+2602
-14
No files matched your search
@@ -22,6 +22,7 @@ pub use long::{InfiniteList, VirtualList};
|
||||
pub use outline::Outline;
|
||||
pub(crate) use sections::Sections;
|
||||
pub use select::SelectableList;
|
||||
pub(crate) use select::row_action;
|
||||
pub(crate) use select::{Pick, picked};
|
||||
pub use sortable::SortableList;
|
||||
pub use swipe::{SwipeAction, SwipeableListItem};
|
||||
|
||||
+19
-2
@@ -1,8 +1,8 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::{
|
||||
App, Div, ElementId, InteractiveElement, IntoElement, ParentElement, RenderOnce, ScrollHandle,
|
||||
SharedString, StatefulInteractiveElement, StyleRefinement, Styled, Window, div,
|
||||
App, Div, ElementId, InteractiveElement, IntoElement, MouseButton, ParentElement, RenderOnce,
|
||||
ScrollHandle, SharedString, StatefulInteractiveElement, StyleRefinement, Styled, Window, div,
|
||||
};
|
||||
|
||||
use super::ListItem;
|
||||
@@ -276,6 +276,23 @@ impl RenderOnce for SelectableList {
|
||||
}
|
||||
}
|
||||
|
||||
/// A button inside a pressable row: its press and its Space or Enter stay its own, so the row neither selects nor activates.
|
||||
pub(crate) fn row_action(button: impl IntoElement) -> gpui::Div {
|
||||
div()
|
||||
.flex_none()
|
||||
.on_mouse_down(MouseButton::Left, |_, window, cx| {
|
||||
window.prevent_default();
|
||||
cx.stop_propagation();
|
||||
})
|
||||
.on_key_down(|event, _, cx| {
|
||||
let key = event.keystroke.key.as_str();
|
||||
if matches!(key, "space" | "enter") && !event.keystroke.modifiers.modified() {
|
||||
cx.stop_propagation();
|
||||
}
|
||||
})
|
||||
.child(button)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gpui::SharedString;
|
||||
|
||||
Reference in new issue
Block a user