Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: restore plugin icons when importing integrations (#45112)

Joel7e15fac03242
diff --git a/web/app/components/plugins/install-plugin/install-bundle/__tests__/index.spec.tsx b/web/app/components/plugins/install-plugin/install-bundle/__tests__/index.spec.tsx
index d8b0e06c0ff..a26020d4c3a 100644
--- a/web/app/components/plugins/install-plugin/install-bundle/__tests__/index.spec.tsx
+++ b/web/app/components/plugins/install-plugin/install-bundle/__tests__/index.spec.tsx
@@ -2,6 +2,7 @@ import type { Dependency, PackageDependency, Plugin } from '../../../types'
import type { ConsoleQueryTestOptions } from '@/test/console/query-data'
import { screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
+import { MARKETPLACE_API_PREFIX } from '@/features/marketplace/api'
import { renderWithConsoleQuery } from '@/test/console/query-data'
import { createDeferred } from '@/test/deferred'
import { createPluginDeclarationFixture, createPluginEntity } from '@/test/fixtures/plugin'
@@ -127,6 +128,20 @@ const renderInstall = (
return { onInstalled, onClose }
}
+it('waits for marketplace metadata before rendering imported plugin icons', async () => {
+ const metadata = createDeferred<{ data: { list: { plugin: Plugin }[] } }>()
+ marketplace.mockReturnValue(metadata.promise)
+ renderInstall([dependencies[0]!])
+
+ expect(screen.queryByRole('presentation')).not.toBeInTheDocument()
+
+ metadata.resolve({ data: { list: [{ plugin: plugins[0]! }] } })
+
+ const icon = await screen.findByRole('presentation')
+ expect(icon).toHaveAttribute('src', `${MARKETPLACE_API_PREFIX}/plugins/test/finished/icon`)
+ expect(icon).toBeVisible()
+})
+
it('aggregates finished, failed and running installs and polls only the unfinished task', async () => {
const user = userEvent.setup()
const pending = createDeferred<{ all_installed: boolean; task_id: string }>()
diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/install-multi.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/install-multi.tsx
index 433b66cb86f..87c7bb56aa9 100644
--- a/web/app/components/plugins/install-plugin/install-bundle/steps/install-multi.tsx
+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/install-multi.tsx
@@ -93,7 +93,7 @@ const InstallByDSLList = ({
key={index}
checked={checked}
onCheckedChange={handleSelect(index)}
- payload={{ ...plugin, from: d.type } as Plugin}
+ payload={plugin}
version={
(d as GitHubItemAndMarketPlaceDependency).value.version! || plugin?.version || ''
}