Skip to content

Commit e1abbe6

Browse files
fix(sagemaker): Disable start/stop button for intermediate state of the space (#8282)
## Problem - Users could click start/stop buttons on SageMaker spaces while they were already in the process of starting or stopping. ## Solution - Disables start/stop buttons when SageMaker space is in STARTING or STOPPING state to prevent invalid operations during state transitions. - Added pending state check in getContext() method - Returns specific context values for pending states (smusSpacePendingNode/awsSagemakerSpacePendingNode) in package.json [openRemoteConnection] --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 7a03794 commit e1abbe6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/core/src/awsService/sagemaker/sagemakerSpace.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,15 @@ export class SagemakerSpace {
191191
public getContext(): string {
192192
const status = this.getStatus()
193193

194-
// only distinguish between running and non-running states
195194
if (status === SpaceStatus.RUNNING) {
196195
return 'awsSagemakerSpaceRunningNode'
197196
}
198197

198+
if (status === SpaceStatus.STOPPED) {
199+
return 'awsSagemakerSpaceStoppedNode'
200+
}
201+
202+
// For all other states (STARTING, STOPPING, etc.), return base context
199203
return this.isSMUSSpace ? 'smusSpaceNode' : 'awsSagemakerSpaceNode'
200204
}
201205

packages/toolkit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,12 +1514,12 @@
15141514
{
15151515
"command": "aws.sagemaker.openRemoteConnection",
15161516
"group": "inline@1",
1517-
"when": "view != aws.smus.rootView && viewItem =~ /^(awsSagemakerSpaceRunningNode|awsSagemakerSpaceNode)$/"
1517+
"when": "view != aws.smus.rootView && viewItem =~ /^(awsSagemakerSpaceRunningNode|awsSagemakerSpaceStoppedNode)$/"
15181518
},
15191519
{
15201520
"command": "aws.smus.openRemoteConnection",
15211521
"group": "inline@1",
1522-
"when": "view == aws.smus.rootView && viewItem =~ /^(awsSagemakerSpaceRunningNode|smusSpaceNode)$/"
1522+
"when": "view == aws.smus.rootView && viewItem =~ /^(awsSagemakerSpaceRunningNode|awsSagemakerSpaceStoppedNode)$/"
15231523
},
15241524
{
15251525
"command": "_aws.toolkit.notifications.dismiss",

0 commit comments

Comments
 (0)