-
Notifications
You must be signed in to change notification settings - Fork 747
feat(stepfunctions): add View by Execution ARN command and provider #7526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
laileni-aws
merged 6 commits into
aws:feature/stepfunctions-execution
from
l0minous:EntryPoint
Jun 23, 2025
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4f2d74e
feat(stepfunctions): add provider file for new entry point and webview
e0703e4
feat(stepfunctions): add View by Execution ARN command and provider
868ea8d
feat(stepfunctions): add View by Execution ARN command and provider
693644d
feat(stepfunctions): add View by Execution ARN command and provider
d64f5cd
feat(stepfunctions): add View by Execution ARN command and provider
89d3f69
feat(stepfunctions): add View by Execution ARN command and provider
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/core/src/stepFunctions/constants/webviewResources.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /*! | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| export const isLocalDev = true // eslint-disable-line @typescript-eslint/naming-convention | ||
| export const localhost = 'http://127.0.0.1:3002' // eslint-disable-line @typescript-eslint/naming-convention | ||
| export const cdn = 'https://d5t62uwepi9lu.cloudfront.net' // eslint-disable-line @typescript-eslint/naming-convention | ||
126 changes: 126 additions & 0 deletions
126
packages/core/src/stepFunctions/executionDetails/executionDetailProvider.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| /*! | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import * as vscode from 'vscode' | ||
| import { getLogger } from '../../shared/logger/logger' | ||
| import request from '../../shared/request' | ||
| import { ToolkitError } from '../../shared/errors' | ||
| import { i18n } from '../../shared/i18n-helper' | ||
| import { ComponentType } from '../workflowStudio/types' | ||
| import { isLocalDev, localhost, cdn } from '../constants/webviewResources' | ||
|
|
||
| /** | ||
| * Provider for Execution Details panels. | ||
| * | ||
| * Execution Details displays information about state machine executions in a WebView panel. | ||
| */ | ||
| export class ExecutionDetailProvider { | ||
| public static readonly viewType = 'stepfunctions.executionDetails' | ||
|
|
||
| /** | ||
| * Opens execution details in a WebView panel. | ||
| * @param executionArn The ARN of the execution to display details for | ||
| * @param params Optional parameters to customize the WebView panel | ||
| */ | ||
| public static async openExecutionDetails( | ||
| executionArn: string, | ||
| params?: vscode.WebviewPanelOptions & vscode.WebviewOptions | ||
| ): Promise<void> { | ||
| // Create and show the webview panel | ||
| const panel = vscode.window.createWebviewPanel( | ||
| ExecutionDetailProvider.viewType, | ||
| `Execution: ${executionArn.split(':').pop() || executionArn}`, | ||
| vscode.ViewColumn.Beside, | ||
| { | ||
| enableScripts: true, | ||
| retainContextWhenHidden: true, | ||
| ...params, | ||
| } | ||
| ) | ||
|
|
||
| // Create the provider and initialize the panel | ||
| const provider = new ExecutionDetailProvider() | ||
| await provider.initializePanel(panel, executionArn) | ||
| } | ||
|
|
||
| /** | ||
| * Registers the command to open execution details. | ||
| * @remarks This should only be called once per extension. | ||
| */ | ||
| public static register(): vscode.Disposable { | ||
| return vscode.commands.registerCommand( | ||
| 'aws.stepFunctions.viewExecutionDetails', | ||
l0minous marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| async (executionArn: string) => { | ||
| await ExecutionDetailProvider.openExecutionDetails(executionArn) | ||
| } | ||
| ) | ||
| } | ||
|
|
||
| protected webviewHtml: string | ||
| protected readonly logger = getLogger() | ||
|
|
||
| constructor() { | ||
| this.webviewHtml = '' | ||
| } | ||
|
|
||
| /** | ||
| * Fetches the webview HTML from the CDN or local server. | ||
| * @private | ||
| */ | ||
| private async fetchWebviewHtml(): Promise<void> { | ||
| const source = isLocalDev ? localhost : cdn | ||
| const response = await request.fetch('GET', `${source}/index.html`).response | ||
| this.webviewHtml = await response.text() | ||
| } | ||
|
|
||
| /** | ||
| * Gets the webview content for Execution Details. | ||
| * @private | ||
| */ | ||
| private getWebviewContent = async (): Promise<string> => { | ||
| const htmlFileSplit = this.webviewHtml.split('<head>') | ||
|
|
||
| // Set asset source to CDN | ||
| const source = isLocalDev ? localhost : cdn | ||
| const baseTag = `<base href='${source}'/>` | ||
|
|
||
| // Set locale, dark mode | ||
| const locale = vscode.env.language | ||
| const localeTag = `<meta name='locale' content='${locale}'>` | ||
| const theme = vscode.window.activeColorTheme.kind | ||
| const isDarkMode = theme === vscode.ColorThemeKind.Dark || theme === vscode.ColorThemeKind.HighContrast | ||
| const darkModeTag = `<meta name='dark-mode' content='${isDarkMode}'>` | ||
|
|
||
| // Set component type to ExecutionDetails | ||
| const componentTypeTag = `<meta name="component-type" content="${ComponentType.ExecutionDetails}" />` | ||
|
|
||
| return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${componentTypeTag} ${htmlFileSplit[1]}` | ||
| } | ||
|
|
||
| /** | ||
| * Initializes a WebView panel with execution details. | ||
| * @param panel The WebView panel to initialize | ||
| * @param executionArn The ARN of the execution to display | ||
| */ | ||
| public async initializePanel(panel: vscode.WebviewPanel, executionArn: string): Promise<void> { | ||
| try { | ||
| if (!this.webviewHtml) { | ||
| await this.fetchWebviewHtml() | ||
| } | ||
|
|
||
| // Set up the content | ||
| panel.webview.html = await this.getWebviewContent() | ||
|
|
||
| // Handle messages from the webview | ||
| panel.webview.onDidReceiveMessage(async (message) => { | ||
| this.logger.debug('Received message from execution details webview: %O', message) | ||
| // Add message handlers as needed | ||
| }) | ||
| } catch (err) { | ||
| void vscode.window.showErrorMessage(i18n('AWS.stepFunctions.executionDetails.failed')) | ||
| throw ToolkitError.chain(err, 'Could not open Execution Details', { code: 'OpenExecutionDetailsFailed' }) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/toolkit/.changes/next-release/Feature-ce02287b-d043-4d71-8589-685903fb5ee7.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Feature", | ||
| "description": "Added view by execution ARN command to visualize an execution" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.