mathesar icon indicating copy to clipboard operation
mathesar copied to clipboard

Add functionality to the Record Selector to support selecting a list of hyperlinks instead of a list of buttons

Open seancolsen opened this issue 1 year ago • 0 comments

Current behavior

  1. The Record Selector launches when RecordSelectorController.acquireUserInput is called.
  2. Each row within the Record Selector acts like a button.
  3. When the user clicks on a row, the Promise returned from acquireUserInput resolves to the id of the record that the user selected.

Use case not met by the current behavior

  • While acquireUserInput is good for getting a record id from the user (e.g. to save it in a cell value), in other contexts we'd like to use the Record Selector to navigate to a specific Record Page. For navigation, a hyperlink-row would be more appropriate than a button-row -- that way the user can open the Record Page link in a new tab.

Implementation

  1. Add a new property to RecordSelectorController called rowType which is 'button' | 'hyperlink'
  2. Add a new method to RecordSelectorController called navigateToRecordPage. When called it sets this.rowType to 'hyperlink'. This function will be similar to acquireUserInput except that it doesn't need to return a Promise.
  3. When calling acquireUserInput, set this.rowType to 'button'.
  4. Within some of the lower-level components, changes based on rowType to use hyperlinks for rows.

seancolsen avatar Aug 11 '22 21:08 seancolsen