Skip to content

Commit 2cfe683

Browse files
Hweinstockjustinmk3JadenSimon
authored
ec2: add progress bar on ssm startSession. (#3604)
* add empty connect command * create sample QuickPick on click * hacky prompt + func to list instanceId * very hacky way to create prompt with instanceIds * move extractInstanceIds to own function * utilize lastTouchedRegion in prompt * throw cancellationError on user cancel * add a title to quickpick * refactor: increase testability * move test utility func to shared utility file * add general test cases for extractInstanceIdsFromReservations * add basic test for prompter * configure command to devMode * refactor to utilize wizard + integrate regionSubmenu * add new testing file * refactor to utilize regionSubmenu in isolation, rather than wrapped in Wizard class * fix awkward indent * add test file from feature/cwl branch * remove old prompter old + tests * delete tests that rely on feature/cwl changes * refactor to avoid circular dependency * fix improper headers + imports * introduce Ec2ConnectClient to handle connection * remove dead parameter * close connection on terminal close * add a little more to error msg * remove dead imports * log error to console * rename function Co-authored-by: Justin M. Keyes <[email protected]> * fix header Co-authored-by: Justin M. Keyes <[email protected]> * fix headers and imports * remove year from header * delete outdated test case * delete outdated test file * remove year from copyright header * fix formatting of files * remove alias in Ec2Instance * utilize interface for object-like shape * improve style + start of work on debugging error * make distinction between status error and permission error * start to add tests for error handling * move code to general Ec2Client * change Log Groups to selection in region submenu * refactor to avoid circular dependency * fix formatting * fix formatting * comment out the ec2Client we are not using * style fix * fix formatting * add test for error handling * fix formatting * add extra wrapper * generalize some code to a remoteSession file * add space between pieces * retrieve IAM role attached to instance when fails to connect * remove dead import * refactor to avoid circular dependency * checks if relevant policies are on attached role * use both probes to determine source of error * update tests * change callback to async/await * remove onError parameter and utilize .catch instead * add test for permissions detection * fix test * make error handling a try-catch * swap ec2Client to v3 * switch over SSM client * update tests and signatures for new error type in v3 * fix formatting * remove dead import * avoid unnecessary default prefix on client name Co-authored-by: Justin M. Keyes <[email protected]> * fix old import * refactor defaultEc2client -> ec2Client * rename Ec2ConnectClient * fix outdated imports in the test * add icons and detail to description * update tests to use sdk3 * update tests and function names * bubble error up * update test case * Remove please in text Co-authored-by: Justin M. Keyes <[email protected]> * Remove please in text in other error Co-authored-by: Justin M. Keyes <[email protected]> * remove unnecessary types and update tests to match * add match on detail, and instance id label * add status bar * add cancellation + only show after 2 seconds * remove delay in showing cancellation bar, since it added delay * remove duplicate import * remove changes to package files * remove changes to ssm client * move disposing of the timeout to a finally block. Co-authored-by: JadenSimon <[email protected]> * change loading bar to only show after 1 second. Co-authored-by: Justin M. Keyes <[email protected]> --------- Co-authored-by: Justin M. Keyes <[email protected]> Co-authored-by: JadenSimon <[email protected]>
1 parent 9cdc942 commit 2cfe683

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/shared/remoteSession.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55

66
import * as vscode from 'vscode'
77
import { Settings } from '../shared/settings'
8+
import { showMessageWithCancel } from './utilities/messages'
9+
import { Timeout } from './utilities/timeoutUtils'
810

911
export async function openRemoteTerminal(options: vscode.TerminalOptions, onClose: () => void) {
10-
await withoutShellIntegration(() => {
12+
const timeout = new Timeout(60000)
13+
14+
await showMessageWithCancel('AWS: Starting session...', timeout, 1000)
15+
await withoutShellIntegration(async () => {
1116
const terminal = vscode.window.createTerminal(options)
1217

1318
const listener = vscode.window.onDidCloseTerminal(t => {
@@ -17,7 +22,7 @@ export async function openRemoteTerminal(options: vscode.TerminalOptions, onClos
1722
})
1823

1924
terminal.show()
20-
})
25+
}).finally(() => timeout.cancel())
2126
}
2227

2328
// VSC is logging args to the PTY host log file if shell integration is enabled :(

0 commit comments

Comments
 (0)