langflow/src/frontend/src/customization/utils/custom-reactFlowUtils.ts
Cristhian Zanforlin Lousa c2e78180f1
feat: Replace standard components with customizable versions and add Langflow Desktop support (#7904)
*  (frontend): Add new customization components and hooks for the frontend application. This includes DashboardWrapperPage, McpServerTab, BaseModal, EmptyPageCommunity, FileCard, IOFileInput, IOModal, ProfilePictureChooserComponent, VoiceAssistant, App, router, CustomPreloadImages, useStartConversation, useStartRecording, CustomAudioWorkletProcessor.

*  (frontend): Add new customization components and utilities for NodeStatus, curl code, JS API code, Python API code, and widget code.

*  (frontend): Add new customization components and controllers for the frontend application.

*  (frontend): Add new customization components and controllers for the frontend application.

* add customization folder desktop

*  (AccountMenu): Introduce CustomAccountMenu component to customize the account menu in the app header
🔄 (ProfileIcon): Refactor ProfileIcon component to CustomProfileIcon for customization purposes
🔄 (langflow-counts): Refactor LangflowCounts component to CustomLangflowCounts for customization purposes

* 🔧 Remove unused files related to dialog, langflow, buildUtils, and reactflowUtils components

*  (frontend): Add new images and components for the frontend UI
📝 (frontend): Update custom hooks to have more descriptive names for better clarity and organization

* 🔧 Remove package-lock.json as it is not needed and can be generated dynamically by npm or yarn when installing dependencies

* [autofix.ci] apply automated fixes

* 📝 (frontend): Add custom dialog content component without fixed positioning
🔧 (frontend): Update dialog class utility to improve dialog styling
🔧 (frontend): Update custom build utils for API endpoints
🔧 (frontend): Add custom get access token utility function
🔧 (frontend): Add custom get host protocol utility function
🔧 (frontend): Add custom pre-load image URL utility function
🔧 (frontend): Add custom react flow utility functions
🔧 (frontend): Add custom refresh latest version utility function
🔧 (frontend): Add custom routes for store pages
🔧 (frontend): Add custom routes for store pages components
🔧 (frontend): Update build utils for API endpoints
🔧 (frontend): Update react flow utility functions for downloading flows

*  (custom-routes-store-pages.tsx): Rename customRoutesStorePages to CustomRoutesStorePages for consistency and clarity
 (custom-routes-store.tsx): Rename customRoutesStore to CustomRoutesStore for consistency and clarity
🔧 (routes.tsx): Remove unused import of StoreGuard to clean up the code and improve maintainability
🔧 (routes.tsx): Update imports of customRoutesStore and customRoutesStorePages to use named imports for consistency and clarity

*  (API/index.ts): Add custom functions to fetch app versions and latest version from a custom source
🔧 (feature-flags.ts): Remove ENABLE_LANGFLOW_DESKTOP feature flag as it is no longer needed
📝 (custom-get-app-latest-version.ts): Add custom functions to fetch app versions and latest version from a custom source

* ♻️ (frontend): refactor API controller to export getAppVersions and getLatestVersion functions instead of calling custom functions directly

*  (deploy-dropdown.tsx): Add customMcpOpen function to handle target attribute in CustomLink component
 (sideBarFolderButtons/index.tsx): Add CustomStoreButton component to render a custom store button if ENABLE_DATASTAX_LANGFLOW is false
📝 (custom-store-button.tsx): Create CustomStoreButton component to render a custom store button
📝 (custom-store-sidebar.tsx): Create CustomStoreSidebar component to define custom store sidebar items
📝 (custom-mcp-open.ts): Create customMcpOpen function to return "_blank" for target attribute
📝 (custom-refresh-latest-version.ts): Add useDarkStore import and use it to refresh latest version
📝 (SettingsPage/index.tsx): Import CustomStoreSidebar and use it to populate langflowItems
📝 (ProfilePictureChooserComponent/index.tsx): Import customPreLoadImageUrl and use it to preload images
📝 (use-preload-images.ts): Remove unused import of BASE_URL_API
📝 (use-preload-images.ts): Remove unused constant BASE_URL_API

* 🔧 (LangflowDesktopLogo.png): remove LangflowDesktopLogo.png as it is no longer needed in the project

*  (custom-fetch-error-component.tsx): add CustomFetchErrorComponent to customize error handling in the frontend
🔧 (GenericErrorComponent/index.tsx): replace FetchErrorComponent with CustomFetchErrorComponent for more flexibility and customization in error handling

*  (updater.ts): introduce new types Version and UpdaterStoreType for managing version information and updater modal state in the frontend customization module

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2025-05-14 15:11:35 +00:00

14 lines
411 B
TypeScript

import { FlowType } from "@/types/flow";
export const customDownloadFlow = (
flow: FlowType,
sortedJsonString: string,
flowName: string,
) => {
const dataUri = `data:text/json;chatset=utf-8,${encodeURIComponent(sortedJsonString)}`;
const downloadLink = document.createElement("a");
downloadLink.href = dataUri;
downloadLink.download = `${flowName || flow.name}.json`;
downloadLink.click();
};