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

Add delete action for multi element context #939

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

Buckwich
Copy link
Member

@Buckwich Buckwich commented Mar 11, 2025

Related to camunda/camunda-modeler#4554

Proposed Changes

Adds ContextPad actions for multi selections. The only action added for now is the delete action. Selecting multiple shapes and deleting with keyboard also works.

recording-dmn-multi-delete.mov

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Mar 11, 2025
@Buckwich Buckwich changed the title 4554-multielement-context-pad Add delete action for multi element context Mar 12, 2025
@Buckwich Buckwich force-pushed the 4554-multielement-context-pad branch 3 times, most recently from 253b990 to d89bcf4 Compare March 12, 2025 10:46
@Buckwich Buckwich force-pushed the 4554-multielement-context-pad branch from d89bcf4 to be76f0c Compare March 12, 2025 10:50
@Buckwich Buckwich marked this pull request as ready for review March 12, 2025 10:55
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Mar 12, 2025
Copy link
Member

@barmac barmac left a comment

Choose a reason for hiding this comment

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

Let's add "Related to..." clause to the commit body. We do it to backlink without referring to a PR.

};

ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
var baseAllowed = this._rules.allowed('elements.delete', {
Copy link
Member

Choose a reason for hiding this comment

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

[question] Why is it called baseAllowed? I know that this is the way it's called in bpmn-js, but we could reflect on this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just reused it, but i'll reword it to make it clear that it could be an array

Copy link
Member Author

Choose a reason for hiding this comment

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

renamed it to allowedOrAllowedElements or do you have a better suggestion?

Copy link
Member

Choose a reason for hiding this comment

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

Good enough!

@@ -166,6 +166,60 @@ describe('features - context-pad', function() {
})
);

describe('multi remove', function() {
Copy link
Member

Choose a reason for hiding this comment

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

Code style convention which should but is not part of eslint ruleset. One empty line after describe, two empty lines between test cases.

Suggested change
describe('multi remove', function() {
describe('multi remove', function() {

Copy link
Member Author

Choose a reason for hiding this comment

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

do you have a link to this style convention? I was looking for it but couldn't find it yet

Copy link
Member

Choose a reason for hiding this comment

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

This is how we've been writing the code for years (e.g. https://github.com/bpmn-io/bpmn-js/blob/develop/test/spec/features/drilldown/DrilldownSpec.js), but it's unfortunately undocumented.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

expect(deleteAction([ shape1, shape2 ])).to.exist;
}
));

Copy link
Member

Choose a reason for hiding this comment

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

Code style convention (see previous comment).

Suggested change

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@barmac
Copy link
Member

barmac commented Mar 12, 2025

The contribution looks good! The code is clean, and there are only a few suggestions/questions to address.

@Buckwich Buckwich force-pushed the 4554-multielement-context-pad branch from be76f0c to c3960ee Compare March 12, 2025 14:57
@Buckwich Buckwich requested a review from barmac March 12, 2025 14:58
@barmac barmac merged commit 16a52f9 into develop Mar 12, 2025
4 checks passed
@barmac barmac deleted the 4554-multielement-context-pad branch March 12, 2025 15:00
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Mar 12, 2025
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.

2 participants