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
111813c7
Commit
111813c7
authored
Jun 09, 2023
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: notion-page-selector
parent
68daf79f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
base.tsx
web/app/components/base/notion-page-selector/base.tsx
+20
-4
No files found.
web/app/components/base/notion-page-selector/base.tsx
View file @
111813c7
...
@@ -9,9 +9,9 @@ import { fetchDataSource } from '@/service/common'
...
@@ -9,9 +9,9 @@ import { fetchDataSource } from '@/service/common'
import
type
{
DataSourceNotionPage
}
from
'@/models/common'
import
type
{
DataSourceNotionPage
}
from
'@/models/common'
type
NotionPageSelectorProps
=
{
type
NotionPageSelectorProps
=
{
onSelect
:
(
selectedPages
:
DataSourceNotionPage
[])
=>
void
onSelect
:
(
selectedPages
:
(
DataSourceNotionPage
&
{
workspace_id
:
string
})
[])
=>
void
canPreview
?:
boolean
canPreview
?:
boolean
onPreview
?:
(
selectedPage
:
DataSourceNotionPage
)
=>
void
onPreview
?:
(
selectedPage
:
DataSourceNotionPage
&
{
workspace_id
:
string
}
)
=>
void
}
}
const
NotionPageSelector
=
({
const
NotionPageSelector
=
({
...
@@ -32,6 +32,22 @@ const NotionPageSelector = ({
...
@@ -32,6 +32,22 @@ const NotionPageSelector = ({
const
handleSelectWorkspace
=
useCallback
((
workspaceId
:
string
)
=>
{
const
handleSelectWorkspace
=
useCallback
((
workspaceId
:
string
)
=>
{
setCurrentWorkspaceId
(
workspaceId
)
setCurrentWorkspaceId
(
workspaceId
)
},
[])
},
[])
const
handleSelecPages
=
(
selectedPages
:
DataSourceNotionPage
[])
=>
{
onSelect
(
selectedPages
.
map
((
item
)
=>
{
return
{
...
item
,
workspace_id
:
currentWorkspace
?.
source_info
.
workspace_id
||
''
,
}
}))
}
const
handlePreviewPage
=
(
previewPage
:
DataSourceNotionPage
)
=>
{
if
(
onPreview
)
{
onPreview
({
...
previewPage
,
workspace_id
:
currentWorkspace
?.
source_info
.
workspace_id
||
''
,
})
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
setCurrentWorkspaceId
(
firstWorkspace
)
setCurrentWorkspaceId
(
firstWorkspace
)
...
@@ -57,9 +73,9 @@ const NotionPageSelector = ({
...
@@ -57,9 +73,9 @@ const NotionPageSelector = ({
currentWorkspace
?.
source_info
.
pages
.
length
&&
(
currentWorkspace
?.
source_info
.
pages
.
length
&&
(
<
PageSelector
<
PageSelector
list=
{
currentWorkspace
?.
source_info
.
pages
}
list=
{
currentWorkspace
?.
source_info
.
pages
}
onSelect=
{
onSelect
}
onSelect=
{
handleSelecPages
}
canPreview=
{
canPreview
}
canPreview=
{
canPreview
}
onPreview=
{
onPreview
}
onPreview=
{
handlePreviewPage
}
/>
/>
)
)
}
}
...
...
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