Skip to content

Commit b467251

Browse files
committed
fix(stepfunctions): Remove and replace legacy render graph commands with workflow studio
1 parent 7e02fc7 commit b467251

File tree

5 files changed

+25
-28
lines changed

5 files changed

+25
-28
lines changed

packages/core/package.nls.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@
172172
"AWS.command.viewSchemaItem": "View Schema",
173173
"AWS.command.searchSchema": "Search Schemas",
174174
"AWS.command.executeStateMachine": "Start Execution...",
175-
"AWS.command.renderStateMachineGraph": "Render graph",
176175
"AWS.command.copyArn": "Copy ARN",
177176
"AWS.command.copyName": "Copy Name",
178177
"AWS.command.openAwsConsole": "Go to AWS management console",

packages/core/src/awsexplorer/activation.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,6 @@ async function registerAwsExplorerCommands(
190190
'aws.executeStateMachine',
191191
async (node: StateMachineNode) => await executeStateMachine(context, node)
192192
),
193-
Commands.register(
194-
'aws.renderStateMachineGraph',
195-
async (node: StateMachineNode) =>
196-
await downloadStateMachineDefinition({
197-
stateMachineNode: node,
198-
outputChannel: toolkitOutputChannel,
199-
isPreviewAndRender: true,
200-
})
201-
),
202193
Commands.register('aws.copyArn', async (node: AWSResourceNode | TreeNode) => {
203194
const sourceNode = getSourceNode<AWSResourceNode>(node)
204195
await copyTextCommand(sourceNode, 'ARN')

packages/core/src/stepFunctions/activation.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { telemetry } from '../shared/telemetry/telemetry'
2323
import { PerfLog } from '../shared/logger/perfLogger'
2424
import { ASLLanguageClient } from './asl/client'
2525
import { WorkflowStudioEditorProvider } from './workflowStudio/workflowStudioEditorProvider'
26+
import { StateMachineNode } from './explorer/stepFunctionsNodes'
27+
import { downloadStateMachineDefinition } from './commands/downloadStateMachineDefinition'
2628

2729
/**
2830
* Activate Step Functions related functionality for the extension.
@@ -56,10 +58,18 @@ export async function activate(
5658

5759
export const previewStateMachineCommand = Commands.declare(
5860
'aws.previewStateMachine',
59-
() => async (arg?: vscode.TextEditor | vscode.Uri) => {
61+
() => async (arg?: vscode.TextEditor | vscode.Uri | StateMachineNode) => {
6062
await telemetry.run('stepfunctions_previewstatemachine', async () => {
63+
if (arg instanceof StateMachineNode) {
64+
return downloadStateMachineDefinition({
65+
stateMachineNode: arg,
66+
outputChannel: globals.outputChannel,
67+
isPreviewAndRender: true,
68+
})
69+
}
70+
6171
arg ??= vscode.window.activeTextEditor
62-
const input = arg instanceof vscode.Uri ? arg : arg?.document
72+
const input = arg instanceof vscode.Uri ? arg : arg?.document.uri
6373

6474
if (!input) {
6575
throw new ToolkitError('No active text editor or document found')

packages/core/src/stepFunctions/commands/downloadStateMachineDefinition.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import { DefaultStepFunctionsClient, StepFunctionsClient } from '../../shared/cl
1515
import { getLogger, Logger } from '../../shared/logger/logger'
1616
import { Result } from '../../shared/telemetry/telemetry'
1717
import { StateMachineNode } from '../explorer/stepFunctionsNodes'
18-
import { previewStateMachineCommand } from '../activation'
1918
import { telemetry } from '../../shared/telemetry/telemetry'
2019
import { fs } from '../../shared/fs/fs'
20+
import { WorkflowStudioEditorProvider } from '../workflowStudio/workflowStudioEditorProvider'
2121

2222
export async function downloadStateMachineDefinition(params: {
2323
outputChannel: vscode.OutputChannel
@@ -40,7 +40,15 @@ export async function downloadStateMachineDefinition(params: {
4040
})
4141

4242
const textEditor = await vscode.window.showTextDocument(doc)
43-
await previewStateMachineCommand.execute(textEditor)
43+
await vscode.commands.executeCommand(
44+
'vscode.openWith',
45+
textEditor.document.uri,
46+
WorkflowStudioEditorProvider.viewType,
47+
{
48+
preserveFocus: true,
49+
viewColumn: vscode.ViewColumn.Beside,
50+
}
51+
)
4452
} else {
4553
const wsPath = vscode.workspace.workspaceFolders
4654
? vscode.workspace.workspaceFolders[0].uri.fsPath

packages/toolkit/package.json

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@
11871187
"when": "false"
11881188
},
11891189
{
1190-
"command": "aws.renderStateMachineGraph",
1190+
"command": "aws.stepfunctions.openWithWorkflowStudio",
11911191
"when": "false"
11921192
},
11931193
{
@@ -1686,7 +1686,7 @@
16861686
"group": "0@1"
16871687
},
16881688
{
1689-
"command": "aws.renderStateMachineGraph",
1689+
"command": "aws.previewStateMachine",
16901690
"when": "view == aws.explorer && viewItem == awsStateMachineNode",
16911691
"group": "0@2"
16921692
},
@@ -3103,17 +3103,6 @@
31033103
}
31043104
}
31053105
},
3106-
{
3107-
"command": "aws.renderStateMachineGraph",
3108-
"title": "%AWS.command.renderStateMachineGraph%",
3109-
"enablement": "isCloud9 || !aws.isWebExtHost",
3110-
"category": "%AWS.title%",
3111-
"cloud9": {
3112-
"cn": {
3113-
"category": "%AWS.title.cn%"
3114-
}
3115-
}
3116-
},
31173106
{
31183107
"command": "aws.copyArn",
31193108
"title": "%AWS.command.copyArn%",
@@ -3343,7 +3332,7 @@
33433332
},
33443333
{
33453334
"command": "aws.previewStateMachine",
3346-
"title": "%AWS.command.stepFunctions.previewStateMachine%",
3335+
"title": "%AWS.command.stepFunctions.openWithWorkflowStudio%",
33473336
"category": "%AWS.title%",
33483337
"enablement": "isCloud9 || !aws.isWebExtHost",
33493338
"icon": "$(aws-stepfunctions-preview)",

0 commit comments

Comments
 (0)