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

feat(crud): Bulk update modal COMPASS-7325 #5007

Merged
merged 25 commits into from
Nov 1, 2023
Merged

feat(crud): Bulk update modal COMPASS-7325 #5007

merged 25 commits into from
Nov 1, 2023

Conversation

lerouxb
Copy link
Contributor

@lerouxb lerouxb commented Oct 19, 2023

Screenshot 2023-10-20 at 14 31 17

Not very many tests yet, but adding the toast will properly test in-progress, done and error states. And we'll add e2e tests in a later ticket.

There's also probably some duplication between this and the delete modal that we can clean up separately as well.

@lerouxb lerouxb added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Oct 20, 2023
@lerouxb lerouxb changed the title [WIP] Bulk update modal feat(crud): Bulk update modal COMPASS-7325 Oct 20, 2023
@github-actions github-actions bot added the feat label Oct 20, 2023
@lerouxb lerouxb marked this pull request as ready for review October 20, 2023 15:44

let preview;
try {
// TODO(COMPASS-7369): we should automatically retry if the get "Write
Copy link
Contributor Author

Choose a reason for hiding this comment

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

☝️

// conflict during plan execution and yielding is disabled."
preview = await this.dataService.previewUpdate(ns, filter, update, {
sample: 3,
// TODO(COMPASS-7368): aborting the in-flight operation is still buggy,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

☝️

return;
}

// TODO(COMPASS-7327): in-progress, success, error in toast
Copy link
Contributor Author

Choose a reason for hiding this comment

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

☝️

@@ -2113,7 +2128,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
result = await raceWithAbort(start(session), abortSignal);
} catch (err) {
if (isCancelError(err)) {
void abort();
await abort();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea why we didn't do this before.

Copy link
Contributor

Choose a reason for hiding this comment

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

because we didn't want to throw if abort failed. now that you changed it, should we catch about error and then continue to throw err, which is relevant in our case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We already wrote abort in a way such that it won’t throw, and if it does, that’s a genuine programming error then that we should raise, right?

await session.abortTransaction();
await session.endSession();
} catch (err: any) {
if (isTransactionAbortError(err)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We might be able to avoid this if we check if the transaction has been aborted or the session otherwise closed after every async call above, but I don't think we can really avoid that. The session can be aborted/killed at any point if we pass in an abortSignal.

});

const codeLightContainerStyles = css({
backgroundColor: palette.gray.light3,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure how this correlates with the styles below: this is exactly the same color we use in the editor? Is it only the dark mode that's different? Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To match the design. Otherwise it is white. We do the exact same thing in the aggregation stage editor:

There's a ticket to refactor that so we don't keep duplicating it along with the banner area at the bottom.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure I follow, default multiline background is the same gray color:

backgroundColor: codePalette.light[0],

Sounds good if we're planning to do a follow-up clean up for this 👍

}: BulkUpdateDialogProps) {
const darkMode = useDarkMode();

const [text, setText] = useState(updateText);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't look like we reset this when modal is re-opened, is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup.

Copy link
Collaborator

@gribnoysup gribnoysup Nov 1, 2023

Choose a reason for hiding this comment

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

Maybe worth leaving a comment that it's on purpose, we have a bunch of modal forms where we reset forms on modal open, I'm worried we can loose this behavior by accident

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

Left a few small comments, but otherwise looks good!

@lerouxb lerouxb merged commit 077e995 into main Nov 1, 2023
5 checks passed
@lerouxb lerouxb deleted the bulk-update-modal branch November 1, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat feature flagged PRs labeled with this label will not be included in the release notes of the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants