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
0ee76706
Commit
0ee76706
authored
Jun 19, 2023
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dataset detail context update
parent
eac26f69
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
index.tsx
web/app/components/datasets/create/step-one/index.tsx
+3
-9
index.tsx
web/app/components/datasets/create/step-two/index.tsx
+4
-0
No files found.
web/app/components/datasets/create/step-one/index.tsx
View file @
0ee76706
...
@@ -59,7 +59,7 @@ const StepOne = ({
...
@@ -59,7 +59,7 @@ const StepOne = ({
notionPages
=
[],
notionPages
=
[],
updateNotionPages
,
updateNotionPages
,
}:
IStepOneProps
)
=>
{
}:
IStepOneProps
)
=>
{
const
{
dataset
,
mutateDatasetRes
}
=
useDatasetDetailContext
()
const
{
dataset
}
=
useDatasetDetailContext
()
const
[
showModal
,
setShowModal
]
=
useState
(
false
)
const
[
showModal
,
setShowModal
]
=
useState
(
false
)
const
[
showFilePreview
,
setShowFilePreview
]
=
useState
(
true
)
const
[
showFilePreview
,
setShowFilePreview
]
=
useState
(
true
)
const
[
currentNotionPage
,
setCurrentNotionPage
]
=
useState
<
Page
|
undefined
>
()
const
[
currentNotionPage
,
setCurrentNotionPage
]
=
useState
<
Page
|
undefined
>
()
...
@@ -79,12 +79,6 @@ const StepOne = ({
...
@@ -79,12 +79,6 @@ const StepOne = ({
setCurrentNotionPage
(
undefined
)
setCurrentNotionPage
(
undefined
)
}
}
const
handleStepChange
=
()
=>
{
if
(
mutateDatasetRes
)
mutateDatasetRes
()
onStepChange
()
}
const
shouldShowDataSourceTypeList
=
!
datasetId
||
(
datasetId
&&
!
dataset
?.
data_source_type
)
const
shouldShowDataSourceTypeList
=
!
datasetId
||
(
datasetId
&&
!
dataset
?.
data_source_type
)
return
(
return
(
...
@@ -145,7 +139,7 @@ const StepOne = ({
...
@@ -145,7 +139,7 @@ const StepOne = ({
{
dataSourceType
===
DataSourceType
.
FILE
&&
(
{
dataSourceType
===
DataSourceType
.
FILE
&&
(
<>
<>
<
FileUploader
onFileUpdate=
{
updateFile
}
file=
{
file
}
titleClassName=
{
(
!
shouldShowDataSourceTypeList
)
?
'mt-[30px] !mb-[44px] !text-lg !font-semibold !text-gray-900'
:
undefined
}
/>
<
FileUploader
onFileUpdate=
{
updateFile
}
file=
{
file
}
titleClassName=
{
(
!
shouldShowDataSourceTypeList
)
?
'mt-[30px] !mb-[44px] !text-lg !font-semibold !text-gray-900'
:
undefined
}
/>
<
Button
disabled=
{
!
file
}
className=
{
s
.
submitButton
}
type=
'primary'
onClick=
{
handle
StepChange
}
>
{
t
(
'datasetCreation.stepOne.button'
)
}
</
Button
>
<
Button
disabled=
{
!
file
}
className=
{
s
.
submitButton
}
type=
'primary'
onClick=
{
on
StepChange
}
>
{
t
(
'datasetCreation.stepOne.button'
)
}
</
Button
>
</>
</>
)
}
)
}
{
dataSourceType
===
DataSourceType
.
NOTION
&&
(
{
dataSourceType
===
DataSourceType
.
NOTION
&&
(
...
@@ -156,7 +150,7 @@ const StepOne = ({
...
@@ -156,7 +150,7 @@ const StepOne = ({
<
div
className=
'mb-8 w-[640px]'
>
<
div
className=
'mb-8 w-[640px]'
>
<
NotionPageSelector
value=
{
notionPages
.
map
(
page
=>
page
.
page_id
)
}
onSelect=
{
updateNotionPages
}
onPreview=
{
updateCurrentPage
}
/>
<
NotionPageSelector
value=
{
notionPages
.
map
(
page
=>
page
.
page_id
)
}
onSelect=
{
updateNotionPages
}
onPreview=
{
updateCurrentPage
}
/>
</
div
>
</
div
>
<
Button
disabled=
{
!
notionPages
.
length
}
className=
{
s
.
submitButton
}
type=
'primary'
onClick=
{
handle
StepChange
}
>
{
t
(
'datasetCreation.stepOne.button'
)
}
</
Button
>
<
Button
disabled=
{
!
notionPages
.
length
}
className=
{
s
.
submitButton
}
type=
'primary'
onClick=
{
on
StepChange
}
>
{
t
(
'datasetCreation.stepOne.button'
)
}
</
Button
>
</>
</>
)
}
)
}
</>
</>
...
...
web/app/components/datasets/create/step-two/index.tsx
View file @
0ee76706
...
@@ -24,6 +24,7 @@ import { formatNumber } from '@/utils/format'
...
@@ -24,6 +24,7 @@ import { formatNumber } from '@/utils/format'
import
type
{
DataSourceNotionPage
}
from
'@/models/common'
import
type
{
DataSourceNotionPage
}
from
'@/models/common'
import
{
DataSourceType
}
from
'@/models/datasets'
import
{
DataSourceType
}
from
'@/models/datasets'
import
NotionIcon
from
'@/app/components/base/notion-icon'
import
NotionIcon
from
'@/app/components/base/notion-icon'
import
{
useDatasetDetailContext
}
from
'@/context/dataset-detail'
type
Page
=
DataSourceNotionPage
&
{
workspace_id
:
string
}
type
Page
=
DataSourceNotionPage
&
{
workspace_id
:
string
}
...
@@ -70,6 +71,7 @@ const StepTwo = ({
...
@@ -70,6 +71,7 @@ const StepTwo = ({
onCancel
,
onCancel
,
}:
StepTwoProps
)
=>
{
}:
StepTwoProps
)
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
mutateDatasetRes
}
=
useDatasetDetailContext
()
const
scrollRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
scrollRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
[
scrolled
,
setScrolled
]
=
useState
(
false
)
const
[
scrolled
,
setScrolled
]
=
useState
(
false
)
const
previewScrollRef
=
useRef
<
HTMLDivElement
>
(
null
)
const
previewScrollRef
=
useRef
<
HTMLDivElement
>
(
null
)
...
@@ -312,6 +314,8 @@ const StepTwo = ({
...
@@ -312,6 +314,8 @@ const StepTwo = ({
updateIndexingTypeCache
&&
updateIndexingTypeCache
(
indexType
)
updateIndexingTypeCache
&&
updateIndexingTypeCache
(
indexType
)
updateResultCache
&&
updateResultCache
(
res
)
updateResultCache
&&
updateResultCache
(
res
)
}
}
if
(
mutateDatasetRes
)
mutateDatasetRes
()
onStepChange
&&
onStepChange
(
+
1
)
onStepChange
&&
onStepChange
(
+
1
)
isSetting
&&
onSave
&&
onSave
()
isSetting
&&
onSave
&&
onSave
()
}
}
...
...
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