-
Notifications
You must be signed in to change notification settings - Fork 198
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
kie-issues#1694: Apache KIE Extended Services extension issues #2802
Conversation
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.
@yesamer Thanks for your PR! I've made some comments inline.
export const enableAutoRunID = "extendedServices.enableAutorun"; | ||
export const connectionHeartbeatIntervalinSecsID = "extendedServices.connectionHeartbeatIntervalinSecs"; | ||
export const extendedServicesURLID = "extendedServices.extendedServicesURL"; | ||
const defaultExtendedServicesURL = "http://localhost:21345"; |
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 should use the env
value instead of hardcoding. To do so, take a look into the build/defaultEnvJson.ts
file in some packages (e.g. online-editor
).
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.
@ljmotta It's a good point. I would like to retrieve that default value directly from the configuration here https://github.com/apache/incubator-kie-tools/pull/2802/files#diff-153d43651b25ee3120020fae349c9e8ed99ccf90aa15995784702244decf9499R91 to avoid duplication and a single place for that property value, do you think is a valid alternative should I consider?
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.
yes, it is important to have an option to configure the url of extended services, users report issues about it #2759
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.
@ljmotta In the examples I checked, the env variables are accessed using the useEnv() hook, but in this case, we are not managing a React app. How can I access to env variable from "plain" typescript?
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.
@yesamer That's true. the defaultEnvJson
is used with the webpack transform + fetch
, which isn't the case here. Now, you could use the webpack's EnvironmentPlugin
to set env variables. The online-editor
uses this approach to set some values inside the codebase. Take a look into the online-editor/webpack.config.ts
, and search for EnvironmentPlugin
. The WEBPACK_REPLACE__*
values are the ones used in the codebase.
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.
@ljmotta It should be done, there are two points to discuss:
- I added EnvironmentPlugin in both extension-main and extension-browser. There's a way to define that once?
- Currently, the host and the post are parametrized, In my opinion, it would be better to have the entire URL as a parameter. E.g. http protocol is hardcoded, what if the user provides its own instance using https?
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.
- If you need to use in both, you can set the env variables in the
commonConfig
variable. - Good point. I'm not familiar on how the user set/use the Extended Services in the VS Code extension. Is it a embeded Extended Services or the user need to manually start the server? For the
extended-services-java
it will always usehttp
. If the user wants to deploy it, the user will need to make the necessary adjustments to make it available throughhttps
.
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.
- Do you have an example for that? I mean, I added the plugin entry for both
web
andnode
https://github.com/apache/incubator-kie-tools/pull/2802/files#diff-1768335dedd5cfa5e1b3830bb3b6c504f1d316dea21de55738df74f7f19c27a5R52
To create a single entry for the plugin, whichtarget
andentry
should I use? - You're right, considering extended-services-java always uses
http
, we are safe here :)
const value = vscode.workspace.getConfiguration().get(property) as T; | ||
if (!value) { | ||
console.warn("Property: " + property + " is missing, using the default: " + defaultValue); | ||
} | ||
return value || defaultValue; | ||
}; |
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'm not sure if I followed. T
can be a boolean
, number
or string
. If is a boolean
it will always be true
, as it is the default value. For number
, can't be 0
, and string
can't be ""
? Or value
can't be undefined
? The (!value)
can be tricky, please, make it explicity.
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.
T can be a boolean, number or string. If is a boolean it will always be true, as it is the default value. For number, can't be 0, and string can't be ""
So, if the user explicitly removes the property the default value is always returned?
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.
@yesamer I just considered the calls to this method. We have just 3 on this file, each one of them with T equals to boolean
, number
or string
. The if
will be true
for the cases I listed, and we will have the log. Additionally, the return will always go to the default value for the same cases:
> "" || "my_default_value"
'my_default_value'
> 0 || 25
25
> false || true
true
If the value
(has the type T
due your casting) can have a different type, please make it explicity. Something like: T | null
or T | undefined
.
packages/extended-services-vscode-extension/src/requests/ValidationRequests.ts
Outdated
Show resolved
Hide resolved
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.
Thank you for the PR. I am happy we improve this extension.
01
Sometimes we use extended service
(singletone) and sometimes we use extended services
(plural).
02
The PR description says we never stop the extended services. Should then extension-browser.ts
contain const stopExtendedServicesCommandUID: string = "extended-services-vscode-extension.stopExtendedServices";
and related code? Or do we keep the option to manually stop the extended services?
No manual check done, waiting until code changes are finished.
export const enableAutoRunID = "extendedServices.enableAutorun"; | ||
export const connectionHeartbeatIntervalinSecsID = "extendedServices.connectionHeartbeatIntervalinSecs"; | ||
export const extendedServicesURLID = "extendedServices.extendedServicesURL"; | ||
const defaultExtendedServicesURL = "http://localhost:21345"; |
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.
yes, it is important to have an option to configure the url of extended services, users report issues about it #2759
packages/extended-services-vscode-extension/src/configurations/Configuration.ts
Outdated
Show resolved
Hide resolved
packages/extended-services-vscode-extension/src/extension/extension-browser.ts
Outdated
Show resolved
Hide resolved
packages/extended-services-vscode-extension/src/extension/extension-main.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # packages/extended-services-vscode-extension/src/configurations/Configuration.ts
@jomarko 02 |
packages/extended-services-vscode-extension/src/configurations/Configuration.ts
Outdated
Show resolved
Hide resolved
Closing the model fileHi @yesamer or anyone, should closing the dmn/bpmn file to close also the message in problems tab? Currently it seems the problems tab is not cleared if model file is closed. Is that an expected behavior? Disable Autorun and use URLOnce I disabled the autorun and started extended services as |
…/Configuration.ts Co-authored-by: Luiz João Motta <[email protected]>
@jomarko I'm double-checking the behavior you reported. However, I'm not fully aware of the expected behavior of this feature, so my goal is to implement a minimal use-case scenario for this extension. |
@jomarko I fixed the first use case you reported, Closing the model file. Screen.Recording.2025-01-10.at.15.10.28.mov |
@ljmotta Yes, please :) |
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.
@yesamer Thanks for your patience, LGTM!
Deferring my review to @jomarko, feel free to merge when approved by him and green! Thanks for the great effort here. |
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.
Thank you @yesamer , I put some comments to code inline.
One question is also what is the difference of extension-main.ts
and extension-browser.ts
as their content seems to be very similar.
My biggest problem is there is no vsix file produced by the PR, or am I searching inappropriately? I tried to build the extension locally: pnpm -F extended-services-vscode-extension... build:prod
however in that case it seems to not work properly, I would like to use vsix produced by the CI.
packages/extended-services-vscode-extension/src/configurations/Configuration.ts
Show resolved
Hide resolved
packages/extended-services-vscode-extension/src/configurations/Configuration.ts
Show resolved
Hide resolved
packages/extended-services-vscode-extension/src/extension/extension-browser.ts
Outdated
Show resolved
Hide resolved
packages/extended-services-vscode-extension/src/requests/PingRequest.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Jozef Marko <[email protected]>
…nsion-browser.ts Co-authored-by: Jozef Marko <[email protected]>
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.
Thank you @yesamer. Using the VSIX produced by the CI I was able to:
- use extended-services extension in the auto run mode
- use extended-services extension connecting to services started in standalone terminal
Approving the PR, however opening two points that are not blocking from the merge.
Extension info
Seems to show old information, probably it needs to be first pushed to marketplace? I do not know. Notice the ping interval value.
Icon
Extended-services liveness icon indicator (bottom right corner) is shown from my point of view in 'difficult to understand' way. From my point of view, in separate ticket it would be worth to do a simplification. Here is my proposal, however not sure what is opinion of others.
Once extended-services extension is installed:
- we either show connection live icon
- or connection not live icon
- there should be no case icon is missing
@jomarko Thank you for the review, it's indeed strange the Extension info is not updated. I checked, and the default value is correct in the package.json. |
Fixes apache/incubator-kie-issues#1684
In this PR:
The main issue is the "ambitious" management of the Extended Service Quarkus App lifecycle.
The original idea was to run the Quarkus application just after a DMN / BPMN file is opened in the editor and close it when all files are closed. Unfortunately, that implementation didn't consider the following scenarios:
For that reason, I simplified the logic: the Extended Service Quarkus App is started when a DMN / BPMN file is opened for the first time and never stopped. The original idea was indeed better from a performance and resource consumption point of view, but it requires a more complex implementation.
extendedServices.connectionHeartbeatIntervalinSecs
default value changed from 1 to 10. Having a heartbeat occurring every second contributed to the reported issue