Project

General

Profile

Actions

Feature #17229

closed

Integrate webshell

Added by Peter Amstutz over 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Workbench2
Target version:
Story points:
-
Release relationship:
Auto

Description

Webshell in Workbench has two main pieces:

1. Shell in a box Javascript. This is the main implementation of the terminal emulator and communication with the server. It is lightly modified from the original upstream code. Specifically, there are a few references to a static asset loaded from /webshell/enabled.gif

arvados/apps/workbench/lib/assets/javascripts/webshell/shell_in_a_box.js

2. The webshell page. This creates a "ShellInABox" object with the appropriate URL. It also has hooks that check for "username:" and "password:" prompts to automatically send the correct username and token:

arvados/apps/workbench/app/views/virtual_machines/webshell.html.erb

For Workbench 2 integration we probably want it to behave the same way as Workbench 1:

  1. Go to the virtual machines page
  2. Click on "Webshell" link
  3. Load webshell in a new tab

It probably makes sense to have the webshell exist on a static HTML page separate from the react app, and just do a handoff of the the webshell server URL, username and token.


Subtasks 1 (0 open1 closed)

Task #18040: Review 17229-integrate-webshellResolvedPeter Amstutz09/09/2021Actions
Actions #1

Updated by Peter Amstutz over 2 years ago

  • Target version set to 2021-09-01 sprint
  • Assigned To set to Stephen Smith
Actions #2

Updated by Peter Amstutz over 2 years ago

  • Description updated (diff)
Actions #3

Updated by Stephen Smith over 2 years ago

  • Status changed from New to In Progress
Actions #4

Updated by Peter Amstutz over 2 years ago

  • Target version changed from 2021-09-01 sprint to 2021-09-15 sprint
Actions #5

Updated by Stephen Smith over 2 years ago

Changes at arvados-workbench2|8faf40308b6ff0e78029a474276cbe9381ee9498 branch 17229-integrate-webshell
Tests developer-tests-workbench2: #473

I wasn't sure if there was a better way to get the token / user / host over to the webshell so I just used url parameters

Actions #6

Updated by Peter Amstutz over 2 years ago

  • Target version changed from 2021-09-15 sprint to 2021-09-29 sprint
Actions #7

Updated by Peter Amstutz over 2 years ago

Two comments:

1) The token is available in local storage. However, we also support storing the token in session storage, which not shared between tabs. Then local storage will be empty. So I think using the URL for hand off is fine.

The first thing it should do when the page loads is read the token into a variable, and then remove it from the URL bar (it should replace the history item, not push a new one). This prevents the user from accidentally copying-and-pasting or bookmarking a URL with their token.

However, if the user reloads the page and the token has been removed from the URL bar, that won't work. So for that case (where there is no token in the URL) it should fall back and check local storage. If there is no token in local storage, it should render an error and offer a link to go back to the virtual machines page.

Also, once the token has been sent, there is no reason to keep it in memory, so we should clear the variable.

2) As Lucas mentioned, workbench2 has an idle timer. The webshell should also respect the idle timer. The timeout configuration item is Workbench.IdleTimeout. If there is no keyboard or mouse activity after the specified amount of time, it should disconnect the session. In addition, I think we have have a local storage item with a "last activity" timestamp. It should set / check this timestamp to coordinate activity across all the workbench2 or webshell tabs. Lucas can tell you more.

Actions #8

Updated by Peter Amstutz over 2 years ago

It could also be configured to only use the URL for handoff when configured for session storage, and use local storage the other times.

Actions #9

Updated by Stephen Smith over 2 years ago

Changes at 405bb231a0cb75e41fdcdf22ce268fe592a2edfd
Tests developer-tests-workbench2: #485

  • Webshell falls back to localStorage if no token passed
  • I added a value to the auth store to keep track of the token storage location setting when constructed in order to inform whether to place the token in the webshell URL or let it pick up the token from localStorage
    • An edge case of this is if there is an extra api token, in which case it will pass over the localStorage token in favor of passing the extra api token in the URL
  • Token is now removed from the url bar on load and cleared from variables
  • Added a message if the token is missing
  • Implemented the idle timer which will Ctrl + C, Ctrl + D to log out and integrates with the existing idle timer in localStorage
  • I also passed the timeout config in the url so it can be consistent between the app and the shell
Actions #10

Updated by Stephen Smith over 2 years ago

arvados-workbench2|0ccf1750b4143223e729fc3212b5e4b0a447b420
Tests developer-tests-workbench2: #486

  • Added an init flag and change request response handler to noop if it's not the initial request and the state is unconnected
  • Also keep track of the current request so we can cancel it immediately in the sessionClosed method so the browser isn't still waiting on a request
Actions #11

Updated by Peter Amstutz over 2 years ago

src/views/virtual-machine-panel/virtual-machine-user-panel.tsx

const EXTRA_TOKEN = "exra";

I think that's a typo?

Otherwise, this LGTM.

Actions #12

Updated by Stephen Smith over 2 years ago

  • Status changed from In Progress to Resolved
Actions #13

Updated by Peter Amstutz over 2 years ago

  • Release changed from 31 to 42
Actions

Also available in: Atom PDF