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

In and Out Variables for Tasks #84

Merged
merged 6 commits into from
Jun 26, 2024
Merged

In and Out Variables for Tasks #84

merged 6 commits into from
Jun 26, 2024

Conversation

theaubmov
Copy link
Collaborator

@theaubmov theaubmov commented Apr 12, 2024

This PR is about controlling data flow through tasks, making sure that tasks receive the right data (inputs) and produce expected results (outputs) that other parts of the process can use.

Summary by CodeRabbit

  • New Features

    • Introduced the ability to manage BPMN input/output variables in the properties panel, allowing users to add and delete input and output variables for user tasks and script tasks.
  • Style

    • Adjusted padding and margins in the bio-properties panel for a more refined layout.

@theaubmov theaubmov requested review from burnettk and danfunk April 12, 2024 11:46
@theaubmov theaubmov linked an issue Apr 12, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Apr 12, 2024

Walkthrough

The recent update introduces styling adjustments for the bio-properties panel in the CSS, new import configurations, and export settings in the index.js, and enhancements for managing BPMN input/output variables in the testing specifications. Specifically, padding changes provide a refined UI, while the JavaScript updates streamline BPMN variable handling within user and script tasks, resulting in a more intuitive user experience and robust test coverage.

Changes

Files Change Summary
app/css/app.css Adjusted the padding-block from 8px to 5px in .bio-properties-panel-group-entries > .bio-properties-panel-description and added styling for .open state.
app/spiffworkflow/index.js Added import for IoPropertiesProvider and updated the export configuration for IoPropertiesProvider and callActivityInterceptor.
test/spec/IoVariablesSpec.js Added functionality for managing BPMN input/output variables in the properties panel, enabling input and output variable addition and deletion for various tasks.
test/spec/bpmn/io_variables.bpmn Defined a BPMN process with input and output data specifications for testing purposes.

Poem

Amid the code, adjustments made,
Ensuring tasks do not degrade,
With styles refined, and BP flows,
Our BPMN smoothly grows.

Variables now, in panels set,
Our task is done, let’s not forget.

- CodeRabbit 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@theaubmov theaubmov self-assigned this Apr 12, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4


// We Select a userTask element
const shapeElement = await expectSelected('Activity_1hmit5k');
expect(shapeElement, "I can't find ManualTask element").to.exist;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix the typo in the error message.

- "I can't find ManualTask element"
+ "I can't find User Task element"

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
expect(shapeElement, "I can't find ManualTask element").to.exist;
expect(shapeElement, "I can't find User Task element").to.exist;


// We Select a userTask element
const shapeElement = await expectSelected('Activity_1hmit5k');
expect(shapeElement, "I can't find Uset Task element").to.exist;
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix the typo in the error message.

- "I can't find Uset Task element"
+ "I can't find User Task element"

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
expect(shapeElement, "I can't find Uset Task element").to.exist;
expect(shapeElement, "I can't find User Task element").to.exist;

Comment on lines +1 to +2
import { is } from 'bpmn-js/lib/util/ModelUtil';
import { createIoGroup } from './IoGroup.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The verification process has revealed that the file IoGroup.js is correctly implemented and available as expected. However, there are issues with locating ModelUtil.js. The file could not be found in the specified directories, suggesting that either the file does not exist, or the import path provided in the code is incorrect. This needs further investigation or correction in the codebase.

Analysis chain

Ensure that the imported modules and functions (is and createIoGroup) are correctly implemented and available.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the existence and correct implementation of ModelUtil and IoGroup.js
fd 'ModelUtil.js' 'bpmn-js/lib/util'
fd 'IoGroup.js' 'app/spiffworkflow/InputOutput/propertiesProvider'

Length of output: 263



Script:

#!/bin/bash
# Correct the search path for ModelUtil.js and verify its existence
fd 'ModelUtil.js' --search-path 'node_modules/bpmn-js/lib/util' --exec cat {}

# Verify the implementation of IoGroup.js by displaying its contents
cat 'app/spiffworkflow/InputOutput/propertiesProvider/IoGroup.js'

Length of output: 1506

Comment on lines +8 to +134
}) : [];

