add new test case about frame in html for record script
This commit is contained in:
parent
789b4669a4
commit
cf30603c7a
|
@ -0,0 +1,8 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>frame1</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img alt="No this picture" src="images/4.jpg">
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bench4Q Test Case</title>
|
||||||
|
<link href="style/bootstrap-cerulean.css" />
|
||||||
|
<link href="style/bootstrap-classic.css" />
|
||||||
|
<link href="style/bootstrap-cerulean.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<iframe src=""></iframe>
|
||||||
|
<img src="images/1.jpg" alt="No this one" />
|
||||||
|
<img src="images/2.jpg" alt="No this one" />
|
||||||
|
<img src="images/3.jpg" alt="No this one" />
|
||||||
|
<script src="script/agentTable.js" type="text/javascript"></script>
|
||||||
|
<script src="script/base.js" type="text/javascript"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -0,0 +1,94 @@
|
||||||
|
var table= $('#agents');
|
||||||
|
$('.datatable').dataTable({
|
||||||
|
"sDom": "<'row-fluid'<'span6'l><'span6'f>>t<'row-fluid'<'span12 center'p>>",
|
||||||
|
"sPaginationType": "bootstrap",
|
||||||
|
"oLanguage": {
|
||||||
|
"sLengthMenu": "_MENU_ records per page"
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
$('.btn-setting').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$("#agentParam").modal('show');
|
||||||
|
});
|
||||||
|
$(document).ready(function() {
|
||||||
|
loadAgents(table);
|
||||||
|
|
||||||
|
});
|
||||||
|
function cancel(){
|
||||||
|
$("#agentParam").modal('hide');
|
||||||
|
}
|
||||||
|
function loadAgents() {
|
||||||
|
table.dataTable().fnClearTable();
|
||||||
|
$.post("loadAgents", {}, function(data) {
|
||||||
|
if (data!=null) {
|
||||||
|
for (var i = 0; i<data.list.length; i++)
|
||||||
|
addAgentTableRow(table, data.list[i]);
|
||||||
|
}
|
||||||
|
},"json");
|
||||||
|
|
||||||
|
$('.btn-info').click(function() {
|
||||||
|
deleteAgent(this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAgentTableRow(table, data) {
|
||||||
|
var status = "NA";
|
||||||
|
switch (data.currentStatus) {
|
||||||
|
case 1:
|
||||||
|
status = "Idle";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
status = "Running";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
status = "BackUp";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
status = "BreakDown";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
status = "NA";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
table.dataTable().fnAddData(
|
||||||
|
[ data.hostName, data.id, data.port, status, data.maxLoad,
|
||||||
|
data.remainLoad, deleteButton ]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAgentId(obj) {
|
||||||
|
var row = obj.parentNode.parentNode;
|
||||||
|
var tbody = row.parentNode;
|
||||||
|
var id = $(tbody).children("tr").eq(row.rowIndex - 1).children("td").eq(1)
|
||||||
|
.text();
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletetablerow(obj) {
|
||||||
|
id=getAgentId(obj);
|
||||||
|
table=obj.pratent.parent;
|
||||||
|
$.post("removeAgentFromPool", {
|
||||||
|
id : id,
|
||||||
|
}, function(data) {
|
||||||
|
if (data)
|
||||||
|
$(table).dataTable().fnDeleteRow(row.rowIndex - 1);
|
||||||
|
else{}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAgentToDB() {
|
||||||
|
$.post("addAgentToPool", {
|
||||||
|
hostName : $("#hostName").val(),
|
||||||
|
port : $("#port").val(),
|
||||||
|
maxLoad : $("#maxLoad").val(),
|
||||||
|
remainLoad : $("#remainLoad").val()
|
||||||
|
}, function(data) {
|
||||||
|
if (data) {
|
||||||
|
loadAgents();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
|
||||||
|
/*var viewButton = "<a class='btn btn-success' href='#' ><i class='icon-zoom-in icon-white'></i>View</a>"+" ";
|
||||||
|
var editButton = "<a class='btn btn-success' href='#' ><i class='icon-edit icon-white'></i>Edit</a>"+" ";
|
||||||
|
var deleteButton = "<a class='btn btn-info' href='#'><i class='icon-trash icon-white'></i>Delete</a>";*/
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
//highlight current / active link
|
||||||
|
$('ul.main-menu li a').each(function(){
|
||||||
|
if($($(this))[0].href==String(window.location))
|
||||||
|
$(this).parent().addClass('active');
|
||||||
|
});
|
||||||
|
//animating menus on hover
|
||||||
|
$('ul.main-menu li:not(.nav-header)').hover(function(){
|
||||||
|
$(this).animate({'margin-left':'+=5'},300);
|
||||||
|
},
|
||||||
|
function(){
|
||||||
|
$(this).animate({'margin-left':'-=5'},300);
|
||||||
|
});
|
||||||
|
docReady();
|
||||||
|
loadProperties();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function docReady(){
|
||||||
|
//makes elements soratble, elements that sort need to have id attribute to save the result
|
||||||
|
$('.sortable').sortable({
|
||||||
|
revert:true,
|
||||||
|
cancel:'.btn,.box-content,.nav-header',
|
||||||
|
update:function(event,ui){
|
||||||
|
//line below gives the ids of elements, you can make ajax call here to save it to the database
|
||||||
|
//console.log($(this).sortable('toArray'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.btn-close').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).parent().parent().parent().fadeOut();
|
||||||
|
});
|
||||||
|
$('.btn-minimize').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var $target = $(this).parent().parent().next('.box-content');
|
||||||
|
if($target.is(':visible')) $('i',$(this)).removeClass('icon-chevron-up').addClass('icon-chevron-down');
|
||||||
|
else $('i',$(this)).removeClass('icon-chevron-down').addClass('icon-chevron-up');
|
||||||
|
$target.slideToggle();
|
||||||
|
});
|
||||||
|
/*$('.btn-setting').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$('#myModal').modal('show');
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"iStart": oSettings._iDisplayStart,
|
||||||
|
"iEnd": oSettings.fnDisplayEnd(),
|
||||||
|
"iLength": oSettings._iDisplayLength,
|
||||||
|
"iTotal": oSettings.fnRecordsTotal(),
|
||||||
|
"iFilteredTotal": oSettings.fnRecordsDisplay(),
|
||||||
|
"iPage": Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
|
||||||
|
"iTotalPages": Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
|
||||||
|
};
|
||||||
|
};
|
||||||
|
$.extend( $.fn.dataTableExt.oPagination, {
|
||||||
|
"bootstrap": {
|
||||||
|
"fnInit": function( oSettings, nPaging, fnDraw ) {
|
||||||
|
var oLang = oSettings.oLanguage.oPaginate;
|
||||||
|
var fnClickHandler = function ( e ) {
|
||||||
|
e.preventDefault();
|
||||||
|
if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
|
||||||
|
fnDraw( oSettings );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(nPaging).addClass('pagination').append(
|
||||||
|
'<ul>'+
|
||||||
|
'<li class="prev disabled"><a href="#">← '+oLang.sPrevious+'</a></li>'+
|
||||||
|
'<li class="next disabled"><a href="#">'+oLang.sNext+' → </a></li>'+
|
||||||
|
'</ul>'
|
||||||
|
);
|
||||||
|
var els = $('a', nPaging);
|
||||||
|
$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
|
||||||
|
$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
|
||||||
|
},
|
||||||
|
|
||||||
|
"fnUpdate": function ( oSettings, fnDraw ) {
|
||||||
|
var iListLength = 5;
|
||||||
|
var oPaging = oSettings.oInstance.fnPagingInfo();
|
||||||
|
var an = oSettings.aanFeatures.p;
|
||||||
|
var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
|
||||||
|
|
||||||
|
if ( oPaging.iTotalPages < iListLength) {
|
||||||
|
iStart = 1;
|
||||||
|
iEnd = oPaging.iTotalPages;
|
||||||
|
}
|
||||||
|
else if ( oPaging.iPage <= iHalf ) {
|
||||||
|
iStart = 1;
|
||||||
|
iEnd = iListLength;
|
||||||
|
} else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
|
||||||
|
iStart = oPaging.iTotalPages - iListLength + 1;
|
||||||
|
iEnd = oPaging.iTotalPages;
|
||||||
|
} else {
|
||||||
|
iStart = oPaging.iPage - iHalf + 1;
|
||||||
|
iEnd = iStart + iListLength - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i=0, iLen=an.length ; i<iLen ; i++ ) {
|
||||||
|
// remove the middle elements
|
||||||
|
$('li:gt(0)', an[i]).filter(':not(:last)').remove();
|
||||||
|
|
||||||
|
// add the new list items and their event handlers
|
||||||
|
for ( j=iStart ; j<=iEnd ; j++ ) {
|
||||||
|
sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
|
||||||
|
$('<li '+sClass+'><a href="#">'+j+'</a></li>')
|
||||||
|
.insertBefore( $('li:last', an[i])[0] )
|
||||||
|
.bind('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
|
||||||
|
fnDraw( oSettings );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
// add / remove disabled classes from the static elements
|
||||||
|
if ( oPaging.iPage === 0 ) {
|
||||||
|
$('li:first', an[i]).addClass('disabled');
|
||||||
|
} else {
|
||||||
|
$('li:first', an[i]).removeClass('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
|
||||||
|
$('li:last', an[i]).addClass('disabled');
|
||||||
|
} else {
|
||||||
|
$('li:last', an[i]).removeClass('disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function loadProperties(){
|
||||||
|
jQuery.i18n.properties({// 加载资浏览器语言对应的资源文件
|
||||||
|
name:'i18n', // 资源文件名称
|
||||||
|
path:'i18n/', // 资源文件路径
|
||||||
|
mode:'map', // 用 Map 的方式使用资源文件中的值
|
||||||
|
} );
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,17 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bench4Q Test Case</title>
|
||||||
|
<link href="style/bootstrap-cerulean.css" />
|
||||||
|
<link href="style/bootstrap-classic.css" />
|
||||||
|
<link href="style/bootstrap-cerulean.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img src="images/1.jpg" alt="No this one" />
|
||||||
|
<img src="images/2.jpg" alt="No this one" />
|
||||||
|
<img src="images/3.jpg" alt="No this one" />
|
||||||
|
|
||||||
|
<script src="script/agentTable.js" type="text/javascript"></script>
|
||||||
|
<script src="script/base.js" type="text/javascript"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in New Issue