mathesar icon indicating copy to clipboard operation
mathesar copied to clipboard

Add keyboard shortcuts for setting a cell to NULL

Open seancolsen opened this issue 3 years ago • 19 comments

Desired behavior

  1. Select a cell.
  2. Press Shift+Delete or Shift+Backspace.
  3. The cell value will be set to NULL, with Mathesar exhibiting the same loading, success, and error behavior as it currently does when the user updates a value within a cell.

Notes

  • The keyboard shortcuts should only be active when in select mode -- in edit mode there should not be any keyboard shortcuts for the user to set the cell value to NULL.

  • If the column has a NOT NULL constraint, then an error toast message should show before a request is sent to the server, and no changes should be made.

    The toast message should read:

    <column_name> does not allow NULL.

    Within the toast message, the The column name should be stylized with the Identifier component and NULL should be stylized with the Null component.

  • If the cell is already NULL, then no request should be sent to the server and no toast message should display.

Additional context

See also

  • #930

seancolsen avatar Jan 03 '22 14:01 seancolsen

hi @seancolsen can I work on this

nk183 avatar Apr 02 '22 11:04 nk183

Go ahead @nk183, thanks!

kgodey avatar Apr 02 '22 15:04 kgodey

@nk183 Are you still working on this? We'll be working to close out this milestone soon, so we'll need to re-assign it to a core team member if we don't get a PR by 2022-04-19. Thanks.

seancolsen avatar Apr 14 '22 16:04 seancolsen

hi @seancolsen can I work on this?

KasukabeDefenceForce avatar Feb 16 '23 06:02 KasukabeDefenceForce

Assigned to you @AbhinavOhri. Thanks!

Anish9901 avatar Feb 16 '23 07:02 Anish9901

hi @Anish9901, I need some help on this. I have figured out the part of how to run the keyboard shortcut but I am unable to figure the file where I should make the desired changes and how to check whether the edit mode is enabled or not.

KasukabeDefenceForce avatar Feb 16 '23 10:02 KasukabeDefenceForce

I have completed setting up the keyboard shortcut. But I could not figure it out the "NOT NULL constraint" segment , can you please guide me on that?

KasukabeDefenceForce avatar Feb 16 '23 19:02 KasukabeDefenceForce

@AbhinavOhri Each Column instance has a nullable: boolean; property. If this is true, it means that the column accepts null as a valid value in the database. If it's false, it means that the column does not allow null.

Refer BaseColumn interface within mathesar_ui/src/api/types/tables/columns.ts/ for the type definitions. You can see that there's a method setNullabilityOfColumn in mathesar_ui/src/stores/table-data/columns.ts which sends requests to update this column property.

As part of this issue, if the column does not allow null, you should be showing a toast message and not send any requests. If it allows null, you can set the value in the cell to null and the requests should be handled by code that's already in place.

pavish avatar Feb 28 '23 15:02 pavish

Hey @Anish9901 Because it has been 2 weeks since an update, can I work on this?

ParthShirole avatar Mar 05 '23 05:03 ParthShirole

Go ahead @ParthShirole

Anish9901 avatar Mar 06 '23 13:03 Anish9901

@Anish9901 I am still working on this. I am done setting up the keybind. I had some doubts about the not null constraint due to which I did not open a draft PR.

KasukabeDefenceForce avatar Mar 06 '23 13:03 KasukabeDefenceForce

I had some doubts about the not null constraint due to which I did not open a draft PR.

I understand that @AbhinavOhri but opening a draft PR helps us to keep track of the progress and since there wasn't one I assumed that no progress was made. Anyway, feel free to open a PR.

Anish9901 avatar Mar 06 '23 13:03 Anish9901

Assigned this back to @AbhinavOhri since there's a PR open.

kgodey avatar Mar 06 '23 19:03 kgodey

can i work on this

Fares-Basousy avatar Apr 01 '23 15:04 Fares-Basousy

@Fares-Basousy there's already a PR under review for this. Please choose another issue.

rajatvijay avatar Apr 03 '23 06:04 rajatvijay

Hi, @Anish9901 can I work on this. as the last PR is in waiting for one month?

Pulkit0729 avatar Jul 01 '23 07:07 Pulkit0729

@Pulkit0729 I think @rajatvijay is taking care of this issue. You can look through other issues to fix.

Anish9901 avatar Jul 03 '23 15:07 Anish9901

Hello @Anish9901 May I take up the task and work on this issue since it is pending yet?

siddhiagarkar avatar Oct 06 '23 06:10 siddhiagarkar

Hey @siddhiagarkar, this issue is being worked on by one of our core team member and is therefore not up for grabs, please find other issues that might interest you.

Anish9901 avatar Oct 06 '23 06:10 Anish9901