|
@@ -6,6 +6,7 @@ import { TracingProvider } from './type'
|
|
|
import cn from '@/utils/classnames'
|
|
|
import { LangfuseIconBig, LangsmithIconBig } from '@/app/components/base/icons/src/public/tracing'
|
|
|
import { Settings04 } from '@/app/components/base/icons/src/vender/line/general'
|
|
|
+import { Eye as View } from '@/app/components/base/icons/src/vender/solid/general'
|
|
|
|
|
|
const I18N_PREFIX = 'app.tracing'
|
|
|
|
|
@@ -13,6 +14,7 @@ type Props = {
|
|
|
type: TracingProvider
|
|
|
readOnly: boolean
|
|
|
isChosen: boolean
|
|
|
+ Config: any
|
|
|
onChoose: () => void
|
|
|
hasConfigured: boolean
|
|
|
onConfig: () => void
|
|
@@ -29,6 +31,7 @@ const ProviderPanel: FC<Props> = ({
|
|
|
type,
|
|
|
readOnly,
|
|
|
isChosen,
|
|
|
+ Config,
|
|
|
onChoose,
|
|
|
hasConfigured,
|
|
|
onConfig,
|
|
@@ -41,6 +44,14 @@ const ProviderPanel: FC<Props> = ({
|
|
|
onConfig()
|
|
|
}, [onConfig])
|
|
|
|
|
|
+ const viewBtnClick = useCallback((e: React.MouseEvent) => {
|
|
|
+ e.preventDefault()
|
|
|
+ e.stopPropagation()
|
|
|
+
|
|
|
+ const url = `${Config?.host}/project/${Config?.project_key}`
|
|
|
+ window.open(url, '_blank', 'noopener,noreferrer')
|
|
|
+ }, [Config?.host, Config?.project_key])
|
|
|
+
|
|
|
const handleChosen = useCallback((e: React.MouseEvent) => {
|
|
|
e.stopPropagation()
|
|
|
if (isChosen || !hasConfigured || readOnly)
|
|
@@ -58,12 +69,20 @@ const ProviderPanel: FC<Props> = ({
|
|
|
{isChosen && <div className='ml-1 flex items-center h-4 px-1 rounded-[4px] border border-primary-500 leading-4 text-xs font-medium text-primary-500 uppercase '>{t(`${I18N_PREFIX}.inUse`)}</div>}
|
|
|
</div>
|
|
|
{!readOnly && (
|
|
|
- <div
|
|
|
- className='flex px-2 items-center h-6 bg-white rounded-md border-[0.5px] border-gray-200 shadow-xs cursor-pointer text-gray-700 space-x-1'
|
|
|
- onClick={handleConfigBtnClick}
|
|
|
- >
|
|
|
- <Settings04 className='w-3 h-3' />
|
|
|
- <div className='text-xs font-medium'>{t(`${I18N_PREFIX}.config`)}</div>
|
|
|
+ <div className={'flex justify-between items-center space-x-1'}>
|
|
|
+ {hasConfigured && (
|
|
|
+ <div className='flex px-2 items-center h-6 bg-white rounded-md border-[0.5px] border-gray-200 shadow-xs cursor-pointer text-gray-700 space-x-1' onClick={viewBtnClick} >
|
|
|
+ <View className='w-3 h-3'/>
|
|
|
+ <div className='text-xs font-medium'>{t(`${I18N_PREFIX}.view`)}</div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ <div
|
|
|
+ className='flex px-2 items-center h-6 bg-white rounded-md border-[0.5px] border-gray-200 shadow-xs cursor-pointer text-gray-700 space-x-1'
|
|
|
+ onClick={handleConfigBtnClick}
|
|
|
+ >
|
|
|
+ <Settings04 className='w-3 h-3' />
|
|
|
+ <div className='text-xs font-medium'>{t(`${I18N_PREFIX}.config`)}</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
)}
|
|
|
|