sync_pkg_svr_url = change_item[:SyncPkgSvrUrl]
sync_pkg_svr_period = change_item[:SyncPkgSvrPeriod]
sync_pkg_svr_description = change_item[:SyncPkgSvrDescription]
+ sync_pkg_svr = SyncPkgServer.find(:first, :conditions => ["distribution_id = ?", dist.id])
if not sync_pkg_svr_url.nil? and not sync_pkg_svr_url.empty?
- sync_pkg_svr = SyncPkgServer.find(:first, :conditions => ["distribution_id = ?", dist.id])
if sync_pkg_svr.nil?
sync_pkg_svr = SyncPkgServer.new
end
sync_pkg_svr.period = sync_pkg_svr_period
sync_pkg_svr.description = sync_pkg_svr_description
sync_pkg_svr.save
+ elsif not sync_pkg_svr.nil? and not sync_pkg_svr_url.nil? and sync_pkg_svr_url.empty?
+ # if sync_pkg_svr is already exist and modified sync_pkg_svr_url is empty then remove it
+ sync_pkg_svr.destroy
end
end
end
end
+ def fullBuildDistribution
+ change_group_list = params[:ChangeInfoList]
+ change_item = change_group_list[0]
+ errmsg = ""
+
+ dist_name = change_item[:DistributionName]
+ if dist_name.nil? or dist_name.empty? then
+ errmsg = "Can't find [#{dist_name}] information"
+ render :json => { :error => errmsg }, :status => 406
+ return
+ end
+
+ dist = Distribution.find(:first, :conditions => ["name = ?", dist_name])
+ if dist.nil?
+ errmsg = "Distribution[#{dist_name}] not exist"
+ end
+
+ server_config = Server_config.find(:first, :conditions => ["property = \"id\""])
+ if server_config.nil?
+ errmsg = "Server name can't find"
+ else
+ server_name = server_config.value
+
+ if server_name.nil? or server_name.empty?
+ errmsg = "Server name can't find"
+ end
+ end
+
+ if errmsg.empty?
+ Utils.sbi_fullbuild_command(server_name, dist_name)
+ render :json => { :success => "OK!" }
+ else
+ render :json => { :error=> errmsg }, :status => 406
+ end
+ end
end
end
def listAll
- listQuery(params[:distribution], params[:status], params[:lastID], "", "")
+ listQuery("QUERY", params[:distribution], params[:status], params[:lastID], "", "")
end
def listSearchId
- listQuery("%", "%", "%", "%", "%")
+ listQuery("QUERY", "%", "%", "%", "%", "%")
end
def listSearchUser
- listQuery(params[:distribution], params[:status], params[:lastID], params[:user], "")
+ listQuery("QUERY", params[:distribution], params[:status], params[:lastID], params[:user], "")
+ end
+
+ def listSearchGroup
+ listQueryGroup("QUERY", params[:distribution], params[:status], params[:lastID], params[:group])
+ end
+
+ def listSearchProject
+ listQueryProject("QUERY", params[:distribution], params[:status], params[:lastID], params[:project])
end
def listSearchDate
- listQuery(params[:distribution], params[:status], params[:lastID], "", params[:date])
+ listQuery("QUERY", params[:distribution], params[:status], params[:lastID], "", params[:date])
+ end
+
+ def updateListAll
+ listQuery("UPDATE", params[:distribution], params[:status], params[:lastID], "", "")
+ end
+
+ def updateListSearchUser
+ listQuery("UPDATE", params[:distribution], params[:status], params[:lastID], params[:user], "")
+ end
+
+ def updateListSearchGroup
+ listQueryGroup("UPDATE", params[:distribution], params[:status], params[:lastID], params[:group])
end
- def listQuery(distribution, status, last_id, user, date)
+ def updateListSearchProject
+ listQueryProject("UPDATE", params[:distribution], params[:status], params[:lastID], params[:project])
+ end
+
+ def updateListSearchDate
+ listQuery("UPDATE", params[:distribution], params[:status], params[:lastID], "", params[:date])
+ end
+
+ def queryJobInfo
+ job_id = params[:jobID]
+ end
+
+
+ def listQuery(query_type, distribution, status, last_id, user, date)
+ condition = ""
+
if(distribution == "ALL")
distribution = "%"
end
status = "'ERROR', 'CANCELED'"
end
- if(last_id == "LATEST")
- last_job_id = Job.maximum(:id)
- if last_job_id.nil?
- last_job_id = 0
+ if(query_type == "QUERY")
+ if(last_id == "LATEST")
+ last_job_id = Job.maximum(:id)
+ if last_job_id.nil?
+ last_job_id = 0
+ end
+ else
+ last_job_id = last_id.to_i - 1
end
+ condition = "jobs.id <= #{last_job_id}"
else
- last_job_id = last_id.to_i - 1
+ condition = "jobs.id > #{last_id}"
end
user = user + "%"
ON jobs.remote_build_server_id = remote_build_servers.id
LEFT JOIN sources
ON jobs.source_id = sources.id
- WHERE jobs.id <= #{last_job_id}
+ WHERE #{condition}
AND jobs.parent_job_id IS NULL
AND jobs.status in (#{status})
AND users.name like '#{user}'
return
end
- def listSearchGroup
- distribution = params[:distribution]
- status = params[:status]
- last_id = params[:lastID]
- group = params[:group]
+ def listQueryGroup(query_type, distribution, status, last_id, group)
if(distribution == "ALL")
distribution = "%"
status = "'ERROR', 'CANCELED'"
end
- if(last_id == "LATEST")
- last_job_id = Job.maximum("id")
- if last_job_id.nil?
- last_job_id = 0
+ if(query_type == "QUERY")
+ if(last_id == "LATEST")
+ last_job_id = Job.maximum(:id)
+ if last_job_id.nil?
+ last_job_id = 0
+ end
+ else
+ last_job_id = last_id.to_i - 1
end
+ condition = "jobs.id <= #{last_job_id}"
else
- last_job_id = last_id.to_i - 1
+ condition = "jobs.id > #{last_id}"
end
group = group + "%"
ELSE 'SINGLE' END AS job_attribute
FROM jobs
LEFT JOIN distributions ON jobs.distribution_id = distributions.id
- WHERE jobs.id <= #{last_job_id}
+ WHERE #{condition}
AND jobs.parent_job_id IS NULL
AND distributions.name like '#{distribution}'
AND jobs.status in (#{status})
return
end
- def listSearchProject
- distribution = params[:distribution]
- status = params[:status]
- last_id = params[:lastID]
- project = params[:project]
-
+ def listQueryProject(query_type, distribution, status, last_id, project)
if(distribution == "ALL")
distribution = "%"
end
status = "'ERROR', 'CANCELED'"
end
- if(last_id == "LATEST")
- last_job_id = Job.maximum("id")
- if last_job_id.nil?
- last_job_id = 0
+ if(query_type == "QUERY")
+ if(last_id == "LATEST")
+ last_job_id = Job.maximum(:id)
+ if last_job_id.nil?
+ last_job_id = 0
+ end
+ else
+ last_job_id = last_id.to_i - 1
end
+ condition = "jobs.id <= #{last_job_id}"
else
- last_job_id = last_id.to_i - 1
+ condition = "jobs.id > #{last_id}"
end
project = project + "%"
ON jobs.remote_build_server_id = remote_build_servers.id
LEFT JOIN sources
ON jobs.source_id = sources.id
- WHERE jobs.id <= #{last_job_id}
+ WHERE #{condition}
AND jobs.status IN (#{status})
AND projects.name like '#{project}'
ORDER BY jobs.id DESC
, DATE_FORMAT(jobs.end_time, '%Y-%m-%d %H:%i:%s') AS end_time
, projects.name AS project_name
, projects.ptype AS project_type
+ , projects.password AS project_password
, users.name AS user_name
, users.email AS user_email
, supported_os.name AS supported_os_name
puts id
line = params[:line].to_i
+ # Get job information
+ job = get_job_info(id)
+ if job.nil?
+ render :text => "Not found Job ID #{id}", :status => 406
+ end
+
+ if job.job_type == "MULTIBUILD"
+ project_name = job.job_type
+ else
+ project_name = job.project_name
+ end
+
+ # Get log file infomation
file_name = "log"
buildsvr_path = Server_config.find(:first, :conditions => ["property = ?", "path"])
directory = "#{buildsvr_path.value}/jobs/#{id}"
#generate to XML
doc = Builder::XmlMarkup.new( :target => out_string = "", :indent => 2 )
- doc.Log("Time" => timestamp,
- "JobId" => id,
- "Continue" => conti) {
- if temp
- temp.each do |data|
- doc.Data(data, "Line" => line)
- line = line + 1
+ doc.Responser {
+ generate_xml_header(doc)
+ doc.Data {
+ doc.JobId(id)
+ doc.Distribution(job.distribution_name)
+ doc.Project(project_name)
+ doc.Builder(job.user_name)
+ doc.Status(job.status)
+ doc.Time(timestamp)
+ doc.Continue(conti)
+ if temp
+ temp.each do |data|
+ doc.LogData(data, "Line" => line)
+ line = line + 1
+ end
end
- end
+ }
}
- #send_data( out_string, :type => "t)
- render :text => out_string,
- :content_type => "text/xml"
+ render :text => out_string, :content_type => "text/xml"
end
+ def cancelJob
+ id = params[:id]
+
+ # get job information
+ job = get_job_info(id)
+ if job.nil?
+ render :text => "Not found Job ID #{id}", :status => 406
+ return
+ end
+
+ # Check job builder
+ if get_user_email != job.user_email
+ if not is_admin(get_user_email)
+ render :text => "You don't have authority to calcel.", :status => 406
+ return
+ end
+ end
+
+ # Excute command
+ begin
+ Utils.sbi_cancel_command(id, job.project_password)
+ rescue => e
+ render :text => e.message, :status => 406
+ return
+ end
+ render :xml=> "<Message>OK</Message>"
+ end
end
doc.Project {
doc.Name(project.name)
doc.Type(project.ptype)
+ maintainer = User.find(:first, :conditions => ["id = ?", project.user_id])
+ if not maintainer.nil?
+ doc.Maintainer(maintainer.email)
+ else
+ doc.Maintainer("")
+ end
+
if checkUserAccessProject(user_id, project.id)
doc.GroupAccess("TRUE")
else
return execute_shell_return(cmd)
end
+ def Utils.sbi_cancel_command(job_id, password)
+ dibs_path = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
+ dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
+ if dibs_config.nil?
+ raise RuntimeError, "Build sever not started"
+ else
+ dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
+ end
+
+ if job_id.nil?
+ raise RuntimeError, "Invalid job id : #{job_id}"
+ end
+
+ options = "-d #{dibs_address} "
+ options = options + " -j #{job_id}"
+ if (not password.nil?)
+ options = options + " -w #{password}"
+ end
+
+ cmd = "#{dibs_path}/build-cli cancel #{options}"
+puts "Cancel command"
+puts "[[[#{cmd}]]]"
+ return execute_shell_return(cmd)
+ end
+
+ def Utils.sbi_fullbuild_command(server_name, dist_name)
+ dibs_path = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
+
+ options = "-n #{server_name} --dist #{dist_name} "
+ cmd = "#{dibs_path}/build-svr fullbuild #{options}"
+puts "Fullbuild command"
+puts "[[[#{cmd}]]]"
+ return execute_shell_return(cmd)
+ end
+
def Utils.execute_shell_return(cmd)
result_lines = []
ret = false
post "sessions/login"
delete "sessions/logout"
- get "jobs/list/:distribution/:status/:lastID" => "jobs#listAll", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
- get "jobs/listSearchUser/:user/:distribution/:status/:lastID" => "jobs#listSearchUser", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
- get "jobs/listSearchGroup/:group/:distribution/:status/:lastID" => "jobs#listSearchGroup", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
- get "jobs/listSearchProject/:project/:distribution/:status/:lastID" => "jobs#listSearchProject" , :constraints => { :project => /[0-9A-Za-z\-\.]+/ }
- get "jobs/listSearchDate/:date/:distribution/:status/:lastID" => "jobs#listSearchDate", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/list/all/:distribution/:status/:lastID" => "jobs#listAll", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/list/user/:user/:distribution/:status/:lastID" => "jobs#listSearchUser", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/list/group/:group/:distribution/:status/:lastID" => "jobs#listSearchGroup", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/list/project/:project/:distribution/:status/:lastID" => "jobs#listSearchProject" , :constraints => { :project => /[0-9A-Za-z\-\.]+/ }
+ get "jobs/list/date/:date/:distribution/:status/:lastID" => "jobs#listSearchDate", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+
+ get "jobs/updateList/all/:distribution/:status/:lastID" => "jobs#updateListAll", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/updateList/user/:user/:distribution/:status/:lastID" => "jobs#updateListSearchUser", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/updateList/group/:group/:distribution/:status/:lastID" => "jobs#updateListSearchGroup", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
+ get "jobs/updateList/project/:project/:distribution/:status/:lastID" => "jobs#updateListSearchProject" , :constraints => { :project => /[0-9A-Za-z\-\.]+/ }
+ get "jobs/updateList/date/:date/:distribution/:status/:lastID" => "jobs#updateListSearchDate", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
match "jobs/log/:id" => "jobs#log"
match "jobs/log/:id/:line" => "jobs#log_more"
+ match "jobs/cancel/:id" => "jobs#cancelJob"
+
get "projects/queryDistribution"
match "projects/queryProject/:distribution" => "projects#queryProject", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
post "admin_distribution/removeDistribution"
post "admin_distribution/modifyDistribution"
+ post "admin_distribution/fullBuildDistribution"
+
get "admin/queryAllOS"
get "admin/queryAllOSCategory"
<link rel="stylesheet" href="stylesheets/jqm-docs.css"/>
<link rel="stylesheet" href="stylesheets/style.css"/>
- <script type="text/javascript" src="javascripts/jquery-1.7.1.js"></script>
+ <script src="javascripts/jquery-1.7.1.js"></script>
<script src="javascripts/jqm-docs.js"></script>
- <script type="text/javascript" src="javascripts/jquery.mobile-1.1.0.js"></script>
+ <script src="javascripts/jquery.mobile-1.1.0.js"></script>
<script src="javascripts/popup-window.js"></script>
<script src="javascripts/main.js"></script>
<script src="javascripts/build.js"></script>
<script src="javascripts/projects.js"></script>
<script src="javascripts/jobs.js"></script>
- <script src="javascripts/log.js"></script>
<script src="javascripts/admin-user.js"></script>
<script src="javascripts/admin-user-modify.js"></script>
<script src="javascripts/admin-group.js"></script>
<select id="adminDistributionSelect" data-native-menu="false" onchange="adminDistributionSetInfo()">
</select>
</div>
+ <div align="right" style="font-size: 10px">
+ <a href="javascript:adminDistributionFullBuild()" data-role="button" data-inline="true" data-icon="gear"> Full build</a>
+ </div>
<div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" >
<h2> Package server url </h2>
<p id="adminDistribution:packageServerUrl" style="font-size: 14px"> </p>
$("#adminDistribution-SyncPackageServer").append(info);
}
+function adminDistributionFullBuild() {
+ var changeInfoList = [];
+ var changeInfoItem;
+ var distName = $("#adminDistributionSelect option:selected").val();
+
+ changeInfoItem = {"DistributionName":distName};
+ changeInfoList.push(changeInfoItem);
+
+ var r=confirm("Distribution ["+distName+"] fullbuild will be started!!! it takes several time");
+ if (r==false)
+ {
+ return;
+ }
+
+ fullBuildDistribution( changeInfoList, function (xml) {
+ $.mobile.changePage("#adminDistribution");
+ });
+}
+
// controller : jobs
function queryJobsList(url, successFunction) {
- getInfoFromServer(url, successFunction);
+ return getInfoFromServer(url, successFunction);
+}
+function updateJobsList(url, successFunction) {
+ return getInfoFromServerNoPreProcess(url, successFunction);
+}
+function queryJobsLog(job_id, next_line, successFunction) {
+ var url = "jobs/log/"+ job_id + "/" + next_line;
+ getInfoFromServerNoPreProcess(url, successFunction);
+}
+function cancelJobsJobid(job_id, successFunction) {
+ var url = "jobs/cancel/"+ job_id;
+ getInfoFromServerNoPreProcess(url, successFunction);
}
// controller : admin_group
postForServer(url, changeInfoList, successFunction);
}
+function fullBuildDistribution(changeInfoList, successFunction) {
+ var url = 'admin_distribution/fullBuildDistribution';
+ postForServer(url, changeInfoList, successFunction);
+}
+
// controller : admin
function queryAllOS(successFunction) {
var url = 'admin/queryAllOS';
}
function getInfoFromServer(url, successFunction) {
- $.ajax({
+ return $.ajax({
url: baseUrl+url,
type: 'GET',
dataType: 'xml',
});
}
+function getInfoFromServerNoPreProcess(url, successFunction) {
+ return $.ajax({
+ url: baseUrl+url,
+ type: 'GET',
+ dataType: 'xml',
+ timeout: 10000,
+ success: function(xml) {
+ setSessionInfo(xml);
+ successFunction(xml);
+ },
+ error: function(jqXHR) {
+ errorProcess(jqXHR);
+ }
+ });
+}
+
function postForServer(url, changeInfoList, successFunction) {
$.ajax({
url: baseUrl+url,
});
}
+function errorProcess(jqXHR){
+ switch (parseInt(jqXHR.status)) {
+ case 401:
+ expireSession();
+ break;
+ case 406:
+ alert("Internal server error : " + jqXHR.responseText);
+ break;
+ case 0:
+ console.error("Error response status : "+jqXHR.status);
+ break;
+ default:
+ console.error("Error response status : "+jqXHR.status);
+ alert("Server error : "+jqXHR.status);
+ break;
+ }
+}
*/
var suggestion_list = new Array();
+var update_ajax;
+var request_list = new Array();
+var request_idx = 0;
+
+function classAjax() {
+ var polling = false;
+ var ajaxObj = undefined;
+}
+
+function addRequestList(ajaxObj) {
+ var class_ajax = new classAjax();
+ class_ajax.polling = true;
+ class_ajax.ajaxObj = ajaxObj;
+
+ return request_list.push(class_ajax) - 1;
+}
+
+function clearRequestList() {
+ while(request_list.length > 0) {
+ var last_request = request_list[request_list.length - 1];
+ if(last_request.polling == true && last_request.ajaxObj != undefined) {
+ last_request.ajaxObj.abort();
+ }
+ request_list.pop();
+ }
+ console.log("Clear all update.");
+}
+
+function isPolling(idx) {
+ if(request_list[idx] != undefined) {
+ return request_list[idx].polling;
+ }
+ else {
+ return false;
+ }
+}
$(function() {
$('#jobSearchSelect input[type="radio"]').checkboxradio().click(function() {
function searchJob(searchText) {
var distribution = $("#jobSelectDistribution option:selected").val();
var selectedValue = $('#jobSearchSelect').find("input[type='radio']:checked").val();
- console.log(searchText);
switch(selectedValue) {
case "ALL":
alert("Can't search on ALL!!");
}
function queryJobListAll(distribution) {
- var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
- clearJobList();
- queryJobList("jobs/list", distribution, selectedStatus, "LATEST");
+ queryJobListByButton("all", distribution, "LATEST");
}
function queryJobListJobId(distribution, jobId) {
- var distribution = $("#jobSelectDistribution option:selected").val();
- var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
- clearJobList();
- queryJobList("jobs/list", distribution, selectedStatus, eval(parseInt(jobId) + 1));
+ queryJobListByButton("all", distribution, eval(parseInt(jobId) + 1));
}
function queryJobListUserName(distribution, name) {
- var distribution = $("#jobSelectDistribution option:selected").val();
- var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
- clearJobList();
var encodingName = encodeURIComponent(name);
- queryJobList("jobs/listSearchUser/"+encodingName, distribution, selectedStatus, "LATEST");
+ queryJobListByButton("user/"+encodingName, distribution, "LATEST");
}
function queryJobListUserGroup(distribution, group) {
- var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
- clearJobList();
- queryJobList("jobs/listSearchGroup/"+group, distribution, selectedStatus, "LATEST");
+ queryJobListByButton("group/"+group, distribution, "LATEST");
}
function queryJobListProject(distribution, project) {
- var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
- clearJobList();
- queryJobList("jobs/listSearchProject/"+project, distribution, selectedStatus, "LATEST");
+ queryJobListByButton("project/"+project, distribution, "LATEST");
}
function queryJobListDate(distribution, date) {
- var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
+ queryJobListByButton("date/"+date, distribution, "LATEST");
+}
+
+function queryJobListByButton(condition, distribution, jobId) {
clearJobList();
- queryJobList("jobs/listSearchDate/"+date, distribution, selectedStatus, "LATEST");
+ clearRequestList();
+ var selectedStatus= $('#jobStatusSelect').find("input[type='radio']:checked").val();
+ var request = queryJobList("jobs/list", condition, distribution, selectedStatus, jobId);
+ if(request != undefined) {
+ request.done(function() {
+ console.log("Start update");
+ updateJobList(condition, distribution, selectedStatus);
+ });
+ }
}
function jobQueryDistribution() {
}
}
-function queryJobList(requestUrl, distribution, selectedStatus, jobId) {
- var url = requestUrl+"/"+ distribution +"/"+ selectedStatus+"/"+jobId;
+function queryJobList(requestUrl, condition, queryDistribution, selectedStatus, jobId) {
+ var url = requestUrl+"/"+condition+"/"+queryDistribution+"/"+selectedStatus+"/"+jobId;
console.log(url);
- queryJobsList(url, function(xml) {
+ return queryJobsList(url, function(xml) {
var lastJobId = 0;
$(xml).find("JobList").find("Job").each(function(){
var id = $(this).find("Id").text();
- var distribution = $(this).find("Distribution").text();
- var projectName = $(this).find("ProjectName").text();
- var jobType = $(this).find("JobType").text();
- var jobAttribute = $(this).find("JobAttribute").text();
- var os = $(this).find("Os").text();
- var jobStatus = $(this).find("Status").text();
- var userName = $(this).find("UserName").text();
- var startTime = $(this).find("StartTime").text();
- var endTime = $(this).find("EndTime").text();
- var li = "";
-
- if(jobAttribute == "SINGLE")
- {
- li = '<li data-role="list-divider">'
- + id+ ' ' +projectName+ '</li>'
- + '<li><a href=log.html?jobid='+id+' class="logWindow" data-ajax="false">'
- + '<h3>' +projectName+ '</h3>'
- + '<p>ID : <strong>' +id+ '</strong></p>'
- + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
- + '<p>OS : <strong>' + os + '</strong></p>'
- + '<p>USER : <strong>' +userName+ '</strong></p>'
- + '<p>TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
- if(jobStatus == "ERROR" || jobStatus == "CANCELED") {
- li = li + '<p class="ui-li-aside"><strong><font color="red">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "JUST_CREATED" || jobStatus == "PENDING"
- || jobStatus == "WORKING" || jobStatus == "REMOTE_WORKING") {
- li = li + '<p class="ui-li-aside"><strong><font color="blue">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "WAITING") {
- li = li + '<p class="ui-li-aside"><strong><font color="green">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "FINISHED") {
- li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
- } else {
- li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
- }
-
- li = li + '</a></li>';
- }
- else if(jobAttribute == "MULTI")
- {
- li = '<li data-role="list-divider">' +id+ ' ' +jobType+ '</li>'
- + '<li><a href=log.html?jobid='+id+' class="logWindow" data-ajax="false">'
- + '<p>USER : <strong>' +userName+ '</strong></p>'
- + '<p>TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
- if(jobStatus.toUpperCase() == "ERROR" || jobStatus.toUpperCase() == "CANCELED") {
- li = li + '<p class="ui-li-aside"><strong><font color="red">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "JUST_CREATED" || jobStatus == "PENDING"
- || jobStatus == "WORKING" || jobStatus == "REMOTE_WORKING") {
- li = li + '<p class="ui-li-aside"><strong><font color="blue">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "WAITING") {
- li = li + '<p class="ui-li-aside"><strong><font color="green">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "FINISHED") {
- li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
- } else {
- li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
- }
-
- li = li + '</a></li>';
- }
- else if(jobAttribute == "CHILD")
- {
- li = '<li><a href=log.html?jobid='+id+' class="logWindow" data-ajax="false">'
- + '<h3>' +projectName+ '</h3>'
- + '<p>ID : <strong>' +id+ '</strong></p>'
- + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
- + '<p>OS : <strong>' +os+ '</strong></p>'
- + '<p>TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
- if(jobStatus.toUpperCase() == "ERROR" || jobStatus.toUpperCase() == "CANCELED") {
- li = li + '<p class="ui-li-aside"><strong><font color="red">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "JUST_CREATED" || jobStatus == "PENDING"
- || jobStatus == "WORKING" || jobStatus == "REMOTE_WORKING") {
- li = li + '<p class="ui-li-aside"><strong><font color="blue">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "WAITING") {
- li = li + '<p class="ui-li-aside"><strong><font color="green">' +jobStatus+ '</strong></p>'
- } else if(jobStatus == "FINISHED") {
- li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
- } else {
- li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
- }
-
- li = li + '</a></li>';
- }
+ var li = generateHtmlJobList($(this));
lastJobId = id;
$("#jobList").append(li).listview('refresh');
});
- console.log(lastJobId);
if(lastJobId > 0)
{
- var moreJobListUrl = 'queryJobList("'+requestUrl+'", "'+distribution+'", "'+selectedStatus+'", "'+lastJobId+'")';
+ var moreJobListUrl = 'queryJobList("'+requestUrl+'", "'+condition+'","'+queryDistribution+'", "'+selectedStatus+'", "'+lastJobId+'")';
$('#moreJobList').attr("onClick", moreJobListUrl);
$('#moreJobList').removeClass('ui-disabled');
}
}
$('#moreJobList').button('refresh');
applyStyleLogWindow();
+
}, errorProcess);
}
+function updateJobList(condition, distribution, selectedStatus) {
+ var latest_job_id= $("#jobList li").first().attr("title");
+ if(latest_job_id == undefined) {
+ latest_job_id = 0;
+ }
+ update_ajax = queryUpdateJobList("jobs/updateList", condition, distribution, selectedStatus, latest_job_id);
+
+ var idx = addRequestList(update_ajax);
+
+ console.log("Update done. Next request in 2sec.");
+ update_ajax.done(function() {
+ setTimeout(function(){
+ if(isPolling(idx) && $.mobile.activePage.attr('id') == "jobs" && idx < 900) {
+ console.log("Update request.");
+ request_list[idx].polling = false;
+ updateJobList(condition, distribution, selectedStatus);
+ }
+ else {
+ console.log("Stop update.");
+ }
+ }, 2000);
+ });
+}
+
+function queryUpdateJobList(requestUrl, condition, queryDistribution, selectedStatus, latest_job_id) {
+ var url = requestUrl+"/"+condition+"/"+queryDistribution+"/"+selectedStatus+"/"+latest_job_id;
+ console.log("update url: "+url);
+ return updateJobsList(url, function(xml) {
+ var firstLi= $("#jobList li").first();
+
+ $(xml).find("JobList").find("Job").each(function(){
+ var id = $(this).find("Id").text();
+ var li = generateHtmlJobList($(this));
+
+ $(li).insertBefore(firstLi);
+ $("#jobList").listview('refresh');
+ });
+ });
+}
+
function clearSuggestJobSearchList() {
$("#jobSearchList").empty();
}
}
sugList.html(str);
sugList.listview("refresh");
- console.log(inputText);
- console.dir(suggestion_list);
}
}
var startIndex = suggestText.search(/\[/);
var endIndex = suggestText.search('\]');
- console.log(startIndex);
- console.log(endIndex);
if(startIndex > 0 && endIndex >0) {
project = suggestText.substr(0, startIndex);
distribution = suggestText.substr(startIndex+1, endIndex-startIndex-1);
clearJobList();
}
+function generateHtmlJobList(xml) {
+ var id = xml.find("Id").text();
+ var distribution = xml.find("Distribution").text();
+ var projectName = xml.find("ProjectName").text();
+ var jobType = xml.find("JobType").text();
+ var jobAttribute = xml.find("JobAttribute").text();
+ var os = xml.find("Os").text();
+ var jobStatus = xml.find("Status").text();
+ var userName = xml.find("UserName").text();
+ var startTime = xml.find("StartTime").text();
+ var endTime = xml.find("EndTime").text();
+ var li = "";
+
+ if(jobAttribute == "SINGLE")
+ {
+ li = '<li title="'+id+'" data-role="list-divider">'
+ + id+ ' ' +projectName+ '</li>'
+ + '<li title="'+id+'"><a href=log.html?jobid='+id+' class="logWindow" data-ajax="false">'
+ + '<h3>' +projectName+ '</h3>'
+ + '<p>ID : <strong>' +id+ '</strong></p>'
+ + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
+ + '<p>OS : <strong>' + os + '</strong></p>'
+ + '<p>USER : <strong>' +userName+ '</strong></p>'
+ + '<p>TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
+ if(queryDistribution == "ALL") {
+ li = li + '<p>DISTRIBUTION: <strong>' +distribution+ '</strong></p>';
+ }
+
+ if(jobStatus == "ERROR" || jobStatus == "CANCELED") {
+ li = li + '<p class="ui-li-aside"><strong><font color="red">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "JUST_CREATED" || jobStatus == "PENDING"
+ || jobStatus == "WORKING" || jobStatus == "REMOTE_WORKING") {
+ li = li + '<p class="ui-li-aside"><strong><font color="blue">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "WAITING") {
+ li = li + '<p class="ui-li-aside"><strong><font color="green">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "FINISHED") {
+ li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
+ } else {
+ li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
+ }
+
+ li = li + '</a></li>';
+ }
+ else if(jobAttribute == "MULTI")
+ {
+ li = '<li title="'+id+'" data-role="list-divider">' +id+ ' ' +jobType+ '</li>'
+ + '<li title="'+id+'"><a href=log.html?jobid='+id+' class="logWindow" data-ajax="false">'
+ + '<p>USER : <strong>' +userName+ '</strong></p>'
+ + '<p>TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
+ if(queryDistribution == "ALL") {
+ li = li + '<p>DISTRIBUTION: <strong>' +distribution+ '</strong></p>';
+ }
+
+ if(jobStatus.toUpperCase() == "ERROR" || jobStatus.toUpperCase() == "CANCELED") {
+ li = li + '<p class="ui-li-aside"><strong><font color="red">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "JUST_CREATED" || jobStatus == "PENDING"
+ || jobStatus == "WORKING" || jobStatus == "REMOTE_WORKING") {
+ li = li + '<p class="ui-li-aside"><strong><font color="blue">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "WAITING") {
+ li = li + '<p class="ui-li-aside"><strong><font color="green">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "FINISHED") {
+ li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
+ } else {
+ li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
+ }
+
+ li = li + '</a></li>';
+ }
+ else if(jobAttribute == "CHILD")
+ {
+ li = '<li title="'+id+'"><a href=log.html?jobid='+id+' class="logWindow" data-ajax="false">'
+ + '<h3>' +projectName+ '</h3>'
+ + '<p>ID : <strong>' +id+ '</strong></p>'
+ + '<p>TYPE : <strong>' +jobType+ '</strong></p>'
+ + '<p>OS : <strong>' +os+ '</strong></p>'
+ + '<p>TIME: <strong>' +startTime+ ' ~ '+endTime+ '</strong></p>';
+
+ if(jobStatus.toUpperCase() == "ERROR" || jobStatus.toUpperCase() == "CANCELED") {
+ li = li + '<p class="ui-li-aside"><strong><font color="red">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "JUST_CREATED" || jobStatus == "PENDING"
+ || jobStatus == "WORKING" || jobStatus == "REMOTE_WORKING") {
+ li = li + '<p class="ui-li-aside"><strong><font color="blue">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "WAITING") {
+ li = li + '<p class="ui-li-aside"><strong><font color="green">' +jobStatus+ '</strong></p>'
+ } else if(jobStatus == "FINISHED") {
+ li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
+ } else {
+ li = li + '<p class="ui-li-aside"><strong>' +jobStatus+ '</strong></p>'
+ }
+
+ li = li + '</a></li>';
+ }
+
+ return li;
+}
var request;
var stop = 1;
+var baseUrl;
var job_id;
var last_line = 0;
-function logInit() {
- var next_line = Number(last_line) + 1;
- var url = "/jobs/log/"+ job_id + "/" + next_line;
- request.open("GET", url, true);
- request.onreadystatechange = updatePage;
- request.send(null);
-}
-
-function receiveData() {
- /* XML parsing */
- var xmlDoc = request.responseXML;
+var init = function () {
+ console.log("init() called");
+ var myUrl = location.href;
+ var varCut = myUrl.indexOf("?");
+ var varCheck = myUrl.substring(varCut+1);
+ eval(varCheck);
- /* pre-process */
- var logElements = xmlDoc.getElementsByTagName("Log")[0];
- var conti = Number(logElements.getAttribute("Continue"));
- job_id = logElements.getAttribute("JobId");
+ job_id = jobid;
+ $('#job-info-id').text(job_id);
+ console.log(job_id);
- /* Insert data */
- var dataElements = xmlDoc.getElementsByTagName("Data");
+ var baseCut = myUrl.indexOf("log.html");
- for(var x=0 ; x < dataElements.length ; x++)
- {
- var insertTable = document.getElementById("logTable");
- var insertRow = document.createElement("tr");
- var insertCel1 = document.createElement("td");
- var insertCel2 = document.createElement("td");
+ baseUrl = myUrl.substring(0, baseCut);
+ console.log("base url:"+baseUrl);
- var line_number = dataElements[x].getAttribute("Line");
- var line_data = dataElements[x].childNodes[0].nodeValue;
+ queryLog();
+};
- insertCel1.width = '30';
- insertCel1.style.textAlign = 'right';
- insertCel1.style.cellpacing = '5';
- insertCel1.innerHTML = line_number;
- last_line = line_number;
+$(document).ready(init);
- insertCel2.style.textAlign = 'left';
- insertCel2.innerHTML = line_data;
-
- insertRow.appendChild(insertCel1);
- insertRow.appendChild(insertCel2);
+function queryLog()
+{
+ var next_line = Number(last_line) + 1;
+ queryJobsLog(job_id, next_line, function(xml) {
+ /* pre-process for header */
+ job_id = $(xml).find("Data").find("JobId").text();
+ var distribution = $(xml).find("Data").find("Distribution").text();
+ var project = $(xml).find("Data").find("Project").text();
+ var builder = $(xml).find("Data").find("Builder").text();
+ var job_status = $(xml).find("Data").find("Status").text();
+ var time = $(xml).find("Data").find("Time").text();
+ var conti = Number($(xml).find("Data").find("Continue").text());
+ var working_status = 0;
+
+ $('#job-info-distribution').html(distribution);
+ $('#job-info-project').html(project);
+ $('#job-info-builder').html(builder);
+ $('#job-info-status').html(job_status);
+ switch(job_status)
+ {
+ case "ERROR" :
+ case "CANCELED" :
+ $('#job-info-status').css("color","red");
+ $('#job-info-cancel input').attr("disabled", true);
+ working_status = 0;
+ break;
+ case "INITIALIZING" :
+ case "JUST_CREATED" :
+ case "PENDING" :
+ case "WORKING" :
+ case "REMOTE_WORKING" :
+ $('#job-info-status').css("color","blue");
+ working_status = 1;
+ break;
+ case "WAITING" :
+ $('#job-info-status').css("color","green");
+ working_status = 1;
+ break;
+ case "FINISHED" :
+ $('#job-info-status').css("color","black");
+ $('#job-info-cancel input').attr("disabled", true);
+ working_status = 0;
+ break;
+ default:
+ console.error(job_status+" status is not define.");
+ $('#job-info-cancel input').attr("disabled", true);
+ working_status = 0;
+ break;
+ }
- insertTable.appendChild(insertRow);
+ /* Insert data */
+ $(xml).find("Data").find("LogData").each(function() {
+ var insertTable = document.getElementById("logTable");
+ var insertRow = document.createElement("tr");
+ var insertCel1 = document.createElement("td");
+ var insertCel2 = document.createElement("td");
+
+ var line_number = $(this).attr("Line");
+ var line_data = $(this).text();
+
+ insertCel1.width = '30';
+ insertCel1.style.textAlign = 'right';
+ insertCel1.style.cellpacing = '5';
+ insertCel1.innerHTML = line_number;
+ last_line = line_number;
+
+ insertCel2.style.textAlign = 'left';
+ insertCel2.innerHTML = line_data;
+
+ insertRow.appendChild(insertCel1);
+ insertRow.appendChild(insertCel2);
+
+ insertTable.appendChild(insertRow);
+
+ });
+
+ if(working_status == 1){
+ console.log("scroll");
+ scrollToBottom();
+ }
+
+ autoQueryLog(conti, working_status);
+ });
+}
+function autoQueryLog(conti, working_status) {
+ if(conti && stop) {
+ queryLog();
}
- scrollToBottom();
- if(conti && stop) {
- waitRequestLog();
+ if(working_status == 1 && stop) {
+ console.log("status is working. try request");
+ setTimeout(function(){queryLog()}, 3000);
}
}
function moreLog() {
stop = 1;
- requestLog();
+ queryLog();
}
-function waitRequestLog() {
- sleep(3000);
- requestLog();
-}
-
-function requestLog() {
- createHttpRequest();
- if(request) {
- }
-}
-
-function updatePage() {
- if (request.readyState == 4) {
- if (request.status == 200) {
- receiveData();
- }
- else if (request.status == 404) {
- alert("Request URL does not exist");
- }
- else {
- alert("Error: status code is " + request.status);
- }
- }
+function cancelJob() {
+ cancelJobsJobid(job_id, function(xml) {
+ alert("Reqeusted cancel job : "+job_id);
+ });
}
function getYScroll()
function scrollToBottom() {
window.scrollTo(0,getYScroll());
}
+
$.mobile.pushStateEnabled = false;
});
-function errorProcess(jqXHR){
- switch (parseInt(jqXHR.status)) {
- case 401:
- expireSession();
- break;
- case 406:
- alert("Internal server error : " + jqXHR.responseText);
- break;
- default:
- alert("Server error : "+jqXHR.status);
- break;
- }
-}
-
-//$(document).ready(function() {
-// var hdhtml = $($.mobile.activePage).children('div').eq(0).clone();
-// var fthtml = $($.mobile.activePage).children('div').eq(2).clone();
-// $('div:jqmData(role="page")').live('pageinit',function() {
-// $('div:jqmData(role="header")').remove();
-// $('div:jqmData(role="footer")').remove();
-// $('div:jqmData(role="page")').prepend(hdhtml).append(fthtml);
-// });
-// if( $('div:jqmData(role="page")').length > 2 ){
-// $('div:jqmData(role="header")').remove();
-// $('div:jqmData(role="footer")').remove();
-// $('div:jqmData(role="page")').prepend(hdhtml).append(fthtml);
-// }
-//});
-
function clearFormData(elementId){
$("#"+elementId).find(':input').each(function() {
switch(this.type) {
var name = project.find("Name").text();
var type = project.find("Type").text();
var groupAccess = project.find("GroupAccess").text();
+ var maintainer = project.find("Maintainer").text();
var div = document.createElement('div');
div.setAttribute('data-role', 'collapsible');
projectList.appendChild(div);
var h2 = document.createElement('h2');
- h2.innerHTML = "["+type+"] "+name;
+ h2.innerHTML = '<span class="alignleft">'+name+'</span><span class="alignright">'+type+'</span>';
div.appendChild(h2);
- var br = document.createElement('br');
- div.appendChild(br);
+ var infoLine = document.createElement('p');
+ infoLine.setAttribute('style', 'font-size: 12px');
+ infoLine.innerHTML = "Maintainer : "+maintainer+"<br><br>";
+ div.appendChild(infoLine);
var ul = document.createElement('ul');
ul.setAttribute('data-role', "listview");
- S-Core Co., Ltd
-->
-<!DOCTYPE html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
- <script type="text/javascript" src="javascripts/jquery-1.7.1.js"></script>
+ <script src="javascripts/jquery-1.7.1.js"></script>
+
+ <script src="javascripts/dibs-api.js"></script>
+ <script src="javascripts/session.js"></script>
+ <script src="javascripts/log.js"></script>
<style>
- body
- {
- overflow:scroll;
- overflow:auto;
+ body {
+ margin: 0;
+ border: none;
+ padding: 0;
+ overflow:scroll;
+ overflow:auto;
+ }
+ #header {
+ border: solid 1px;
+ height: 28px;
+ width: 100%;
+ padding: 0;
+ background-color: yellow;
+ position:fixed;
+ z-index: 9;
+ vertical-align:middle
+ }
+ .job-info {
+ height: 26px;
+ position: relative;
+ top: 7px;
+ left: 5px;
+ font-size: 12px;
+ float: left;
+ vertical-align:middle
+ }
+ .job-info-data {
+
+ }
+ #job-info-cancel {
+ position: absolute;
+ right:10px;
+ }
+ #body {
+ position: absolute;
+ top: 30px;
+ width: 100%;
}
</style>
</head>
<body>
- <table id="logTable" style="border: #000000 1px solid; font-size:9pt">
- </table>
- <div data-role="controlgroup" data-type="horizontal">
+ <div id="header">
+ <div class="job-info" style="width: 120px;">
+ <span>Job ID: </span>
+ <strong><span id="job-info-id" class="job-info-data"></span></strong>
+ </div>
+ <div class="job-info" style="width: 200px;">
+ <span>Distribution: </span>
+ <strong><span id="job-info-distribution" class="job-info-data"></span></strong>
+ </div>
+ <div class="job-info" style="width: 200px;">
+ <span>Project: </span>
+ <strong><span id="job-info-project" class="job-info-data"></span></strong>
+ </div>
+ <div class="job-info" style="width: 200px; display:none;">
+ <span>Builder: </span>
+ <strong><span id="job-info-builder" class="job-info-data"></span></strong>
+ </div>
+ <div class="job-info" style="width: 200px;">
+ <span>Status: </span>
+ <strong><span id="job-info-status" class="job-info-data"></span></strong>
+ </div>
+ <div id="job-info-cancel" data-mini="true">
+ <input type="button" data-mini="true" value="CANCEL" onClick=cancelJob() / >
+ </div>
+ </div>
+ <div id="body">
+ <table id="logTable" style="width: 100%; border: #000000 1px solid; font-size:9pt">
+ </table>
+ <div id="footer" data-role="controlgroup" data-mini="true" data-type="horizontal">
<input type="button" value="More" onClick=moreLog() / >
<input type="button" value="Stop" onClick=stopLog() / >
</div>
</body>
</html>
-<script language="javascript" type="text/javascript">
- var request;
- var stop = 1;
-
- var baseUrl;
- var job_id;
- var last_line = 0;
-
- function createHttpRequest() {
- request = false;
- try {
- request = new XMLHttpRequest();
- }
- catch(trymicrosoft) {
- try {
- request = new ActiveXobject("Msxml2.XMLHTTP");
- }
- catch(othermicrosoft) {
- try {
- request = new ActiveXobject("Microsoft.XMLHTTP");
- }
- catch(failed) {
- request = false;
- }
- }
- }
-
- if(!request) {
- alert("Error XMLHttpRequest");
- }
- }
-
- function receiveData() {
- /* XML parsing */
- var xmlDoc = request.responseXML;
-
- /* pre-process */
- var logElements = xmlDoc.getElementsByTagName("Log")[0];
- var conti = Number(logElements.getAttribute("Continue"));
- job_id = logElements.getAttribute("JobId");
-
- /* Insert data */
- var dataElements = xmlDoc.getElementsByTagName("Data");
-
- for(var x=0 ; x < dataElements.length ; x++)
- {
- var insertTable = document.getElementById("logTable");
- var insertRow = document.createElement("tr");
- var insertCel1 = document.createElement("td");
- var insertCel2 = document.createElement("td");
-
- var line_number = dataElements[x].getAttribute("Line");
- var line_data = dataElements[x].childNodes[0].nodeValue;
-
- insertCel1.width = '30';
- insertCel1.style.textAlign = 'right';
- insertCel1.style.cellpacing = '5';
- insertCel1.innerHTML = line_number;
- last_line = line_number;
-
- insertCel2.style.textAlign = 'left';
- insertCel2.innerHTML = line_data;
-
- insertRow.appendChild(insertCel1);
- insertRow.appendChild(insertCel2);
-
- insertTable.appendChild(insertRow);
-
- }
- scrollToBottom();
-
- if(conti && stop) {
- requestLog();
- }
- }
-
- function stopLog() {
- stop = 0;
- }
-
- function moreLog() {
- stop = 1;
- requestLog();
- }
-
- function requestLog() {
- createHttpRequest();
- if(request) {
- var next_line = Number(last_line) + 1;
- var url = baseUrl + "jobs/log/"+ job_id + "/" + next_line;
- request.open("GET", url, true);
- request.onreadystatechange = updatePage;
- request.send(null);
- }
- }
-
- function updatePage() {
- if (request.readyState == 4) {
- if (request.status == 200) {
- receiveData();
- }
- else if (request.status == 404) {
- alert("Request URL does not exist");
- }
- else {
- alert("Error: status code is " + request.status);
- }
- }
- }
-
- function getYScroll()
- {
- var yScroll;
- if (window.innerHeight && window.scrollMaxY) {
- yScroll = window.innerHeight + window.scrollMaxY;
- } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
- yScroll = document.body.scrollHeight;
- } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
- yScroll = document.body.offsetHeight;
- }
- return yScroll;
- }
-
- function scrollToBottom() {
- window.scrollTo(0,getYScroll());
- }
-
- var init = function () {
- console.log("init() called");
- var myUrl = location.href;
- var varCut = myUrl.indexOf("?");
- var varCheck = myUrl.substring(varCut+1);
- eval(varCheck);
-
- job_id = jobid;
- console.log(job_id);
-
- var baseCut = myUrl.indexOf("log.html");
-
- baseUrl = myUrl.substring(0, baseCut);
- console.log("base url:"+baseUrl);
-
- requestLog();
- };
-
- $(document).ready(init);
-</script>
border-style: solid;
border-color: #999999;
}
+
+.alignleft {
+ float: left;
+}
+.alignright {
+ float: right;
+}