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
340d7495
Commit
340d7495
authored
Aug 04, 2023
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: unarchive document supported
parent
2be29bb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
list.tsx
web/app/components/datasets/documents/list.tsx
+11
-2
dataset-documents.en.ts
web/i18n/lang/dataset-documents.en.ts
+1
-0
dataset-documents.zh.ts
web/i18n/lang/dataset-documents.zh.ts
+1
-0
datasets.ts
web/service/datasets.ts
+4
-0
No files found.
web/app/components/datasets/documents/list.tsx
View file @
340d7495
...
@@ -22,7 +22,7 @@ import type { IndicatorProps } from '@/app/components/header/indicator'
...
@@ -22,7 +22,7 @@ import type { IndicatorProps } from '@/app/components/header/indicator'
import
Indicator
from
'@/app/components/header/indicator'
import
Indicator
from
'@/app/components/header/indicator'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
asyncRunSafe
}
from
'@/utils'
import
{
formatNumber
}
from
'@/utils/format'
import
{
formatNumber
}
from
'@/utils/format'
import
{
archiveDocument
,
deleteDocument
,
disableDocument
,
enableDocument
,
syncDocument
}
from
'@/service/datasets'
import
{
archiveDocument
,
deleteDocument
,
disableDocument
,
enableDocument
,
syncDocument
,
unArchiveDocument
}
from
'@/service/datasets'
import
NotionIcon
from
'@/app/components/base/notion-icon'
import
NotionIcon
from
'@/app/components/base/notion-icon'
import
ProgressBar
from
'@/app/components/base/progress-bar'
import
ProgressBar
from
'@/app/components/base/progress-bar'
import
{
DataSourceType
,
type
DocumentDisplayStatus
,
type
SimpleDocumentDetail
}
from
'@/models/datasets'
import
{
DataSourceType
,
type
DocumentDisplayStatus
,
type
SimpleDocumentDetail
}
from
'@/models/datasets'
...
@@ -86,7 +86,7 @@ export const StatusItem: FC<{
...
@@ -86,7 +86,7 @@ export const StatusItem: FC<{
</
div
>
</
div
>
}
}
type
OperationName
=
'delete'
|
'archive'
|
'enable'
|
'disable'
|
'sync'
type
OperationName
=
'delete'
|
'archive'
|
'enable'
|
'disable'
|
'sync'
|
'un_archive'
// operation action for list and detail
// operation action for list and detail
export
const
OperationAction
:
FC
<
{
export
const
OperationAction
:
FC
<
{
...
@@ -117,6 +117,9 @@ export const OperationAction: FC<{
...
@@ -117,6 +117,9 @@ export const OperationAction: FC<{
case
'archive'
:
case
'archive'
:
opApi
=
archiveDocument
opApi
=
archiveDocument
break
break
case
'un_archive'
:
opApi
=
unArchiveDocument
break
case
'enable'
:
case
'enable'
:
opApi
=
enableDocument
opApi
=
enableDocument
break
break
...
@@ -211,6 +214,12 @@ export const OperationAction: FC<{
...
@@ -211,6 +214,12 @@ export const OperationAction: FC<{
<
ArchiveIcon
/>
<
ArchiveIcon
/>
<
span
className=
{
s
.
actionName
}
>
{
t
(
'datasetDocuments.list.action.archive'
)
}
</
span
>
<
span
className=
{
s
.
actionName
}
>
{
t
(
'datasetDocuments.list.action.archive'
)
}
</
span
>
</
div
>
}
</
div
>
}
{
archived
&&
(
<
div
className=
{
s
.
actionItem
}
onClick=
{
()
=>
onOperate
(
'un_archive'
)
}
>
<
ArchiveIcon
/>
<
span
className=
{
s
.
actionName
}
>
{
t
(
'datasetDocuments.list.action.unarchive'
)
}
</
span
>
</
div
>
)
}
<
div
className=
{
cn
(
s
.
actionItem
,
s
.
deleteActionItem
,
'group'
)
}
onClick=
{
()
=>
setShowModal
(
true
)
}
>
<
div
className=
{
cn
(
s
.
actionItem
,
s
.
deleteActionItem
,
'group'
)
}
onClick=
{
()
=>
setShowModal
(
true
)
}
>
<
TrashIcon
className=
{
'w-4 h-4 stroke-current text-gray-500 stroke-2 group-hover:text-red-500'
}
/>
<
TrashIcon
className=
{
'w-4 h-4 stroke-current text-gray-500 stroke-2 group-hover:text-red-500'
}
/>
<
span
className=
{
cn
(
s
.
actionName
,
'group-hover:text-red-500'
)
}
>
{
t
(
'datasetDocuments.list.action.delete'
)
}
</
span
>
<
span
className=
{
cn
(
s
.
actionName
,
'group-hover:text-red-500'
)
}
>
{
t
(
'datasetDocuments.list.action.delete'
)
}
</
span
>
...
...
web/i18n/lang/dataset-documents.en.ts
View file @
340d7495
...
@@ -19,6 +19,7 @@ const translation = {
...
@@ -19,6 +19,7 @@ const translation = {
settings
:
'Segment settings'
,
settings
:
'Segment settings'
,
add
:
'Add new segment'
,
add
:
'Add new segment'
,
archive
:
'Archive'
,
archive
:
'Archive'
,
unarchive
:
'Unarchive'
,
delete
:
'Delete'
,
delete
:
'Delete'
,
enableWarning
:
'Archived file cannot be enabled'
,
enableWarning
:
'Archived file cannot be enabled'
,
sync
:
'Sync'
,
sync
:
'Sync'
,
...
...
web/i18n/lang/dataset-documents.zh.ts
View file @
340d7495
...
@@ -19,6 +19,7 @@ const translation = {
...
@@ -19,6 +19,7 @@ const translation = {
settings
:
'分段设置'
,
settings
:
'分段设置'
,
add
:
'添加新分段'
,
add
:
'添加新分段'
,
archive
:
'归档'
,
archive
:
'归档'
,
unarchive
:
'撤销归档'
,
delete
:
'删除'
,
delete
:
'删除'
,
enableWarning
:
'归档的文件无法启用'
,
enableWarning
:
'归档的文件无法启用'
,
sync
:
'同步'
,
sync
:
'同步'
,
...
...
web/service/datasets.ts
View file @
340d7495
...
@@ -118,6 +118,10 @@ export const archiveDocument: Fetcher<CommonResponse, CommonDocReq> = ({ dataset
...
@@ -118,6 +118,10 @@ export const archiveDocument: Fetcher<CommonResponse, CommonDocReq> = ({ dataset
return
patch
(
`/datasets/
${
datasetId
}
/documents/
${
documentId
}
/status/archive`
)
as
Promise
<
CommonResponse
>
return
patch
(
`/datasets/
${
datasetId
}
/documents/
${
documentId
}
/status/archive`
)
as
Promise
<
CommonResponse
>
}
}
export
const
unArchiveDocument
:
Fetcher
<
CommonResponse
,
CommonDocReq
>
=
({
datasetId
,
documentId
})
=>
{
return
patch
(
`/datasets/
${
datasetId
}
/documents/
${
documentId
}
/status/un_archive`
)
as
Promise
<
CommonResponse
>
}
export
const
enableDocument
:
Fetcher
<
CommonResponse
,
CommonDocReq
>
=
({
datasetId
,
documentId
})
=>
{
export
const
enableDocument
:
Fetcher
<
CommonResponse
,
CommonDocReq
>
=
({
datasetId
,
documentId
})
=>
{
return
patch
(
`/datasets/
${
datasetId
}
/documents/
${
documentId
}
/status/enable`
)
as
Promise
<
CommonResponse
>
return
patch
(
`/datasets/
${
datasetId
}
/documents/
${
documentId
}
/status/enable`
)
as
Promise
<
CommonResponse
>
}
}
...
...
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