-
Notifications
You must be signed in to change notification settings - Fork 108
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
Implement JS Function / Scripting Component #1100
base: develop
Are you sure you want to change the base?
Conversation
166f7fc
to
2bdbc10
Compare
773111e
to
8becf41
Compare
8becf41
to
e723faa
Compare
@Skaiir The toggle "Do not submit" can be unclear, especially when placed before the input for function.
Another suggestion is to update the explanation text for function parameters:
|
@Skaiir Not directly related to the JS component but good to do. Can we update the icons for the iFrame and Group components to the new ones in Figma? As well as reorder them: (1) Group, (2) Dynamic list, (3) iFrame? Let me know if it's better to handle as a separate issue. |
4535f38
to
7f8e939
Compare
7f8e939
to
3e97e82
Compare
3e97e82
to
27774b0
Compare
27774b0
to
f5d35da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Skaiir In the future it would be better to split into a PR for properties panel, one for the schema package and for the editor/viewer
packages/form-js-viewer/src/render/components/icons/JSFunction.svg
Outdated
Show resolved
Hide resolved
packages/form-js-editor/src/render/components/editor-form-fields/EditorJSFunctionField.js
Outdated
Show resolved
Hide resolved
|
||
const [ sandbox, setSandbox ] = useState(null); | ||
const [ hasRunLoad, setHasRunLoad ] = useState(false); | ||
const [ iframeContainerId ] = useState(`fjs-sandbox-iframe-container_${uuidv4()}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Douglas, it looks like we don't really need this.
If it's really necessary we could try to replace it with crypto.randomUUID()
}); | ||
|
||
// wait for the iframe to compute the expression and pass it back | ||
await new Promise(r => setTimeout(r, 100)).then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use waitFor
from testing library here I think
packages/form-js-viewer/src/render/components/form-fields/JSFunctionField.js
Outdated
Show resolved
Hide resolved
packages/form-js-viewer/src/render/components/form-fields/JSFunctionField.js
Show resolved
Hide resolved
Websandbox.connection.setLocalApi({ compute: ___executeUserCode___ }); | ||
`; | ||
|
||
const _sandbox = Sandbox.create(hostAPI, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you update the sandbox instead of always creating a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually want to completely destroy it, to make sure all user code event subscriptions get wiped as they are working on it in the playground. In the viewer this will only run once.
@Skaiir We need to rebase this branch |
@volodymyr-melnykc do we track the use of the form components anywhere? I think we can do some really interesting things, but I don't see most users using it because it looks a bit too complex to me. |
@vsgoulart We implemented the event tracking here: https://github.com/camunda/team-hto/issues/350 I prepared the report about form components usage. It's available here: |
75e7eb8
to
b661452
Compare
7756938
to
4f833f4
Compare
Related to #1103
4a2e1d4
to
4345acb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Skaiir Just one small comment left
We have a bug on the table component, we need to validated the values to see if they're strings because this crashes the entire app
}); | ||
|
||
// wait for the iframe to compute the expression and pass it back | ||
await new Promise(r => setTimeout(r, 100)).then(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also replace the other occurrences with the waitFor
I mentioned in the other comments
Deprioritized due to the re-architecture project. |
Closes #1102