From 7be93653c3700ee77fa507f792dc305c8494c92f Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 30 Jun 2023 10:52:23 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(inputListComponent):=20remov?= =?UTF-8?q?e=20unnecessary=20padding=20from=20input=20list=20component=20t?= =?UTF-8?q?o=20improve=20layout=20=F0=9F=94=A7=20fix(tabsContext):=20add?= =?UTF-8?q?=20optional=20fileName=20parameter=20to=20downloadFlow=20functi?= =?UTF-8?q?on=20to=20allow=20customizing=20the=20downloaded=20file=20name?= =?UTF-8?q?=20=F0=9F=94=A7=20fix(exportModal):=20add=20optional=20fileName?= =?UTF-8?q?=20parameter=20to=20downloadFlow=20function=20calls=20to=20allo?= =?UTF-8?q?w=20customizing=20the=20downloaded=20file=20name=20=F0=9F=94=A7?= =?UTF-8?q?=20fix(tabsContext):=20update=20downloadFlow=20function=20signa?= =?UTF-8?q?ture=20to=20include=20optional=20fileName=20parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/components/inputListComponent/index.tsx | 2 +- src/frontend/src/contexts/tabsContext.tsx | 4 ++-- src/frontend/src/modals/exportModal/index.tsx | 4 ++-- src/frontend/src/types/tabs/index.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index d81da6183..5c9c0e78b 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -23,7 +23,7 @@ export default function InputListComponent({
{inputList.map((i, idx) => ( diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index cf4303a4d..75d4dd73b 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -268,7 +268,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { /** * Downloads the current flow as a JSON file */ - function downloadFlow(flow: FlowType) { + function downloadFlow(flow: FlowType, fileName?: string) { // create a data URI with the current flow data const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent( JSON.stringify(flow) @@ -277,7 +277,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { // create a link element and set its properties const link = document.createElement("a"); link.href = jsonString; - link.download = `${flows.find((f) => f.id === tabId).name}.json`; + link.download = `${fileName && fileName != "" ? fileName : flows.find((f) => f.id === tabId).name}.json`; // simulate a click on the link element to trigger the download link.click(); diff --git a/src/frontend/src/modals/exportModal/index.tsx b/src/frontend/src/modals/exportModal/index.tsx index 236c27366..3febacf9f 100644 --- a/src/frontend/src/modals/exportModal/index.tsx +++ b/src/frontend/src/modals/exportModal/index.tsx @@ -80,9 +80,9 @@ export default function ExportModal() {