feat(plugin): allow open source to display non-SaaS plugins
This commit is contained in:
@ -18,10 +18,10 @@
|
||||
* Node source
|
||||
*/
|
||||
|
||||
import { type FlowNodeEntity } from '@flowgram-adapter/free-layout-editor';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { IconCozStore, IconCozTray } from '@coze-arch/coze-design/icons';
|
||||
import { IconButton, Tooltip } from '@coze-arch/coze-design';
|
||||
import { type FlowNodeEntity } from '@flowgram-adapter/free-layout-editor';
|
||||
|
||||
import { useNodeOrigin } from './use-node-origin';
|
||||
|
||||
@ -32,9 +32,9 @@ interface ReferenceNodeOriginProps {
|
||||
export const ReferenceNodeOrigin: React.FC<ReferenceNodeOriginProps> = ({
|
||||
node,
|
||||
}) => {
|
||||
const { isFromStore, isFromLibrary } = useNodeOrigin(node);
|
||||
const { isFromStore, isFromLibrary, isFromCozeCnStore } = useNodeOrigin(node);
|
||||
|
||||
if (isFromStore) {
|
||||
if (isFromStore || isFromCozeCnStore) {
|
||||
return (
|
||||
<Tooltip content={I18n.t('workflow_node_from_store')}>
|
||||
<IconButton icon={<IconCozStore />} size="mini" color="secondary" />
|
||||
|
||||
@ -50,11 +50,9 @@ export const useNodeOrigin = (node: FlowNodeEntity) => {
|
||||
* 3. There is a shelf status
|
||||
*/
|
||||
const apiData = nodeData.getNodeData<StandardNodeType.Api>();
|
||||
const isFromStore =
|
||||
isApi &&
|
||||
!isFromProject &&
|
||||
(!!apiData.pluginProductStatus ||
|
||||
apiData.plugin_from === PluginFrom.FromSaas);
|
||||
const isFromStore = isApi && !isFromProject && !!apiData.pluginProductStatus;
|
||||
const isFromCozeCnStore =
|
||||
isApi && !isFromProject && apiData.plugin_from === PluginFrom.FromSaas;
|
||||
|
||||
/**
|
||||
* Is it from the resource library?
|
||||
@ -67,5 +65,6 @@ export const useNodeOrigin = (node: FlowNodeEntity) => {
|
||||
isApi,
|
||||
isFromStore,
|
||||
isFromLibrary,
|
||||
isFromCozeCnStore,
|
||||
};
|
||||
};
|
||||
|
||||
@ -68,11 +68,6 @@ export const PluginLink = ({
|
||||
return null;
|
||||
}
|
||||
|
||||
// Open source plugins only display plugins from the SaaS platform
|
||||
if (IS_OPEN_SOURCE && plugin_from !== PluginFrom.FromSaas) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return <IconCozLoading className="animate-spin text-xs coz-fg-dim" />;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import {
|
||||
type WorkflowNodeJSON,
|
||||
type WorkflowNodeRegistry,
|
||||
} from '@coze-workflow/base';
|
||||
import { PluginFrom } from '@coze-arch/bot-api/playground_api';
|
||||
|
||||
import { type WorkflowPlaygroundContext } from '@/workflow-playground-context';
|
||||
import { type NodeTestMeta } from '@/test-run-kit';
|
||||
@ -95,6 +96,14 @@ export const PLUGIN_NODE_REGISTRY: WorkflowNodeRegistry<NodeTestMeta> = {
|
||||
|
||||
getHeaderExtraOperation: (formValues: ApiNodeFormData) => {
|
||||
const identifier = getApiNodeIdentifier(formValues?.inputs?.apiParam ?? []);
|
||||
|
||||
if (
|
||||
IS_OPEN_SOURCE &&
|
||||
formValues?.inputs?.pluginFrom !== PluginFrom.FromSaas
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return createPluginLink(identifier);
|
||||
},
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import {
|
||||
type BatchDTO,
|
||||
type ValueExpression,
|
||||
} from '@coze-workflow/base';
|
||||
import { type PluginFrom } from '@coze-arch/bot-api/playground_api';
|
||||
|
||||
import type { NodeMeta, SettingOnErrorDTO, SettingOnErrorVO } from '@/typing';
|
||||
|
||||
@ -39,6 +40,7 @@ export interface ApiNodeFormData {
|
||||
inputParameters?: InputParametersMap;
|
||||
batch?: BatchVO;
|
||||
batchMode?: string;
|
||||
pluginFrom?: PluginFrom;
|
||||
settingOnError?: SettingOnErrorDTO;
|
||||
};
|
||||
outputs: ViewVariableMeta[];
|
||||
|
||||
Reference in New Issue
Block a user