feat(web): create system-features vertical (#36894)

This commit is contained in:
yyh
2026-06-01 10:15:25 +00:00
committed by GitHub
parent fc7716704d
commit 8fc2807194
100 changed files with 260 additions and 290 deletions
@@ -1,6 +1,7 @@
import type { PluginInstallationScope } from '@dify/contracts/api/console/system-features/types.gen'
import { describe, expect, it } from 'vitest'
import { renderHookWithSystemFeatures as renderHook } from '@/__tests__/utils/mock-system-features'
import { InstallationScope } from '@/types/feature'
import { InstallationScope } from '@/features/system-features/constants'
import { pluginInstallLimit } from '../use-install-plugin-limit'
const basePlugin = {
@@ -117,7 +118,7 @@ describe('pluginInstallLimit', () => {
const features = {
plugin_installation_permission: {
restrict_to_marketplace_only: false,
plugin_installation_scope: 'unknown-scope' as InstallationScope,
plugin_installation_scope: 'unknown-scope' as unknown as PluginInstallationScope,
},
}
@@ -1,12 +1,12 @@
import type { GetSystemFeaturesResponse } from '@dify/contracts/api/console/system-features/types.gen'
import type { Plugin, PluginManifestInMarket } from '../../types'
import type { SystemFeatures } from '@/types/feature'
import { useSuspenseQuery } from '@tanstack/react-query'
import { systemFeaturesQueryOptions } from '@/service/system-features'
import { InstallationScope } from '@/types/feature'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { InstallationScope } from '@/features/system-features/constants'
type PluginProps = (Plugin | PluginManifestInMarket) & { from: 'github' | 'marketplace' | 'package' }
export function pluginInstallLimit(plugin: PluginProps, systemFeatures: SystemFeatures) {
export function pluginInstallLimit(plugin: PluginProps, systemFeatures: GetSystemFeaturesResponse) {
if (systemFeatures.plugin_installation_permission.restrict_to_marketplace_only) {
if (plugin.from === 'github' || plugin.from === 'package')
return { canInstall: false }