function add(event) {
const { businessObject } = element;

const newOutputID = moddle.ids.nextPrefixed('DataOutput_');

// Create a new DataOutput
const newOutput = bpmnFactory.create('bpmn:DataOutput', { id: newOutputID, name: newOutputID });

// Check if ioSpecification already exists
createSpecification(bpmnFactory, businessObject, 'output', newOutput)

// Update the element
updateElementProperties(commandStack, element);

event.stopPropagation();
}

return { items, add };
}

function removeFactory(props) {
const { element, bpmnFactory, commandStack, outputEntry } = props;
return function (event) {
event.stopPropagation();
removeElementFromSpecification(element, outputEntry, 'output');
updateElementProperties(commandStack, element);
};
}

function OutputParamGroup(props) {

const { id, outputEntry, element, moddle, commandStack, translate, bpmnFactory } = props;

return [
{
id,
outputEntry,
component: OutputParamTextField,
isEdited: isTextFieldEntryEdited,
element,
moddle,
commandStack,
translate,
bpmnFactory
}
];
}

function OutputParamTextField(props) {

const { id, element, outputEntry, moddle, commandStack, translate, bpmnFactory } = props;

const debounce = useService('debounceInput');

const setValue = (value) => {
try {
const ioSpecification = element.businessObject.ioSpecification;

if (!value || value == '') {
console.error('No value provided for this input.');
return;
}

if (!ioSpecification) {
console.error('No ioSpecification found for this element.');
return;
}

let existingInput = ioSpecification.dataOutputs.find(input => input.id === outputEntry.name || input.name === outputEntry.name);

if (existingInput) {
existingInput.name = value;
existingInput.id = value;
} else {
console.error(`No DataOutput found :> ${outputEntry.name}`);
return;
}

updateElementProperties(commandStack, element);

} catch (error) {
console.log('Setting Value Error : ', error);
}
};

const getValue = () => {
return outputEntry.name;
};

return TextFieldEntry({
element,
id: `${id}-output`,
label: translate('Output Name'),
getValue,
setValue,
debounce,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The functions createSpecification, removeElementFromSpecification, and updateElementProperties are correctly implemented and integrated as verified by their presence and definitions in helpers.js. However, the component TextFieldEntry could not be located within the repository. It is possible that this component is sourced externally or not included in the repository. Please ensure that TextFieldEntry is correctly integrated and available for use in the project.

Analysis chain

The OutputParametersArray function is well-implemented, providing structured management for output parameters. Ensure that the components and helper functions (TextFieldEntry, createSpecification, removeElementFromSpecification, updateElementProperties) are correctly implemented and integrated.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the correct implementation and integration of TextFieldEntry, createSpecification, removeElementFromSpecification, and updateElementProperties
fd 'TextFieldEntry.js' '@bpmn-io/properties-panel'
fd 'helpers.js' 'app/spiffworkflow/InputOutput'

Length of output: 248



Script:

#!/bin/bash
# Search for TextFieldEntry.js in the entire repository
fd 'TextFieldEntry.js'

# Check for the presence of createSpecification, removeElementFromSpecification, and updateElementProperties in helpers.js
rg 'function createSpecification' app/spiffworkflow/InputOutput/helpers.js
rg 'function removeElementFromSpecification' app/spiffworkflow/InputOutput/helpers.js
rg 'function updateElementProperties' app/spiffworkflow/InputOutput/helpers.js

Length of output: 489

@burnettk
Copy link
Contributor

i think there are a couple nitpicky copy exits suggested by coderabbit.

perhaps it would be worth demoing this one to the team?

@theaubmov
Copy link
Collaborator Author

@burnettk Except for the typing mistakes, the main point raised by Coderabbit is having some challenges locating some utils functions that exist at the level of the BPMN.js library, and we import them in our extensions, such as the is method that can be used to verify the type of an element.

Do you mean these two points, or are there other suggestions I've missed?

@burnettk
Copy link
Contributor

i just wanted you to take a look at them and see if they were worth fixing, you did it, thanks. 👍

@burnettk
Copy link
Contributor

i guess there are some conflicts here now, @theaubmov since we stalled so long, sorry. are you worried about this change in general, or it's not too likely to break existing functionality? i just merged everything else, but this one scared me the most. i'd love to get it merged if you think it's good to go. thank you.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cadd745 and 27d47eb.

Files selected for processing (2)
  • app/css/app.css (1 hunks)
  • app/spiffworkflow/index.js (3 hunks)
Additional comments not posted (4)
app/css/app.css (2)

77-77: Padding adjustment in .bio-properties-panel-description

The reduction in padding-block from 8px to 5px could enhance the compactness of the UI, making more content visible without scrolling. Ensure this change aligns with the overall design principles of the application.


80-87: Styling for expanded groups in the properties panel

The modifications to .bio-properties-panel-group-entries.open > .bio-properties-panel-group include adjustments to margins, borders, and the removal of box-shadow and transition effects. This simplifies the styling and potentially improves performance by reducing repaints caused by transitions.

app/spiffworkflow/index.js (2)

19-19: Addition of IoPropertiesProvider and CallActivityInterceptor to module exports

The integration of IoPropertiesProvider and CallActivityInterceptor is crucial for the new functionalities described in the PR. Ensure these components are properly documented and tested, especially since they are now part of the exported API.

Also applies to: 48-48


71-72: Correct registration of IoPropertiesProvider and CallActivityInterceptor

The registration of these components in the module configuration is essential for their activation and use within the framework. Verify that these components behave as expected in the runtime environment.

Verification successful

Correct registration and likely testing of IoPropertiesProvider and CallActivityInterceptor

The components IoPropertiesProvider and CallActivityInterceptor are correctly registered in the module configuration. The presence of related test files such as test/spec/CallActivitySpec.js and test/spec/BpmnInputOutputSpec.js suggests that these components are indirectly tested.

  • test/spec/CallActivitySpec.js
  • test/spec/BpmnInputOutputSpec.js
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the behavior of IoPropertiesProvider and CallActivityInterceptor in the runtime environment.

# Test: Check logs for any runtime errors or warnings related to these components.
cat logs/runtime.log | grep -E 'IoPropertiesProvider|CallActivityInterceptor'

Length of output: 128



Script:

#!/bin/bash
# Search for the definitions of IoPropertiesProvider and CallActivityInterceptor in the codebase
echo "Definitions:"
ast-grep --lang javascript --pattern 'class IoPropertiesProvider { $$$ }'
ast-grep --lang javascript --pattern 'class CallActivityInterceptor { $$$ }'

# Search for the usages of IoPropertiesProvider and CallActivityInterceptor in the codebase
echo "Usages:"
rg 'IoPropertiesProvider'
rg 'CallActivityInterceptor'

# Search for any existing tests related to IoPropertiesProvider and CallActivityInterceptor
echo "Tests:"
rg 'IoPropertiesProvider' --glob '*test*'
rg 'CallActivityInterceptor' --glob '*test*'

Length of output: 1864



Script:

#!/bin/bash
# Search for any test suites or files that might indirectly test IoPropertiesProvider and CallActivityInterceptor
echo "Indirect Tests:"
rg 'IoPropertiesProvider' --glob '*spec*'
rg 'CallActivityInterceptor' --glob '*spec*'

# Check if there are any references to these components in the test configuration or setup files
echo "Test Configuration References:"
rg 'IoPropertiesProvider' --glob '*config*'
rg 'CallActivityInterceptor' --glob '*config*'

Length of output: 587



Script:

#!/bin/bash
# Re-run the search with --debug to understand why files are being skipped
echo "Debug Indirect Tests:"
rg 'IoPropertiesProvider' --glob '*spec*' --debug
rg 'CallActivityInterceptor' --glob '*spec*' --debug

# Search for any test files in the codebase without filtering by name
echo "All Test Files:"
rg --files | grep -E 'test|spec'

Length of output: 59962

@theaubmov
Copy link
Collaborator Author

Yes, I got your concerns. I believe we can merge this change. The new feature is an extension to the editor and it won't impact or alter any existing features. The point of introducing in and out variables for tasks is to allow users to define input and output elements at the task level.

@burnettk burnettk merged commit 020de78 into main Jun 26, 2024
1 check passed
@burnettk burnettk deleted the feature/io-variables branch June 26, 2024 14:42
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.

In and Out Variables for Tasks
2 participants