add dialog of recordScript
This commit is contained in:
parent
4c05dd7415
commit
c2bcf8672a
|
@ -206,4 +206,5 @@ startServer=start server to generate a script or upload a script to server
|
|||
testExecuteTime=Execute Time
|
||||
startServerFail=Fail to start record server:
|
||||
stopTestPlan=Stop Test
|
||||
stop=Stop
|
||||
stop=Stop
|
||||
testProxySettings=testProxySettings
|
|
@ -208,3 +208,4 @@ startServer=\u70B9\u51FB\u542F\u52A8\u670D\u52A1\u5F55\u5236\u811A\u672C\u6216\u
|
|||
testExecuteTime=\u6267\u884C\u65F6\u95F4
|
||||
stopTestPlan=\u505C\u6B62\u6D4B\u8BD5
|
||||
stop=\u505C\u6B62
|
||||
testProxySettings=\u6d4b\u8bd5Proxy\u8bbe\u7f6e
|
|
@ -143,20 +143,77 @@ body {
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="scriptInfo"><fmt:message key="startServer" /></p>
|
||||
<input autofocus class="input" id="target-url" name="target-url" type="url" value="http://">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="startServer()" id="startServer">
|
||||
<fmt:message key="startserver" />
|
||||
<fmt:message key="script_jsp_recordScript" />
|
||||
</button>
|
||||
<button type="button" id="uploadScript" class="btn btn-primary">
|
||||
<fmt:message key="uploadScript" />
|
||||
</button>
|
||||
</div>
|
||||
<div id="fileName" style="display: none" class="modal-footer">
|
||||
<input class="input-mini" name="scriptname"></input>
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="saveScript()">
|
||||
<fmt:message key="savefile" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal hide fade" id="mySecondModal">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="settings" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="scriptInfo2"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="testRecordProxy()" id="testRecordProxy">
|
||||
<fmt:message key="testProxySettings" />
|
||||
</button>
|
||||
<button type="button" id="cancel" class="btn btn-primary">
|
||||
<fmt:message key="plugin_jsp_cancel" />
|
||||
</button>
|
||||
</div>
|
||||
<div id="fileName" style="display: none" class="modal-footer">
|
||||
<input class="input-mini" name="scriptname"></input>
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="saveScript()">
|
||||
<fmt:message key="savefile" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal hide fade" id="myThirdModal">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="settings" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="scriptInfo3"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="javascript:window.location.href='http://www.baidu.com/'" id="startRecording">
|
||||
<fmt:message key="startRecording" />
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="stopServer()" id="stopServer">
|
||||
<fmt:message key="stopserver" />
|
||||
</button>
|
||||
<button type="button" id="uploadScript" class="btn btn-primary">
|
||||
<fmt:message key="uploadScript" />
|
||||
</button>
|
||||
</div>
|
||||
<div id="fileName" style="display: none" class="modal-footer">
|
||||
<input class="input-mini" name="scriptname"></input>
|
||||
|
|
|
@ -5,24 +5,27 @@ $('.btn-setting').click(function(e) {
|
|||
e.preventDefault();
|
||||
$('#myModal').modal('show');
|
||||
});
|
||||
$("#mySecondModal #cancel").click(function() {
|
||||
$('#mySecondModal').modal('hide');
|
||||
});
|
||||
function startServer() {
|
||||
$.post("startRecordServer", {}, function(data) {
|
||||
if (data.success) {
|
||||
server = data.server;
|
||||
$('#scriptInfo').text(
|
||||
$.i18n.prop("setProxy")+
|
||||
" IP:133.133.2.100"
|
||||
+ " ,port: " + server.port
|
||||
+ $.i18n.prop("recordScript"));
|
||||
$('#startServer').attr('disabled', true);
|
||||
$('#stopServer').attr('disabled', false);
|
||||
$('#myModal').modal('hide');
|
||||
$('#mySecondModal').modal('show');
|
||||
$('#scriptInfo2').text(
|
||||
$.i18n.prop("setProxy")+
|
||||
" IP:133.133.2.100"
|
||||
+ " ,port: " + server.port
|
||||
+ $.i18n.prop("recordScript"));
|
||||
//$('#startServer').attr('disabled', true);
|
||||
//$('#stopServer').attr('disabled', false);
|
||||
} else {
|
||||
$('#scriptInfo').html(
|
||||
$.i18n.prop("startServerFail") + data.failedMessage);
|
||||
}
|
||||
|
||||
}, "json");
|
||||
|
||||
}
|
||||
$('#uploadScript')
|
||||
.click(
|
||||
|
@ -60,7 +63,7 @@ function stopServer() {
|
|||
scriptRecordUUID : server.fileName
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
$('#scriptInfo').text(
|
||||
$('#scriptInfo3').text(
|
||||
"stop record server error:" + data.failedMessage);
|
||||
$('#stopServer').attr('disabled', true);
|
||||
$('#startServer').attr('disabled', false);
|
||||
|
@ -68,13 +71,13 @@ function stopServer() {
|
|||
|
||||
else {
|
||||
$('#fileName').show();
|
||||
$('#scriptInfo').text(
|
||||
$('#scriptInfo3').text(
|
||||
$.i18n.prop("stopRecord")
|
||||
);
|
||||
}
|
||||
}, "json");
|
||||
} else {
|
||||
$('#scriptInfo').text("record script server has not started");
|
||||
$('#scriptInfo3').text("record script server has not started");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,11 +90,11 @@ function saveScript() {
|
|||
scriptRecordUUID : server.fileName
|
||||
}, function(data) {
|
||||
if (data.success) {
|
||||
$("#scriptInfo").text($.i18n.prop("saveScriptSuccess"));
|
||||
$("#scriptInfo3").text($.i18n.prop("saveScriptSuccess"));
|
||||
$('#fileName').hide();
|
||||
server = null;
|
||||
} else {
|
||||
$("#scriptInfo").text($.i18n.prop("saveScriptFail") + data.failedMessage);
|
||||
$("#scriptInfo3").text($.i18n.prop("saveScriptFail") + data.failedMessage);
|
||||
$('#fileName').hide();
|
||||
}
|
||||
loadScript(table, 2);
|
||||
|
@ -122,4 +125,42 @@ function getScriptPlugins(scriptId) {
|
|||
}
|
||||
|
||||
}, "json")
|
||||
}
|
||||
|
||||
function testRecordProxy() {
|
||||
$.post("testRecordProxy", {}, function(data) {
|
||||
if (data.success) {
|
||||
$('#mySecondModal').modal('hide');
|
||||
$('#myThirdModal').modal('show');
|
||||
server = data.server;
|
||||
$('#scriptInfo3').text(
|
||||
$.i18n.prop("RecordingScript"));
|
||||
//$('#startServer').attr('disabled', true);
|
||||
$('#stopServer').attr('disabled', true);
|
||||
} else {
|
||||
$('#scriptInfo2').html(
|
||||
$.i18n.prop("ProxySettingError") + data.failedMessage);
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function startRecording() {
|
||||
//if (server != null) {
|
||||
$.post("startRecording", {
|
||||
port : server.port,
|
||||
scriptRecordUUID : server.fileName
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
$('#scriptInfo3').text(
|
||||
"start recording error:" + data.failedMessage);
|
||||
$('#stopServer').attr('disabled', false);
|
||||
$('#startRecording').attr('disabled', true);
|
||||
}
|
||||
else {
|
||||
window.location.href='http://www.baidu.com/';
|
||||
}
|
||||
}, "json");
|
||||
// } else {
|
||||
// $('#scriptInfo3').text("record script server has not started");
|
||||
// }
|
||||
}
|
Loading…
Reference in New Issue