Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
6cf137f777
|
@ -0,0 +1,17 @@
|
|||
package io.metersphere.api.dto.parse.swagger;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SwaggerApi {
|
||||
private String swagger;
|
||||
private SwaggerInfo info;
|
||||
private String host;
|
||||
private String basePath;
|
||||
private List<String> schemes;
|
||||
private List<SwaggerTag> tags;
|
||||
private JSONObject paths;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.api.dto.parse.swagger;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SwaggerInfo {
|
||||
private String version;
|
||||
private String title;
|
||||
private String description;
|
||||
private String termsOfService;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package io.metersphere.api.dto.parse.swagger;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SwaggerParameter {
|
||||
private String name;
|
||||
private String in;
|
||||
private String description;
|
||||
private Boolean required;
|
||||
private String type;
|
||||
private String format;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package io.metersphere.api.dto.parse.swagger;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SwaggerRequest {
|
||||
private List<String> tags;
|
||||
private String summary;
|
||||
private String description;
|
||||
private String operationId;
|
||||
private List<String> consumes;
|
||||
private List<String> produces;
|
||||
private SwaggerParameter parameters;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.metersphere.api.dto.parse.swagger;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SwaggerTag {
|
||||
private String name;
|
||||
private String description;
|
||||
}
|
|
@ -27,173 +27,6 @@ public class PostmanParser extends ApiImportAbstractParser {
|
|||
@Override
|
||||
public ApiImport parse(InputStream source) {
|
||||
String testStr = getApiTestStr(source);
|
||||
|
||||
// String testStr = "{\n" +
|
||||
// "\t\"info\": {\n" +
|
||||
// "\t\t\"_postman_id\": \"9721cd51-8626-4f61-9ac1-e77b8399cca8\",\n" +
|
||||
// "\t\t\"name\": \"test\",\n" +
|
||||
// "\t\t\"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n" +
|
||||
// "\t},\n" +
|
||||
// "\t\"item\": [\n" +
|
||||
// "\t\t{\n" +
|
||||
// "\t\t\t\"name\": \"test\",\n" +
|
||||
// "\t\t\t\"request\": {\n" +
|
||||
// "\t\t\t\t\"auth\": {\n" +
|
||||
// "\t\t\t\t\t\"type\": \"basic\",\n" +
|
||||
// "\t\t\t\t\t\"basic\": [\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"password\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"string\"\n" +
|
||||
// "\t\t\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"username\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"string\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t]\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"method\": \"POST\",\n" +
|
||||
// "\t\t\t\t\"header\": [\n" +
|
||||
// "\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\"key\": \"aaa\",\n" +
|
||||
// "\t\t\t\t\t\t\"value\": \"testH\",\n" +
|
||||
// "\t\t\t\t\t\t\"type\": \"text\"\n" +
|
||||
// "\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\"body\": {\n" +
|
||||
// "\t\t\t\t\t\"mode\": \"raw\",\n" +
|
||||
// "\t\t\t\t\t\"raw\": \"<html>\\n</html>\\n\",\n" +
|
||||
// "\t\t\t\t\t\"options\": {\n" +
|
||||
// "\t\t\t\t\t\t\"raw\": {\n" +
|
||||
// "\t\t\t\t\t\t\t\"language\": \"html\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"url\": {\n" +
|
||||
// "\t\t\t\t\t\"raw\": \"https://localhost:8080?tset=test\",\n" +
|
||||
// "\t\t\t\t\t\"protocol\": \"https\",\n" +
|
||||
// "\t\t\t\t\t\"host\": [\n" +
|
||||
// "\t\t\t\t\t\t\"localhost\"\n" +
|
||||
// "\t\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\t\"port\": \"8080\",\n" +
|
||||
// "\t\t\t\t\t\"query\": [\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"tset\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"description\": \"test\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t]\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"description\": \"dd\"\n" +
|
||||
// "\t\t\t},\n" +
|
||||
// "\t\t\t\"response\": []\n" +
|
||||
// "\t\t},\n" +
|
||||
// "\t\t{\n" +
|
||||
// "\t\t\t\"name\": \"test Copy\",\n" +
|
||||
// "\t\t\t\"request\": {\n" +
|
||||
// "\t\t\t\t\"auth\": {\n" +
|
||||
// "\t\t\t\t\t\"type\": \"basic\",\n" +
|
||||
// "\t\t\t\t\t\"basic\": [\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"password\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"string\"\n" +
|
||||
// "\t\t\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"username\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"string\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t]\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"method\": \"POST\",\n" +
|
||||
// "\t\t\t\t\"header\": [\n" +
|
||||
// "\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\"key\": \"testH\",\n" +
|
||||
// "\t\t\t\t\t\t\"value\": \"testH\",\n" +
|
||||
// "\t\t\t\t\t\t\"type\": \"text\"\n" +
|
||||
// "\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\"body\": {\n" +
|
||||
// "\t\t\t\t\t\"mode\": \"raw\",\n" +
|
||||
// "\t\t\t\t\t\"raw\": \"{\\\"name\\\":\\\"test\\\"}\\n\",\n" +
|
||||
// "\t\t\t\t\t\"options\": {\n" +
|
||||
// "\t\t\t\t\t\t\"raw\": {\n" +
|
||||
// "\t\t\t\t\t\t\t\"language\": \"json\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"url\": {\n" +
|
||||
// "\t\t\t\t\t\"raw\": \"http://localhost:8081\",\n" +
|
||||
// "\t\t\t\t\t\"protocol\": \"http\",\n" +
|
||||
// "\t\t\t\t\t\"host\": [\n" +
|
||||
// "\t\t\t\t\t\t\"localhost\"\n" +
|
||||
// "\t\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\t\"port\": \"8081\"\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"description\": \"dd\"\n" +
|
||||
// "\t\t\t},\n" +
|
||||
// "\t\t\t\"response\": []\n" +
|
||||
// "\t\t},\n" +
|
||||
// "\t\t{\n" +
|
||||
// "\t\t\t\"name\": \"test Copy Copy\",\n" +
|
||||
// "\t\t\t\"request\": {\n" +
|
||||
// "\t\t\t\t\"auth\": {\n" +
|
||||
// "\t\t\t\t\t\"type\": \"basic\",\n" +
|
||||
// "\t\t\t\t\t\"basic\": [\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"password\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"string\"\n" +
|
||||
// "\t\t\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"username\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"string\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t]\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"method\": \"POST\",\n" +
|
||||
// "\t\t\t\t\"header\": [\n" +
|
||||
// "\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\"key\": \"testH\",\n" +
|
||||
// "\t\t\t\t\t\t\"value\": \"testH\",\n" +
|
||||
// "\t\t\t\t\t\t\"type\": \"text\"\n" +
|
||||
// "\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\"body\": {\n" +
|
||||
// "\t\t\t\t\t\"mode\": \"urlencoded\",\n" +
|
||||
// "\t\t\t\t\t\"urlencoded\": [\n" +
|
||||
// "\t\t\t\t\t\t{\n" +
|
||||
// "\t\t\t\t\t\t\t\"key\": \"test\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"value\": \"tset\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"description\": \"dd\",\n" +
|
||||
// "\t\t\t\t\t\t\t\"type\": \"text\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\t\"options\": {\n" +
|
||||
// "\t\t\t\t\t\t\"raw\": {\n" +
|
||||
// "\t\t\t\t\t\t\t\"language\": \"json\"\n" +
|
||||
// "\t\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t\t}\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"url\": {\n" +
|
||||
// "\t\t\t\t\t\"raw\": \"http://localhost:8081\",\n" +
|
||||
// "\t\t\t\t\t\"protocol\": \"http\",\n" +
|
||||
// "\t\t\t\t\t\"host\": [\n" +
|
||||
// "\t\t\t\t\t\t\"localhost\"\n" +
|
||||
// "\t\t\t\t\t],\n" +
|
||||
// "\t\t\t\t\t\"port\": \"8081\"\n" +
|
||||
// "\t\t\t\t},\n" +
|
||||
// "\t\t\t\t\"description\": \"dd\"\n" +
|
||||
// "\t\t\t},\n" +
|
||||
// "\t\t\t\"response\": []\n" +
|
||||
// "\t\t}\n" +
|
||||
// "\t],\n" +
|
||||
// "\t\"protocolProfileBehavior\": {}\n" +
|
||||
// "}";
|
||||
|
||||
PostmanCollection postmanCollection = JSON.parseObject(testStr.toString(), PostmanCollection.class);
|
||||
PostmanCollectionInfo info = postmanCollection.getInfo();
|
||||
List<Request> requests = parseRequests(postmanCollection);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
package io.metersphere.api.parse;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.parse.ApiImport;
|
||||
import io.metersphere.api.dto.parse.postman.PostmanItem;
|
||||
import io.metersphere.api.dto.parse.postman.PostmanRequest;
|
||||
import io.metersphere.api.dto.parse.postman.PostmanUrl;
|
||||
import io.metersphere.api.dto.parse.swagger.SwaggerApi;
|
||||
import io.metersphere.api.dto.parse.swagger.SwaggerInfo;
|
||||
import io.metersphere.api.dto.parse.swagger.SwaggerRequest;
|
||||
import io.metersphere.api.dto.scenario.Request;
|
||||
import io.metersphere.api.dto.scenario.Scenario;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class SwaggerParser extends ApiImportAbstractParser {
|
||||
|
||||
@Override
|
||||
public ApiImport parse(InputStream source) {
|
||||
String testStr = getApiTestStr(source);
|
||||
|
||||
SwaggerApi swaggerApi = JSON.parseObject(testStr.toString(), SwaggerApi.class);
|
||||
|
||||
SwaggerInfo info = swaggerApi.getInfo();
|
||||
|
||||
String title = info.getTitle();
|
||||
|
||||
|
||||
// List<Request> requests = parseRequests(swaggerApi);
|
||||
// ApiImport apiImport = new ApiImport();
|
||||
// List<Scenario> scenarios = new ArrayList<>();
|
||||
// Scenario scenario = new Scenario();
|
||||
// scenario.setRequests(requests);
|
||||
// scenario.setName(info.getName());
|
||||
// scenarios.add(scenario);
|
||||
// apiImport.setScenarios(scenarios);
|
||||
// return apiImport;
|
||||
return null;
|
||||
}
|
||||
|
||||
// private List<Request> parseRequests(SwaggerApi swaggerApi) {
|
||||
// JSONObject paths = swaggerApi.getPaths();
|
||||
//
|
||||
// Set<String> pathNames = paths.keySet();
|
||||
//
|
||||
// for (String path : pathNames) {
|
||||
// JSONObject pathObject = paths.getJSONObject(path);
|
||||
// Set<String> methods = pathObject.keySet();
|
||||
// for (String method : methods) {
|
||||
// SwaggerRequest swaggerRequest = JSON.parseObject(pathObject.getJSONObject(method).toJSONString(), SwaggerRequest.class);
|
||||
// Request request = new Request();
|
||||
// request.setName(swaggerRequest.getOperationId());
|
||||
// request.setUrl(url.getRaw());
|
||||
// request.setPath(.getRaw());
|
||||
// request.setUseEnvironment(false);
|
||||
// request.setMethod(requestDesc.getMethod());
|
||||
// request.setHeaders(parseKeyValue(requestDesc.getHeader()));
|
||||
// request.setParameters(parseKeyValue(url.getQuery()));
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<PostmanItem> item = postmanCollection.getItem();
|
||||
// List<Request> requests = new ArrayList<>();
|
||||
// for (PostmanItem requestItem : item) {
|
||||
// Request request = new Request();
|
||||
// PostmanRequest requestDesc = requestItem.getRequest();
|
||||
// PostmanUrl url = requestDesc.getUrl();
|
||||
// request.setName(requestItem.getName());
|
||||
// request.setUrl(url.getRaw());
|
||||
// request.setUseEnvironment(false);
|
||||
// request.setMethod(requestDesc.getMethod());
|
||||
// request.setHeaders(parseKeyValue(requestDesc.getHeader()));
|
||||
// request.setParameters(parseKeyValue(url.getQuery()));
|
||||
// Body body = new Body();
|
||||
// JSONObject postmanBody = requestDesc.getBody();
|
||||
// String bodyMode = postmanBody.getString("mode");
|
||||
// if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.RAW.value())) {
|
||||
// body.setRaw(postmanBody.getString(bodyMode));
|
||||
// body.setType(MsRequestBodyType.RAW.value());
|
||||
// String contentType = postmanBody.getJSONObject("options").getJSONObject("raw").getString("language");
|
||||
// List<KeyValue> headers = request.getHeaders();
|
||||
// boolean hasContentType = false;
|
||||
// for (KeyValue header : headers) {
|
||||
// if (StringUtils.equalsIgnoreCase(header.getName(), "Content-Type")) {
|
||||
// hasContentType = true;
|
||||
// }
|
||||
// }
|
||||
// if (!hasContentType) {
|
||||
// headers.add(new KeyValue("Content-Type", contentType));
|
||||
// }
|
||||
// } else if (StringUtils.equals(bodyMode, PostmanRequestBodyMode.FORM_DATA.value()) || StringUtils.equals(bodyMode, PostmanRequestBodyMode.URLENCODED.value())) {
|
||||
// List<PostmanKeyValue> postmanKeyValues = JSON.parseArray(postmanBody.getString(bodyMode), PostmanKeyValue.class);
|
||||
// body.setType(MsRequestBodyType.KV.value());
|
||||
// body.setKvs(parseKeyValue(postmanKeyValues));
|
||||
// }
|
||||
// request.setBody(body);
|
||||
// requests.add(request);
|
||||
// }
|
||||
// return requests;
|
||||
// }
|
||||
}
|
|
@ -12,6 +12,7 @@ import io.metersphere.api.parse.MsParser;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiTestFileMapper;
|
||||
import io.metersphere.base.mapper.ApiTestMapper;
|
||||
import io.metersphere.base.mapper.TestCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiTestMapper;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.FileType;
|
||||
|
@ -57,6 +58,8 @@ public class APITestService {
|
|||
private APIReportService apiReportService;
|
||||
@Resource
|
||||
private ScheduleService scheduleService;
|
||||
@Resource
|
||||
private TestCaseMapper testCaseMapper;
|
||||
|
||||
public List<APITestResult> list(QueryAPITestRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
@ -129,6 +132,20 @@ public class APITestService {
|
|||
}
|
||||
|
||||
public void delete(String testId) {
|
||||
|
||||
// 是否关联测试用例
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
testCaseExample.createCriteria().andTestIdEqualTo(testId);
|
||||
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
|
||||
if (testCases.size() > 0) {
|
||||
String caseName = "";
|
||||
for (int i = 0; i < testCases.size(); i++) {
|
||||
caseName = caseName + testCases.get(i).getName() + ",";
|
||||
}
|
||||
caseName = caseName.substring(0, caseName.length() - 1);
|
||||
MSException.throwException(Translator.get("related_case_del_fail_prefix") + caseName + Translator.get("related_case_del_fail_suffix"));
|
||||
}
|
||||
|
||||
deleteFileByTestId(testId);
|
||||
apiReportService.deleteByTestId(testId);
|
||||
apiTestMapper.deleteByPrimaryKey(testId);
|
||||
|
|
|
@ -40,17 +40,24 @@ public class SystemParameterService {
|
|||
|
||||
public void editMail(List<SystemParameter> parameters) {
|
||||
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
|
||||
boolean empty = paramList.size() < 2;
|
||||
boolean empty = paramList.size() <= 0;
|
||||
|
||||
parameters.forEach(parameter -> {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) {
|
||||
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
|
||||
parameter.setParamValue(string);
|
||||
if (!StringUtils.isBlank(parameter.getParamValue())) {
|
||||
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
|
||||
parameter.setParamValue(string);
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
systemParameterMapper.insert(parameter);
|
||||
} else {
|
||||
example.createCriteria().andParamKeyEqualTo(parameter.getParamKey());
|
||||
if (systemParameterMapper.countByExample(example) > 0) {
|
||||
systemParameterMapper.updateByPrimaryKey(parameter);
|
||||
} else {
|
||||
systemParameterMapper.insert(parameter);
|
||||
}
|
||||
example.clear();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -68,6 +75,8 @@ public class SystemParameterService {
|
|||
javaMailSender.setUsername(hashMap.get(ParamConstants.MAIL.ACCOUNT.getKey()));
|
||||
javaMailSender.setPassword(hashMap.get(ParamConstants.MAIL.PASSWORD.getKey()));
|
||||
Properties props = new Properties();
|
||||
props.put("mail.smtp.timeout", "5000");
|
||||
props.put("mail.smtp.connectiontimeout", "5000");
|
||||
props.put("mail.smtp.auth", "true");
|
||||
if (BooleanUtils.toBoolean(hashMap.get(ParamConstants.MAIL.SSL.getKey()))) {
|
||||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
|
@ -105,8 +114,11 @@ public class SystemParameterService {
|
|||
}
|
||||
} else {
|
||||
paramList.stream().filter(param -> param.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())).forEach(param -> {
|
||||
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
param.setParamValue(string);
|
||||
if (!StringUtils.isBlank(param.getParamValue())) {
|
||||
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
|
||||
param.setParamValue(string);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
paramList.sort(Comparator.comparingInt(SystemParameter::getSort));
|
||||
|
|
|
@ -405,7 +405,13 @@ class JMXRequest {
|
|||
this.port = url.port;
|
||||
this.protocol = url.protocol.split(":")[0];
|
||||
if (this.method.toUpperCase() !== "GET") {
|
||||
this.pathname += url.search.replace('&', '&');
|
||||
// this.pathname += url.search.replace('&', '&');
|
||||
this.pathname += '?';
|
||||
request.parameters.forEach(parameter => {
|
||||
if (parameter.name) {
|
||||
this.pathname += (parameter.name + '=' + parameter.value + '&');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,12 +131,15 @@
|
|||
let transactions = data.reduce(function (total, currentValue) {
|
||||
return total + parseFloat(currentValue.transactions);
|
||||
}, 0);
|
||||
transactions = transactions.toFixed(2);
|
||||
let received = data.reduce(function (total, currentValue) {
|
||||
return total + parseFloat(currentValue.received);
|
||||
}, 0);
|
||||
received = received.toFixed(2);
|
||||
let sent = data.reduce(function (total, currentValue) {
|
||||
return total + parseFloat(currentValue.sent);
|
||||
}, 0);
|
||||
sent = sent.toFixed(2);
|
||||
|
||||
let error = (Math.round(failSize / allSamples * 10000) / 100) + '%';
|
||||
let averageTime = (averageTimeTotal / allSamples).toFixed(2);
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</el-card>
|
||||
</ms-main-container>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="createVisible">
|
||||
<el-dialog :title="title" :visible.sync="createVisible" destroy-on-close>
|
||||
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</el-dialog>
|
||||
|
||||
<!--Change personal password-->
|
||||
<el-dialog :title="$t('member.edit_password')" :visible.sync="editPasswordVisible" width="35%" left>
|
||||
<el-dialog :title="$t('member.edit_password')" :visible.sync="editPasswordVisible" width="35%" :before-close='closeDialog' left >
|
||||
<el-form :model="ruleForm" :rules="rules" ref="editPasswordForm" label-width="120px" class="demo-ruleForm">
|
||||
<el-form-item :label="$t('member.old_password')" prop="password" style="margin-bottom: 29px">
|
||||
<el-input v-model="ruleForm.password" autocomplete="off" show-password/>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<ms-dialog-footer
|
||||
@cancel="editPasswordVisible = false"
|
||||
@cancel="cancel()"
|
||||
@confirm="updatePassword('editPasswordForm')"/>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
@ -156,6 +156,16 @@
|
|||
editPassword(row) {
|
||||
this.editPasswordVisible = true;
|
||||
},
|
||||
cancel(){
|
||||
this.editPasswordVisible = false;
|
||||
this.ruleForm.password="";
|
||||
this.ruleForm.newpassword="";
|
||||
},
|
||||
closeDialog(){
|
||||
this.editPasswordVisible = false;
|
||||
this.ruleForm.password="";
|
||||
this.ruleForm.newpassword="";
|
||||
},
|
||||
updateUser(updateUserForm) {
|
||||
this.$refs[updateUserForm].validate(valid => {
|
||||
if (valid) {
|
||||
|
|
|
@ -21,7 +21,144 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: 'email'
|
||||
formInline: {
|
||||
/*host: 'smtp.163.com',
|
||||
port: '465',
|
||||
account: 'xjj0608@163.com',
|
||||
password: '2345678',*/
|
||||
},
|
||||
|
||||
input: '',
|
||||
visible: true,
|
||||
result: {},
|
||||
showEdit: true,
|
||||
showSave: false,
|
||||
showCancel: false,
|
||||
show: true,
|
||||
disabledConnection: false,
|
||||
disabledSave: false,
|
||||
loading: false,
|
||||
activeName: 'email',
|
||||
rules: {
|
||||
host: [
|
||||
{
|
||||
required: true,
|
||||
message: ' '
|
||||
},
|
||||
],
|
||||
port: [
|
||||
{
|
||||
required: true,
|
||||
message: ' '
|
||||
}
|
||||
],
|
||||
account: [
|
||||
{
|
||||
required: true,
|
||||
message: ' '
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
activated() {
|
||||
this.query()
|
||||
this.change()
|
||||
},
|
||||
methods: {
|
||||
changeType() {
|
||||
this.$refs.input = 'password'
|
||||
},
|
||||
query() {
|
||||
this.result = this.$get("/system/mail/info", response => {
|
||||
this.$set(this.formInline, "host", response.data[0].paramValue);
|
||||
this.$set(this.formInline, "port", response.data[1].paramValue);
|
||||
this.$set(this.formInline, "account", response.data[2].paramValue);
|
||||
this.$set(this.formInline, "password", response.data[3].paramValue);
|
||||
if(response.data[4].paramValue!=""){
|
||||
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
|
||||
}
|
||||
if(response.data[5].paramValue!=""){
|
||||
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
|
||||
}
|
||||
if(response.data[6].paramValue!=""){
|
||||
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue));
|
||||
}
|
||||
})
|
||||
},
|
||||
change() {
|
||||
if (!this.formInline.host || !this.formInline.port || !this.formInline.account) {
|
||||
this.disabledConnection = true;
|
||||
this.disabledSave = true;
|
||||
} else {
|
||||
this.disabledConnection = false;
|
||||
this.disabledSave = false;
|
||||
}
|
||||
},
|
||||
testConnection(formInline) {
|
||||
let param = {
|
||||
"smtp.server": this.formInline.host,
|
||||
"smtp.port": this.formInline.port,
|
||||
"smtp.account": this.formInline.account,
|
||||
"smtp.password": this.formInline.password,
|
||||
"smtp.ssl": this.formInline.SSL,
|
||||
"smtp.tls": this.formInline.TLS,
|
||||
"smtp.smtp": this.formInline.SMTP,
|
||||
};
|
||||
this.$refs[formInline].validate((valid) => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/system/testConnection", param, response => {
|
||||
this.$success(this.$t('commons.connection_successful'));
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
edit() {
|
||||
this.change()
|
||||
this.showEdit = false;
|
||||
this.showSave = true;
|
||||
this.showCancel = true;
|
||||
this.show = false;
|
||||
},
|
||||
save(formInline) {
|
||||
this.showEdit = true;
|
||||
this.showCancel = false;
|
||||
this.showSave = false;
|
||||
this.show = true;
|
||||
let param = [
|
||||
{paramKey: "smtp.host", paramValue: this.formInline.host, type: "text", sort: 1},
|
||||
{paramKey: "smtp.port", paramValue: this.formInline.port, type: "text", sort: 2},
|
||||
{paramKey: "smtp.account", paramValue: this.formInline.account, type: "text", sort: 3},
|
||||
{paramKey: "smtp.password", paramValue: this.formInline.password, type: "password", sort: 4},
|
||||
{paramKey: "smtp.ssl", paramValue: this.formInline.SSL, type: "text", sort: 5},
|
||||
{paramKey: "smtp.tls", paramValue: this.formInline.TLS, type: "text", sort: 6},
|
||||
{paramKey: "smtp.smtp", paramValue: this.formInline.SMTP, type: "text", sort: 7}
|
||||
]
|
||||
|
||||
this.$refs[formInline].validate(valid => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/system/edit/email", param, response => {
|
||||
let flag = response.success;
|
||||
if (flag) {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
} else {
|
||||
this.$message.error(this.$t('commons.save_failed'));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.query();
|
||||
this.showEdit = true;
|
||||
this.showCancel = false;
|
||||
this.showSave = false;
|
||||
this.show = true;
|
||||
this.change()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="id" label="ID"/>
|
||||
<el-table-column prop="name" :label="$t('commons.username')" width="200"/>
|
||||
<el-table-column prop="name" :label="$t('commons.name')" width="200"/>
|
||||
<el-table-column :label="$t('commons.role')" width="120">
|
||||
<template v-slot:default="scope">
|
||||
<ms-roles-tag :roles="scope.row.roles"/>
|
||||
|
@ -162,7 +162,7 @@
|
|||
</el-dialog>
|
||||
|
||||
<!--Modify user information in system settings-->
|
||||
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true"
|
||||
<el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="35%" :destroy-on-close="true"
|
||||
@close="handleClose">
|
||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
|
||||
<el-form-item label="ID" prop="id">
|
||||
|
|
|
@ -355,6 +355,13 @@
|
|||
this.$success(this.$t('commons.save_success'));
|
||||
if (this.operationType == 'add' && this.isCreateContinue) {
|
||||
this.form.name = '';
|
||||
this.form.prerequisite = '';
|
||||
this.form.steps = [{
|
||||
num: 1,
|
||||
desc: '',
|
||||
result: ''
|
||||
}];
|
||||
this.form.remark = '';
|
||||
this.$emit("refresh");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue