pmux-logview 0.3.4 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +1 -1
- data/{conf → config/pmux-logview}/config.ru +2 -1
- data/{conf → config/pmux-logview}/password +0 -0
- data/{conf → config/pmux-logview}/pmux-logview.conf +4 -3
- data/lib/pmux-logview/application.rb +9 -0
- data/lib/pmux-logview/controller.rb +9 -5
- data/lib/pmux-logview/log_parser.rb +121 -175
- data/lib/pmux-logview/model.rb +2 -2
- data/lib/pmux-logview/static/css/jquery-ui-timepicker-addon.css +11 -0
- data/lib/pmux-logview/static/css/pmux-logview.css +8 -0
- data/lib/pmux-logview/static/js/jquery-ui-timepicker-addon.js +2134 -0
- data/lib/pmux-logview/static/js/jquery.activity-indicator-1.0.0.min.js +1 -1
- data/lib/pmux-logview/static/js/pmux-logview-index.js +240 -62
- data/lib/pmux-logview/static/js/tchart.js +2 -2
- data/lib/pmux-logview/version.rb +1 -1
- data/lib/pmux-logview/views/index.erb +44 -4
- data/pmux-logview.gemspec +1 -2
- data/rpm/RPMS/noarch/rubygem200-pmux-logview-0.3.10-1.noarch.rpm +0 -0
- data/rpm/SOURCES/pmux-logview +111 -0
- data/rpm/SOURCES/pmux-logview-0.3.10.gem +0 -0
- data/rpm/SRPMS/rubygem200-pmux-logview-0.3.10-1.src.rpm +0 -0
- data/rpm/pmux-logview.spec +1 -2
- metadata +128 -154
@@ -7,4 +7,4 @@
|
|
7
7
|
* Author: Felix Gnass [fgnass at neteye dot de]
|
8
8
|
* Version: 1.0.0
|
9
9
|
*/
|
10
|
-
(function($){$.fn.activity=function(opts){this.each(function(){var $this=$(this);var el=$this.data("activity");if(el){clearInterval(el.data("interval"));el.remove();$this.removeData("activity");}if(opts!==false){opts=$.extend({color:$this.css("color")},$.fn.activity.defaults,opts);el=render($this,opts).css("position","absolute").prependTo(opts.outside?"body":$this);var h=$this.outerHeight()-el.height();var w=$this.outerWidth()-el.width();var margin={top:opts.valign=="top"?opts.padding:opts.valign=="bottom"?h-opts.padding:Math.floor(h/2),left:opts.align=="left"?opts.padding:opts.align=="right"?w-opts.padding:Math.floor(w/2)};var offset=$this.offset();if(opts.outside){el.css({top:offset.top+"px",left:offset.left+"px"});}else{margin.top-=el.offset().top-offset.top;margin.left-=el.offset().left-offset.left;}el.css({marginTop:margin.top+"px",marginLeft:margin.left+"px"});animate(el,opts.segments,Math.round(10/opts.speed)/10);$this.data("activity",el);}});return this;};$.fn.activity.defaults={segments:12,space:3,length:7,width:4,speed:1.2,align:"center",valign:"center",padding:4};$.fn.activity.getOpacity=function(opts,i){var steps=opts.steps||opts.segments-1;var end=opts.opacity!==undefined?opts.opacity:1/steps;return 1-Math.min(i,steps)*(1-end)/steps;};var render=function(){return $("<div>").addClass("busy");};var animate=function(){};function svg(tag,attr){var el=document.createElementNS("http://www.w3.org/2000/svg",tag||"svg");if(attr){$.each(attr,function(k,v){el.setAttributeNS(null,k,v);});}return $(el);}if(document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect){render=function(target,d){var innerRadius=d.width*2+d.space;var r=(innerRadius+d.length+Math.ceil(d.width/2)+1);var el=svg().width(r*2).height(r*2);var g=svg("g",{"stroke-width":d.width,"stroke-linecap":"round",stroke:d.color}).appendTo(svg("g",{transform:"translate("+r+","+r+")"}).appendTo(el));for(var i=0;i<d.segments;i++){g.append(svg("line",{x1:0,y1:innerRadius,x2:0,y2:innerRadius+d.length,transform:"rotate("+(360/d.segments*i)+", 0, 0)",opacity:$.fn.activity.getOpacity(d,i)}));}return $("<div>").append(el).width(2*r).height(2*r);};if(document.createElement("div").style.WebkitAnimationName!==undefined){var animations={};animate=function(el,steps,duration){if(!animations[steps]){var name="spin"+steps;var rule="@-webkit-keyframes "+name+" {";for(var i=0;i<steps;i++){var p1=Math.round(100000/steps*i)/1000;var p2=Math.round(100000/steps*(i+1)-1)/1000;var value="% { -webkit-transform:rotate("+Math.round(360/steps*i)+"deg); }\n";rule+=p1+value+p2+value;}rule+="100% { -webkit-transform:rotate(100deg); }\n}";document.styleSheets[0].insertRule(rule);animations[steps]=name;}el.css("-webkit-animation",animations[steps]+" "+duration+"s linear infinite");};}else{animate=function(el,steps,duration){var rotation=0;var g=el.find("g g").get(0);el.data("interval",setInterval(function(){g.setAttributeNS(null,"transform","rotate("+(++rotation%steps*(360/steps))+")");},duration*1000/steps));};}}else{var s=$("<shape>").css("behavior","url(#default#VML)").appendTo("body");if(s.get(0).adj){var sheet=document.createStyleSheet();$.each(["group","shape","stroke"],function(){sheet.addRule(this,"behavior:url(#default#VML);");});render=function(target,d){var innerRadius=d.width*2+d.space;var r=(innerRadius+d.length+Math.ceil(d.width/2)+1);var s=r*2;var o=-Math.ceil(s/2);var el=$("<group>",{coordsize:s+" "+s,coordorigin:o+" "+o}).css({top:o,left:o,width:s,height:s});for(var i=0;i<d.segments;i++){el.append($("<shape>",{path:"m "+innerRadius+",0 l "+(innerRadius+d.length)+",0"}).css({width:s,height:s,rotation:(360/d.segments*i)+"deg"}).append($("<stroke>",{color:d.color,weight:d.width+"px",endcap:"round",opacity:$.fn.activity.getOpacity(d,i)})));}return $("<group>",{coordsize:s+" "+s}).css({width:s,height:s,overflow:"hidden"}).append(el);};animate=function(el,steps,duration){var rotation=0;var g=el.get(0);el.data("interval",setInterval(function(){g.style.rotation=++rotation%steps*(360/steps);},duration*1000/steps));};}$(s).remove();}})(jQuery);
|
10
|
+
(function($){$.fn.activity=function(opts){this.each(function(){var $this=$(this);var el=$this.data("activity");if(el){clearInterval(el.data("interval"));el.remove();$this.removeData("activity");}if(opts!==false){opts=$.extend({color:$this.css("color")},$.fn.activity.defaults,opts);el=render($this,opts).css("position","absolute").prependTo(opts.outside?"body":$this);var h=$this.outerHeight()-el.height();var w=$this.outerWidth()-el.width();var margin={top:opts.valign=="top"?opts.padding:opts.valign=="bottom"?h-opts.padding:Math.floor(h/2),left:opts.align=="left"?opts.padding:opts.align=="right"?w-opts.padding:Math.floor(w/2)};var offset=$this.offset();if(opts.outside){el.css({top:offset.top+"px",left:offset.left+"px"});}else{margin.top-=el.offset().top-offset.top;margin.left-=el.offset().left-offset.left;}el.css({marginTop:margin.top+"px",marginLeft:margin.left+"px"});animate(el,opts.segments,Math.round(10/opts.speed)/10);$this.data("activity",el);}});return this;};$.fn.activity.defaults={segments:12,space:3,length:7,width:4,speed:1.2,align:"center",valign:"center",padding:4};$.fn.activity.getOpacity=function(opts,i){var steps=opts.steps||opts.segments-1;var end=opts.opacity!==undefined?opts.opacity:1/steps;return 1-Math.min(i,steps)*(1-end)/steps;};var render=function(){return $("<div>").addClass("busy");};var animate=function(){};function svg(tag,attr){var el=document.createElementNS("http://www.w3.org/2000/svg",tag||"svg");if(attr){$.each(attr,function(k,v){el.setAttributeNS(null,k,v);});}return $(el);}if(document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect){render=function(target,d){var innerRadius=d.width*2+d.space;var r=(innerRadius+d.length+Math.ceil(d.width/2)+1);var el=svg().width(r*2).height(r*2);var g=svg("g",{"stroke-width":d.width,"stroke-linecap":"round",stroke:d.color}).appendTo(svg("g",{transform:"translate("+r+","+r+")"}).appendTo(el));for(var i=0;i<d.segments;i++){g.append(svg("line",{x1:0,y1:innerRadius,x2:0,y2:innerRadius+d.length,transform:"rotate("+(360/d.segments*i)+", 0, 0)",opacity:$.fn.activity.getOpacity(d,i)}));}return $("<div>").append(el).width(2*r).height(2*r);};if(document.createElement("div").style.WebkitAnimationName!==undefined){var animations={};animate=function(el,steps,duration){if(!animations[steps]){var name="spin"+steps;var rule="@-webkit-keyframes "+name+" {";for(var i=0;i<steps;i++){var p1=Math.round(100000/steps*i)/1000;var p2=Math.round(100000/steps*(i+1)-1)/1000;var value="% { -webkit-transform:rotate("+Math.round(360/steps*i)+"deg); }\n";rule+=p1+value+p2+value;}rule+="100% { -webkit-transform:rotate(100deg); }\n}";document.styleSheets[0].insertRule(rule,0);animations[steps]=name;}el.css("-webkit-animation",animations[steps]+" "+duration+"s linear infinite");};}else{animate=function(el,steps,duration){var rotation=0;var g=el.find("g g").get(0);el.data("interval",setInterval(function(){g.setAttributeNS(null,"transform","rotate("+(++rotation%steps*(360/steps))+")");},duration*1000/steps));};}}else{var s=$("<shape>").css("behavior","url(#default#VML)").appendTo("body");if(s.get(0).adj){var sheet=document.createStyleSheet();$.each(["group","shape","stroke"],function(){sheet.addRule(this,"behavior:url(#default#VML);");});render=function(target,d){var innerRadius=d.width*2+d.space;var r=(innerRadius+d.length+Math.ceil(d.width/2)+1);var s=r*2;var o=-Math.ceil(s/2);var el=$("<group>",{coordsize:s+" "+s,coordorigin:o+" "+o}).css({top:o,left:o,width:s,height:s});for(var i=0;i<d.segments;i++){el.append($("<shape>",{path:"m "+innerRadius+",0 l "+(innerRadius+d.length)+",0"}).css({width:s,height:s,rotation:(360/d.segments*i)+"deg"}).append($("<stroke>",{color:d.color,weight:d.width+"px",endcap:"round",opacity:$.fn.activity.getOpacity(d,i)})));}return $("<group>",{coordsize:s+" "+s}).css({width:s,height:s,overflow:"hidden"}).append(el);};animate=function(el,steps,duration){var rotation=0;var g=el.get(0);el.data("interval",setInterval(function(){g.style.rotation=++rotation%steps*(360/steps);},duration*1000/steps));};}$(s).remove();}})(jQuery);
|
@@ -5,9 +5,8 @@ pmux_logview.index = {
|
|
5
5
|
job_log_sort_order: "desc",
|
6
6
|
job_log_nitems: 20,
|
7
7
|
job_log_page: 0,
|
8
|
-
|
9
|
-
|
10
|
-
reload_job_log_type: "archive",
|
8
|
+
job_log_realtime_jobs: {},
|
9
|
+
job_log_search_jobs: {},
|
11
10
|
reload_job_log_initialized: false,
|
12
11
|
reload_dispatcher_log_initialized: false,
|
13
12
|
job_log_ajax_requested: false,
|
@@ -20,11 +19,16 @@ pmux_logview.index = {
|
|
20
19
|
tab_active_index: 0,
|
21
20
|
selected_job_id: null,
|
22
21
|
$main_tab: null,
|
23
|
-
$
|
22
|
+
$job_log_realtime_table: null,
|
23
|
+
$job_log_search_table: null,
|
24
|
+
$job_log_type: null,
|
24
25
|
$dispatcher_log_table: null,
|
26
|
+
$load_button: null,
|
25
27
|
$more_button: null,
|
26
28
|
$job_chart_tchart: null,
|
27
|
-
max_mapper_length: 35
|
29
|
+
max_mapper_length: 35,
|
30
|
+
$start_date_picker: null,
|
31
|
+
$end_date_picker: null
|
28
32
|
};
|
29
33
|
|
30
34
|
pmux_logview.index.draw_job_chart = function() {
|
@@ -44,22 +48,42 @@ pmux_logview.index.draw_job_chart = function() {
|
|
44
48
|
tasks : {}
|
45
49
|
};
|
46
50
|
var job_count = 0;
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
if (this.$job_log_type.val() == "realtime") {
|
52
|
+
for (job_id in this.job_log_realtime_jobs) {
|
53
|
+
var from = Number(this.job_log_realtime_jobs[job_id].start_time_msec);
|
54
|
+
var to;
|
55
|
+
if ("end_time_msec" in this.job_log_realtime_jobs[job_id]) {
|
56
|
+
to = Number(this.job_log_realtime_jobs[job_id].end_time_msec);
|
57
|
+
} else {
|
58
|
+
continue;
|
59
|
+
}
|
60
|
+
source.tasks[job_id] = {
|
61
|
+
name: "id " + job_id,
|
62
|
+
from: from,
|
63
|
+
to: to,
|
64
|
+
clickEventArg: this.job_log_realtime_jobs[job_id],
|
65
|
+
nextTasks: null
|
66
|
+
}
|
67
|
+
job_count += 1;
|
54
68
|
}
|
55
|
-
|
56
|
-
|
57
|
-
from
|
58
|
-
|
59
|
-
|
60
|
-
|
69
|
+
} else {
|
70
|
+
for (job_id in this.job_log_search_jobs) {
|
71
|
+
var from = Number(this.job_log_search_jobs[job_id].start_time_msec);
|
72
|
+
var to;
|
73
|
+
if ("end_time_msec" in this.job_log_search_jobs[job_id]) {
|
74
|
+
to = Number(this.job_log_search_jobs[job_id].end_time_msec);
|
75
|
+
} else {
|
76
|
+
continue;
|
77
|
+
}
|
78
|
+
source.tasks[job_id] = {
|
79
|
+
name: "id " + job_id,
|
80
|
+
from: from,
|
81
|
+
to: to,
|
82
|
+
clickEventArg: this.job_log_search_jobs[job_id],
|
83
|
+
nextTasks: null
|
84
|
+
}
|
85
|
+
job_count += 1;
|
61
86
|
}
|
62
|
-
job_count += 1;
|
63
87
|
}
|
64
88
|
if (job_count != 0) {
|
65
89
|
this.$job_chart_tchart.tchart('update', source);
|
@@ -78,47 +102,141 @@ pmux_logview.index.update_progress_bar = function() {
|
|
78
102
|
});
|
79
103
|
};
|
80
104
|
|
81
|
-
pmux_logview.index.reload_job_log = function(force) {
|
105
|
+
pmux_logview.index.reload_job_log = function(force, change_ui) {
|
82
106
|
if (!this.parent.can_reload) {
|
83
107
|
return;
|
84
108
|
}
|
85
109
|
if (!force && this.job_log_ajax_requested) {
|
86
110
|
return;
|
87
111
|
}
|
112
|
+
this.job_log_ajax_requested = true;
|
88
113
|
var self = this;
|
89
|
-
var param = {
|
90
|
-
sort_order: this.job_log_sort_order,
|
91
|
-
type: this.reload_job_log_type,
|
114
|
+
var param = { sort_order: this.job_log_sort_order,
|
92
115
|
nitems: this.job_log_nitems,
|
93
|
-
page: this.job_log_page
|
94
|
-
jobs_cookie: this.job_log_jobs_cookie };
|
116
|
+
page: this.job_log_page }
|
95
117
|
this.parent.ajax_base("log/job", "GET", param).done(function(data, textStatus, XMLHttpRequest) {
|
96
|
-
if (!("
|
97
|
-
self.$
|
98
|
-
self.$
|
99
|
-
self.
|
118
|
+
if (!("jobs" in data)) {
|
119
|
+
self.$job_log_realtime_table.fnClearTable();
|
120
|
+
self.$job_log_realtime_table.fnAddData(["invalid response", "", "", "", ""]);
|
121
|
+
self.job_log_ajax_requested = false;
|
122
|
+
if (change_ui) {
|
123
|
+
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
124
|
+
self.$more_button.show();
|
125
|
+
}
|
100
126
|
return;
|
101
127
|
}
|
102
|
-
$.extend(true, self.
|
103
|
-
self.
|
104
|
-
self.$job_log_table.fnClearTable();
|
128
|
+
$.extend(true, self.job_log_realtime_jobs, data.jobs);
|
129
|
+
self.$job_log_realtime_table.fnClearTable();
|
105
130
|
var sorted_jobs = [];
|
106
|
-
for (var job_id in self.
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
131
|
+
for (var job_id in self.job_log_realtime_jobs) {
|
132
|
+
sorted_jobs.push(self.job_log_realtime_jobs[job_id]);
|
133
|
+
}
|
134
|
+
if (self.$job_log_realtime_table.fnSettings().aaSorting.length == 0) {
|
135
|
+
sorted_jobs.sort(function(a,b){
|
136
|
+
var aTime = Number(a.start_time_msec);
|
137
|
+
var bTime = Number(b.start_time_msec);
|
138
|
+
if ( aTime < bTime ) return 1;
|
139
|
+
if ( aTime > bTime ) return -1;
|
140
|
+
return 0;
|
141
|
+
});
|
142
|
+
}
|
143
|
+
var body_array = [];
|
144
|
+
for (i = 0; i < sorted_jobs.length; i++) {
|
145
|
+
var row_array = []
|
146
|
+
var job_id_html = '';
|
147
|
+
job_id_html += '<button class="detail-button container button-color button-normalize ui-corner-all" data-job-id="' + sorted_jobs[i]["job_id"] + '">';
|
148
|
+
if ("error_status" in sorted_jobs[i]) {
|
149
|
+
job_id_html += ' <span class="icon-space"><font color="red">' + sorted_jobs[i].job_id + '</font></span>';
|
119
150
|
} else {
|
120
|
-
sorted_jobs.
|
151
|
+
job_id_html += ' <span class="icon-space">' + sorted_jobs[i].job_id + '</span>';
|
121
152
|
}
|
153
|
+
job_id_html += ' </span><span class="button-icon-adjust ui-icon ui-icon-info"></span>';
|
154
|
+
job_id_html += '</button>';
|
155
|
+
if ("error_status" in sorted_jobs[i]) {
|
156
|
+
job_id_html += '<button class="error-button error-info button-color button-normalize ui-corner-all" data-error-status="' + sorted_jobs[i].error_status + '" data-error-message="' + self.parent.html_escape(sorted_jobs[i].error_message) + '">';
|
157
|
+
job_id_html += '<div class="error-info ui-state-error"><span class="error-info ui-icon ui-icon-alert"></span></div>';
|
158
|
+
job_id_html += '</button>';
|
159
|
+
}
|
160
|
+
row_array.push(job_id_html)
|
161
|
+
if (sorted_jobs[i].mapper && sorted_jobs[i].mapper.length > self.max_mapper_length) {
|
162
|
+
row_array.push('<span class="text-ellipsis">'+ self.parent.html_escape(sorted_jobs[i].mapper.substring(0, self.max_mapper_length)) + '...</span>');
|
163
|
+
} else {
|
164
|
+
row_array.push('<span class="text-ellipsis">'+ self.parent.html_escape(sorted_jobs[i].mapper) + '</span>');
|
165
|
+
}
|
166
|
+
row_array.push('<span class="cell-nowrap">' + sorted_jobs[i].start_time + '</span>');
|
167
|
+
if (sorted_jobs[i].end_time.match(/^\d+%$/)) {
|
168
|
+
var percent = sorted_jobs[i].end_time.replace("%","");
|
169
|
+
row_array.push('<span class="cell-nowrap"><div class="progress-bar" data-value="' + percent + '" ></div></span>');
|
170
|
+
} else {
|
171
|
+
row_array.push('<span class="cell-nowrap">' + sorted_jobs[i].end_time + '</span>');
|
172
|
+
}
|
173
|
+
row_array.push(sorted_jobs[i].elapsed_time);
|
174
|
+
body_array.push(row_array);
|
175
|
+
}
|
176
|
+
self.$job_log_realtime_table.fnAddData(body_array);
|
177
|
+
self.update_progress_bar();
|
178
|
+
self.valid_last_job_id = true;
|
179
|
+
self.job_log_ajax_requested = false;
|
180
|
+
if (change_ui) {
|
181
|
+
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
182
|
+
self.$more_button.show();
|
183
|
+
}
|
184
|
+
}).fail(function(XMLHttpRequest, textStatus, errorThrown) {
|
185
|
+
self.parent.open_dialog("job log の読み込みに失敗しました。");
|
186
|
+
self.job_log_ajax_requested = false;
|
187
|
+
if (change_ui) {
|
188
|
+
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
189
|
+
self.$more_button.show();
|
190
|
+
}
|
191
|
+
});
|
192
|
+
};
|
193
|
+
|
194
|
+
pmux_logview.index.load_job_log = function(force, change_ui) {
|
195
|
+
if (!this.parent.can_reload) {
|
196
|
+
return;
|
197
|
+
}
|
198
|
+
if (!force && this.job_log_ajax_requested) {
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
this.job_log_ajax_requested = true;
|
202
|
+
var self = this;
|
203
|
+
var param = { sort_order: this.job_log_sort_order,
|
204
|
+
nitems: this.job_log_nitems,
|
205
|
+
page: this.job_log_page }
|
206
|
+
var start_date = this.$start_date_picker.datepicker('getDate');
|
207
|
+
var end_date = this.$end_date_picker.datepicker('getDate');
|
208
|
+
if (start_date != null) {
|
209
|
+
param.start_time_msec = start_date.getTime();
|
210
|
+
}
|
211
|
+
if (end_date != null) {
|
212
|
+
param.end_time_msec = end_date.getTime();
|
213
|
+
}
|
214
|
+
this.parent.ajax_base("log/job", "GET", param).done(function(data, textStatus, XMLHttpRequest) {
|
215
|
+
if (!("jobs" in data)) {
|
216
|
+
self.$job_log_search_table.fnClearTable();
|
217
|
+
self.$job_log_search_table.fnAddData(["invalid response", "", "", "", ""]);
|
218
|
+
self.job_log_ajax_requested = false;
|
219
|
+
if (change_ui) {
|
220
|
+
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
221
|
+
self.$load_button.show();
|
222
|
+
}
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
self.job_log_search_jobs = {};
|
226
|
+
$.extend(true, self.job_log_search_jobs, data.jobs);
|
227
|
+
self.$job_log_search_table.fnClearTable();
|
228
|
+
var sorted_jobs = [];
|
229
|
+
for (var job_id in self.job_log_search_jobs) {
|
230
|
+
sorted_jobs.push(self.job_log_search_jobs[job_id]);
|
231
|
+
}
|
232
|
+
if (self.$job_log_search_table.fnSettings().aaSorting.length == 0) {
|
233
|
+
sorted_jobs.sort(function(a,b){
|
234
|
+
var aTime = Number(a.start_time_msec);
|
235
|
+
var bTime = Number(b.start_time_msec);
|
236
|
+
if ( aTime < bTime ) return 1;
|
237
|
+
if ( aTime > bTime ) return -1;
|
238
|
+
return 0;
|
239
|
+
});
|
122
240
|
}
|
123
241
|
var body_array = [];
|
124
242
|
for (i = 0; i < sorted_jobs.length; i++) {
|
@@ -153,18 +271,22 @@ pmux_logview.index.reload_job_log = function(force) {
|
|
153
271
|
row_array.push(sorted_jobs[i].elapsed_time);
|
154
272
|
body_array.push(row_array);
|
155
273
|
}
|
156
|
-
self.$
|
274
|
+
self.$job_log_search_table.fnAddData(body_array);
|
157
275
|
self.update_progress_bar();
|
158
|
-
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
159
276
|
self.valid_last_job_id = true;
|
160
|
-
self.reload_job_log_type = "update";
|
161
277
|
self.job_log_ajax_requested = false;
|
278
|
+
if (change_ui) {
|
279
|
+
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
280
|
+
self.$load_button.show();
|
281
|
+
}
|
162
282
|
}).fail(function(XMLHttpRequest, textStatus, errorThrown) {
|
163
283
|
self.parent.open_dialog("job log の読み込みに失敗しました。");
|
164
|
-
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
165
284
|
self.job_log_ajax_requested = false;
|
285
|
+
if (change_ui) {
|
286
|
+
self.parent.activityOff(function(){ self.$main_tab.tabs("option", "disabled", false) });
|
287
|
+
self.$load_button.show();
|
288
|
+
}
|
166
289
|
});
|
167
|
-
self.job_log_ajax_requested = true;
|
168
290
|
};
|
169
291
|
|
170
292
|
pmux_logview.index.reload_dispatcher_log = function() {
|
@@ -197,13 +319,12 @@ pmux_logview.index.reload = function() {
|
|
197
319
|
if (this.need_reload_job_log) {
|
198
320
|
if (this.reload_job_log_timer_id == null) {
|
199
321
|
this.reload_job_log_timer_id = setInterval(function(){
|
200
|
-
self.reload_job_log(false);
|
322
|
+
self.reload_job_log(false, false);
|
201
323
|
}, 3000);
|
202
324
|
}
|
203
325
|
if (!this.reload_job_log_initialized) {
|
204
326
|
this.parent.activityOn(function(){ self.$main_tab.tabs("option", "disabled", true) });
|
205
|
-
this.
|
206
|
-
this.reload_job_log(true);
|
327
|
+
this.reload_job_log(true, true);
|
207
328
|
this.reload_job_log_initialized = true;
|
208
329
|
}
|
209
330
|
} else {
|
@@ -251,16 +372,62 @@ pmux_logview.index.initialize = function() {
|
|
251
372
|
if (self.tab_active_index == 0) {
|
252
373
|
self.need_reload_job_log = true;
|
253
374
|
self.need_reload_dispatcher_log = false;
|
254
|
-
}
|
375
|
+
}else if (self.tab_active_index == 1) {
|
255
376
|
self.need_reload_job_log = false;
|
256
|
-
self.need_reload_dispatcher_log =
|
377
|
+
self.need_reload_dispatcher_log = false;
|
257
378
|
} else if (self.tab_active_index == 2) {
|
379
|
+
self.need_reload_job_log = false;
|
380
|
+
self.need_reload_dispatcher_log = true;
|
381
|
+
} else if (self.tab_active_index == 3) {
|
382
|
+
self.need_reload_job_log = false;
|
383
|
+
self.need_reload_dispatcher_log = false;
|
258
384
|
self.draw_job_chart();
|
259
385
|
}
|
260
386
|
self.reload();
|
261
387
|
}
|
262
388
|
});
|
263
|
-
this.$
|
389
|
+
this.$job_log_realtime_table = $("#job-log-realtime-table").dataTable({
|
390
|
+
aaSorting: [],
|
391
|
+
bPaginate: false,
|
392
|
+
bScrollCollapse: true,
|
393
|
+
bSort: true,
|
394
|
+
bFilter: true,
|
395
|
+
bJQueryUI: true,
|
396
|
+
bAutoWidth: true,
|
397
|
+
sPaginationType: "full_numbers",
|
398
|
+
fnRowCallback: function(nRow) {
|
399
|
+
if (nRow.cells[0]) nRow.cells[0].noWrap = true;
|
400
|
+
if (nRow.cells[1]) nRow.cells[1].noWrap = true;
|
401
|
+
return nRow
|
402
|
+
},
|
403
|
+
fnDrawCallback: function() {
|
404
|
+
self.update_progress_bar();
|
405
|
+
var $this = (this)
|
406
|
+
if ($this.fnSettings().aaSorting.length != 0) {
|
407
|
+
var sort_key = self.job_log_sort_keys[$this.fnSettings().aaSorting[0][0]];
|
408
|
+
var sort_order = $this.fnSettings().aaSorting[0][1];
|
409
|
+
if (self.job_log_sort_key != sort_key || self.job_log_sort_order != sort_order) {
|
410
|
+
self.job_log_sort_key = sort_key;
|
411
|
+
self.job_log_sort_order = sort_order;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
self.$error_button = $(".error-button").click(function(event) {
|
415
|
+
var html = '<table class="border task-tooltip"><thead class="task-tooltip"></thead>';
|
416
|
+
html += '<tbody class="task-tooltip"><tr class="task-tooltip">';
|
417
|
+
html += '<td class="task-tooltip">status:</td>';
|
418
|
+
html += '<td class="task-tooltip">' + $(event.currentTarget).attr("data-error-status") +'</td>';
|
419
|
+
html += '</tr><tr class="task-tooltip">';
|
420
|
+
html += '<td class="task-tooltip">message:</td>';
|
421
|
+
html += '<td class="task-tooltip">' + $(event.currentTarget).attr("data-error-message") +'</td>';
|
422
|
+
html += '</tr></tbody></table>';
|
423
|
+
self.parent.open_tooltip(html, event.target, event);
|
424
|
+
});
|
425
|
+
self.$detail_button = $(".detail-button").click(function(event) {
|
426
|
+
self.open_detail($(event.currentTarget).attr("data-job-id"));
|
427
|
+
});
|
428
|
+
}
|
429
|
+
});
|
430
|
+
this.$job_log_search_table = $("#job-log-search-table").dataTable({
|
264
431
|
aaSorting: [],
|
265
432
|
bPaginate: false,
|
266
433
|
bScrollCollapse: true,
|
@@ -283,9 +450,6 @@ pmux_logview.index.initialize = function() {
|
|
283
450
|
if (self.job_log_sort_key != sort_key || self.job_log_sort_order != sort_order) {
|
284
451
|
self.job_log_sort_key = sort_key;
|
285
452
|
self.job_log_sort_order = sort_order;
|
286
|
-
self.job_log_page = 0;
|
287
|
-
self.reload_job_log_type = "archive";
|
288
|
-
self.reload_job_log(true);
|
289
453
|
}
|
290
454
|
}
|
291
455
|
self.$error_button = $(".error-button").click(function(event) {
|
@@ -315,9 +479,9 @@ pmux_logview.index.initialize = function() {
|
|
315
479
|
});
|
316
480
|
this.$more_button = $("#more-button").click(function() {
|
317
481
|
self.job_log_page += 1;
|
318
|
-
self.
|
482
|
+
self.$more_button.hide();
|
319
483
|
self.parent.activityOn(function(){ self.$main_tab.tabs("option", "disabled", true) });
|
320
|
-
self.reload_job_log(true);
|
484
|
+
self.reload_job_log(true, true);
|
321
485
|
});
|
322
486
|
this.$job_chart_tchart = $("#job-chart-tchart").tchart({
|
323
487
|
onTaskClick: function(task, target, event) {
|
@@ -338,11 +502,25 @@ pmux_logview.index.initialize = function() {
|
|
338
502
|
self.parent.open_tooltip(html, target, event);
|
339
503
|
}
|
340
504
|
});
|
505
|
+
this.$start_date_picker = $("#start-date-picker").datetimepicker({ dateFormat: "yy-mm-dd",
|
506
|
+
timeFormat: 'HH:mm:ss',
|
507
|
+
showMonthAfterYear: true });
|
508
|
+
this.$end_date_picker = $("#end-date-picker").datetimepicker({ dateFormat: 'yy-mm-dd',
|
509
|
+
timeFormat: 'HH:mm:ss',
|
510
|
+
showMonthAfterYear: true});
|
341
511
|
$(window).resize(function() {
|
342
512
|
if (self.draw_invoke_timer_id == null) {
|
343
513
|
self.draw_invoke_timer_id = setInterval(function() { self.draw_invoke() }, 1000);
|
344
514
|
}
|
345
515
|
});
|
516
|
+
this.$load_button = $("#load-button").click(function() {
|
517
|
+
self.$load_button.hide();
|
518
|
+
self.parent.activityOn(function(){ self.$main_tab.tabs("option", "disabled", true) });
|
519
|
+
self.load_job_log(true, true);
|
520
|
+
});
|
521
|
+
this.$job_log_type = $("#job-log-type").change(function() {
|
522
|
+
self.draw_job_chart();
|
523
|
+
});
|
346
524
|
this.reload();
|
347
525
|
};
|
348
526
|
|
@@ -151,8 +151,8 @@
|
|
151
151
|
commonData.tasks = [];
|
152
152
|
commonData.containers = [ {cls: "scrollButtonsContainer"},
|
153
153
|
{cls: "optionsContainer" } ];
|
154
|
-
commonData.datePickerContainersData = [ {cls: "datePickerContainer startDatePickerContainer", label: "start :"},
|
155
|
-
{cls: "datePickerContainer endDatePickerContainer", label: "end :"} ]
|
154
|
+
commonData.datePickerContainersData = [ {cls: "datePickerContainer startDatePickerContainer", label: "start date :"},
|
155
|
+
{cls: "datePickerContainer endDatePickerContainer", label: "end date :"} ]
|
156
156
|
commonData.datePickersData = [ {span: "span.startDatePickerContainer", data: [{ cls: "startDatePicker" }] },
|
157
157
|
{span: "span.endDatePickerContainer", data: [{ cls: "endDatePicker" }] } ]
|
158
158
|
if (source.actors != null) {
|
data/lib/pmux-logview/version.rb
CHANGED
@@ -9,11 +9,13 @@
|
|
9
9
|
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
|
10
10
|
<script type="text/javascript" src="js/d3.v3.min.js"></script>
|
11
11
|
<script type="text/javascript" src="js/jquery.activity-indicator-1.0.0.min.js"></script>
|
12
|
+
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
|
12
13
|
<script type="text/javascript" src="js/tchart.js"></script>
|
13
14
|
<script type="text/javascript" src="js/pmux-logview-base.js"></script>
|
14
15
|
<script type="text/javascript" src="js/pmux-logview-index.js"></script>
|
15
16
|
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.0.css" />
|
16
17
|
<link rel="stylesheet" type="text/css" href="css/jquery.dataTables.css" />
|
18
|
+
<link rel="stylesheet" type="text/css" href="css/jquery-ui-timepicker-addon.css" />
|
17
19
|
<link rel="stylesheet" type="text/css" href="css/tchart.css" />
|
18
20
|
<link rel="stylesheet" type="text/css" href="css/pmux-logview.css" />
|
19
21
|
</head>
|
@@ -42,12 +44,13 @@
|
|
42
44
|
<div class="tabs-container">
|
43
45
|
<div id="main-tabs">
|
44
46
|
<ul>
|
45
|
-
<li><a href="#job-log">job log</a></li>
|
47
|
+
<li><a href="#job-log-realtime">job log (realtime)</a></li>
|
48
|
+
<li><a href="#job-log-search">job log (search)</a></li>
|
46
49
|
<li><a href="#dispatcher-log">dispatcher log</a></li>
|
47
50
|
<li><a href="#job-chart">job chart</a></li>
|
48
51
|
</ul>
|
49
|
-
<div id="job-log">
|
50
|
-
<table id="job-log-table" class="border">
|
52
|
+
<div id="job-log-realtime">
|
53
|
+
<table id="job-log-realtime-table" class="border">
|
51
54
|
<thead>
|
52
55
|
<tr>
|
53
56
|
<th>id</th>
|
@@ -57,7 +60,7 @@
|
|
57
60
|
<th>elapsed time</th>
|
58
61
|
</tr>
|
59
62
|
</thead>
|
60
|
-
<tbody id="job-log-table-body">
|
63
|
+
<tbody id="job-log-realtime-table-body">
|
61
64
|
</tbody>
|
62
65
|
</table>
|
63
66
|
<div>
|
@@ -66,6 +69,37 @@
|
|
66
69
|
</button>
|
67
70
|
</div>
|
68
71
|
</div>
|
72
|
+
<div id="job-log-search">
|
73
|
+
<div id="date-picker">
|
74
|
+
<table class="y-space">
|
75
|
+
<thead>
|
76
|
+
</thead>
|
77
|
+
<tbody>
|
78
|
+
<tr>
|
79
|
+
<td class="x-space">end timeの日時で絞り込み</td>
|
80
|
+
<td class="x-space">検索開始日:</td>
|
81
|
+
<td class="x-space"><input type="text" id="start-date-picker"></input></td>
|
82
|
+
<td class="x-space">検索終了日:</td>
|
83
|
+
<td class="x-space"><input type="text" id="end-date-picker"></input></td>
|
84
|
+
<td class="x-space"><button id="load-button" class="button-color button-normalize ui-corner-all">ロード</button></td>
|
85
|
+
</tr>
|
86
|
+
</tbody>
|
87
|
+
</table>
|
88
|
+
</div>
|
89
|
+
<table id="job-log-search-table" class="border">
|
90
|
+
<thead>
|
91
|
+
<tr>
|
92
|
+
<th>id</th>
|
93
|
+
<th>mapper</th>
|
94
|
+
<th>start time</th>
|
95
|
+
<th>end time</th>
|
96
|
+
<th>elapsed time</th>
|
97
|
+
</tr>
|
98
|
+
</thead>
|
99
|
+
<tbody id="job-log-search-table-body">
|
100
|
+
</tbody>
|
101
|
+
</table>
|
102
|
+
</div>
|
69
103
|
<div id="dispatcher-log">
|
70
104
|
<table id="dispatcher-log-table" class="border">
|
71
105
|
<thead>
|
@@ -78,6 +112,12 @@
|
|
78
112
|
</table>
|
79
113
|
</div>
|
80
114
|
<div id="job-chart">
|
115
|
+
<div class="y-space">
|
116
|
+
<select id="job-log-type">
|
117
|
+
<option value="realtime" selected>realtime</option>
|
118
|
+
<option value="search">search</option>
|
119
|
+
</select>
|
120
|
+
</div>
|
81
121
|
<div class="job-chart-container background-gradient">
|
82
122
|
<div id="job-chart-tchart">
|
83
123
|
</div>
|