openhab / openhab-vscode

VS Code extension for openHAB configuration files
https://marketplace.visualstudio.com/items?itemName=openhab.openhab
Eclipse Public License 2.0
159 stars 47 forks source link

error notification since update to 0.4.0 #108

Closed udo1toni closed 5 years ago

udo1toni commented 6 years ago

Since 0.4.0 links for opening item or thing in paper ui does not work any more.

Expected Behavior

A click at the context menu in items/things list (Show in Paper UI) should open corresponding page in Paper UI

Current Behavior

Action does result in an error notification:

<item/thing name> - Paper UI could not be opened: resource is not available

See https://community.openhab.org/t/vs-code-openhab-extension/30205/265?u=udo_hartmann and following...

Your Environment

openHAB2:

VSCode:

Confectrician commented 5 years ago

Just for the record: https://community.openhab.org/t/vs-code-openhab-extension/30205/268?u=confectrician

We have to change the complete previewHTML part to a webview as described here: https://code.visualstudio.com/docs/extensions/webview

MHerbst commented 5 years ago

I have tried to replace the command "previewHTML" by a webview. This work fine for displaying the sitemap, but it fails when I try to open PaperUI: image

The console shows this angular message; image

Maybe somebody has an idea how to to solve this problem. If not we should better disable the option to show PaperUI within VSCode.

Confectrician commented 5 years ago

I am already in discussion with kuba on this and did a try on y branch of my fork too. Unfortunately there seems to be some difficulties with the scripts, even if you allow them within the extension.

Did you go for an iframe (that was my first try) or did you make an http request and display the raw html?

also did you enable script usage?

MHerbst commented 5 years ago

Yes, I User an IFRAME with Scripting enabled. This worked very well with the sitemap display. It's quite strange that it does not work with Angular and I assume that it won't Work with raw html either. I have tried the same html code with the iframe directly in Chrome and it worked. I don't know what the Webview ist doing here.

Confectrician commented 5 years ago

Ok so we're nearly at the same state.

I would then prefer to remove this option for paper UI (at least temporary)

MHerbst commented 5 years ago

I agree. Are you already working on a PR, @Confectrician ? If not I can try to create a PR until next weekend. I would also try to implement an auto update function (see #10).

Confectrician commented 5 years ago

I am working on a (very small) fix for that misleading setting description and could remove that too. Alltough i am quite busy too within this week. Feel free to work on the auto update function, i didn't invest time in that yet.

I was diligent meanwhile and took care of getting the needed vs marketplace accesses, so that we are able to publish a new release with those small fixes directly. 🙂

Confectrician commented 5 years ago

I have started #117 and will add some more things within the next days.

Confectrician commented 5 years ago

While looking through the code, we could also just remove the configuration for "paperInBrowser" and let open the paperUi in an external browser on default.

So we would still have a quick access to paper UI. It only wouldn't be embedded in vscode.

Confectrician commented 5 years ago

Hey @MHerbst could you please check if your webview works when you choose a "thing" to show in paper ui?

I have discovered that the simple mode of paper UI can block things. Reference: #118 for a more detailed explanation.

Maybe the webview works and we just weren't able to acces sthe edit page because of that setting.

MHerbst commented 5 years ago

@Confectrician I have tested it and Things don't work either :-(.
Also "simple mode" is always disabled in my test environment. It seems to be a general problem. If I find some time this weekend I will setup VSCode in a Linux VM and test whether this is a Windows-specific problem.

Confectrician commented 5 years ago

I am developing on ubuntu and testing with my oh environment on a raspberry. I can't confirm that now, since my webview branch is also the one where the show in paper ui command has changed to external on default.

We can add paperui back at any time if we find a solution. :)

Let's focus on some fixes we can push through the pipe in the nearer future and work on the bigger problems afterwards.

I am currently refactoring the webview stuff to a separate class to keep it adaptable and extendable in the future. If that works fine and looks well, we should push a release first.

MHerbst commented 5 years ago

OK, I agree :-). Before I work on any changes I will wait for your refactoring. In the meantime, I'm going to familiarize myself with the code and typescript.

Confectrician commented 5 years ago

I'm going to familiarize myself with the code and typescript

I am doing this while i am coding.:smile: You can already take a look at my PR and check if a am doing something wrong, or if there's something looking strange for you.

Hopefully i can add the webview commit later already.

Confectrician commented 5 years ago

Adressed in #117