/** * Class BX.Scale.InfoTable * Server's InfoTable control */ ;(function(window) { if (BX.Scale.InfoTable) return; /** * Class BX.Scale.InfoTable * @constructor */ BX.Scale.InfoTable = function (hostname, categories) { this.hostname = hostname; this.maxParamsCount = 0; this.structure = categories; this.loadBars = {}; this.tableObj = null; this.toggleButton = null; for(var category in categories) { var paramsCount = 0; for(var param in categories[category].PARAMS) { paramsCount++; } if(this.maxParamsCount < paramsCount) this.maxParamsCount = paramsCount; } }; /** * Returns DOM object contains InfoTable * @returns {object} */ BX.Scale.InfoTable.prototype.getDomObj = function() { if(!this.domObj) { this.domObj = BX.create('div',{props:{className:"adm-scale-table-wrap"}}); var table = BX.create('table',{props:{className:"adm-scale-info-table"}}), tr = BX.create('tr'), paramsTable = [], col = 0, row, param; BX.addClass(tr, "no_toggle"); for(var cat in this.structure) { tr.appendChild(BX.create('td', {props:{className:"adm-scale-info-table-header"}, html: this.structure[cat].NAME})); row = 0; for(param in this.structure[cat].PARAMS) { if(!paramsTable[row]) paramsTable[row] = []; paramsTable[row][col] = this.structure[cat].PARAMS[param]; this.structure[cat].PARAMS[param].id = this.hostname+"_infotable_"+cat+"_"+param; row++; } while(row < this.maxParamsCount) { if(!paramsTable[row]) paramsTable[row] = []; paramsTable[row][col] = null; row++; } col++; } table.appendChild(tr); for( row=0; row