立即停止测试功能

This commit is contained in:
Captain.B 2020-06-29 13:39:17 +08:00
parent a6c9e45f9a
commit 910ce17270
6 changed files with 45 additions and 7 deletions

View File

@ -21,6 +21,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
@ -95,6 +96,11 @@ public class PerformanceTestController {
return performanceTestService.run(request);
}
@GetMapping("stop/{reportId}")
public void stopTest(@PathVariable String reportId) {
performanceTestService.stopTest(reportId);
}
@GetMapping("/file/metadata/{testId}")
public List<FileMetadata> getFileMetadata(@PathVariable String testId) {
return fileService.getFileMetadataByTestId(testId);

View File

@ -393,4 +393,8 @@ public class PerformanceTestService {
private void addOrUpdatePerformanceTestCronJob(Schedule request) {
scheduleService.addOrUpdateCronJob(request, PerformanceTestJob.getJobKey(request.getResourceId()), PerformanceTestJob.getTriggerKey(request.getResourceId()), PerformanceTestJob.class);
}
public void stopTest(String reportId) {
reportService.deleteReport(reportId);
}
}

View File

@ -13,12 +13,21 @@
<el-breadcrumb-item>{{reportName}}</el-breadcrumb-item>
</el-breadcrumb>
</el-row>
<!-- <el-row class="ms-report-view-btns">-->
<!-- <el-button :disabled="isReadOnly" type="primary" plain size="mini">{{$t('report.test_stop_now')}}</el-button>-->
<!-- <el-button :disabled="isReadOnly" type="success" plain size="mini">{{$t('report.test_execute_again')}}</el-button>-->
<!-- <el-button :disabled="isReadOnly" type="info" plain size="mini">{{$t('report.export')}}</el-button>-->
<!-- <el-button :disabled="isReadOnly" type="warning" plain size="mini">{{$t('report.compare')}}</el-button>-->
<!-- </el-row>-->
<el-row class="ms-report-view-btns">
<el-button :disabled="isReadOnly || status !== 'Running'" type="primary" plain size="mini"
@click="stopTest(reportId)">
{{$t('report.test_stop_now')}}
</el-button>
<!--<el-button :disabled="isReadOnly || status !== 'Completed'" type="success" plain size="mini">
{{$t('report.test_execute_again')}}
</el-button>
<el-button :disabled="isReadOnly" type="info" plain size="mini">
{{$t('report.export')}}
</el-button>
<el-button :disabled="isReadOnly" type="warning" plain size="mini">
{{$t('report.compare')}}
</el-button>-->
</el-row>
</el-col>
<el-col :span="8">
<span class="ms-report-time-desc">
@ -147,7 +156,20 @@
this.endTime = '0';
this.minutes = '0';
this.seconds = '0';
}
},
stopTest(reportId) {
this.$confirm(this.$t('report.test_stop_now_confirm'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get('/performance/stop/' + reportId, () => {
this.$success(this.$t('report.test_stop_success'));
this.$router.push('/performance/report/all');
})
}).catch(() => {
});
},
},
created() {
this.isReadOnly = false;

View File

@ -204,6 +204,8 @@ export default {
'test_start_time': 'Test Start Time',
'test_end_time': 'Test End Time',
'test_stop_now': 'Test Stop Now',
'test_stop_now_confirm': 'Are you sure you want to stop the current test immediately?',
'test_stop_success': 'Test stop successfully',
'test_execute_again': 'Test Execute Again',
'export': 'Export',
'compare': 'Compare',

View File

@ -202,6 +202,8 @@ export default {
'test_start_time': '开始时间',
'test_end_time': '结束时间',
'test_stop_now': '立即停止',
'test_stop_now_confirm': '确定要立即停止当前测试吗?',
'test_stop_success': '停止成功',
'test_execute_again': '再次执行',
'export': '导出',
'compare': '比较',

View File

@ -202,6 +202,8 @@ export default {
'test_start_time': '開始時間',
'test_end_time': '結束時間',
'test_stop_now': '立即停止',
'test_stop_now_confirm': '確定要立即停止當前測試嗎?',
'test_stop_success': '停止成功',
'test_execute_again': '再次執行',
'export': '導出',
'compare': '比較',