Skip to content

Upgrade table viewer#12

Open
congchuahiep wants to merge 10 commits into
mainfrom
feat/table-viewer-upgrade
Open

Upgrade table viewer#12
congchuahiep wants to merge 10 commits into
mainfrom
feat/table-viewer-upgrade

Conversation

@congchuahiep

Copy link
Copy Markdown
Owner

close #10

- Add render_tr method for stripe styling using theme's table_even color instead
  of table-level stripe config
- Migrate hardcoded colors to theme tokens: danger_foreground for deleted rows,
  warning for edited cells background
- Add warning.background to theme with yellow color (#fff085)
- Add mono_font_family to data table container and configure row_header(false)
  in TableState
- Refactor cell rendering to use outer/inner div pattern for consistent styling
  structure
- Update connection window to use flex_grow() instead of flex_1() and add
  text_ellipsis_start() stub
- Add loading spinner and close button support to Tab component; loading
  uses Spinner from gpui-component
- Extract close button logic from TabBar into Tab with on_close callback
- Add error state field to GridState and wire up TableViewerTab error
  handling
- Add error view to SmartDataGrid with warning icon when errors occur
- Add triangle-warning-fill.svg icon asset
- Update danger.foreground color in theme to warning yellow (#F0B100)
- Add RowInsert struct with values field to schema module and export it from
  engine lib
- Extend DataChangeset struct to include inserts: Vec<RowInsert> field
- Implement INSERT statement generation in generate_changeset_script method; for
  each insert,
  build column list and values from ColumnData entries and format as "INSERT
  INTO ... VALUES ..."
- Add test case for insert operation in SQLite driver to verify changeset script
  generation
- Add AddRow, DeleteRow, and DiscardChanges actions to datagrid module
- Implement pending_inserts handling in DataChangesetBuilder to generate
  RowInsert entries for new rows
- Update GridDelegate rows_count to include pending_inserts and modify cell
  rendering to show inserted rows with green background and deleted rows with
  red strikethrough styling
- Add GridState helper methods: is_inserted_row, is_deleted_row, insert_index,
  original_len, total_len, cell_value
- Implement on_add_row to append empty row to pending_inserts, on_delete_row to
  remove inserted rows or toggle pending_deletes for original rows
- Fix on_confirm_edit to handle edits on inserted rows by updating
  pending_inserts directly instead of pending_edits
- Wire toolbar buttons (Add, Delete, Discard) to their respective action
  handlers
- Update theme colors with success.background and adjusted danger/warning
  opacity for better visual distinction
- Add focus_handle field to SmartDataGrid and use it for action dispatching
  instead of window.dispatch_action
- Enable row_header(false) in table configuration
- Fix on_delete_row to delete selected cell's row when no row is explicitly
  selected, improving UX consistency
- Add track_focus to main view for proper focus context management
- Add RowInsert import to sqlite tests
- Update danger.background in theme with alpha channel for consistency with
  other semi-transparent colors
- Refactor grid state types to use Option<SharedString> for nullable cells;
  pending_edits, pending_inserts, and original_rows now store optional values.
- Introduce DataTypeCategory enum with categories (Text, Integer, Float,
  Boolean, DateTime, Binary, Uuid, Unknown) defining UI behavior, empty input
  handling, and validation rules.
- Update SqlDialect::format_value to accept Option<&str> and DataTypeCategory
  for proper NULL/empty string serialization per type.
- Simplify cell rendering in GridDelegate using match on (is_edited, is_null)
  with distinct styling for NULL values (italic, muted) versus empty strings.
- Remove unused EngineError import and dead validate_sql_type function; add
  cell_original_value helper method to GridState.
- Introduce GridError enum with Fatal, Commit, and None variants to properly
  categorize grid errors and enable fine-grained error display logic.
- Update GridState.error field from Option<SharedString> to GridError type;
  initialize as GridError::None in constructor.
- Add is_fatal() and message() methods to GridError for convenient error state
  checks and message retrieval.
- Refactor SmartDataGrid rendering to use when_else with is_fatal() check: show
  error overlay only for fatal errors, otherwise render data table.
- Apply GridError::Fatal in TableViewerTab when table loading fails; update
  data_changeset_builder to remove unused SharedString import.
- Extract data source abstraction into GridDataSource enum with Table and Query
  variants to support multiple data sources beyond TableViewer
- Move data loading logic from TableViewerTab to SmartDataGrid::load() for
  better encapsulation; TableViewerTab now only handles grid initialization
- Add schema caching to SqlClient using Arc<RwLock<HashMap>> with
  get_table_info_cached() method to avoid redundant schema queries
- Rename GridState::is_editable() to can_edit() and add
  can_paginate()/can_insert() methods for clearer intent
- Add GridError::Refresh variant to distinguish refresh failures from fatal
  errors; update error message handling accordingly
- Update DataChangesetBuilder and SmartDataGrid constructors to accept
  GridDataSource instead of raw table name
- Fix editing activation to check can_edit() and loading state before allowing
  cell edits
- Introduce GridFetchState enum (Idle, Loading, Loaded, Error) to replace
  separate is_loading and error fields in GridState for better state tracking
- Remove GridError::None variant and update GridError message() to only handle
  actual error cases
- Consolidate set_loading and set_error methods into single set_fetch_state
  method for unified state management
- Update SmartDataGrid load() to use has_displayable_data() helper for
  determining if refresh error should be treated as fatal or recoverable
- Add helper methods to GridFetchState (is_loading, is_idle, is_loaded,
  is_error, is_fatal, has_displayable_data, as_error) for convenient state
  checks
- Update TableViewerTab and SmartDataGrid render to use fetch_state.is_loading()
  and fetch_state methods for error display
- Remove limit and offset fields from GridState struct and its default
  implementation to reduce state duplication
- Add limit and offset fields directly to GridDataSource::Table enum variant
  to keep pagination config close to its data source
- Update TableViewerTab to pass limit: 1000 and offset: 0 when creating
  GridDataSource::Table
- Refactor SmartDataGrid to read limit and offset directly from the data source
  instead of accessing GridState
- Simplify source_table() method using `..` pattern for GridDataSource::Table
  destructuring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display NULL value correctly in DataGrid

1 participant