Skip to content

Commit 693644d

Browse files
author
Diler Zaza
committed
feat(stepfunctions): add View by Execution ARN command and provider
1 parent 868ea8d commit 693644d

File tree

6 files changed

+41
-45
lines changed

6 files changed

+41
-45
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
export const isLocalDev = true // eslint-disable-line @typescript-eslint/naming-convention
7+
export const localhost = 'http://127.0.0.1:3002' // eslint-disable-line @typescript-eslint/naming-convention
8+
export const cdn = 'https://d5t62uwepi9lu.cloudfront.net' // eslint-disable-line @typescript-eslint/naming-convention

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

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,10 @@
66
import * as vscode from 'vscode'
77
import { getLogger } from '../../shared/logger/logger'
88
import request from '../../shared/request'
9-
import { getClientId } from '../../shared/telemetry/util'
10-
import { telemetry } from '../../shared/telemetry/telemetry'
11-
import globals from '../../shared/extensionGlobals'
12-
// import { getStringHash } from '../../shared/utilities/textUtilities'
139
import { ToolkitError } from '../../shared/errors'
14-
import { getTabSizeSetting } from '../../shared/utilities/editorUtilities'
1510
import { i18n } from '../../shared/i18n-helper'
16-
import { WorkflowMode } from '../workflowStudio/types'
17-
18-
const isLocalDev = true
19-
const localhost = 'http://127.0.0.1:3002'
20-
const cdn = 'https://d5t62uwepi9lu.cloudfront.net'
21-
let clientId = ''
11+
import { ComponentType } from '../workflowStudio/types'
12+
import { isLocalDev, localhost, cdn } from '../constants/webviewResources'
2213

2314
/**
2415
* Provider for Execution Details panels.
@@ -37,23 +28,21 @@ export class ExecutionDetailProvider {
3728
executionArn: string,
3829
params?: vscode.WebviewPanelOptions & vscode.WebviewOptions
3930
): Promise<void> {
40-
await telemetry.stepfunctions_openWorkflowStudio.run(async () => {
41-
// Create and show the webview panel
42-
const panel = vscode.window.createWebviewPanel(
43-
ExecutionDetailProvider.viewType,
44-
`Execution: ${executionArn.split(':').pop() || executionArn}`,
45-
vscode.ViewColumn.Beside,
46-
{
47-
enableScripts: true,
48-
retainContextWhenHidden: true,
49-
...params,
50-
}
51-
)
52-
53-
// Create the provider and initialize the panel
54-
const provider = new ExecutionDetailProvider()
55-
await provider.initializePanel(panel, executionArn)
56-
})
31+
// Create and show the webview panel
32+
const panel = vscode.window.createWebviewPanel(
33+
ExecutionDetailProvider.viewType,
34+
`Execution: ${executionArn.split(':').pop() || executionArn}`,
35+
vscode.ViewColumn.Beside,
36+
{
37+
enableScripts: true,
38+
retainContextWhenHidden: true,
39+
...params,
40+
}
41+
)
42+
43+
// Create the provider and initialize the panel
44+
const provider = new ExecutionDetailProvider()
45+
await provider.initializePanel(panel, executionArn)
5746
}
5847

5948
/**
@@ -102,16 +91,12 @@ export class ExecutionDetailProvider {
10291
const localeTag = `<meta name='locale' content='${locale}'>`
10392
const theme = vscode.window.activeColorTheme.kind
10493
const isDarkMode = theme === vscode.ColorThemeKind.Dark || theme === vscode.ColorThemeKind.HighContrast
105-
const tabSizeTag = `<meta name='tab-size' content='${getTabSizeSetting()}'>`
10694
const darkModeTag = `<meta name='dark-mode' content='${isDarkMode}'>`
10795

10896
// Set component type to ExecutionDetails
109-
const componentTypeTag = `<meta name="component-type" content="ExecutionDetails" />`
97+
const componentTypeTag = `<meta name="component-type" content="${ComponentType.ExecutionDetails}" />`
11098

111-
// Set to read-only mode as this is just displaying execution details
112-
const modeTag = `<meta name="workflow-mode" content="${WorkflowMode.Readonly}" />`
113-
114-
return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${tabSizeTag} ${modeTag} ${componentTypeTag} ${htmlFileSplit[1]}`
99+
return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${componentTypeTag} ${htmlFileSplit[1]}`
115100
}
116101

117102
/**
@@ -125,10 +110,6 @@ export class ExecutionDetailProvider {
125110
await this.fetchWebviewHtml()
126111
}
127112

128-
if (clientId === '') {
129-
clientId = getClientId(globals.globalState)
130-
}
131-
132113
// Set up the content
133114
panel.webview.html = await this.getWebviewContent()
134115

packages/core/src/stepFunctions/workflowStudio/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import { IAM, StepFunctions } from 'aws-sdk'
66
import * as vscode from 'vscode'
77

8+
export enum ComponentType {
9+
WorkflowStudio = 'WorkflowStudio',
10+
ExecutionDetails = 'ExecutionDetails',
11+
}
12+
813
export enum WorkflowMode {
914
Editable = 'toolkit',
1015
Readonly = 'readonly',

packages/core/src/stepFunctions/workflowStudio/workflowStudioEditorProvider.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ import { getTabSizeSetting } from '../../shared/utilities/editorUtilities'
1515
import { WorkflowStudioEditor } from './workflowStudioEditor'
1616
import { i18n } from '../../shared/i18n-helper'
1717
import { isInvalidJsonFile, isInvalidYamlFile } from '../utils'
18-
import { WorkflowMode } from './types'
18+
import { ComponentType, WorkflowMode } from './types'
19+
import { isLocalDev, localhost, cdn } from '../constants/webviewResources'
1920

20-
const isLocalDev = false
21-
const localhost = 'http://127.0.0.1:3002'
22-
const cdn = 'https://d5t62uwepi9lu.cloudfront.net'
2321
let clientId = ''
2422

2523
/**
@@ -133,7 +131,11 @@ export class WorkflowStudioEditorProvider implements vscode.CustomTextEditorProv
133131
const darkModeTag = `<meta name='dark-mode' content='${isDarkMode}'>`
134132

135133
const modeTag = `<meta name="workflow-mode" content="${mode}" />`
136-
return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${tabSizeTag} ${modeTag} ${htmlFileSplit[1]}`
134+
135+
// Set component type to WorkflowStudio
136+
const componentTypeTag = `<meta name="component-type" content="${ComponentType.WorkflowStudio}" />`
137+
138+
return `${htmlFileSplit[0]} <head> ${baseTag} ${localeTag} ${darkModeTag} ${tabSizeTag} ${modeTag} ${componentTypeTag} ${htmlFileSplit[1]}`
137139
}
138140

139141
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"type": "Feature",
3-
"description": "View By Execution ARN command launches a webview panel for Execution Details"
3+
"description": "Added view by execution ARN command to visualize an execution"
44
}

packages/toolkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "aws-toolkit-vscode",
33
"displayName": "AWS Toolkit",
44
"description": "Including CodeCatalyst, Infrastructure Composer, and support for Lambda, S3, CloudWatch Logs, CloudFormation, and many other services.",
5-
"version": "3.63.0-SNAPSHOT",
5+
"version": "3.67.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

0 commit comments

Comments
 (0)