1
|
var curPageCompTests;
|
2
|
var curPageRegistrations;
|
3
|
var curPageWorkflows;
|
4
|
var pageSize;
|
5
|
|
6
|
function ajaxCall(){
|
7
|
var curPage;
|
8
|
var currentAttrValue = $(".tab-content > .active").attr('id');
|
9
|
if (currentAttrValue == "CompTests") {
|
10
|
curPage = curPageCompTests;
|
11
|
} else if (currentAttrValue == "Registrations") {
|
12
|
curPage = curPageRegistrations;
|
13
|
} else if (currentAttrValue == "Workflows") {
|
14
|
curPage = curPageWorkflows;
|
15
|
}
|
16
|
|
17
|
$.ajax({
|
18
|
url: "refresh"+currentAttrValue+"Tab.action?jobType="+currentAttrValue+"&startPage="+curPage+"&pageSize="+pageSize,
|
19
|
cache: false
|
20
|
}).done(function( html ) {
|
21
|
$("#"+currentAttrValue+"Tab").html(html);
|
22
|
});
|
23
|
|
24
|
}
|
25
|
|
26
|
function nextPage(){
|
27
|
var currentAttrValue = $(".tab-content > .active").attr('id');
|
28
|
if (currentAttrValue == "CompTests") {
|
29
|
curPageCompTests++;
|
30
|
} else if (currentAttrValue == "Registrations") {
|
31
|
curPageRegistrations++;
|
32
|
} else if (currentAttrValue == "Workflows") {
|
33
|
curPageWorkflows++;
|
34
|
}
|
35
|
ajaxCall();
|
36
|
}
|
37
|
function previousPage(){
|
38
|
var currentAttrValue = $(".tab-content > .active").attr('id');
|
39
|
if (currentAttrValue == "CompTests") {
|
40
|
curPageCompTests--;
|
41
|
} else if (currentAttrValue == "Registrations") {
|
42
|
curPageRegistrations--;
|
43
|
} else if (currentAttrValue == "Workflows") {
|
44
|
curPageWorkflows--;
|
45
|
}
|
46
|
ajaxCall();
|
47
|
}
|
48
|
function testCall(){
|
49
|
alert( "success" );
|
50
|
}
|
51
|
function updatePageSize(size, totalJobs){
|
52
|
pageSize = size;
|
53
|
var currentAttrValue = $(".tab-content > .active").attr('id');
|
54
|
if (currentAttrValue == "CompTests") {
|
55
|
if (totalJobs < pageSize * curPageCompTests) {
|
56
|
curPageCompTests = Math.floor(totalJobs/pageSize) ;
|
57
|
if (curPageCompTests == 0)
|
58
|
curPageCompTests ++;
|
59
|
}
|
60
|
} else if (currentAttrValue == "Registrations") {
|
61
|
if (totalJobs < pageSize * curPageRegistrations) {
|
62
|
curPageRegistrations = Math.floor(totalJobs/pageSize) ;
|
63
|
if (curPageRegistrations == 0)
|
64
|
curPageRegistrations ++;
|
65
|
}
|
66
|
} else if (currentAttrValue == "Workflows") {
|
67
|
if (totalJobs < pageSize * curPageWorkflows) {
|
68
|
curPageWorkflows = Math.floor(totalJobs/pageSize) ;
|
69
|
if (curPageWorkflows == 0)
|
70
|
curPageWorkflows ++;
|
71
|
}
|
72
|
}
|
73
|
ajaxCall();
|
74
|
}
|
75
|
|
76
|
jQuery(document).ready(function() {
|
77
|
curPageCompTests = 1;
|
78
|
curPageRegistrations = 1;
|
79
|
curPageWorkflows = 1;
|
80
|
pageSize = 10;
|
81
|
jQuery('.tabs .tab-links a').on('click', function(e) {
|
82
|
var currentAttrValue = jQuery(this).attr('href');
|
83
|
// Show/Hide Tabs
|
84
|
jQuery('.tabs ' + currentAttrValue).show().siblings().hide();
|
85
|
jQuery('.tabs ' + currentAttrValue).addClass('active').siblings().removeClass('active');
|
86
|
// Change/remove current tab to active
|
87
|
jQuery(this).parent('li').addClass('active').siblings().removeClass('active');
|
88
|
|
89
|
e.preventDefault();
|
90
|
ajaxCall();
|
91
|
|
92
|
});
|
93
|
setInterval(ajaxCall,10000);
|
94
|
|
95
|
|
96
|
});
|