From 245bb02c886ab79e50c9344f6ce3ae8e2399641b Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 1 Nov 2024 14:51:35 +0800 Subject: [PATCH] chore: add on start to install --- .../install-from-local-package/steps/install.tsx | 6 +++++- .../install-from-marketplace/steps/install.tsx | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx index 08b21ad1ff..8461eeb425 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/install.tsx @@ -13,10 +13,11 @@ import checkTaskStatus from '../../base/check-task-status' const i18nPrefix = 'plugin.installModal' -interface Props { +type Props = { uniqueIdentifier: string payload: PluginDeclaration onCancel: () => void + onStartToInstall?: () => void onInstalled: () => void onFailed: (message?: string) => void } @@ -25,6 +26,7 @@ const Installed: FC = ({ uniqueIdentifier, payload, onCancel, + onStartToInstall, onInstalled, onFailed, }) => { @@ -43,6 +45,8 @@ const Installed: FC = ({ const handleInstall = async () => { if (isInstalling) return setIsInstalling(true) + onStartToInstall?.() + try { const { all_installed: isInstalled, diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx index 8a6c5d3c0e..f1f5fecf93 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/steps/install.tsx @@ -18,6 +18,7 @@ type Props = { uniqueIdentifier: string payload: PluginManifestInMarket onCancel: () => void + onStartToInstall?: () => void onInstalled: () => void onFailed: (message?: string) => void } @@ -26,6 +27,7 @@ const Installed: FC = ({ uniqueIdentifier, payload, onCancel, + onStartToInstall, onInstalled, onFailed, }) => { @@ -43,6 +45,7 @@ const Installed: FC = ({ const handleInstall = async () => { if (isInstalling) return + onStartToInstall?.() setIsInstalling(true) try { @@ -90,7 +93,7 @@ const Installed: FC = ({ ) }) - }, [payload]) + }, [payload.latest_version, supportCheckInstalled]) return ( <>