vmware-archive / kubeless-ui

Graphical User Interface for Kubeless
Apache License 2.0
418 stars 75 forks source link

AceEditor mode bug #68

Open ColdFire87 opened 6 years ago

ColdFire87 commented 6 years ago

Hi,

I'm using minikube and I've deployed kubeless-ui via the k8s.yml file. I am getting the service url via minikube service -n kubeless ui --url which gives me http://192.168.99.100:30113. I am using Chrome Version 69.0.3497.100 (Official Build) (64-bit) on Windows 7 x64. The bug also occurs on Firefox 62.0.3 (64-bit) so I don't think it's a browser specific bug.

Something goes wrong in the editor react component and the editor does not have syntax highlighting. The chain of events starts in src/components/Editor/Editor.js at line 145 in render(), where the mode is computed for the AceEditor 3rd party component.

-> render() -> runtimeToMode() -> RuntimeHelper.runtimeToLanguage() -> -> await this.getAllRuntimes() -> ... start returning

Somewhere along the way this fails because a Promise is not handled properly. Because of that the browser issues a request to http://192.168.99.100:30113/mode-[object%20Promise].js which of course fails.

I think you need an async/await pair either in runtimeToMode() or render() or both :).

In let mode = this.runtimeToMode(), mode ends up to be a Promise object, not the resolved result.

I wanted to run the app locally but I'm on Windows and node-sass does not support it.