Merge branch 'dev' of https://github.com/fit2cloudrd/metersphere-server into dev
This commit is contained in:
commit
d02edcb1b3
|
@ -133,12 +133,6 @@
|
|||
<artifactId>opencsv</artifactId>
|
||||
<version>5.1</version>
|
||||
</dependency>
|
||||
<!-- jmeter -->
|
||||
<dependency>
|
||||
<groupId>org.apache.jmeter</groupId>
|
||||
<artifactId>ApacheJMeter_core</artifactId>
|
||||
<version>${jmeter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- easyexcel -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
import org.apache.jmeter.util.JMeterUtils;
|
||||
import org.apache.jorphan.util.JOrphanUtils;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MsJMeterUtils {
|
||||
/**
|
||||
* Load the JMeter properties file; if not found, then
|
||||
* default to "org/apache/jmeter/jmeter.properties" from the classpath
|
||||
*
|
||||
* <p>
|
||||
* c.f. loadProperties
|
||||
*
|
||||
* @param file Name of the file from which the JMeter properties should be loaded
|
||||
*/
|
||||
public static void loadJMeterProperties(String file) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
JMeterUtils.loadJMeterProperties(file);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
Properties p = new Properties(System.getProperties());
|
||||
// In jar file classpath is
|
||||
is = ClassLoader.getSystemResourceAsStream(
|
||||
"BOOT-INF/classes/org/apache/jmeter/jmeter.properties"); // $NON-NLS-1$
|
||||
if (is == null) {
|
||||
throw new RuntimeException("Could not read JMeter properties file:" + file);
|
||||
}
|
||||
p.load(is);
|
||||
|
||||
FieldUtils.writeStaticField(JMeterUtils.class, "appProperties", p, true);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Could not read JMeter properties file:" + file);
|
||||
}
|
||||
} finally {
|
||||
JOrphanUtils.closeQuietly(is);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -132,17 +132,11 @@
|
|||
this.status = data.status;
|
||||
switch (data.status) {
|
||||
case 'Error':
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: "报告生成错误,无法查看!"
|
||||
});
|
||||
this.$warning("报告生成错误,无法查看!");
|
||||
break;
|
||||
case 'Starting':
|
||||
case 'Reporting':
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: "报告生成中...."
|
||||
});
|
||||
this.$info("报告生成中....");
|
||||
break;
|
||||
case 'Running':
|
||||
this.showTestLogging = true;
|
||||
|
|
|
@ -136,16 +136,10 @@
|
|||
},
|
||||
handleEdit(report) {
|
||||
if (report.status === "Error") {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: "报告生成错误,无法查看!"
|
||||
});
|
||||
this.$warning("报告生成错误,无法查看!");
|
||||
return false
|
||||
} else if (report.status === "Starting") {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: "报告生成中..."
|
||||
});
|
||||
this.$info("报告生成中...")
|
||||
return false
|
||||
}
|
||||
this.$router.push({
|
||||
|
@ -164,10 +158,7 @@
|
|||
},
|
||||
_handleDelete(report) {
|
||||
this.result = this.$post(this.deletePath + report.id, {}, () => {
|
||||
this.$message({
|
||||
message: this.$t('commons.delete_success'),
|
||||
type: 'success'
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -125,10 +125,7 @@
|
|||
let options = this.getSaveOption();
|
||||
|
||||
this.result = this.$request(options, () => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success'
|
||||
});
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$refs.advancedConfig.cancelAllEdit();
|
||||
this.$router.push({path: '/performance/test/all'})
|
||||
});
|
||||
|
@ -142,16 +139,9 @@
|
|||
|
||||
this.result = this.$request(options, (response) => {
|
||||
this.testPlan.id = response.data;
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.result = this.$post(this.runPath, {id: this.testPlan.id}, () => {
|
||||
this.$message({
|
||||
message: this.$t('load_test.is_running'),
|
||||
type: 'success'
|
||||
});
|
||||
this.$success(this.$t('load_test.is_running'))
|
||||
this.$router.push({path: '/performance/report/all'})
|
||||
})
|
||||
});
|
||||
|
@ -196,20 +186,12 @@
|
|||
},
|
||||
validTestPlan() {
|
||||
if (!this.testPlan.name) {
|
||||
this.$message({
|
||||
message: this.$t('load_test.test_name_is_null'),
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
this.$error(this.$t('load_test.test_name_is_null'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.testPlan.projectId) {
|
||||
this.$message({
|
||||
message: this.$t('load_test.project_is_null'),
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
this.$error(this.$t('load_test.project_is_null'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,10 +167,7 @@
|
|||
};
|
||||
|
||||
this.result = this.$post(this.deletePath, data, () => {
|
||||
this.$message({
|
||||
message: this.$t('commons.delete_success'),
|
||||
type: 'success'
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -306,23 +306,23 @@
|
|||
let counts = this.groupBy(this.domains, 'domain');
|
||||
for (let c in counts) {
|
||||
if (counts[c] > 1) {
|
||||
this.$message.error(this.$t('load_test.domain_is_duplicate'));
|
||||
this.$error(this.$t('load_test.domain_is_duplicate'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
counts = this.groupBy(this.params, 'name');
|
||||
for (let c in counts) {
|
||||
if (counts[c] > 1) {
|
||||
this.$message.error(this.$t('load_test.param_is_duplicate'));
|
||||
this.$error(this.$t('load_test.param_is_duplicate'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.domains.filter(d => !d.domain || !d.ip).length > 0) {
|
||||
this.$message.error(this.$t('load_test.domain_ip_is_empty'));
|
||||
this.$error(this.$t('load_test.domain_ip_is_empty'));
|
||||
return false;
|
||||
}
|
||||
if (this.params.filter(d => !d.name || !d.value).length > 0) {
|
||||
this.$message.error(this.$t('load_test.param_name_value_is_empty'));
|
||||
this.$error(this.$t('load_test.param_name_value_is_empty'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
}
|
||||
|
||||
if (this.tableData.filter(f => f.name === file.name).length > 0) {
|
||||
this.$message.error(this.$t('load_test.delete_file'));
|
||||
this.$error(this.$t('load_test.delete_file'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@
|
|||
}
|
||||
},
|
||||
handleExceed() {
|
||||
this.$message.error(this.$t('load_test.delete_file'));
|
||||
this.$error(this.$t('load_test.delete_file'));
|
||||
},
|
||||
fileValidator(file) {
|
||||
/// todo: 是否需要对文件内容和大小做限制
|
||||
|
@ -193,10 +193,7 @@
|
|||
oldJmxNum = this.fileList.filter(f => f.name.toLowerCase().endsWith(".jmx")).length;
|
||||
}
|
||||
if (newJmxNum + oldJmxNum !== 1) {
|
||||
this.$message({
|
||||
message: this.$t('load_test.jmx_is_null'),
|
||||
type: 'error'
|
||||
});
|
||||
this.$error(this.$t('load_test.jmx_is_null'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -281,10 +281,7 @@
|
|||
},
|
||||
validConfig() {
|
||||
if (!this.resourcePool) {
|
||||
this.$message({
|
||||
message: this.$t('load_test.resource_pool_is_null'),
|
||||
type: 'warning'
|
||||
});
|
||||
this.$warning(this.$t('load_test.resource_pool_is_null'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,10 +107,7 @@
|
|||
create() {
|
||||
let workspaceId = this.currentUser.lastWorkspaceId;
|
||||
if (!workspaceId) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: this.$t('project.please_choose_workspace')
|
||||
})
|
||||
this.$warning(this.$t('project.please_choose_workspace'));
|
||||
return false;
|
||||
}
|
||||
this.title = this.$t('project.create');
|
||||
|
|
|
@ -189,10 +189,7 @@
|
|||
organizationId: this.currentUser().lastOrganizationId
|
||||
}
|
||||
this.result = this.$post("/organization/member/update", param, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.updateVisible = false;
|
||||
this.initTableData();
|
||||
});
|
||||
|
@ -204,26 +201,17 @@
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get('/user/org/member/delete/' + this.currentUser().lastOrganizationId + '/' + row.id, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'))
|
||||
});
|
||||
},
|
||||
create() {
|
||||
let orgId = this.currentUser().lastOrganizationId;
|
||||
if (!orgId) {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: this.$t('organization.select_organization')
|
||||
})
|
||||
this.$warning(this.$t('organization.select_organization'));
|
||||
return false;
|
||||
}
|
||||
this.form = {};
|
||||
|
|
|
@ -345,17 +345,11 @@
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get('/user/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + row.id, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.cellClick(this.currentWorkspaceRow);
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'));
|
||||
});
|
||||
},
|
||||
updateOrgMember() {
|
||||
|
@ -368,10 +362,7 @@
|
|||
workspaceId: this.currentWorkspaceRow.id
|
||||
}
|
||||
this.result = this.$post("/workspace/member/update", param, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.updateMemberVisible = false;
|
||||
this.cellClick(this.currentWorkspaceRow);
|
||||
});
|
||||
|
|
|
@ -113,10 +113,7 @@
|
|||
this.$refs[updateUserForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.result = this.$post(this.updatePath, this.form,response => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
localStorage.setItem(TokenKey, JSON.stringify(response.data));
|
||||
this.updateVisible = false;
|
||||
this.initTableData();
|
||||
|
|
|
@ -319,17 +319,11 @@
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get(this.deletePath + row.id, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData()
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'));
|
||||
});
|
||||
},
|
||||
delMember(row) {
|
||||
|
@ -339,27 +333,18 @@
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + row.id, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'))
|
||||
this.cellClick(this.currentRow);
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'));
|
||||
});
|
||||
},
|
||||
createOrganization(createOrganizationForm) {
|
||||
this.$refs[createOrganizationForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.result = this.$post(this.createPath, this.form, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.save_success')
|
||||
});
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.initTableData();
|
||||
this.createVisible = false;
|
||||
});
|
||||
|
@ -372,10 +357,7 @@
|
|||
this.$refs[udpateOrganizationForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.result = this.$post(this.updatePath, this.form, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'))
|
||||
this.updateVisible = false;
|
||||
this.initTableData();
|
||||
});
|
||||
|
@ -442,10 +424,7 @@
|
|||
organizationId: this.currentRow.id
|
||||
}
|
||||
this.result = this.$post("/organization/member/update", param, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'))
|
||||
this.updateMemberVisible = false;
|
||||
this.cellClick(this.currentRow);
|
||||
});
|
||||
|
|
|
@ -296,10 +296,7 @@
|
|||
this.$refs[updateForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.result = this.$post("/workspace/special/update", this.form, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.updateVisible = false;
|
||||
this.list();
|
||||
});
|
||||
|
@ -388,17 +385,11 @@
|
|||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get('/user/special/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + row.id, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.cellClick(this.currentWorkspaceRow);
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'));
|
||||
});
|
||||
},
|
||||
updateOrgMember() {
|
||||
|
@ -411,10 +402,7 @@
|
|||
workspaceId: this.currentWorkspaceRow.id
|
||||
}
|
||||
this.result = this.$post("/workspace/member/update", param, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.updateMemberVisible = false;
|
||||
this.cellClick(this.currentWorkspaceRow);
|
||||
});
|
||||
|
|
|
@ -280,10 +280,7 @@
|
|||
if (this.infoList.length > 1) {
|
||||
this.infoList.splice(index, 1)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: this.$t('test_resource_pool.cannot_remove_all_node')
|
||||
});
|
||||
this.$warning(this.$t('test_resource_pool.cannot_remove_all_node'))
|
||||
}
|
||||
},
|
||||
validateResourceInfo() {
|
||||
|
@ -341,15 +338,9 @@
|
|||
this.result = this.$get(`/testresourcepool/delete/${row.id}`).then(() => {
|
||||
this.initTableData();
|
||||
});
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'));
|
||||
});
|
||||
},
|
||||
createTestResourcePool(createTestResourcePoolForm) {
|
||||
|
@ -370,10 +361,7 @@
|
|||
this.initTableData());
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: vri.msg
|
||||
});
|
||||
this.$warning(vri.msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -413,10 +401,7 @@
|
|||
self.loading = false);
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: vri.msg
|
||||
});
|
||||
this.$warning(vri.msg);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -429,10 +414,7 @@
|
|||
},
|
||||
changeSwitch(row) {
|
||||
this.result = this.$post('/testresourcepool/update', row).then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('test_resource_pool.status_change_success')
|
||||
});
|
||||
this.$success(this.$t('test_resource_pool.status_change_success'));
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,16 +185,10 @@
|
|||
this.initTableData();
|
||||
this.loading = false;
|
||||
});
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.delete_success')
|
||||
});
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancel')
|
||||
});
|
||||
this.$info(this.$t('commons.delete_cancel'));
|
||||
});
|
||||
},
|
||||
edit(row) {
|
||||
|
@ -217,10 +211,7 @@
|
|||
workspaceId: this.currentUser().lastWorkspaceId
|
||||
}
|
||||
this.result = this.$post("/workspace/member/update", param, () => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('commons.modify_success')
|
||||
});
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.updateVisible = false;
|
||||
this.initTableData();
|
||||
});
|
||||
|
@ -233,10 +224,7 @@
|
|||
};
|
||||
let wsId = this.currentUser().lastWorkspaceId;
|
||||
if (typeof wsId == "undefined" || wsId == null || wsId == "") {
|
||||
this.$message({
|
||||
message: '请先选择工作空间!',
|
||||
type: 'warning'
|
||||
});
|
||||
this.$warning("请先选择工作空间!");
|
||||
return false;
|
||||
}
|
||||
this.$post('/user/org/member/list/all', param, response => {
|
||||
|
|
Loading…
Reference in New Issue