Skip to content

Commit 91cc317

Browse files
author
Zelin Zhou
committed
feat: auto fill existing ExecutionInput when click StartExecution from ExecutionDetails tab.
1 parent 2b92a6f commit 91cc317

File tree

7 files changed

+72
-20
lines changed

7 files changed

+72
-20
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ExecutionDetailsContext,
1212
ApiCallRequestMessage,
1313
InitResponseMessage,
14+
StartExecutionMessage,
1415
} from '../messageHandlers/types'
1516
import {
1617
loadStageMessageHandler,
@@ -39,7 +40,7 @@ export async function handleMessage(message: Message, context: ExecutionDetailsC
3940
break
4041
}
4142
case Command.START_EXECUTION:
42-
void startExecutionMessageHandler(context)
43+
void startExecutionMessageHandler(message as StartExecutionMessage, context)
4344
break
4445
case Command.EDIT_STATE_MACHINE:
4546
void editStateMachineMessageHandler(context)
@@ -85,7 +86,7 @@ async function initMessageHandler(context: ExecutionDetailsContext) {
8586
}
8687
}
8788

88-
async function startExecutionMessageHandler(context: ExecutionDetailsContext) {
89+
async function startExecutionMessageHandler(message: StartExecutionMessage, context: ExecutionDetailsContext) {
8990
const logger = getLogger('stepfunctions')
9091
try {
9192
// Parsing execution ARN to get state machine info
@@ -100,6 +101,7 @@ async function startExecutionMessageHandler(context: ExecutionDetailsContext) {
100101
arn: stateMachineArn,
101102
name: stateMachineName,
102103
region: region,
104+
executionInput: message.executionInput,
103105
})
104106
} catch (error) {
105107
logger.error('Start execution failed: %O', error)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ export interface SyncFileRequestMessage extends SaveFileRequestMessage {
105105
fileContents: string
106106
}
107107

108+
export interface StartExecutionMessage extends Message {
109+
executionInput?: string
110+
}
111+
108112
export enum ApiAction {
109113
IAMListRoles = 'iam:ListRoles',
110114
SFNTestState = 'sfn:TestState',

packages/core/src/stepFunctions/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,21 @@ export const openWorkflowStudioWithDefinition = async (
177177
* Shows the Execute State Machine webview with the provided state machine data
178178
* @param extensionContext The extension context
179179
* @param outputChannel The output channel for logging
180-
* @param stateMachineData Object containing arn, name, and region of the state machine
180+
* @param stateMachineData Object containing arn, name, region, and optional executionInput of the state machine
181181
* @returns The webview instance
182182
*/
183183
export const showExecuteStateMachineWebview = async (stateMachineData: {
184184
arn: string
185185
name: string
186186
region: string
187+
executionInput?: string
187188
}) => {
188189
const Panel = VueWebview.compilePanel(ExecuteStateMachineWebview)
189190
const wv = new Panel(globals.context, globals.outputChannel, {
190191
arn: stateMachineData.arn,
191192
name: stateMachineData.name,
192193
region: stateMachineData.region,
194+
executionInput: stateMachineData.executionInput,
193195
})
194196

195197
await wv.show({

packages/core/src/stepFunctions/vue/executeStateMachine/executeStateMachine.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface StateMachine {
2222
arn: string
2323
name: string
2424
region: string
25+
executionInput?: string
2526
}
2627

2728
export class ExecuteStateMachineWebview extends VueWebview {
@@ -89,11 +90,16 @@ export class ExecuteStateMachineWebview extends VueWebview {
8990
}
9091
}
9192

92-
export async function executeStateMachine(context: ExtContext, node: StateMachineNode): Promise<void> {
93+
export async function executeStateMachine(
94+
context: ExtContext,
95+
node: StateMachineNode,
96+
executionInput?: string
97+
): Promise<void> {
9398
await showExecuteStateMachineWebview({
9499
arn: node.details.stateMachineArn || '',
95100
name: node.details.name || '',
96101
region: node.regionCode,
102+
executionInput,
97103
})
98104
telemetry.stepfunctions_executeStateMachineView.emit()
99105
}

packages/core/src/stepFunctions/vue/executeStateMachine/executeStateMachine.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ const defaultInitialData = {
5555
name: '',
5656
region: '',
5757
arn: '',
58+
executionInput: '',
5859
}
5960
6061
export default defineComponent({
6162
async created() {
6263
this.initialData = (await client.init()) ?? this.initialData
64+
if (this.initialData.executionInput) {
65+
this.executionInput = this.initialData.executionInput
66+
}
6367
},
6468
data: () => ({
6569
initialData: defaultInitialData,
@@ -89,7 +93,9 @@ export default defineComponent({
8993
break
9094
case 'textarea':
9195
this.placeholderJson = defaultJsonPlaceholder
92-
this.executionInput = ''
96+
if (!this.initialData.executionInput) {
97+
this.executionInput = ''
98+
}
9399
this.fileInputVisible = false
94100
break
95101
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "[Step Functions] Start Execution from Execution Details tab now fills the existing Execution Input in the Start Execution tab."
4+
}

packages/toolkit/package.json

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4576,110 +4576,138 @@
45764576
"fontCharacter": "\\f1d0"
45774577
}
45784578
},
4579-
"aws-lambda-function": {
4579+
"aws-lambda-create-stack": {
45804580
"description": "AWS Contributed Icon",
45814581
"default": {
45824582
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
45834583
"fontCharacter": "\\f1d1"
45844584
}
45854585
},
4586-
"aws-mynah-MynahIconBlack": {
4586+
"aws-lambda-create-stack-light": {
45874587
"description": "AWS Contributed Icon",
45884588
"default": {
45894589
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
45904590
"fontCharacter": "\\f1d2"
45914591
}
45924592
},
4593-
"aws-mynah-MynahIconWhite": {
4593+
"aws-lambda-function": {
45944594
"description": "AWS Contributed Icon",
45954595
"default": {
45964596
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
45974597
"fontCharacter": "\\f1d3"
45984598
}
45994599
},
4600-
"aws-mynah-logo": {
4600+
"aws-mynah-MynahIconBlack": {
46014601
"description": "AWS Contributed Icon",
46024602
"default": {
46034603
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46044604
"fontCharacter": "\\f1d4"
46054605
}
46064606
},
4607-
"aws-redshift-cluster": {
4607+
"aws-mynah-MynahIconWhite": {
46084608
"description": "AWS Contributed Icon",
46094609
"default": {
46104610
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46114611
"fontCharacter": "\\f1d5"
46124612
}
46134613
},
4614-
"aws-redshift-cluster-connected": {
4614+
"aws-mynah-logo": {
46154615
"description": "AWS Contributed Icon",
46164616
"default": {
46174617
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46184618
"fontCharacter": "\\f1d6"
46194619
}
46204620
},
4621-
"aws-redshift-database": {
4621+
"aws-redshift-cluster": {
46224622
"description": "AWS Contributed Icon",
46234623
"default": {
46244624
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46254625
"fontCharacter": "\\f1d7"
46264626
}
46274627
},
4628-
"aws-redshift-redshift-cluster-connected": {
4628+
"aws-redshift-cluster-connected": {
46294629
"description": "AWS Contributed Icon",
46304630
"default": {
46314631
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46324632
"fontCharacter": "\\f1d8"
46334633
}
46344634
},
4635-
"aws-redshift-schema": {
4635+
"aws-redshift-database": {
46364636
"description": "AWS Contributed Icon",
46374637
"default": {
46384638
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46394639
"fontCharacter": "\\f1d9"
46404640
}
46414641
},
4642-
"aws-redshift-table": {
4642+
"aws-redshift-redshift-cluster-connected": {
46434643
"description": "AWS Contributed Icon",
46444644
"default": {
46454645
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46464646
"fontCharacter": "\\f1da"
46474647
}
46484648
},
4649-
"aws-s3-bucket": {
4649+
"aws-redshift-schema": {
46504650
"description": "AWS Contributed Icon",
46514651
"default": {
46524652
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46534653
"fontCharacter": "\\f1db"
46544654
}
46554655
},
4656-
"aws-s3-create-bucket": {
4656+
"aws-redshift-table": {
46574657
"description": "AWS Contributed Icon",
46584658
"default": {
46594659
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46604660
"fontCharacter": "\\f1dc"
46614661
}
46624662
},
4663-
"aws-schemas-registry": {
4663+
"aws-s3-bucket": {
46644664
"description": "AWS Contributed Icon",
46654665
"default": {
46664666
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46674667
"fontCharacter": "\\f1dd"
46684668
}
46694669
},
4670-
"aws-schemas-schema": {
4670+
"aws-s3-create-bucket": {
46714671
"description": "AWS Contributed Icon",
46724672
"default": {
46734673
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46744674
"fontCharacter": "\\f1de"
46754675
}
46764676
},
4677-
"aws-stepfunctions-preview": {
4677+
"aws-sagemaker-code-editor": {
46784678
"description": "AWS Contributed Icon",
46794679
"default": {
46804680
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
46814681
"fontCharacter": "\\f1df"
46824682
}
4683+
},
4684+
"aws-sagemaker-jupyter-lab": {
4685+
"description": "AWS Contributed Icon",
4686+
"default": {
4687+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
4688+
"fontCharacter": "\\f1e0"
4689+
}
4690+
},
4691+
"aws-schemas-registry": {
4692+
"description": "AWS Contributed Icon",
4693+
"default": {
4694+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
4695+
"fontCharacter": "\\f1e1"
4696+
}
4697+
},
4698+
"aws-schemas-schema": {
4699+
"description": "AWS Contributed Icon",
4700+
"default": {
4701+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
4702+
"fontCharacter": "\\f1e2"
4703+
}
4704+
},
4705+
"aws-stepfunctions-preview": {
4706+
"description": "AWS Contributed Icon",
4707+
"default": {
4708+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
4709+
"fontCharacter": "\\f1e3"
4710+
}
46834711
}
46844712
},
46854713
"notebooks": [

0 commit comments

Comments
 (0)