refactor: sort json before exporting and add tags to flows (#6849)

* feat: Enhance flow download with recursive JSON sorting

- Add `sortJsonStructure` function to recursively sort object keys and array elements
- Improve `downloadFlow` function to create deterministic JSON output
- Add error handling for flow download process
- Ensure consistent and predictable JSON file generation

* feat: Include flow tags in export modal payload

Add `tags` to the export modal payload to ensure comprehensive flow metadata is preserved during export

* 📝 (model.py): Add tags field to FlowRead and FlowHeader models for better organization and categorization of flows
✨ (use-post-add-flow.ts): Add support for adding tags to a new flow in the frontend
✨ (exportModal/index.tsx): Include tags when exporting a flow in the export modal
♻️ (index.tsx): Refactor ListComponent to remove unnecessary comments and improve code readability
🔧 (reactflowUtils.ts): Update createNewFlow function to include tags field when creating a new flow

* style: add blank line

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-03-05 09:06:26 -03:00 • committed by GitHub
commit e5f654a752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 66 additions and 24 deletions

View file

@ -200,6 +200,7 @@ class FlowRead(FlowBase):
id: UUID
user_id: UUID | None = Field()
folder_id: UUID | None = Field()
tags: list[str] | None = Field(None, description="The tags of the flow")
class FlowHeader(BaseModel):
@ -215,6 +216,7 @@ class FlowHeader(BaseModel):
endpoint_name: str | None = Field(None, description="The name of the endpoint associated with this flow")
description: str | None = Field(None, description="A description of the flow")
data: dict | None = Field(None, description="The data of the component, if is_component is True")
tags: list[str] | None = Field(None, description="The tags of the flow")
@field_validator("data", mode="before")
@classmethod