Select Git revision
component-utils.js
component-utils.js 8.17 KiB
function copy_to_clipboard() {
var textArea = getInfoTextAreaObject();
// the copy() method copies the selected portion
// of the text area. That's why we have to select
// all its content before copying.
// May be misleading for users.
if (textArea.selectedText == "")
{
textArea.selectAll();
}
textArea.copy();
}
function delete_job_info(jobid) {
if(!db) {
console.log("database not available in delete_job_info");
return;
}
db.transaction( function(tx) {
tx.executeSql('DELETE FROM jobinfo WHERE job_id = ?', [ jobid ]);
});
}
function update_job_info(jobid, status, url, expDate) {
if(!db) {
console.log("database not available in update_job_info");
return;
}
db.transaction( function(tx) {
tx.executeSql('UPDATE jobinfo SET status = ?,url = ?,expiration_date = ? WHERE job_id = ?', [ status, url, expDate, jobid]);
});
}
function insert_job_info(projectName, jobid, status, url, expDate) {
if(!db) {
console.log("database not available in insert_job_info");
return;
}
db.transaction( function(tx) {
tx.executeSql('INSERT INTO jobinfo VALUES(?, ?, ?, ?, ?)', [ projectName, jobid, status, url, expDate ]);
});
}
function read_job_info() {
if(!db) {
console.log("database not available in read_job_info");
return;
}
db.transaction( function(tx) {
console.log("getting jobs");
var result = tx.executeSql('select * from jobinfo where status != "Running"');
var model = get_model();
if(result.rows.length > 0) {
for(var i = 0; i < result.rows.length; i++) {
//console.log("to model:");
//console.log(result.rows.item(i).project_name);
//console.log(result.rows.item(i).job_id);
//console.log(result.rows.item(i).status);
//console.log(result.rows.item(i).url);