Add Open in Browser command to running containers#1429
Conversation
|
|
||
| if (possiblePorts.length === 0) { | ||
| // tslint:disable-next-line: no-floating-promises | ||
| ext.ui.showWarningMessage('No valid ports were mapped from the container to the host.'); |
There was a problem hiding this comment.
Do we want to leave a cancel step in telemetry here, and/or throw a UserCancelledError?
There was a problem hiding this comment.
I tried several variants and this seemed to work best (or was the least worst). UserCancelledError doesn't seem technically correct, as the user didn't make a choice--the container just didn't have any ports to browse to. Throwing any other kind of error results in the error dialog with the "report issue" button, which we clearly don't want. You might argue that the command result should be Failed in this case, but I'm not sure it matters from the telemetry analysis point of view. We can pick out this scenario by looking for a completed command, where the possible ports is the empty set and no port was selected.
There was a problem hiding this comment.
For the somewhat similar case where the Azure registry already exists (the one Paul hit), I had it throw a UserCancelledError as a way of getting out of the execution; so it wouldn't be unprecedented.
karolz-ms
left a comment
There was a problem hiding this comment.
Looks good!, Just one question...
Adds an
Open in Browsercommand to the context menu of running containers in the containers tree view.The command opens the browser to the first exposed port mapped to the host that likely represents a "web" endpoint. The heuristic works as follows:
443,80,3000,3001,5001,5000,8080,8081)The "possible" ports as well as the selected port is captured by telemetry, in order to understand how that heuristic could be improved.