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.

1.8 KB
Raw Blame
'use client'

import type { NetworkAccessGroupResponse } from '@dify/contracts/api/console/workspaces/types.gen'
import { useTranslation } from 'react-i18next'
import AppIcon from '@/app/components/base/app-icon'

type PolicyReferencedAppsProps = {
  apps: NetworkAccessGroupResponse['apps']
  usedByCount: number
}

export function PolicyReferencedApps({ apps, usedByCount }: PolicyReferencedAppsProps) {
  const { t } = useTranslation(['common'])

  if (apps.length === 0) {
    if (usedByCount <= 0) return null

    return (
      <p className="system-sm-regular text-text-tertiary">
        {t(($) => $['settings.ipPolicyUsedBy'], { ns: 'common', count: usedByCount })}
      </p>
    )
  }

  return (
    <ul className="flex flex-wrap content-start items-start gap-2">
      {apps.map((app) => (
        <li key={app.id} className="max-w-full min-w-0">
          <a
            href={
              app.bound_agent_id
                ? `/agents/${app.bound_agent_id}/configure`
                : `/app/${app.id}/overview`
            }
            target="_blank"
            rel="noreferrer"
            className="flex min-h-7 max-w-full items-center gap-1.5 rounded-md border border-components-panel-border-subtle bg-background-default py-1 pr-1.5 pl-1 outline-hidden hover:bg-state-base-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid"
          >
            <AppIcon size="xs" decorative icon={app} className="size-5 shrink-0 rounded-sm" />
            <span className="min-w-0 system-sm-medium wrap-anywhere text-text-primary">
              {app.name}
            </span>
            <span
              aria-hidden
              className="i-ri-arrow-right-up-line size-3.5 shrink-0 text-text-tertiary"
            />
          </a>
        </li>
      ))}
    </ul>
  )
}