Skip to content

Commit 3d63696

Browse files
l0minousDiler Zaza
andauthored
feat(stepfunctions): Enabling text box input to accept Execution ARNs (#7625)
## Problem `View Execution Details by Execution ARN` command currently works only as a button that opens a hardcoded execution ARN ## Solution Modifying `View Execution Details by Execution ARN` command to now prompt the user to input an Execution ARN which gets passed to `ExecutionDetailProvider`. Invalid ARNs open a webview displaying `The execution ARN is invalid.` ## Verification ![test5](https://github.com/user-attachments/assets/c24490fb-e9d8-4269-8885-9399989ad359) --- - 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. --------- Co-authored-by: Diler Zaza <[email protected]>
1 parent f8d4757 commit 3d63696

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

packages/core/src/stepFunctions/activation.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { WorkflowStudioEditorProvider } from './workflowStudio/workflowStudioEdi
2424
import { StateMachineNode } from './explorer/stepFunctionsNodes'
2525
import { downloadStateMachineDefinition } from './commands/downloadStateMachineDefinition'
2626
import { ExecutionDetailProvider } from './executionDetails/executionDetailProvider'
27+
import { validate } from '@aws-sdk/util-arn-parser'
2728

2829
/**
2930
* Activate Step Functions related functionality for the extension.
@@ -100,7 +101,19 @@ async function registerStepFunctionCommands(
100101
await publishStateMachine({ awsContext: awsContext, outputChannel: outputChannel, region: region })
101102
}),
102103
Commands.register('aws.stepfunctions.viewExecutionDetailsByExecutionARN', async () => {
103-
await ExecutionDetailProvider.openExecutionDetails('')
104+
const arn = await vscode.window.showInputBox({
105+
prompt: 'Enter Execution ARN',
106+
placeHolder:
107+
'arn:aws:states:us-east-1:123456789012:execution:MyStateMachine:12345678-1234-1234-1234-123456789012',
108+
})
109+
110+
if (validate(arn)) {
111+
await ExecutionDetailProvider.openExecutionDetails(arn!)
112+
} else {
113+
void vscode.window.showErrorMessage(
114+
'Invalid ARN format. Please provide a valid Step Functions execution ARN (e.g., arn:aws:states:us-east-1:123456789012:execution:MyStateMachine:12345678-1234-1234-1234-123456789012)'
115+
)
116+
}
104117
})
105118
)
106119
}

packages/core/src/stepFunctions/executionDetails/executionDetailProvider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class ExecutionDetailProvider {
6767
* Gets the webview content for Execution Details.
6868
* @private
6969
*/
70-
private getWebviewContent = async (): Promise<string> => {
70+
private getWebviewContent = async (executionArn: string): Promise<string> => {
7171
const htmlFileSplit = this.webviewHtml.split('<head>')
7272

7373
// Set asset source to CDN
@@ -83,8 +83,9 @@ export class ExecutionDetailProvider {
8383

8484
// Set component type to ExecutionDetails
8585
const componentTypeTag = `<meta name="component-type" content="${ComponentType.ExecutionDetails}" />`
86+
const executionArnTag = `<meta name="execution-arn" content="${executionArn}" />`
8687

87-
return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${componentTypeTag} ${htmlFileSplit[1]}`
88+
return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${componentTypeTag} ${executionArnTag} ${htmlFileSplit[1]}`
8889
}
8990

9091
/**
@@ -99,7 +100,7 @@ export class ExecutionDetailProvider {
99100
}
100101

101102
// Set up the content
102-
panel.webview.html = await this.getWebviewContent()
103+
panel.webview.html = await this.getWebviewContent(executionArn)
103104
const context: ExecutionDetailsContext = {
104105
panel,
105106
loaderNotification: undefined,

0 commit comments

Comments
 (0)