bwsw / cloudstack-ui

Modern UI for Apache Cloudstack User Self Service Portal
https://bitworks.software/
Apache License 2.0
163 stars 63 forks source link

Smart HTTP VM Access Helper implementation #1680

Closed bwsw closed 4 years ago

bwsw commented 4 years ago

Description

Current HTTP VM Access Helper implementation generates the link as http://<ip>:<port>/<path>, where <ip> is taken from VM information, <port>/<path> is taken from VM tags, which are filled when VM created from a template.

The problem is that a user may click the helper link when VM is still in the booting state and VM HTTP software inside VM is not loaded yet, so user can get an error.

This feature proposal is to implement smart HTTP Access Helper which relies on a small backend Node Service presented as an endpoint for UI which is requested by UI about the HTTP Status of http://<ip>:<port>/<path>. The backend Node implementation should use HEAD request to the URI and return OK if 200 OK is received. This means that the link can be shown to the user in the UI.

The implementation must use configurable timeout (default 60 seconds) which is limit time to wait for a remote URI to reach 200 OK state. If the state not reached after the timeout, then UI must display timeout error notice instead of URI.

If the backend Node endpoint is not accessible, then UI must just show URI instantly.

Implement the feature and necessary tests.