Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
de59b3d2
authored
Sep 10, 2024
by
Finley Ge
Committed by
GitHub
Sep 10, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: app select dataset (#2660)
parent
08190c2f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
11 deletions
+29
-11
packages/service/support/permission/dataset/auth.ts
+3
-1
projects/app/src/components/core/app/FileSelect.tsx
+0
-1
projects/app/src/pages/api/core/dataset/allDataset.ts
+24
-7
projects/app/src/pages/app/detail/components/SimpleApp/EditForm.tsx
+2
-2
No files found.
packages/service/support/permission/dataset/auth.ts
View file @
de59b3d2
...
@@ -90,13 +90,15 @@ export const authDatasetByTmbId = async ({
...
@@ -90,13 +90,15 @@ export const authDatasetByTmbId = async ({
const
{
dataset
:
parent
}
=
await
authDatasetByTmbId
({
const
{
dataset
:
parent
}
=
await
authDatasetByTmbId
({
tmbId
,
tmbId
,
datasetId
:
dataset
.
parentId
,
datasetId
:
dataset
.
parentId
,
per
per
,
isRoot
});
});
const
Per
=
new
DatasetPermission
({
const
Per
=
new
DatasetPermission
({
per
:
parent
.
permission
.
value
,
per
:
parent
.
permission
.
value
,
isOwner
isOwner
});
});
return
{
return
{
Per
,
Per
,
defaultPermission
:
parent
.
defaultPermission
defaultPermission
:
parent
.
defaultPermission
...
...
projects/app/src/components/core/app/FileSelect.tsx
View file @
de59b3d2
...
@@ -6,7 +6,6 @@ import {
...
@@ -6,7 +6,6 @@ import {
Flex
,
Flex
,
ModalBody
,
ModalBody
,
useDisclosure
,
useDisclosure
,
Image
,
HStack
,
HStack
,
Switch
,
Switch
,
ModalFooter
ModalFooter
...
...
projects/app/src/pages/api/core/dataset/allDataset.ts
View file @
de59b3d2
...
@@ -27,10 +27,7 @@ async function handler(req: NextApiRequest): Promise<DatasetSimpleItemType[]> {
...
@@ -27,10 +27,7 @@ async function handler(req: NextApiRequest): Promise<DatasetSimpleItemType[]> {
const
[
myDatasets
,
rpList
]
=
await
Promise
.
all
([
const
[
myDatasets
,
rpList
]
=
await
Promise
.
all
([
MongoDataset
.
find
({
MongoDataset
.
find
({
teamId
,
teamId
type
:
{
$ne
:
DatasetTypeEnum
.
folder
}
})
})
.
sort
({
.
sort
({
updateTime
:
-
1
updateTime
:
-
1
...
@@ -45,9 +42,29 @@ async function handler(req: NextApiRequest): Promise<DatasetSimpleItemType[]> {
...
@@ -45,9 +42,29 @@ async function handler(req: NextApiRequest): Promise<DatasetSimpleItemType[]> {
const
filterDatasets
=
myDatasets
const
filterDatasets
=
myDatasets
.
map
((
dataset
)
=>
{
.
map
((
dataset
)
=>
{
const
perVal
=
rpList
.
find
(
const
perVal
=
(()
=>
{
(
item
)
=>
String
(
item
.
resourceId
)
===
String
(
dataset
.
_id
)
const
perVal
=
rpList
.
find
(
)?.
permission
;
(
item
)
=>
String
(
item
.
resourceId
)
===
String
(
dataset
.
_id
)
)?.
permission
;
if
(
perVal
)
{
return
perVal
;
}
if
(
dataset
.
inheritPermission
&&
dataset
.
parentId
)
{
const
parentDataset
=
myDatasets
.
find
(
(
item
)
=>
String
(
item
.
_id
)
===
String
(
dataset
.
parentId
)
);
if
(
parentDataset
)
{
const
parentPerVal
=
rpList
.
find
((
item
)
=>
String
(
item
.
resourceId
)
===
String
(
parentDataset
.
_id
))
?.
permission
??
parentDataset
.
defaultPermission
;
if
(
parentPerVal
)
{
return
parentPerVal
;
}
}
}
})();
const
Per
=
new
DatasetPermission
({
const
Per
=
new
DatasetPermission
({
per
:
perVal
??
dataset
.
defaultPermission
,
per
:
perVal
??
dataset
.
defaultPermission
,
isOwner
:
String
(
dataset
.
tmbId
)
===
tmbId
||
tmbPer
.
isOwner
isOwner
:
String
(
dataset
.
tmbId
)
===
tmbId
||
tmbPer
.
isOwner
...
...
projects/app/src/pages/app/detail/components/SimpleApp/EditForm.tsx
View file @
de59b3d2
...
@@ -10,7 +10,6 @@ import {
...
@@ -10,7 +10,6 @@ import {
HStack
HStack
}
from
'@chakra-ui/react'
;
}
from
'@chakra-ui/react'
;
import
{
SmallAddIcon
}
from
'@chakra-ui/icons'
;
import
{
SmallAddIcon
}
from
'@chakra-ui/icons'
;
import
{
useSystemStore
}
from
'@/web/common/system/useSystemStore'
;
import
type
{
AppSimpleEditFormType
}
from
'@fastgpt/global/core/app/type.d'
;
import
type
{
AppSimpleEditFormType
}
from
'@fastgpt/global/core/app/type.d'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useTranslation
}
from
'next-i18next'
;
import
{
useTranslation
}
from
'next-i18next'
;
...
@@ -79,7 +78,6 @@ const EditForm = ({
...
@@ -79,7 +78,6 @@ const EditForm = ({
const
{
appDetail
}
=
useContextSelector
(
AppContext
,
(
v
)
=>
v
);
const
{
appDetail
}
=
useContextSelector
(
AppContext
,
(
v
)
=>
v
);
const
{
allDatasets
}
=
useDatasetStore
();
const
{
allDatasets
}
=
useDatasetStore
();
const
{
llmModelList
}
=
useSystemStore
();
const
[,
startTst
]
=
useTransition
();
const
[,
startTst
]
=
useTransition
();
const
selectDatasets
=
useMemo
(
const
selectDatasets
=
useMemo
(
...
@@ -506,6 +504,8 @@ const EditForm = ({
...
@@ -506,6 +504,8 @@ const EditForm = ({
...
e
...
e
}
}
}));
}));
console
.
dir
(
e
);
}
}
}
}
/>
/>
)
}
)
}
...
...
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