Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Support webview in dedicate container #947

Merged
merged 1 commit into from
Dec 21, 2020
Merged

Support webview in dedicate container #947

merged 1 commit into from
Dec 21, 2020

Conversation

vzhukovs
Copy link
Contributor

@vzhukovs vzhukovs commented Dec 7, 2020

What does this PR do?

This changes proposal adds an ability to run extension that provides webviews in dedicate container. The problem was in resource loading mechanism, that didn't support resource loading by file service from remote containers. This changes proposal modifies webview creation step by providing custom scheme: file-sidecar-${machineName} instead of default file for vscode-resource or theia-resource resources.

Depends on:

Signed-off-by: Vladyslav Zhukovskyi vzhukovs@redhat.com

Screenshot/screencast of this PR

Provided steps to test.

What issues does this PR fix or reference?

eclipse-che/che#16870

How to test this PR?

  1. Create workspace from workspace.yaml
  2. It will open a workspace with dedicate extension: didact
  3. Open a didact sample
  4. Webview should be displayed the same as it was run in the same container with Theia.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Happy Path Channel

HAPPY_PATH_CHANNEL=stable

@vzhukovs vzhukovs added kind/bug Something isn't working severity/P1 labels Dec 7, 2020
@vzhukovs vzhukovs self-assigned this Dec 7, 2020
@eclipse-che eclipse-che deleted a comment from che-bot Dec 9, 2020
@dmytro-ndp
Copy link
Contributor

[crw-ci-test --rebuild]

@che-bot
Copy link
Contributor

che-bot commented Dec 9, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:947
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:947

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.


export class RemoteWebview extends WebviewImpl {}

export class WebviewsContentAware {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably will need to spend some times on bringing DI in upstream for the plug-in host

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to digg into this thing and from what I saw, this requires some refactoring in plugin initializing mechanism. Am I right?

Copy link
Member

Choose a reason for hiding this comment

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

}

// Browser part perform preprocess initial html content by replacing vscode-resource:/path/to/file
// to https://authority/webview/theia-resource/file/path/to/file. To be able to operate with custom
Copy link
Contributor

@benoitf benoitf Dec 9, 2020

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this solution, but it seems, that this won't work. The problem is extending the WebviewWidget won't get a proper effect, because this code is run on browser part on Theia sidecar and we need to provide the container name from environment variable on the sidecar from plugin.

Copy link
Member

Choose a reason for hiding this comment

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

I tried this solution, but it seems, that this won't work.

sorry @vzhukovs but it's not clear to me if
you think that this will not work OR you have tried and this didn't work
Could you please clarify it? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried. The main problem here is that rebound class will be executing on Theia's container where we don't have any sidecar specific information. As far as rebound class will execute from the browser part we also don't have ability to get environment information. So it better to intercept this method's calls from server side on sidecar directly:

VS Code extension (sidecar server side) > Method intercept and link modification (sidecar server side) > Plugin Ext (sidecar server side > theia browser side) > Theia (theia browser side).

Copy link
Contributor

Choose a reason for hiding this comment

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

we can't only rebind only in sidecar usecase ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I saw, I couldn't get this worked

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

My browser's console is cluttered with tons of output like this one:
image

I guess that was needed for debugging purposes. Can we disable it?

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

Everything works perfectly with a brand new Workapce. But after refreshing the page, the test plug-in is failed to start:
image

@azatsarynnyy
Copy link
Member

[crw-ci-test --rebuild]

@eclipse-che eclipse-che deleted a comment from che-bot Dec 10, 2020
@che-bot
Copy link
Contributor

che-bot commented Dec 10, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:947
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:947

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

@vzhukovs
Copy link
Contributor Author

My browser's console is cluttered with tons of output like this one:
image

I guess that was needed for debugging purposes. Can we disable it?

The image that provided in how to test section is conjunction of #946, eclipse-theia/theia#8832 and eclipse-theia/theia#8833 code base. So additional console output is might be in case. But this PR doesn't have additional console output logs. It was done just for the debug purposes.

@vzhukovs
Copy link
Contributor Author

Everything works perfectly with a brand new Workapce. But after refreshing the page, the test plug-in is failed to start:
image

Checking it now.

@azatsarynnyy
Copy link
Member

Everything works perfectly with a brand new Workapce. But after refreshing the page, the test plug-in is failed to start:
image

Checking it now.

@vzhukovs I'm able to reproduce the error constantly on Hosted Che with the Devfile you provided in How to test this PR? section:

Peek 2020-12-15 12-20

@azatsarynnyy
Copy link
Member

Everything works perfectly with a brand new Workapce. But after refreshing the page, the test plug-in is failed to start:
image

It's not related to the PR changes. The same error is present in master branch.
@vzhukovs will you file a corresponding issue as we've discussed it offline?

Copy link
Member

@azatsarynnyy azatsarynnyy left a comment

Choose a reason for hiding this comment

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

I've tested it according to the provided How to test steps.
I was able to get the Didact tutorial rendered correctly, which is based on a Webview from a separate sidecar.

@che-bot
Copy link
Contributor

che-bot commented Dec 20, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:947
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:947

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

Signed-off-by: Vladyslav Zhukovskyi <vzhukovs@redhat.com>
@che-bot
Copy link
Contributor

che-bot commented Dec 21, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:947
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:947

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

  • Use comment "[crw-ci-test]" to rerun happy path E2E test.
  • Use comment "[crw-ci-test --rebuild]" to re-build the images and rerun happy path E2E test.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working severity/P1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants