Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AJ-1277] select and delete rows #5090

Closed
wants to merge 24 commits into from
Closed

Conversation

mspector
Copy link
Contributor

@mspector mspector commented Sep 18, 2024

Jira Ticket: https://broadworkbench.atlassian.net/browse/AJ-1277

Summary of changes:

What

  • Adds support to select and delete rows in a WDS data table

Why

  • progress towards WDS feature parity

Testing strategy

  • Unit tests
  • Manual tests against dev

@mspector mspector marked this pull request as ready for review September 19, 2024 19:08
@mspector mspector requested a review from a team as a code owner September 19, 2024 19:08
@mspector mspector marked this pull request as draft September 19, 2024 19:14
@mspector mspector marked this pull request as ready for review September 19, 2024 19:57
src/libs/ajax/WorkspaceDataService.ts Outdated Show resolved Hide resolved
setDeletingRecords(false);
setSelectedRecords({});
setRefreshKey(_.add(1));
Ajax().Metrics.captureEvent(Events.workspaceDataDelete, extractWorkspaceDetails(workspace.workspace));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that we are capturing the deletion event

src/workspace-data/data-table/wds/RecordDeleter.js Outdated Show resolved Hide resolved
@@ -177,7 +183,7 @@ export class WdsDataTableProvider implements DataTableProvider {
supportsExport: false,
supportsPointCorrection: false,
supportsFiltering: false,
supportsRowSelection: false,
supportsRowSelection: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this set to true, we render the "select all" option in the data table. Selecting that option causes an error for WDS-powered data tables.

mspector and others added 2 commits September 25, 2024 16:44
Co-authored-by: Kevin Marete <49183352+kevinmarete@users.noreply.github.com>
Co-authored-by: Kevin Marete <49183352+kevinmarete@users.noreply.github.com>
Copy link

sonarcloud bot commented Sep 30, 2024

import { reportError } from 'src/libs/error';
import * as Utils from 'src/libs/utils';

export const RecordDeleter = ({ onDismiss, onSuccess, dataProvider, collectionId, selectedRecords, runningSubmissionsCount }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason why this is .js instead of .ts? I'd love for new files to be .ts so we don't have to convert them later!

return onDismiss();
}

// Handle 409 error by filtering additional deletions that need to be deleted first
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this in case of references? Or why would they need to be deleted first?


const moreToDelete = !!additionalDeletions.length;

const total = selectedKeys.length + additionalDeletions.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this additionalDeletions also be checked with !!?

@calypsomatic
Copy link
Contributor

If I run this branch against your AJ-1277_delete-records-capabilities WDS branch, I get an error when I try to delete a record - on WDS's end it shows that it gets the request with no errors, but the response returned to the UI is { "error": "Bad Request", "message": "Failed to read request", "status": 400, "timestamp": "2024-09-30T13:39:57.320+00:00", "path": "/records/v1/f6f984a9-3bbe-48b9-9389-bf73f8d2f558/primary/delete" }. Is there something further I need to do to get this set up to work?

@calypsomatic
Copy link
Contributor

Ok I think there's a mismatch between the format of the deleteRecordsRequest in the front end and backend. In the backend, everything is camel case: recordIds, front-end is snake cake: record_ids. But once I changed that there were still problems: recordIds should be a list of strings, the record ids, but the front end is passing in a list of objects with keys entityName and entityType.

@davidangb davidangb marked this pull request as draft October 2, 2024 13:11
@davidangb davidangb closed this Oct 21, 2024
@davidangb davidangb deleted the AJ-1277_select-and-delete-rows branch October 21, 2024 14:25
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.

5 participants