Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.iflytek.astron.console.toolkit.entity.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
* Result details for resource bindings resolved while importing a workflow.
*/
@Data
public class WorkflowImportReport {
private int mappedPluginCount;
private List<UnresolvedPlugin> unresolvedPlugins = new ArrayList<>();

public void pluginMapped() {
mappedPluginCount++;
}

public void pluginUnresolved(String nodeId, String nodeLabel, String pluginName, String reason) {
unresolvedPlugins.add(new UnresolvedPlugin(nodeId, nodeLabel, pluginName, reason));
}

/**
* Plugin node that could not be safely rebound in the target environment.
*/
@Data
@AllArgsConstructor
public static class UnresolvedPlugin {
private String nodeId;
private String nodeLabel;
private String pluginName;
private String reason;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.iflytek.astron.console.toolkit.entity.vo;

import com.iflytek.astron.console.commons.entity.workflow.Workflow;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* Imported workflow response with non-breaking resource-resolution details.
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WorkflowImportVo extends Workflow {
private WorkflowImportReport importReport;
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ interface FileUploadEvent {
// 定义workflowImport响应类型
interface WorkflowImportResponse {
flowId: string;
importReport?: {
mappedPluginCount: number;
unresolvedPlugins: Array<{
nodeId: string;
nodeLabel?: string;
pluginName?: string;
reason: string;
}>;
};
}

// 定义自定义上传文件类型,扩展UploadFile
Expand Down Expand Up @@ -112,6 +121,33 @@ function WorkflowImportModal({
})
.then((value: unknown) => {
const res = value as WorkflowImportResponse;
const unresolvedPlugins = res.importReport?.unresolvedPlugins || [];
if (unresolvedPlugins.length > 0) {
const nodeNames = unresolvedPlugins
.slice(0, 5)
.map(item => item.nodeLabel || item.pluginName || item.nodeId)
.join(', ');
const remainingNodes = Math.max(unresolvedPlugins.length - 5, 0);
message.warning({
content: i18next.t(
'workflow.promptDebugger.importPluginMappingWarning',
{
count: unresolvedPlugins.length,
nodes: nodeNames,
remaining:
remainingNodes > 0
? i18next.t(
'workflow.promptDebugger.importPluginMappingMore',
{
count: remainingNodes,
}
)
: '',
}
),
duration: 8,
});
}
setWorkflowImportModalVisible(false);
navigate(`/work_flow/${res.flowId}/arrange`);
})
Expand Down
3 changes: 3 additions & 0 deletions console/frontend/src/locales/en-En/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,9 @@ const translation = {
pleaseUploadYmlYamlFormat: 'Please upload yml, yaml format files!',
fileFormatYmlYaml:
'File format is yml, yaml, file size does not exceed 20M',
importPluginMappingWarning:
'Workflow imported, but {{count}} plugin node(s) could not be matched safely. Please select them manually: {{nodes}}{{remaining}}',
importPluginMappingMore: ' and {{count}} more',
// AddTool component translations
updateConfig: 'Update Config',
// FlowOperatorPanel component translations
Expand Down
3 changes: 3 additions & 0 deletions console/frontend/src/locales/zh-ZH/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,9 @@ const translation = {
uploadFileSizeExceeded: '上传文件大小不能超出20M!',
pleaseUploadYmlYamlFormat: '请上传yml、yaml格式文件!',
fileFormatYmlYaml: '文件格式为yml、yaml,文件大小不超过20M',
importPluginMappingWarning:
'工作流已导入,但有 {{count}} 个插件节点未能安全匹配,请手动选择:{{nodes}}{{remaining}}',
importPluginMappingMore: ' 等另外 {{count}} 个节点',
// AddTool component translations
updateConfig: '更新配置',
// FlowOperatorPanel component translations
Expand Down
Loading