-
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]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olexii4 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 |
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.67% -0.01%
==========================================
Files 500 500
Lines 45482 45512 +30
Branches 3164 3178 +14
==========================================
+ Hits 41700 41724 +24
- Misses 3754 3756 +2
- Partials 28 32 +4 ☔ 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?
} | ||
|
||
if (plugin === undefined) { | ||
console.warn('Failed to get plugin'); |
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.
maybe editor not plugin
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 have fixed it.
const annotations = { | ||
[COMPONENT_UPDATE_POLICY]: 'managed', | ||
[REGISTRY_URL]: editorReference, | ||
[REGISTRY_URL]: `http://127.0.0.1:8080/dashboard/api/editors/devfile?che-editor=${match[1]}`, |
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'd move http://127.0.0.1:8080/dashboard/api/editors/devfile?che-editor=
into a const, maybe EDITOR_DEVFILE_API_QUERY
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 have fixed it.
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}]}}]" |
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.