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
75c208e8
Commit
75c208e8
authored
Mar 12, 2024
by
crazywoola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: retry button ui
parent
4b3982d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
8 deletions
+27
-8
index.tsx
web/app/components/datasets/documents/index.tsx
+22
-8
style.module.css
web/app/components/datasets/documents/style.module.css
+5
-0
No files found.
web/app/components/datasets/documents/index.tsx
View file @
75c208e8
...
...
@@ -5,10 +5,11 @@ import useSWR from 'swr'
import
{
useTranslation
}
from
'react-i18next'
import
{
useRouter
}
from
'next/navigation'
import
{
debounce
,
groupBy
,
omit
}
from
'lodash-es'
// import Link from 'next/link'
import
{
PlusIcon
}
from
'@heroicons/react/24/solid'
import
classNames
from
'classnames'
import
List
from
'./list'
import
s
from
'./style.module.css'
import
Divider
from
'@/app/components/base/divider'
import
Loading
from
'@/app/components/base/loading'
import
Button
from
'@/app/components/base/button'
import
Input
from
'@/app/components/base/input'
...
...
@@ -24,6 +25,11 @@ import { DataSourceType } from '@/models/datasets'
// Custom page count is not currently supported.
const
limit
=
15
const
WarningIcon
=
()
=>
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
>
<
path
fillRule=
"evenodd"
clipRule=
"evenodd"
d=
"M6.40616 0.834307C6.14751 0.719294 5.85222 0.719294 5.59356 0.834307C5.3938 0.923133 5.26403 1.07959 5.17373 1.20708C5.08495 1.33242 4.9899 1.49664 4.88536 1.67723L0.751783 8.81705C0.646828 8.9983 0.551451 9.16302 0.486781 9.3028C0.421056 9.44487 0.349754 9.63584 0.372478 9.85381C0.401884 10.1359 0.549654 10.3922 0.779012 10.5589C0.956259 10.6878 1.15726 10.7218 1.31314 10.7361C1.46651 10.7501 1.65684 10.7501 1.86628 10.7501H10.1334C10.3429 10.7501 10.5332 10.7501 10.6866 10.7361C10.8425 10.7218 11.0435 10.6878 11.2207 10.5589C11.4501 10.3922 11.5978 10.1359 11.6272 9.85381C11.65 9.63584 11.5787 9.44487 11.5129 9.3028C11.4483 9.16303 11.3529 8.99833 11.248 8.81709L7.11436 1.67722C7.00983 1.49663 6.91477 1.33242 6.82599 1.20708C6.73569 1.07959 6.60593 0.923133 6.40616 0.834307ZM6.49988 4.50012C6.49988 4.22398 6.27602 4.00012 5.99988 4.00012C5.72374 4.00012 5.49988 4.22398 5.49988 4.50012V6.50012C5.49988 6.77626 5.72374 7.00012 5.99988 7.00012C6.27602 7.00012 6.49988 6.77626 6.49988 6.50012V4.50012ZM5.99988 8.00012C5.72374 8.00012 5.49988 8.22398 5.49988 8.50012C5.49988 8.77626 5.72374 9.00012 5.99988 9.00012H6.00488C6.28102 9.00012 6.50488 8.77626 6.50488 8.50012C6.50488 8.22398 6.28102 8.00012 6.00488 8.00012H5.99988Z"
fill=
"#F79009"
/>
</
svg
>
const
FolderPlusIcon
=
({
className
}:
React
.
SVGProps
<
SVGElement
>
)
=>
{
return
<
svg
width=
"20"
height=
"20"
viewBox=
"0 0 20 20"
fill=
"none"
xmlns=
"http://www.w3.org/2000/svg"
className=
{
className
??
''
}
>
<
path
d=
"M10.8332 5.83333L9.90355 3.9741C9.63601 3.439 9.50222 3.17144 9.30265 2.97597C9.12615 2.80311 8.91344 2.67164 8.6799 2.59109C8.41581 2.5 8.11668 2.5 7.51841 2.5H4.33317C3.39975 2.5 2.93304 2.5 2.57652 2.68166C2.26292 2.84144 2.00795 3.09641 1.84816 3.41002C1.6665 3.76654 1.6665 4.23325 1.6665 5.16667V5.83333M1.6665 5.83333H14.3332C15.7333 5.83333 16.4334 5.83333 16.9681 6.10582C17.4386 6.3455 17.821 6.72795 18.0607 7.19836C18.3332 7.73314 18.3332 8.4332 18.3332 9.83333V13.5C18.3332 14.9001 18.3332 15.6002 18.0607 16.135C17.821 16.6054 17.4386 16.9878 16.9681 17.2275C16.4334 17.5 15.7333 17.5 14.3332 17.5H5.6665C4.26637 17.5 3.56631 17.5 3.03153 17.2275C2.56112 16.9878 2.17867 16.6054 1.93899 16.135C1.6665 15.6002 1.6665 14.9001 1.6665 13.5V5.83333ZM9.99984 14.1667V9.16667M7.49984 11.6667H12.4998"
stroke=
"#667085"
strokeWidth=
"1.5"
strokeLinecap=
"round"
strokeLinejoin=
"round"
/>
...
...
@@ -206,13 +212,21 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
onChange=
{
debounce
(
setSearchValue
,
500
)
}
value=
{
searchValue
}
/>
{
embeddingAvailable
&&
(
<
Button
type=
'primary'
onClick=
{
routeToDocCreate
}
className=
'!h-8 !text-[13px] !shrink-0'
>
<
PlusIcon
className=
'h-4 w-4 mr-2 stroke-current'
/>
{
isDataSourceNotion
&&
t
(
'datasetDocuments.list.addPages'
)
}
{
!
isDataSourceNotion
&&
t
(
'datasetDocuments.list.addFile'
)
}
</
Button
>
)
}
<
div
className=
'flex gap-2'
>
<
div
className=
{
classNames
(
'inline-flex justify-center items-center gap-2'
,
s
.
retryBtn
)
}
>
<
WarningIcon
/>
<
span
className=
'flex shrink-0'
>
3 docs embeddings failed
</
span
>
<
Divider
type=
'vertical'
className=
'!h-4'
/>
<
span
className=
'text-primary-600 font-bold'
>
RETRY
</
span
>
</
div
>
{
embeddingAvailable
&&
(
<
Button
type=
'primary'
onClick=
{
routeToDocCreate
}
className=
'!h-8 !text-[13px] !shrink-0'
>
<
PlusIcon
className=
'h-4 w-4 mr-2 stroke-current'
/>
{
isDataSourceNotion
&&
t
(
'datasetDocuments.list.addPages'
)
}
{
!
isDataSourceNotion
&&
t
(
'datasetDocuments.list.addFile'
)
}
</
Button
>
)
}
</
div
>
</
div
>
{
isLoading
?
<
Loading
type=
'app'
/>
...
...
web/app/components/datasets/documents/style.module.css
View file @
75c208e8
...
...
@@ -119,3 +119,8 @@
.warningIcon
{
@apply
w-[22px]
h-[22px]
fill-current
text-red-600;
}
.retryBtn
{
@apply
inline-flex
justify-center
items-center
content-center
h-9
leading-5
rounded-lg
px-4
py-2
text-base
cursor-pointer;
@apply
border-solid
border
border-gray-200
cursor-pointer
text-gray-500
hover
:
bg-white
hover
:
shadow-sm
hover
:
border-gray-300
;
}
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