Skip to content

Commit

Permalink
fix: 插件支持系统级别配置到特定空间使用 #104
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 32232
  • Loading branch information
ywywZhou authored and normal-wls committed Mar 3, 2025
1 parent 2d9c6f8 commit cffbd6c
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions frontend/src/store/modules/atomForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ const atomForm = {
* @param {String} payload.setName 自定义请求类型
*/
async loadAtomConfig({ commit }, payload) {
const { name, atom, classify = 'component', version = 'legacy', project_id } = payload;
const { name, atom, classify = 'component', version = 'legacy', space_id } = payload;
const atomClassify = classify;
const atomFile = name || atom;
const atomVersion = atomClassify === 'component' ? version : 'legacy';
const params = { project_id }; // 业务下需要带 project_id,公共流程、插件开发等不需要传
const params = { space_id };
const url = atomClassify === 'component' ? `api/plugin/${atomFile}/` : `api/template/variable/${atomFile}/`;

// 变量暂时没有版本系统
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/task/TaskExecute/ExecuteInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@
if (pluginGroup && pluginGroup[version]) {
return pluginGroup[version];
}
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: this.project_id });
await this.loadAtomConfig({ atom: plugin, version, classify, name, space_id: this.spaceId });
const config = $.atoms[plugin];
return config;
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@
*/
async getAtomConfig(config) {
const { plugin, version, classify, name, isThird } = config;
const projectId = this.componentValue.template_source === 'common' ? undefined : this.project_id;
try {
// 先取标准节点缓存的数据
const pluginGroup = this.pluginConfigs[plugin];
Expand Down Expand Up @@ -594,7 +593,7 @@
if (isThird) {
await this.getThirdConfig(plugin, version);
} else {
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: projectId });
await this.loadAtomConfig({ atom: plugin, version, classify, name, space_id: this.spaceId });
this.outputs = this.pluginOutput[plugin][version];
}
const config = $.atoms[plugin];
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/views/task/TaskExecute/ModifyTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
},
computed: {
...mapState({
spaceId: state => state.template.spaceId,
atomFormConfig: state => state.atomForm.config,
}),
...mapState('project', {
Expand Down Expand Up @@ -123,7 +124,7 @@
return this.atomFormConfig[type][version];
}
try {
await this.loadAtomConfig({ atom: type, version, project_id: this.project_id });
await this.loadAtomConfig({ atom: type, version, space_id: this.spaceId });
return this.atomFormConfig[type][version];
} catch (e) {
console.log(e);
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/views/task/TaskExecute/RetryNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
},
computed: {
...mapState({
spaceId: state => state.template.spaceId,
atomFormConfig: state => state.atomForm.config,
}),
...mapState('project', {
Expand Down Expand Up @@ -156,7 +157,7 @@
const { constants } = this.componentValue.pipeline;
this.renderConfig = await this.getSubflowInputsConfig(constants);
} else {
await this.loadAtomConfig({ atom: type, version, project_id: this.project_id });
await this.loadAtomConfig({ atom: type, version, space_id: this.spaceId });
this.renderConfig = this.atomFormConfig[type][version];
}
} catch (e) {
Expand Down Expand Up @@ -234,7 +235,7 @@
if (pluginGroup && pluginGroup[version]) {
return pluginGroup[version];
}
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: this.project_id });
await this.loadAtomConfig({ atom: plugin, version, classify, name, space_id: this.spaceId });
const config = $.atoms[plugin];
return config;
} catch (e) {
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/views/task/TaskParamEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
},
computed: {
...mapState({
spaceId: state => state.template.spaceId,
atomFormConfig: state => state.atomForm.config,
}),
...mapState('project', {
Expand Down Expand Up @@ -170,7 +171,7 @@
if (pluginCode) {
atomConfig = await this.getThirdPartyAtomConfig(pluginCode, version);
} else {
await this.loadAtomConfig({ name, atom, classify, version, project_id: this.project_id });
await this.loadAtomConfig({ name, atom, classify, version, space_id: this.spaceId });
atomConfig = tools.deepClone(this.atomFormConfig[atom][version]);
}
}
Expand Down Expand Up @@ -354,7 +355,7 @@
if (pluginCode) {
atomConfig = await this.getThirdPartyAtomConfig(pluginCode, version);
} else {
await this.loadAtomConfig({ name, atom, classify, version, project_id: this.project_id });
await this.loadAtomConfig({ name, atom, classify, version, space_id: this.spaceId });
atomConfig = this.atomFormConfig[atom][version];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
},
computed: {
...mapState({
spaceId: state => state.template.spaceId,
activities: state => state.template.activities,
constants: state => state.template.constants,
gateways: state => state.template.gateways,
Expand Down Expand Up @@ -405,7 +406,6 @@
},
async getAtomConfig(config) {
const { plugin, version, classify, name, isThird } = config;
const projectId = this.common ? undefined : this.project_id;
try {
// 先取标准节点缓存的数据
const pluginGroup = this.pluginConfigs[plugin];
Expand All @@ -432,7 +432,7 @@
/* eslint-disable-next-line */
eval(renderFrom)
} else {
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: projectId });
await this.loadAtomConfig({ atom: plugin, version, classify, name, space_id: this.spaceId });
}
const config = $.atoms[plugin];
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@
*/
async getAtomConfig(config) {
const { plugin, version, classify, name, isThird } = config;
const projectId = this.isCommonTpl ? undefined : this.projectId;
try {
// 先取标准节点缓存的数据
const pluginGroup = this.pluginConfigs[plugin];
Expand All @@ -584,7 +583,7 @@
// api插件输入输出
if (this.isApiPlugin && this.basicInfo.metaUrl) {
// 统一api基础配置
await this.loadAtomConfig({ atom: plugin, version, project_id: projectId });
await this.loadAtomConfig({ atom: plugin, version, space_id: this.spaceId });
// api插件配置
const resp = await this.loadUniformApiMeta({
spaceId: this.spaceId,
Expand Down Expand Up @@ -614,7 +613,7 @@
if (isThird) {
await this.getThirdConfig(plugin, version);
} else {
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id: projectId });
await this.loadAtomConfig({ atom: plugin, version, classify, name, space_id: this.spaceId });
}
const config = $.atoms[plugin];
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@
await this.loadAtomConfig({
classify,
name: this.atomType,
project_id: this.common ? undefined : this.project_id,
space_id: this.spaceId,
version,
atom,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
} else if (pluginCode) {
atomConfig = await this.getThirdPartyAtomConfig(pluginCode, version);
} else {
await this.loadAtomConfig({ name, atom, classify, version, project_id: this.project_id });
await this.loadAtomConfig({ name, atom, classify, version, space_id: this.spaceId });
atomConfig = tools.deepClone(this.atomFormConfig[atom][version]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@
*/
async getAtomConfig(config) {
const { plugin, version, classify, name, isThird } = config;
const projectId = this.componentValue.template_source === 'common' ? undefined : this.project_id;
try {
// 先取标准节点缓存的数据
const pluginGroup = this.pluginConfigs[plugin];
Expand All @@ -461,7 +460,7 @@
const { api_meta: apiMeta } = this.nodeConfig.component || {};
if (!apiMeta) return;
// 统一api基础配置
await this.loadAtomConfig({ atom: plugin, version, project_id: projectId });
await this.loadAtomConfig({ atom: plugin, version, space_id: this.spaceId });
// api插件配置
const resp = await this.loadUniformApiMeta({
spaceId: this.spaceId,
Expand All @@ -488,7 +487,7 @@
version,
classify,
name,
project_id: projectId,
space_id: this.spaceId,
});
this.outputs = this.pluginOutput[plugin][version];
}
Expand Down

0 comments on commit cffbd6c

Please sign in to comment.