File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/core/src/stepFunctions/vue/executeStateMachine Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff 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 },
You can’t perform that action at this time.
0 commit comments