Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
84414533
Commit
84414533
authored
Jul 11, 2023
by
Joel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: ui
parent
8d40b9bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
index.tsx
...ts/share/text-generation/run-batch/res-download/index.tsx
+57
-0
No files found.
web/app/components/share/text-generation/run-batch/res-download/index.tsx
0 → 100644
View file @
84414533
'use client'
import
type
{
FC
}
from
'react'
import
React
from
'react'
import
{
useCSVDownloader
,
}
from
'react-papaparse'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
import
{
Download02
as
DownloadIcon
}
from
'@/app/components/base/icons/src/vender/solid/general'
import
Button
from
'@/app/components/base/button'
export
type
IResDownloadProps
=
{
isMobile
:
boolean
vars
:
{
name
:
string
}[]
values
:
string
[][]
}
const
ResDownload
:
FC
<
IResDownloadProps
>
=
({
isMobile
,
vars
,
values
,
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
CSVDownloader
,
Type
}
=
useCSVDownloader
()
const
addQueryContentVars
=
[
...
vars
,
{
name
:
t
(
'share.generation.queryTitle'
)
},
{
name
:
'Result'
},
]
const
headers
=
(()
=>
{
const
res
:
Record
<
string
,
string
>
=
{}
addQueryContentVars
.
forEach
((
item
)
=>
{
res
[
item
.
name
]
=
''
})
return
res
})()
return
(
<
CSVDownloader
className=
"block cursor-pointer"
type=
{
Type
.
Link
}
filename=
{
'template'
}
bom=
{
true
}
config=
{
{
// delimiter: ';',
}
}
data=
{
[
headers
,
...
values
,
]
}
>
<
Button
className=
{
cn
(
'flex items-center !h-8 space-x-2 text-xs font-medium'
,
isMobile
?
'!p-0 !w-8 justify-center'
:
'!px-3'
)
}
>
<
DownloadIcon
className=
'w-4 h-4 text-[#155EEF]'
/>
{
!
isMobile
&&
<
span
className=
'text-[#155EEF]'
>
{
t
(
'common.operation.download'
)
}
</
span
>
}
</
Button
>
</
CSVDownloader
>
)
}
export
default
React
.
memo
(
ResDownload
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment