Skip to content
Snippets Groups Projects
Select Git revision
  • 329708dbc40e8173fe4861da3afa58385bc8f1f5
  • master default protected
  • update-renderer-class
3 results

cronlog-renderer.class.php

Blame
  • functions.js 7.61 KiB
    /*
    
    
    
    */
    
    // ----------------------------------------------------------------------
    // CONSTANTS
    // ----------------------------------------------------------------------
    
    const AM_RESULTS={
        0: 'OK',
        1: 'unknown',
        2: 'warning',
        3: 'error'
    };
    
    const OUT_ID_APPS='app-section';
    const OUT_ID_TAGS='tag-section';
    const ID_TAGINPUT='E_TAGS';
    
    // ----------------------------------------------------------------------
    // VARS
    // ----------------------------------------------------------------------
    
    var AM_TAGURL=false;
    var AM_PRETTYURL=false;
    var AM_TIMER=false;
    
    // ----------------------------------------------------------------------
    // FUNCTIONS
    // ----------------------------------------------------------------------
    
    function _getAMApiUrl(sPath){
        return AM_PRETTYURL 
            ? AM_SERVER_URL+sPath
            : AM_SERVER_URL+'/index.php?request='+sPath
        ;
    }
    
    /**
     * get url to fetch the tags
     * @returns string
     */
    function _getUrlForTags(){
        return  _getAMApiUrl('/v1/apps/tags');
    }
    
    /**
     * get url to fetch all applications with given tags
     * @param {string} tags list of tags - separated by comma
     * @returns 
     */
    function _getUrlWithTags(tags){
        return  _getAMApiUrl('/v1/apps/tags/'+tags+'/all');
        }
    
    /**
     * helper: get a table row with data of an application
     * @param {string} sLabel 
     * @param {string} sText 
     * @returns string
     */
    function _appItem(sLabel,sText){
        return '<tr><td>'+sLabel+'&nbsp;&nbsp;</td><td>'+sText+'</td></tr>'
    }
    
    /**
     * helper: get a 2 digit count
     * @param {int} i