-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fix editor update flow #1310
base: main
Are you sure you want to change the base?
Fix editor update flow #1310
Conversation
Signed-off-by: Oleksii Orel <[email protected]>
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1310 kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1310", name: che-dashboard}]}}]" |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1310 +/- ##
==========================================
+ Coverage 91.68% 91.76% +0.08%
==========================================
Files 500 501 +1
Lines 45482 45532 +50
Branches 3164 3179 +15
==========================================
+ Hits 41700 41784 +84
+ Misses 3754 3715 -39
- Partials 28 33 +5 ☔ View full report in Codecov by Sentry. |
return Object.assign({ content: dump(editor), editorYamlUrl: editorIdOrPath }); | ||
return { | ||
content: dump(editor), | ||
editorYamlUrl: `http://127.0.0.1:8080/dashboard/api/editors/devfile?che-editor=${editorId}`, |
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.
@olexii4 could you clarify this change 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.
@ibuziuk The previous implementation allowed assigning editorId to a field named "editorYamlUrl". Based on the variable name 'editorYamlUrl', it is unexpected to have the value editorId there.
This misunderstanding led to an error. That is why I changed the implementation to use URLs instead of IDs.
This URL http://127.0.0.1:8080/dashboard/api/editors/devfile?che-editor=${editorId}
is a part of dashboard API, which returns the editor devfile by ID. You can test it with dashboard swagger:
For example, an HTTP POST request {che-server}/dashboard/api/data/resolver
with JSON data
{
"url": "http://127.0.0.1:8080/dashboard/api/editors/devfile?che-editor=che-incubator/che-code/latest"
}
PS
This request will be sent if we don't have the proper editor in the redux store.
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.
@olexii4
I've tested the PR according to the description, and it works as expected.
Could you clarify the root cause of why the template wasn't patched with editorId?
Based on the variable name 'editorYamlUrl', it is unexpected to have the value editorId there.
I’d prefer to avoid hardcoding the API URL here. Would it make sense to rename the variable while still using editorId?
packages/dashboard-frontend/src/services/workspace-client/devworkspace/devWorkspaceClient.ts
Outdated
Show resolved
Hide resolved
packages/dashboard-frontend/src/services/workspace-client/devworkspace/devWorkspaceClient.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Oleksii Orel <[email protected]>
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1310 kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1310", name: che-dashboard}]}}]" |
@svor The main reason was an error while converting devfile into the devworkspace template. The previous implementation worked well because we got a new editor devfile object before converting it into the devworkspace template. The existing implementation tried to change the editor devfile object in the redux store. |
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.
lgtm
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.
@olexii4 👍 LGTM
once approved by @dmytro-ndp please, backport to 7.98.x for 3.19
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ibuziuk, olexii4, svor The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@olexii4, @ibuziuk : hello,
|
This is a brilliant idea. But it's not that simple. |
What does this PR do?
This PR fixes the editor update flow and changes the approach of how to store
editorYamlUrl
variable in thedevworkspace.metadata.annotations[REGISTRY_URL]
.The existing implementation allows using editorId instead of URL.
With these changes, a correct API request
http://127.0.0.1:8080/dashboard/api/editors/devfile?che-editor=${editorId}
will be stored instead of an editorID.What issues does this PR fix or reference?
fixes https://issues.redhat.com/browse/CRW-7936
Is it tested? How?
{che-server}/dashboard/api/swagger
.Use Devworkspace Template API and find the templateName.
/spec/commands
) the target template with the next patch:/spec/commands
should be empty./spec/commands
should be restored.