diff --git a/web/features/deployments/detail/access-tab.tsx b/web/features/deployments/detail/access-tab.tsx index a8395143eb..6d495c106d 100644 --- a/web/features/deployments/detail/access-tab.tsx +++ b/web/features/deployments/detail/access-tab.tsx @@ -79,7 +79,7 @@ function DeveloperApiAccessSection({ ) } - function handleRevokeApiKey(_environmentId: string, apiKeyId: string) { + function handleRevokeApiKey(apiKeyId: string) { revokeApiKey.mutate({ params: { appInstanceId: appId, @@ -146,7 +146,6 @@ export function AccessTab({ instanceId: appId }: { const apiEnabled = accessConfig?.developerApi?.enabled ?? false const apiKeys = accessConfig?.developerApi?.apiKeys ?? [] const handleSetEnvironmentAccessPolicy = async ( - appId: string, environmentId: string, accessMode: string, subjects: AccessSubject[], diff --git a/web/features/deployments/detail/access-tab/api-keys.tsx b/web/features/deployments/detail/access-tab/api-keys.tsx index 0dc6eae700..6af6e623e5 100644 --- a/web/features/deployments/detail/access-tab/api-keys.tsx +++ b/web/features/deployments/detail/access-tab/api-keys.tsx @@ -16,7 +16,7 @@ import { environmentName } from '../../utils' export function ApiKeyRow({ apiKey, onCopy, onRevoke }: { apiKey: DeveloperAPIKeySummary onCopy: (apiKeyId: string) => Promise - onRevoke: () => void + onRevoke: (apiKeyId: string) => void }) { const { t } = useTranslation('deployments') const [copied, setCopied] = useState(false) @@ -61,7 +61,7 @@ export function ApiKeyRow({ apiKey, onCopy, onRevoke }: { @@ -162,7 +156,7 @@ export function OverviewTab({ instanceId }: { {releaseRows.length === 0 ? canCreateRelease ? ( - ) @@ -201,7 +195,7 @@ export function OverviewTab({ instanceId }: {
}> + diff --git a/web/features/deployments/list/environment-filter.tsx b/web/features/deployments/list/environment-filter.tsx index 450cc2b821..018d3122e4 100644 --- a/web/features/deployments/list/environment-filter.tsx +++ b/web/features/deployments/list/environment-filter.tsx @@ -1,5 +1,6 @@ 'use client' +import type { DeploymentEnvironmentOption } from '@dify/contracts/enterprise/types.gen' import type { ReactNode } from 'react' import { cn } from '@langgenius/dify-ui/cn' import { @@ -23,23 +24,16 @@ type EnvironmentFilterOption = { disabledReason?: string } -type FilterEnvironment = { - id: string - name: string - disabled?: boolean - disabledReason?: string +function hasEnvironmentId(env: DeploymentEnvironmentOption): env is DeploymentEnvironmentOption & { id: string } { + return Boolean(env.id) } -function getEnvironmentId(env: FilterEnvironment) { - return env.id -} - -function getEnvironmentFilterOption(env: FilterEnvironment): EnvironmentFilterOption { +function getEnvironmentFilterOption(env: DeploymentEnvironmentOption & { id: string }): EnvironmentFilterOption { return { value: env.id, - text: env.name, + text: env.name || env.id, icon: , - disabled: env.disabled, + disabled: env.deployable === false, disabledReason: env.disabledReason, } } @@ -50,20 +44,8 @@ export function EnvironmentFilter() { const [envFilter, setEnvFilter] = useQueryState('env', envFilterQueryState) const { data: environmentOptionsReply } = useQuery(consoleQuery.enterprise.appDeploy.listDeploymentEnvironmentOptions.queryOptions()) const environmentOptions = environmentOptionsReply?.environments ?? [] - - function getFilterEnvironment(env: (typeof environmentOptions)[number]): FilterEnvironment[] { - if (!env.id) - return [] - return [{ - id: env.id, - name: env.name || env.id, - disabled: env.deployable === false, - disabledReason: env.disabledReason, - }] - } - - const environments = environmentOptions.flatMap(getFilterEnvironment) - const envIdSet = new Set(environments.map(getEnvironmentId)) + const environments = environmentOptions.filter(hasEnvironmentId) + const envIdSet = new Set(environments.map(env => env.id)) const activeFilter = envFilter === 'all' || envFilter === 'not-deployed' || envIdSet.has(envFilter) ? envFilter : 'all' diff --git a/web/features/deployments/list/index.tsx b/web/features/deployments/list/index.tsx index cb6722d0f7..865079aca9 100644 --- a/web/features/deployments/list/index.tsx +++ b/web/features/deployments/list/index.tsx @@ -1,6 +1,5 @@ 'use client' -import type { ChangeEvent } from 'react' import { useQuery } from '@tanstack/react-query' import { useDebounce } from 'ahooks' import { debounce, useQueryState } from 'nuqs' @@ -26,14 +25,6 @@ function DeploymentsSearchInput() { }) } - function handleKeywordsInputChange(e: ChangeEvent) { - handleKeywordsChange(e.target.value) - } - - function handleKeywordsClear() { - handleKeywordsChange('') - } - return ( handleKeywordsChange(e.target.value)} + onClear={() => handleKeywordsChange('')} /> ) } diff --git a/web/features/deployments/utils.ts b/web/features/deployments/utils.ts index 8e1c74faa6..5f5d722c47 100644 --- a/web/features/deployments/utils.ts +++ b/web/features/deployments/utils.ts @@ -40,10 +40,6 @@ export function environmentHealth(environment?: ConsoleEnvironmentSummary | Envi return status.includes('ready') ? 'ready' : 'degraded' } -export function releaseId(release?: ConsoleReleaseSummary) { - return release?.id ?? '' -} - export function releaseLabel(release?: ConsoleReleaseSummary) { return release?.name || release?.displayId || release?.id || '—' } @@ -52,14 +48,6 @@ export function releaseCommit(release?: ConsoleReleaseSummary) { return release?.shortCommitId || release?.commitId || '—' } -export function runtimeBindingLabel(binding?: RuntimeBindingDisplay) { - return binding?.label || binding?.slot || binding?.kind || '—' -} - -export function runtimeBindingValue(binding?: RuntimeBindingDisplay) { - return binding?.displayValue || binding?.maskedValue || binding?.displayName || '—' -} - export function runtimeBindingSummary(binding?: RuntimeBindingDisplay) { return binding?.label || binding?.slot || binding?.displayName || binding?.displayValue || binding?.maskedValue || binding?.kind || '—' }