Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • v1.1.0
  • 1.1.2
  • v1.2.0
  • 1.0.2
  • v1.0.1-a
  • v1.0.1
  • v1.0
  • v0.3
  • v0.2
  • v0.1.1
  • v0.1
12 results

component-utils.js

Blame
  • 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);