fix: hide export pipeline button (#25343)

This commit is contained in:
crazywoola 2025-09-09 15:44:45 +08:00 committed by GitHub
commit 9240ed680e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 10 deletions

View File

@ -144,9 +144,11 @@ const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailEx
})
const a = document.createElement('a')
const file = new Blob([data], { type: 'application/yaml' })
a.href = URL.createObjectURL(file)
const url = URL.createObjectURL(file)
a.href = url
a.download = `${appDetail.name}.yml`
a.click()
URL.revokeObjectURL(url)
}
catch {
notify({ type: 'error', message: t('app.exportFailed') })

View File

@ -65,9 +65,11 @@ const DropDown = ({
})
const a = document.createElement('a')
const file = new Blob([data], { type: 'application/yaml' })
a.href = URL.createObjectURL(file)
const url = URL.createObjectURL(file)
a.href = url
a.download = `${name}.pipeline`
a.click()
URL.revokeObjectURL(url)
}
catch {
Toast.notify({ type: 'error', message: t('app.exportFailed') })

View File

@ -60,9 +60,11 @@ const HeaderOptions: FC<Props> = ({
const a = document.createElement('a')
const content = listTransformer(list).join('\n')
const file = new Blob([content], { type: 'application/jsonl' })
a.href = URL.createObjectURL(file)
const url = URL.createObjectURL(file)
a.href = url
a.download = `annotations-${locale}.jsonl`
a.click()
URL.revokeObjectURL(url)
}
const fetchList = async () => {

View File

@ -159,9 +159,11 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
})
const a = document.createElement('a')
const file = new Blob([data], { type: 'application/yaml' })
a.href = URL.createObjectURL(file)
const url = URL.createObjectURL(file)
a.href = url
a.download = `${app.name}.yml`
a.click()
URL.revokeObjectURL(url)
}
catch {
notify({ type: 'error', message: t('app.exportFailed') })

View File

@ -114,9 +114,11 @@ const DatasetCard = ({
})
const a = document.createElement('a')
const file = new Blob([data], { type: 'application/yaml' })
a.href = URL.createObjectURL(file)
const url = URL.createObjectURL(file)
a.href = url
a.download = `${name}.pipeline`
a.click()
URL.revokeObjectURL(url)
}
catch {
Toast.notify({ type: 'error', message: t('app.exportFailed') })
@ -274,6 +276,7 @@ const DatasetCard = ({
htmlContent={
<Operations
showDelete={!isCurrentWorkspaceDatasetOperator}
showExportPipeline={dataset.runtime_mode === 'rag_pipeline'}
openRenameModal={openRenameModal}
handleExportPipeline={handleExportPipeline}
detectIsUsedByApp={detectIsUsedByApp}

View File

@ -6,6 +6,7 @@ import OperationItem from './operation-item'
type OperationsProps = {
showDelete: boolean
showExportPipeline: boolean
openRenameModal: () => void
handleExportPipeline: () => void
detectIsUsedByApp: () => void
@ -13,6 +14,7 @@ type OperationsProps = {
const Operations = ({
showDelete,
showExportPipeline,
openRenameModal,
handleExportPipeline,
detectIsUsedByApp,
@ -27,11 +29,13 @@ const Operations = ({
name={t('common.operation.edit')}
handleClick={openRenameModal}
/>
<OperationItem
Icon={RiFileDownloadLine}
name={t('datasetPipeline.operations.exportPipeline')}
handleClick={handleExportPipeline}
/>
{showExportPipeline && (
<OperationItem
Icon={RiFileDownloadLine}
name={t('datasetPipeline.operations.exportPipeline')}
handleClick={handleExportPipeline}
/>
)}
</div>
{showDelete && (
<>