Fixed import function
This commit is contained in:
parent
ec240072e7
commit
a055e4f1fa
3 changed files with 25 additions and 2 deletions
1
src/frontend/package-lock.json
generated
1
src/frontend/package-lock.json
generated
|
|
@ -480,7 +480,6 @@
|
||||||
},
|
},
|
||||||
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
|
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"extraneous": true,
|
|
||||||
"inBundle": true,
|
"inBundle": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import EmptyComponent from "../emptyComponent";
|
||||||
import HeaderComponent from "../headerComponent";
|
import HeaderComponent from "../headerComponent";
|
||||||
import { downloadFlow, removeApiKeys } from "../../../../utils/reactflowUtils";
|
import { downloadFlow, removeApiKeys } from "../../../../utils/reactflowUtils";
|
||||||
import { useDarkStore } from "../../../../stores/darkStore";
|
import { useDarkStore } from "../../../../stores/darkStore";
|
||||||
|
import { UPLOAD_ERROR_ALERT } from "../../../../constants/alerts_constants";
|
||||||
|
|
||||||
export default function ComponentsComponent({
|
export default function ComponentsComponent({
|
||||||
type = "all",
|
type = "all",
|
||||||
|
|
@ -156,6 +157,26 @@ export default function ComponentsComponent({
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleImport = () => {
|
||||||
|
uploadFlow({ newProject: true, isComponent: false })
|
||||||
|
.then(() => {
|
||||||
|
resetFilter();
|
||||||
|
getFoldersApi(true);
|
||||||
|
if (!folderId || folderId === myCollectionId) {
|
||||||
|
getFolderById(folderId ? folderId : myCollectionId);
|
||||||
|
}
|
||||||
|
setSelectedFlowsComponentsCards([]);
|
||||||
|
|
||||||
|
setSuccessData({ title: "Flows imported successfully" });
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
setErrorData({
|
||||||
|
title: UPLOAD_ERROR_ALERT,
|
||||||
|
list: [error],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const version = useDarkStore((state) => state.version);
|
const version = useDarkStore((state) => state.version);
|
||||||
|
|
||||||
const handleExport = () => {
|
const handleExport = () => {
|
||||||
|
|
@ -252,6 +273,7 @@ export default function ComponentsComponent({
|
||||||
handleSelectAll={handleSelectAll}
|
handleSelectAll={handleSelectAll}
|
||||||
handleDuplicate={() => handleSelectOptionsChange("duplicate")}
|
handleDuplicate={() => handleSelectOptionsChange("duplicate")}
|
||||||
handleExport={() => handleSelectOptionsChange("export")}
|
handleExport={() => handleSelectOptionsChange("export")}
|
||||||
|
handleImport={() => handleImport()}
|
||||||
disableFunctions={!(selectedFlowsComponentsCards?.length > 0)}
|
disableFunctions={!(selectedFlowsComponentsCards?.length > 0)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ type HeaderComponentProps = {
|
||||||
handleDelete: () => void;
|
handleDelete: () => void;
|
||||||
handleDuplicate: () => void;
|
handleDuplicate: () => void;
|
||||||
handleExport: () => void;
|
handleExport: () => void;
|
||||||
|
handleImport: () => void;
|
||||||
disableFunctions: boolean;
|
disableFunctions: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -20,6 +21,7 @@ const HeaderComponent = ({
|
||||||
handleDelete,
|
handleDelete,
|
||||||
handleDuplicate,
|
handleDuplicate,
|
||||||
handleExport,
|
handleExport,
|
||||||
|
handleImport,
|
||||||
disableFunctions,
|
disableFunctions,
|
||||||
}: HeaderComponentProps) => {
|
}: HeaderComponentProps) => {
|
||||||
const [shouldSelectAll, setShouldSelectAll] = useState(true);
|
const [shouldSelectAll, setShouldSelectAll] = useState(true);
|
||||||
|
|
@ -36,7 +38,7 @@ const HeaderComponent = ({
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={handleClick}
|
onClick={handleImport}
|
||||||
className="text-sm"
|
className="text-sm"
|
||||||
>
|
>
|
||||||
<ForwardedIconComponent
|
<ForwardedIconComponent
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue