fix(插件定义): 插件脚本初始化问题修复
This commit is contained in:
parent
99261a56c4
commit
9566b3b6f7
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Plugin implements Serializable {
|
||||
|
@ -12,6 +11,8 @@ public class Plugin implements Serializable {
|
|||
|
||||
private String pluginId;
|
||||
|
||||
private String scriptId;
|
||||
|
||||
private String clazzName;
|
||||
|
||||
private String sourcePath;
|
||||
|
|
|
@ -314,6 +314,76 @@ public class PluginExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIsNull() {
|
||||
addCriterion("script_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIsNotNull() {
|
||||
addCriterion("script_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdEqualTo(String value) {
|
||||
addCriterion("script_id =", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotEqualTo(String value) {
|
||||
addCriterion("script_id <>", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdGreaterThan(String value) {
|
||||
addCriterion("script_id >", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("script_id >=", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLessThan(String value) {
|
||||
addCriterion("script_id <", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("script_id <=", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdLike(String value) {
|
||||
addCriterion("script_id like", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotLike(String value) {
|
||||
addCriterion("script_id not like", value, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdIn(List<String> values) {
|
||||
addCriterion("script_id in", values, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotIn(List<String> values) {
|
||||
addCriterion("script_id not in", values, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdBetween(String value1, String value2) {
|
||||
addCriterion("script_id between", value1, value2, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScriptIdNotBetween(String value1, String value2) {
|
||||
addCriterion("script_id not between", value1, value2, "scriptId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andClazzNameIsNull() {
|
||||
addCriterion("clazz_name is null");
|
||||
return (Criteria) this;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="plugin_id" jdbcType="VARCHAR" property="pluginId" />
|
||||
<result column="script_id" jdbcType="VARCHAR" property="scriptId" />
|
||||
<result column="clazz_name" jdbcType="VARCHAR" property="clazzName" />
|
||||
<result column="source_path" jdbcType="VARCHAR" property="sourcePath" />
|
||||
<result column="source_name" jdbcType="VARCHAR" property="sourceName" />
|
||||
|
@ -76,8 +77,8 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, plugin_id, clazz_name, source_path, source_name, exec_entry, create_time,
|
||||
update_time, create_user_id
|
||||
id, `name`, plugin_id, script_id, clazz_name, source_path, source_name, exec_entry,
|
||||
create_time, update_time, create_user_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
form_option, form_script
|
||||
|
@ -132,15 +133,15 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.PluginWithBLOBs">
|
||||
insert into plugin (id, `name`, plugin_id,
|
||||
clazz_name, source_path, source_name,
|
||||
exec_entry, create_time, update_time,
|
||||
create_user_id, form_option, form_script
|
||||
)
|
||||
script_id, clazz_name, source_path,
|
||||
source_name, exec_entry, create_time,
|
||||
update_time, create_user_id, form_option,
|
||||
form_script)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pluginId,jdbcType=VARCHAR},
|
||||
#{clazzName,jdbcType=VARCHAR}, #{sourcePath,jdbcType=VARCHAR}, #{sourceName,jdbcType=VARCHAR},
|
||||
#{execEntry,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{createUserId,jdbcType=VARCHAR}, #{formOption,jdbcType=LONGVARCHAR}, #{formScript,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
#{scriptId,jdbcType=VARCHAR}, #{clazzName,jdbcType=VARCHAR}, #{sourcePath,jdbcType=VARCHAR},
|
||||
#{sourceName,jdbcType=VARCHAR}, #{execEntry,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{createUserId,jdbcType=VARCHAR}, #{formOption,jdbcType=LONGVARCHAR},
|
||||
#{formScript,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.PluginWithBLOBs">
|
||||
insert into plugin
|
||||
|
@ -154,6 +155,9 @@
|
|||
<if test="pluginId != null">
|
||||
plugin_id,
|
||||
</if>
|
||||
<if test="scriptId != null">
|
||||
script_id,
|
||||
</if>
|
||||
<if test="clazzName != null">
|
||||
clazz_name,
|
||||
</if>
|
||||
|
@ -192,6 +196,9 @@
|
|||
<if test="pluginId != null">
|
||||
#{pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scriptId != null">
|
||||
#{scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clazzName != null">
|
||||
#{clazzName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -239,6 +246,9 @@
|
|||
<if test="record.pluginId != null">
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.scriptId != null">
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.clazzName != null">
|
||||
clazz_name = #{record.clazzName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -276,6 +286,7 @@
|
|||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
clazz_name = #{record.clazzName,jdbcType=VARCHAR},
|
||||
source_path = #{record.sourcePath,jdbcType=VARCHAR},
|
||||
source_name = #{record.sourceName,jdbcType=VARCHAR},
|
||||
|
@ -294,6 +305,7 @@
|
|||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
plugin_id = #{record.pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{record.scriptId,jdbcType=VARCHAR},
|
||||
clazz_name = #{record.clazzName,jdbcType=VARCHAR},
|
||||
source_path = #{record.sourcePath,jdbcType=VARCHAR},
|
||||
source_name = #{record.sourceName,jdbcType=VARCHAR},
|
||||
|
@ -314,6 +326,9 @@
|
|||
<if test="pluginId != null">
|
||||
plugin_id = #{pluginId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scriptId != null">
|
||||
script_id = #{scriptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clazzName != null">
|
||||
clazz_name = #{clazzName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -348,6 +363,7 @@
|
|||
update plugin
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
plugin_id = #{pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{scriptId,jdbcType=VARCHAR},
|
||||
clazz_name = #{clazzName,jdbcType=VARCHAR},
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
source_name = #{sourceName,jdbcType=VARCHAR},
|
||||
|
@ -363,6 +379,7 @@
|
|||
update plugin
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
plugin_id = #{pluginId,jdbcType=VARCHAR},
|
||||
script_id = #{scriptId,jdbcType=VARCHAR},
|
||||
clazz_name = #{clazzName,jdbcType=VARCHAR},
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
source_name = #{sourceName,jdbcType=VARCHAR},
|
||||
|
|
|
@ -64,6 +64,7 @@ public class PluginService {
|
|||
plugin.setUpdateTime(System.currentTimeMillis());
|
||||
plugin.setName(item.getName());
|
||||
plugin.setPluginId(resource.getPluginId());
|
||||
plugin.setScriptId(item.getId());
|
||||
plugin.setSourcePath(path);
|
||||
plugin.setFormOption(item.getFormOption());
|
||||
plugin.setFormScript(item.getFormScript());
|
||||
|
@ -156,9 +157,9 @@ public class PluginService {
|
|||
return plugins;
|
||||
}
|
||||
|
||||
public Plugin get(String pluginId) {
|
||||
public Plugin get(String scriptId) {
|
||||
PluginExample example = new PluginExample();
|
||||
example.createCriteria().andPluginIdEqualTo(pluginId);
|
||||
example.createCriteria().andScriptIdEqualTo(scriptId);
|
||||
List<PluginWithBLOBs> plugins = pluginMapper.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isNotEmpty(plugins)) {
|
||||
return plugins.get(0);
|
||||
|
|
|
@ -2,6 +2,7 @@ CREATE TABLE `plugin` (
|
|||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`name` varchar(300) DEFAULT NULL COMMENT 'plugin name',
|
||||
`plugin_id` varchar(300) NOT NULL COMMENT 'Plugin id',
|
||||
`script_id` varchar(300) NOT NULL COMMENT 'Ui script id',
|
||||
`clazz_name` varchar(500) NOT NULL COMMENT 'Plugin clazzName',
|
||||
`source_path` varchar(300) NOT NULL COMMENT 'Plugin jar path',
|
||||
`source_name` varchar(300) NOT NULL COMMENT 'Plugin jar name',
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
:is-max="isMax"
|
||||
:show-btn="showBtn"
|
||||
:background-color="defBackgroundColor"
|
||||
:title="request.type">
|
||||
:title="pluginName">
|
||||
|
||||
<template v-slot:request>
|
||||
<legend style="width: 100%">
|
||||
|
@ -120,6 +120,7 @@ export default {
|
|||
option: formCreate.parseJson(
|
||||
'{"form":{"labelPosition":"right","size":"mini","labelWidth":"120px","hideRequiredAsterisk":false,"showMessage":false,"inlineMessage":false}}'
|
||||
),
|
||||
pluginName: "",
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
|
@ -130,6 +131,7 @@ export default {
|
|||
}
|
||||
this.data = this.request;
|
||||
this.request.type = 'Sampler';
|
||||
this.pluginName = this.request.type;
|
||||
},
|
||||
watch: {
|
||||
message() {
|
||||
|
@ -178,6 +180,7 @@ export default {
|
|||
if (id) {
|
||||
this.$get('/plugin/get/' + id, response => {
|
||||
let plugin = response.data;
|
||||
this.pluginName = plugin.name;
|
||||
this.execEntry = plugin.execEntry;
|
||||
if (plugin && plugin.formScript) {
|
||||
this.rules = formCreate.parseJson(plugin.formScript);
|
||||
|
|
|
@ -200,7 +200,7 @@ export function setComponent(type, _this, plugin) {
|
|||
_this.$refs.scenarioRelevance.open();
|
||||
break;
|
||||
default:
|
||||
_this.scenarioDefinition.push(new PluginController({type: plugin.name, pluginId: plugin.pluginId}));
|
||||
_this.scenarioDefinition.push(new PluginController({type: plugin.name, pluginId: plugin.scriptId}));
|
||||
break;
|
||||
}
|
||||
if (_this.selectedNode) {
|
||||
|
|
Loading…
Reference in New Issue