+ ////////////////////
+ // the names of the hidden fields that hold the input to this class
+ // are hard-wired for now
+ this.parse_html = function () {
+ this.sliceid=getInnerText($$("span#leases_sliceid")[0]).strip();
+ this.slicename=getInnerText($$("span#leases_slicename")[0]).strip();
+ this.leases_grain=getInnerText($$("span#leases_grain")[0]).strip();
+ this.leases_offset=getInnerText($$("span#leases_offset")[0]).strip();
+ this.leases_slots=getInnerText($$("span#leases_slots")[0]).strip();
+ this.leases_w=getInnerText($$("span#leases_w")[0]).strip();
+
+ var table = $$("table#leases_data")[0];
+ // no reservable nodes - no data
+ if ( ! table) return false;
+ // check for the body too xxx
+ // the nodelabels
+ var data = [], axisx = [], axisy = [];
+ table.getElementsBySelector("tbody>tr>th").each(function (cell) {
+ axisy.push(getInnerText(cell));
+ });
+
+ // the timeslot labels
+ table.getElementsBySelector("thead>tr>th").each(function (cell) {
+ /* [0]: timestamp -- [1]: displayable*/
+ axisx.push(getInnerText(cell).split("&"));
+ });
+
+ // leases - expect colspan to describe length in grains
+ // the text contents is expected to be lease_id & slicename
+ table.getElementsBySelector("tbody>tr>td").each(function (cell) {
+ var cell_data;
+ var slice_attributes=getInnerText(cell).split('&');
+ // booked leases come with lease id and slice name
+ if (slice_attributes.length == 2) {
+ // leases is booked : slice_id, slice_name, duration in grains
+ cell_data=new Array (slice_attributes[0], slice_attributes[1], cell.colSpan);
+ } else {
+ cell_data = new Array ('','',cell.colSpan);
+ }
+ data.push(cell_data);
+ });
+
+ this.axisx=axisx;
+ this.axisy=axisy;
+ this.data=data;
+ return true;
+ }