spring-projects/spring-flo

How to save stream output to json and json to graph

snv1914 opened this issue · 3 comments

Hi,

As i have seen that there is text-editor to show the graph output text.

But here i want to save the output as json.
And also i want the saved json as parameter and then graph can be drawn on canvas.

Is there a way like that?

Can someone help to solve the issue.

There is no support for this from the library but this should be doable. The demo app has a toolbar with buttons, therefore, following the example in the repo you should be able to add a save button (https://github.com/spring-projects/spring-flo/blob/main/src/demo/app/app.component.html#L20) and code a handler for it using a Flo editor handle object: Flo.EditorContext (https://github.com/spring-projects/spring-flo/blob/main/src/demo/app/app.component.ts#L41) and dsl binding in your component (https://github.com/spring-projects/spring-flo/blob/main/src/demo/app/app.component.html#L11).

Thanks @BoykoAlex .
I am able to get dsl using this.dsl at https://github.com/spring-projects/spring-flo/blob/main/src/demo/app/app.component.ts#L38.

Also to get json, i tried this way:
Here I am able to get json using this this.editorContext.getGraph() function. Please see this json file node-connection-json-file.txt

image

after that when i load saved json from external source, can i know is there any way here that the saved json to be read and show as graph? Is there any function like setGraph with json as parameter?

(or)

only dsl format is used to show as graph?

I'd use the DSL as the serialization format rather than the graph