ソースを参照

feat: support select multi datasets (#235)

tags/0.3.1
Joel 2年前
コミット
970950e3a8
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 1
- 10
web/app/components/app/configuration/dataset-config/select-dataset/index.tsx ファイルの表示

import Link from 'next/link' import Link from 'next/link'


import s from './style.module.css' import s from './style.module.css'
import Toast from '@/app/components/base/toast'


export interface ISelectDataSetProps { export interface ISelectDataSetProps {
isShow: boolean isShow: boolean
const [loaded, setLoaded] = React.useState(false) const [loaded, setLoaded] = React.useState(false)
const [datasets, setDataSets] = React.useState<DataSet[] | null>(null) const [datasets, setDataSets] = React.useState<DataSet[] | null>(null)
const hasNoData = !datasets || datasets?.length === 0 const hasNoData = !datasets || datasets?.length === 0
// Only one dataset can be selected. Historical data retains data and supports multiple selections, but when saving, only one can be selected. This is based on considerations of performance and accuracy.
const canSelectMulti = selectedIds.length > 1
const canSelectMulti = true
useEffect(() => { useEffect(() => {
(async () => { (async () => {
const { data } = await fetchDatasets({ url: '/datasets', params: { page: 1 } }) const { data } = await fetchDatasets({ url: '/datasets', params: { page: 1 } })
} }


const handleSelect = () => { const handleSelect = () => {
if (selected.length > 1) {
Toast.notify({
type: 'error',
message: t('appDebug.feature.dataSet.notSupportSelectMulti')
})
return
}
onSelect(selected) onSelect(selected)
} }
return ( return (

読み込み中…
キャンセル
保存