Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

built-in-pipeline-list.tsx 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. import { usePipelineTemplateList } from '@/service/use-pipeline'
  2. import TemplateCard from './template-card'
  3. import CreateCard from './create-card'
  4. import { useI18N } from '@/context/i18n'
  5. import { useMemo } from 'react'
  6. import { LanguagesSupported } from '@/i18n-config/language'
  7. const BuiltInPipelineList = () => {
  8. const { locale } = useI18N()
  9. const language = useMemo(() => {
  10. if (['zh-Hans', 'ja-JP'].includes(locale))
  11. return locale
  12. return LanguagesSupported[0]
  13. }, [locale])
  14. const { data: pipelineList, isLoading } = usePipelineTemplateList({ type: 'built-in', language })
  15. const list = pipelineList?.pipeline_templates || []
  16. return (
  17. <div className='grid grid-cols-1 gap-3 py-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4'>
  18. <CreateCard />
  19. {!isLoading && list.map((pipeline, index) => (
  20. <TemplateCard
  21. key={index}
  22. type='built-in'
  23. pipeline={pipeline}
  24. showMoreOperations={false}
  25. />
  26. ))}
  27. </div>
  28. )
  29. }
  30. export default BuiltInPipelineList