支持启动测试时弹框提示点击跳转到指定报告

This commit is contained in:
azhengzz 2021-02-25 16:17:49 +08:00
parent 1cf33f08a2
commit d012393c94
4 changed files with 10 additions and 6 deletions

View File

@ -80,10 +80,10 @@ class AbstractDispatcher(ABC):
self.dispatcher_logger = DispatcherLogger(use_memory_string_handler=True, self.dispatcher_logger = DispatcherLogger(use_memory_string_handler=True,
use_dispatcher_log_db_handler=True, use_dispatcher_log_db_handler=True,
dispatcher_id=self.dispatcher.id) dispatcher_id=self.dispatcher.id)
# 发送调度执行开始信息
emit_dispatcher_start(id=self.dispatcher.id, type=self.trigger_element_type)
# 调度报告 # 调度报告
Report.add(name=element.name, result=REPORT_RESULT.RUNNING, dispatcher_id=self.dispatcher.id) report = Report.add(name=element.name, result=REPORT_RESULT.RUNNING, dispatcher_id=self.dispatcher.id)
# 发送调度执行开始信息
emit_dispatcher_start(id=self.dispatcher.id, type=self.trigger_element_type, report_id=report.id)
elif logger is not None: elif logger is not None:
self.dispatcher_logger = logger self.dispatcher_logger = logger
# 创建一条调度子数据 # 创建一条调度子数据

View File

@ -31,17 +31,19 @@ def emit_dispatcher_result(id, type, result):
) )
def emit_dispatcher_start(id, type): def emit_dispatcher_start(id, type, report_id):
""" """
调度执行开始 调度执行开始
:param id:调度id :param id:调度id
:param type:调度类型 project/module :param type:调度类型 project/module
:param report_id: 报告id
""" """
socketio.emit( socketio.emit(
SocketIOEvent.DISPATCHER_BEGIN, SocketIOEvent.DISPATCHER_BEGIN,
dict( dict(
id=str(id), id=str(id),
type=str(type).lower(), type=str(type).lower(),
report_id=str(report_id),
), ),
namespace='/user/' + str(current_user.id), namespace='/user/' + str(current_user.id),
) )

View File

@ -37,8 +37,9 @@ let dispatcher_id = null; // 项目调度id 打开模块页面时查询返回调
user_socket.on('DISPATCHER_BEGIN', function (data) { user_socket.on('DISPATCHER_BEGIN', function (data) {
dispatcher_id = data.id; dispatcher_id = data.id;
if (data.type === 'project'){ if (data.type === 'project'){
message("项目测试启动成功", "success");
projectDispatcherRunning(); projectDispatcherRunning();
// message("项目测试启动成功", "success");
message(`<a class="text-left" target="_blank" href='/report/detail/${data.report_id}' style="text-decoration:underline;">项目测试启动成功,点击跳转到编号${data.report_id}报告</a>`, "success");
} }
}); });
// 调度结束 // 调度结束

View File

@ -97,8 +97,9 @@ user_socket.on('DISPATCHER_RESULT', function (data) {
user_socket.on('DISPATCHER_BEGIN', function (data) { user_socket.on('DISPATCHER_BEGIN', function (data) {
dispatcher_id = data.id; dispatcher_id = data.id;
if (data.type === 'module'){ if (data.type === 'module'){
message("模块测试启动成功", "success");
moduleDispatcherRunning(); moduleDispatcherRunning();
// message("模块测试启动成功", "success");
message(`<a class="text-left" target="_blank" href='/report/detail/${data.report_id}' style="text-decoration:underline;">模块测试启动成功,点击跳转到编号${data.report_id}报告</a>`, "success");
} }
}); });
// 调度结束 // 调度结束