4.8.10 test (#2578)

* fix: auth error

* perf: refresh members

* fix: variable run

* fix: runtime check

* fix: dataset info show
This commit is contained in:
Archer
2024-08-30 10:27:07 +08:00
committed by GitHub
parent 6d00f73e91
commit 2ef98c24be
11 changed files with 78 additions and 54 deletions

View File

@@ -77,8 +77,6 @@ export type SystemPluginTemplateItemType = WorkflowTemplateType & {
description: string; description: string;
value?: any; value?: any;
}[]; }[];
workflow: WorkflowTemplateBasicType;
}; };
export type THelperLine = { export type THelperLine = {

View File

@@ -314,7 +314,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
result: Record<string, any>; result: Record<string, any>;
}[]; }[];
// If there are no running nodes, the workflow is complete // If there are no running nodes, the workflow is complete
if (!flat.some((item) => item.runStatus === 'run')) return; if (flat.length === 0) return;
// Update the node output at the end of the run and get the next nodes // Update the node output at the end of the run and get the next nodes
const nextNodes = flat.map((item) => nodeOutput(item.node, item.result)).flat(); const nextNodes = flat.map((item) => nodeOutput(item.node, item.result)).flat();

View File

@@ -52,6 +52,11 @@ export const authAppByTmbId = async ({
if (!app) { if (!app) {
return Promise.reject(AppErrEnum.unExist); return Promise.reject(AppErrEnum.unExist);
} }
if (String(app.teamId) !== teamId) {
return Promise.reject(AppErrEnum.unAuthApp);
}
const isOwner = tmbPer.isOwner || String(app.tmbId) === String(tmbId); const isOwner = tmbPer.isOwner || String(app.tmbId) === String(tmbId);
const { Per, defaultPermission } = await (async () => { const { Per, defaultPermission } = await (async () => {

View File

@@ -28,6 +28,10 @@ export async function authOpenApiKeyCrud({
return Promise.reject(OpenApiErrEnum.unExist); return Promise.reject(OpenApiErrEnum.unExist);
} }
if (String(openapi.teamId) !== teamId) {
return Promise.reject(OpenApiErrEnum.unAuth);
}
if (!!openapi.appId) { if (!!openapi.appId) {
// if is not global openapi, then auth app // if is not global openapi, then auth app
const { app } = await authAppByTmbId({ appId: openapi.appId!, tmbId, per }); const { app } = await authAppByTmbId({ appId: openapi.appId!, tmbId, per });

View File

@@ -43,6 +43,11 @@ export const authDatasetByTmbId = async ({
if (!dataset) { if (!dataset) {
return Promise.reject(DatasetErrEnum.unExist); return Promise.reject(DatasetErrEnum.unExist);
} }
if (String(dataset.teamId) !== teamId) {
return Promise.reject(DatasetErrEnum.unAuthDataset);
}
const isOwner = tmbPer.isOwner || String(dataset.tmbId) === String(tmbId); const isOwner = tmbPer.isOwner || String(dataset.tmbId) === String(tmbId);
// get dataset permission or inherit permission from parent folder. // get dataset permission or inherit permission from parent folder.

View File

@@ -29,10 +29,14 @@ export async function authOutLinkCrud({
return Promise.reject(OutLinkErrEnum.unExist); return Promise.reject(OutLinkErrEnum.unExist);
} }
if (String(outLink.teamId) !== teamId) {
return Promise.reject(OutLinkErrEnum.unAuthLink);
}
const { app } = await authAppByTmbId({ const { app } = await authAppByTmbId({
tmbId, tmbId,
appId: outLink.appId, appId: outLink.appId,
per: per per
}); });
return { return {

View File

@@ -71,7 +71,7 @@ export const TeamModalContextProvider = ({ children }: { children: ReactNode })
} = useRequest2( } = useRequest2(
() => { () => {
if (!userInfo?.team?.teamId) return Promise.resolve([]); if (!userInfo?.team?.teamId) return Promise.resolve([]);
return loadAndGetTeamMembers(); return loadAndGetTeamMembers(true);
}, },
{ {
manual: false, manual: false,

View File

@@ -244,9 +244,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
// Get runtimeNodes // Get runtimeNodes
let runtimeNodes = storeNodes2RuntimeNodes(nodes, getWorkflowEntryNodeIds(nodes, newHistories)); let runtimeNodes = storeNodes2RuntimeNodes(nodes, getWorkflowEntryNodeIds(nodes, newHistories));
if (isPlugin) { if (isPlugin) {
// Rewrite plugin run params variables // Assign values to runtimeNodes using variables
variables = removePluginInputVariables(variables, runtimeNodes);
runtimeNodes = updatePluginInputByVariables(runtimeNodes, variables); runtimeNodes = updatePluginInputByVariables(runtimeNodes, variables);
// Remove pluginInput fields from variables (they are not global variables)
variables = removePluginInputVariables(variables, runtimeNodes);
} }
runtimeNodes = rewriteNodeOutputByHistories(newHistories, runtimeNodes); runtimeNodes = rewriteNodeOutputByHistories(newHistories, runtimeNodes);

View File

@@ -247,7 +247,7 @@ const ListItem = () => {
<Box color={'myGray.500'}>{formatTimeToChatTime(app.updateTime)}</Box> <Box color={'myGray.500'}>{formatTimeToChatTime(app.updateTime)}</Box>
</HStack> </HStack>
)} )}
{app.permission.hasManagePer && ( {app.permission.hasWritePer && (
<Box className="more" display={['', 'none']}> <Box className="more" display={['', 'none']}>
<MyMenu <MyMenu
Button={ Button={
@@ -289,6 +289,8 @@ const ListItem = () => {
} }
] ]
: []), : []),
...(app.permission.hasManagePer
? [
{ {
children: [ children: [
{ {
@@ -332,7 +334,9 @@ const ListItem = () => {
] ]
: []) : [])
] ]
}, }
]
: []),
...(AppFolderTypeList.includes(app.type) ...(AppFolderTypeList.includes(app.type)
? [] ? []
: [ : [
@@ -347,7 +351,6 @@ const ListItem = () => {
] ]
} }
]), ]),
...(app.permission.isOwner ...(app.permission.isOwner
? [ ? [
{ {

View File

@@ -1,4 +1,4 @@
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { Box, Flex, Input } from '@chakra-ui/react'; import { Box, Flex, Input } from '@chakra-ui/react';
import { delDatasetById } from '@/web/core/dataset/api'; import { delDatasetById } from '@/web/core/dataset/api';
@@ -50,7 +50,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
DatasetPageContext, DatasetPageContext,
(v) => v.refetchDatasetTraining (v) => v.refetchDatasetTraining
); );
const { setValue, register, handleSubmit, watch } = useForm<DatasetItemType>({ const { setValue, register, handleSubmit, watch, reset } = useForm<DatasetItemType>({
defaultValues: datasetDetail defaultValues: datasetDetail
}); });
@@ -147,6 +147,10 @@ const Info = ({ datasetId }: { datasetId: string }) => {
errorToast: t('common:common.Update Failed') errorToast: t('common:common.Update Failed')
}); });
useEffect(() => {
reset(datasetDetail);
}, [datasetDetail._id]);
return ( return (
<Box w={'100%'} h={'100%'} p={6}> <Box w={'100%'} h={'100%'} p={6}>
<Box> <Box>

View File

@@ -18,7 +18,7 @@ export const useCopyData = () => {
duration = 1000 duration = 1000
) => { ) => {
try { try {
if (hasHttps() && !isProduction && navigator.clipboard) { if ((hasHttps() || !isProduction) && navigator.clipboard) {
await navigator.clipboard.writeText(data); await navigator.clipboard.writeText(data);
} else { } else {
throw new Error(''); throw new Error('');