Skip to content

Commit 7bcca69

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

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default defineComponent({
6262
async created() {
6363
this.initialData = (await client.init()) ?? this.initialData
6464
if (this.initialData.executionInput) {
65-
this.executionInput = this.initialData.executionInput
65+
this.executionInput = this.formatJson(this.initialData.executionInput)
6666
}
6767
},
6868
data: () => ({
@@ -110,7 +110,7 @@ export default defineComponent({
110110
reader.onload = (event) => {
111111
if (event.target) {
112112
const result = event.target.result
113-
this.executionInput = result as string
113+
this.executionInput = this.formatJson(result as string)
114114
}
115115
} // desired file content
116116
reader.onerror = (error) => {
@@ -121,6 +121,15 @@ export default defineComponent({
121121
this.textAreaVisible = true
122122
}
123123
},
124+
formatJson: function (jsonString: string): string {
125+
try {
126+
const parsed = JSON.parse(jsonString)
127+
return JSON.stringify(parsed, null, 2)
128+
} catch (error) {
129+
console.warn('Failed to format JSON:', error)
130+
return jsonString
131+
}
132+
},
124133
sendInput: function () {
125134
client.executeStateMachine(this.executionInput || '{}')
126135
},

0 commit comments

Comments
 (0)