Changeset 2935


Ignore:
Timestamp:
Nov 28, 2016, 12:02:53 PM (3 years ago)
Author:
kbut
Message:

check variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center/js/main.js

    r2930 r2935  
    88  this.scriptsLoaded=0;
    99}
    10 
     10AdminCenter.prototype.checkVariableExists = function checkVariableExists(variable,patharray){
     11
     12        let auxparent = variable,
     13            imax = patharray.length,
     14            i;
     15        for ( i = 0 ; i < imax; i++){
     16                if ( ! auxparent.hasOwnProperty(patharray[i])){return false};
     17                auxparent = auxparent[patharray[i]];
     18                if (auxparent === null && (i + 1 < imax)){return false};
     19        }
     20        return true;
     21}
    1122AdminCenter.prototype.getServerInfo = function getServerInfo(){
    1223  var self=this;
     
    1930    var ServerConfig=args;
    2031    self.ServerConfig=ServerConfig;
    21 
    22     $("#serverInfo_SRV_IP").html(ServerConfig["SRV_IP"]["value"]);
    23     $("#serverInfo_HOSTNAME").html(ServerConfig["HOSTNAME"]["value"]);
    24     $("#serverInfo_INTERNAL_DOMAIN").html(ServerConfig["INTERNAL_DOMAIN"]["value"]);
    25     $("#serverInfo_INTERNAL_INTERFACE").html(ServerConfig["INTERNAL_INTERFACE"]["value"]);
    26     $("#serverInfo_EXTERNAL_INTERFACE").html(ServerConfig["EXTERNAL_INTERFACE"]["value"]);
    27     $("#serverInfo_INTERNAL_MASK").html(ServerConfig["INTERNAL_MASK"]["value"]);
    28     $("#serverInfo_INTERNAL_NETWORK").html(ServerConfig["INTERNAL_NETWORK"]["value"]);
    29     $("#serverInfo_DNS1").html(ServerConfig["DNS_EXTERNAL"]["value"][0]);
    30     $("#serverInfo_DNS2").html(ServerConfig["DNS_EXTERNAL"]["value"][1]);
    31 
    32     $("#serverInfo_DHCP_ENABLE").html(ServerConfig["DHCP_ENABLE"]["value"]);
    33     $("#serverInfo_IP_RANGE").html(ServerConfig["DHCP_FIRST_IP"]["value"]+"<br/>"+ServerConfig["DHCP_LAST_IP"]["value"]);
    34     $("#serverInfo_DHCP_HOST_MAX").html(ServerConfig["DHCP_HOST_MAX"]["value"]);
    35 
    36     $("#serverInfo_LAST_MIRROR_DATE").html(ServerConfig["LLIUREXMIRROR"]["value"]["llx16"]["last_mirror_date"]);
    37     $("#serverInfo_MIRROR_SIZE").html(ServerConfig["LLIUREXMIRROR"]["value"]["llx16"]["mirror_size"]);
    38 
    39     $("#serverInfo_PROXY_ENABLED").html(ServerConfig["PROXY_ENABLED"]["value"]);
    40     $("#serverInfo_PROXY_HOST").html(ServerConfig["PROXY_HOST"]["value"]);
    41     $("#serverInfo_PROXY_HTTPORT").html(ServerConfig["PROXY_HTTP_PORT"]["value"]);
     32    if ( self.checkVariableExists(ServerConfig,['SRV_IP','value']) ) $("#serverInfo_SRV_IP").html(ServerConfig["SRV_IP"]["value"]);
     33    if ( self.checkVariableExists(ServerConfig,['INTERNAL_DOMAIN','value']) ) $("#serverInfo_HOSTNAME").html(ServerConfig["HOSTNAME"]["value"]);
     34    if ( self.checkVariableExists(ServerConfig,['INTERNAL_DOMAIN','value']) )$("#serverInfo_INTERNAL_DOMAIN").html(ServerConfig["INTERNAL_DOMAIN"]["value"]);
     35    if ( self.checkVariableExists(ServerConfig,['INTERNAL_INTERFACE','value']) ) $("#serverInfo_INTERNAL_INTERFACE").html(ServerConfig["INTERNAL_INTERFACE"]["value"]);
     36    if ( self.checkVariableExists(ServerConfig,['EXTERNAL_INTERFACE','value']) ) $("#serverInfo_EXTERNAL_INTERFACE").html(ServerConfig["EXTERNAL_INTERFACE"]["value"]);
     37    if ( self.checkVariableExists(ServerConfig,['INTERNAL_MASK','value']) ) $("#serverInfo_INTERNAL_MASK").html(ServerConfig["INTERNAL_MASK"]["value"]);
     38    if ( self.checkVariableExists(ServerConfig,['INTERNAL_NETWORK','value']) ) $("#serverInfo_INTERNAL_NETWORK").html(ServerConfig["INTERNAL_NETWORK"]["value"]);
     39    if ( self.checkVariableExists(ServerConfig,['DNS_EXTERNAL','value',0]) ) { $("#serverInfo_DNS1").html(ServerConfig["DNS_EXTERNAL"]["value"][0]);}
     40    if ( self.checkVariableExists(ServerConfig,['DNS_EXTERNAL','value',1]) ) { $("#serverInfo_DNS2").html(ServerConfig["DNS_EXTERNAL"]["value"][1]);}
     41
     42    if ( self.checkVariableExists(ServerConfig,['DHCP_ENABLE','value']) ) $("#serverInfo_DHCP_ENABLE").html(ServerConfig["DHCP_ENABLE"]["value"]);
     43    if ( self.checkVariableExists(ServerConfig,['DHCP_FIRST_IP','value']) ) $("#serverInfo_IP_RANGE").html(ServerConfig["DHCP_FIRST_IP"]["value"]+"<br/>"+ServerConfig["DHCP_LAST_IP"]["value"]);
     44    if ( self.checkVariableExists(ServerConfig,['DHCP_HOST_MAX','value']) ) $("#serverInfo_DHCP_HOST_MAX").html(ServerConfig["DHCP_HOST_MAX"]["value"]);
     45
     46    if ( self.checkVariableExists(ServerConfig,['LLIUREXMIRROR','value','llx16','last_mirror_date']) ) $("#serverInfo_LAST_MIRROR_DATE").html(ServerConfig["LLIUREXMIRROR"]["value"]["llx16"]["last_mirror_date"]);
     47    if ( self.checkVariableExists(ServerConfig,['LLIUREXMIRROR','value','llx16','mirror_size']) ) $("#serverInfo_MIRROR_SIZE").html(ServerConfig["LLIUREXMIRROR"]["value"]["llx16"]["mirror_size"]);
     48
     49    if ( self.checkVariableExists(ServerConfig,['PROXY_ENABLED','value']) ) $("#serverInfo_PROXY_ENABLED").html(ServerConfig["PROXY_ENABLED"]["value"]);
     50    if ( self.checkVariableExists(ServerConfig,['PROXY_HOST','value']) ) $("#serverInfo_PROXY_HOST").html(ServerConfig["PROXY_HOST"]["value"]);
     51    if ( self.checkVariableExists(ServerConfig,['PROXY_HTTP_PORT','value']) ) $("#serverInfo_PROXY_HTTPORT").html(ServerConfig["PROXY_HTTP_PORT"]["value"]);
    4252
    4353  });
Note: See TracChangeset for help on using the changeset viewer.