refactor(接口测试): 增加接口用例保存并继续添加功能

--story=1013901 --user=赵勇 【接口测试】接口case新增“保存并继续添加”按钮 https://www.tapd.cn/55049933/s/1439638

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-11-29 19:09:03 +08:00 committed by Craftsman
parent 96c10cf472
commit 1de3e7302f
3 changed files with 20 additions and 18 deletions

View File

@ -42,18 +42,6 @@
style="margin-left: -20px"> style="margin-left: -20px">
{{ saveButtonText }} {{ saveButtonText }}
</el-button> </el-button>
<el-button
v-if="!isXpack || !showUpdateRule"
type="primary"
size="small"
@click="saveAndCreate()"
v-prevent-re-click
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']"
style="margin-left: 2px">
{{ $t('home.dashboard.api_case.save_and_create') }}
</el-button>
<el-dropdown <el-dropdown
v-else v-else
style="margin-left: -17px" style="margin-left: -17px"
@ -75,6 +63,17 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button
v-if="!isXpack || !showUpdateRule"
type="primary"
size="small"
@click="saveAndCreate()"
v-prevent-re-click
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']"
style="margin-left: 2px">
{{ $t('home.dashboard.api_case.save_and_create') }}
</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-card> </el-card>

View File

@ -623,10 +623,10 @@ export default {
data.method = data.protocol; data.method = data.protocol;
} }
}, },
addModule(row) { addModule(row, created) {
this.saveApi(row, 'default-module'); this.saveApi(row, 'default-module', created);
}, },
saveApi(row, module) { saveApi(row, module, created) {
let data = this.api; let data = this.api;
data.name = this.apiCase.name; data.name = this.apiCase.name;
data.moduleId = module; data.moduleId = module;
@ -639,6 +639,9 @@ export default {
row.apiDefinitionId = data.id; row.apiDefinitionId = data.id;
this.saveCase(row); this.saveCase(row);
} }
if (created) {
this.$emit('addCase');
}
}); });
}, },
reload() { reload() {
@ -761,7 +764,7 @@ export default {
if (this.compare.indexOf(row.id) === -1) { if (this.compare.indexOf(row.id) === -1) {
this.compare.push(row.id); this.compare.push(row.id);
if (this.api.saved) { if (this.api.saved) {
this.addModule(row); this.addModule(row, created);
} else { } else {
this.api.source = 'editCase'; this.api.source = 'editCase';
if (!this.isSave) { if (!this.isSave) {

View File

@ -151,8 +151,8 @@ public abstract class SSLManager {
JMeterContext threadContext = JMeterContextService.getContext(); JMeterContext threadContext = JMeterContextService.getContext();
if (threadContext != null && threadContext.getCurrentSampler() != null) { if (threadContext != null && threadContext.getCurrentSampler() != null) {
String resourceId = threadContext.getCurrentSampler().getPropertyAsString("MS-RESOURCE-ID"); String resourceId = threadContext.getCurrentSampler().getPropertyAsString("MS-RESOURCE-ID");
log.info("重新加载认证文件{}", resourceId);
if (StringUtils.isNotBlank(resourceId) && keyMap.containsKey(resourceId)) { if (StringUtils.isNotBlank(resourceId) && keyMap.containsKey(resourceId)) {
log.info("重新加载认证文件{}", resourceId);
KeystoreDTO dto = keyMap.get(resourceId); KeystoreDTO dto = keyMap.get(resourceId);
// 加载认证文件 // 加载认证文件
try (InputStream in = new FileInputStream(new File(dto.getPath()))) { try (InputStream in = new FileInputStream(new File(dto.getPath()))) {
@ -372,8 +372,8 @@ public abstract class SSLManager {
JMeterContext threadContext = JMeterContextService.getContext(); JMeterContext threadContext = JMeterContextService.getContext();
if (threadContext != null && threadContext.getCurrentSampler() != null) { if (threadContext != null && threadContext.getCurrentSampler() != null) {
String resourceId = threadContext.getCurrentSampler().getPropertyAsString("MS-RESOURCE-ID"); String resourceId = threadContext.getCurrentSampler().getPropertyAsString("MS-RESOURCE-ID");
log.info("重新加载认证文件{}", resourceId);
if (StringUtils.isNotBlank(resourceId) && keyMap.containsKey(resourceId)) { if (StringUtils.isNotBlank(resourceId) && keyMap.containsKey(resourceId)) {
log.info("重新加载认证文件{}", resourceId);
KeystoreDTO dto = keyMap.get(resourceId); KeystoreDTO dto = keyMap.get(resourceId);
SSLManager.manager = new JsseSSLManager(null); SSLManager.manager = new JsseSSLManager(null);
SSLManager.manager.keyStore = null; SSLManager.manager.keyStore = null;