feat(exportModal): add version field to exported flow data

The version field is added to the exported flow data in order to keep track of the version of the flow. This allows for better management and identification of different versions of the flow.

fix(exportModal): fetch and set version from API

The version is fetched from the API using the `getVersion` function and then set in the state variable `version` using the `setVersion` function. This ensures that the correct version is used when exporting the flow.

feat(flow): add version field to FlowType

The `FlowType` interface is updated to include a `version` field. This allows for storing and retrieving the version of the flow when needed.
This commit is contained in:
anovazzi1 2023-11-16 17:18:40 -03:00
commit 15c4532e5b
3 changed files with 7387 additions and 33 deletions

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@ import { EXPORT_DIALOG_SUBTITLE } from "../../constants/constants";
import { alertContext } from "../../contexts/alertContext";
import { FlowsContext } from "../../contexts/flowsContext";
import { typesContext } from "../../contexts/typesContext";
import { getVersion } from "../../controllers/API";
import { removeApiKeys } from "../../utils/reactflowUtils";
import BaseModal from "../baseModal";
@ -24,6 +25,13 @@ const ExportModal = forwardRef(
const [name, setName] = useState(flow!.name);
const [description, setDescription] = useState(flow!.description);
const [open, setOpen] = useState(false);
// Initialize state variable for the version
const [version, setVersion] = useState("");
useEffect(() => {
getVersion().then((data) => {
setVersion(data.version);
});
}, []);
return (
<BaseModal size="smaller-h-full" open={open} setOpen={setOpen}>
@ -73,6 +81,7 @@ const ExportModal = forwardRef(
data: reactFlowInstance?.toObject()!,
description,
name,
version,
},
name!,
description
@ -88,6 +97,7 @@ const ExportModal = forwardRef(
data: reactFlowInstance?.toObject()!,
description,
name,
version: version,
}),
name!,
description

View file

@ -10,6 +10,7 @@ export type FlowType = {
is_component?: boolean;
parent?: string;
date_created?: string;
version?: string;
};
export type NodeType = {
id: string;