refactor(测试跟踪): 缺少平台插件提示优化

--bug=1019967 --user=陈建星 【测试跟踪】缺陷管理-删除jira缺陷失败 https://www.tapd.cn/55049933/s/1299905
This commit is contained in:
chenjianxing 2022-11-21 17:27:10 +08:00 committed by jianxing
parent 576662b71e
commit 100bec5f3d
8 changed files with 41 additions and 13 deletions

View File

@ -1,5 +1,7 @@
package io.metersphere.service;
import io.metersphere.commons.exception.MSException;
import io.metersphere.i18n.Translator;
import io.metersphere.platform.api.Platform;
import io.metersphere.platform.api.PluginMetaInfo;
import io.metersphere.base.domain.PluginWithBLOBs;
@ -7,7 +9,6 @@ import io.metersphere.base.domain.ServiceIntegration;
import io.metersphere.base.mapper.PluginMapper;
import io.metersphere.commons.constants.KafkaTopicConstants;
import io.metersphere.commons.constants.PluginScenario;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
@ -46,6 +47,8 @@ public class PlatformPluginService {
@Resource
private KafkaTemplate<String, String> kafkaTemplate;
private static final String PLUGIN_DOWNLOAD_URL = "https://github.com/metersphere/metersphere-platform-plugin";
private PlatformPluginManager pluginManager;
public synchronized PlatformPluginManager getPluginManager() {
@ -133,14 +136,7 @@ public class PlatformPluginService {
}
public List<SelectOption> getProjectOption(PlatformProjectOptionRequest request) {
IntegrationRequest integrationRequest = new IntegrationRequest();
BeanUtils.copyBean(integrationRequest, request);
ServiceIntegration serviceIntegration = baseIntegrationService.get(integrationRequest);
PlatformRequest platformRequest = new PlatformRequest();
platformRequest.setIntegrationConfig(serviceIntegration.getConfiguration());
Platform platform = getPluginManager().getPlatformByKey(request.getPlatform(), platformRequest);
Platform platform = getPlatform(request.getPlatform(), request.getWorkspaceId());
GetOptionRequest getOptionRequest = new GetOptionRequest();
getOptionRequest.setOptionMethod(request.getOptionMethod());
getOptionRequest.setProjectConfig(request.getProjectConfig());
@ -152,6 +148,21 @@ public class PlatformPluginService {
}
public Platform getPlatform(String platformKey, String workspaceId) {
IntegrationRequest integrationRequest = new IntegrationRequest();
integrationRequest.setPlatform(platformKey);
integrationRequest.setWorkspaceId(StringUtils.isBlank(workspaceId) ? SessionUtils.getCurrentWorkspaceId() : workspaceId);
ServiceIntegration serviceIntegration = baseIntegrationService.get(integrationRequest);
PlatformRequest pluginRequest = new PlatformRequest();
pluginRequest.setIntegrationConfig(serviceIntegration.getConfiguration());
Platform platform = getPluginManager().getPlatformByKey(platformKey, pluginRequest);
if (platform == null) {
MSException.throwException(Translator.get("platform_plugin_not_exit") + PLUGIN_DOWNLOAD_URL);
}
return platform;
}
public Map getFrontendMetaDataConfig(PluginWithBLOBs plugin, String configName) {
Map metaData = JSON.parseMap(plugin.getFormScript());
Map config = (Map) metaData.get(configName);

View File

@ -1,2 +1,3 @@
error_lang_invalid=Invalid language parameter, new
read_permission_file_fail=Failed to read permission file!
platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in:

View File

@ -1,2 +1,3 @@
error_lang_invalid=语言参数错误, 新
read_permission_file_fail=读取权限文件失败!
platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件:

View File

@ -1,2 +1,3 @@
error_lang_invalid=語言參數錯誤,新
read_permission_file_fail=讀取權限文件失敗!
platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件:

View File

@ -1,7 +1,9 @@
package io.metersphere.service;
import io.metersphere.commons.constants.IssuesManagePlatform;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.JSON;
import io.metersphere.i18n.Translator;
import io.metersphere.platform.api.Platform;
import io.metersphere.platform.api.PluginMetaInfo;
import io.metersphere.base.domain.PluginWithBLOBs;
@ -33,6 +35,8 @@ public class PlatformPluginService {
@Resource
private BaseIntegrationService baseIntegrationService;
private static final String PLUGIN_DOWNLOAD_URL = "https://github.com/metersphere/metersphere-platform-plugin";
private PlatformPluginManager pluginManager;
public synchronized PlatformPluginManager getPluginManager() {
@ -82,7 +86,11 @@ public class PlatformPluginService {
PlatformRequest pluginRequest = new PlatformRequest();
pluginRequest.setIntegrationConfig(serviceIntegration.getConfiguration());
return getPluginManager().getPlatformByKey(platformKey, pluginRequest);
Platform platform = getPluginManager().getPlatformByKey(platformKey, pluginRequest);
if (platform == null) {
MSException.throwException(Translator.get("platform_plugin_not_exit") + PLUGIN_DOWNLOAD_URL);
}
return platform;
}
public Platform getPlatform(String platformKey) {

View File

@ -221,4 +221,6 @@ test_case_status_saved=Saved
execute_not_pass=Not pass
execute_pass=Pass
jira_auth_error=Account name or password (Token) is wrong
jira_auth_url_error=The test connection failed, please check whether the Jira address is correct
jira_auth_url_error=The test connection failed, please check whether the Jira address is correct
platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in:

View File

@ -193,4 +193,6 @@ test_case_status_finished=已完成
execute_not_pass=未通过
execute_pass=通过
jira_auth_error=账号名或密码(Token)错误
jira_auth_url_error=测试连接失败请检查Jira地址是否正确
jira_auth_url_error=测试连接失败请检查Jira地址是否正确
platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件:

View File

@ -194,4 +194,6 @@ test_case_status_finished=已完成
execute_not_pass=未通過
execute_pass=通過
jira_auth_error=賬號名或密碼(Token)錯誤
jira_auth_url_error=測試連接失敗請檢查Jira地址是否正確
jira_auth_url_error=測試連接失敗請檢查Jira地址是否正確
platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件: