Changeset 9f9dbe4a3435c32205c9b02c801f233d22486a01

Show
Ignore:
Timestamp:
06/11/09 22:46:51 (5 years ago)
Author:
Umar Farooq <umar@omniti.com>
git-committer:
Umar Farooq <umar@omniti.com> 1244760411 +0000
git-parent:

[504c244aab3b3a41bd8cde575384557c0053bee8]

git-author:
Umar Farooq <umar@omniti.com> 1244760411 +0000
Message:

adding permalink for graphs, probably needs some styling, and does not account for granularity matching yet, refs #100

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ui/web/htdocs/css/style.css

    ra91a782 r9f9dbe4  
    748748} 
    749749#maingraph div.plot-area { 
     750height:400px; 
     751width:780px; 
     752} 
     753#drawing_board { 
     754margin:0 auto; 
     755height:400px; 
     756width:780px; 
     757} 
     758#drawing_board div.plot-area { 
    750759height:400px; 
    751760width:780px; 
  • ui/web/htdocs/graph_panel.inc

    ra3e35d2 r9f9dbe4  
    5353} 
    5454 
     55function update_permalink(id, start, end, gran){ 
     56 $("#gpermalink a").attr("href", "drawing_board.php?otype=graph&id="+id+"&start="+start+"&end="+end+"&gran="+gran); 
     57} 
    5558 
    5659function graph_stream_data() { 
     
    113116  } 
    114117  current_graph_id = id; 
     118  update_permalink(current_graph_id, "", "", ""); 
    115119  fetch_graph_info(current_graph_id); 
    116120} 
     
    324328  return -1; 
    325329} 
    326  
     330//this function works on the maingraph dom element, which is used througout in graph editing 
    327331function refresh_graph_from_json(j) { 
    328332  graphinfo = j; 
     
    378382<span class="streamData ">Stream Data</span> 
    379383<span class="editGraph">Edit Graph</span> 
     384<span class="permalink" id="gpermalink"><a href="">Link</a></span> 
    380385 
    381386<h2 id="graphTitle"></h2> 
     
    454459                $("#graph_widgetCalendar").slideUp("slow"); 
    455460                $("#graph_datetool .datechoice").removeClass("selected"); 
     461 
     462                //start here will be in seconds 
    456463                displayinfo.start = time_windows[$(this).html()]; 
    457464                displayinfo.end = ''; 
    458465                $(this).addClass("selected"); 
     466                var cdate = new Date(); 
     467                update_permalink(graphinfo.id, parseInt(cdate.getTime() - displayinfo.start*1000), "", ""); 
    459468                maingraph.ReconGraphRefresh({graphid: graphinfo.id, start: time_windows[$(this).html()], end: '', type: graphinfo.type}); 
    460469                return false; 
     
    475484                        displayinfo.start = start.toUTCString(); 
    476485                        displayinfo.end = end.toUTCString(); 
     486                        update_permalink(graphinfo.id, parseInt(start.getTime()), parseInt(end.getTime()), ""); 
    477487                        maingraph.ReconGraphRefresh({graphid: graphinfo.id, start: displayinfo.start, end: displayinfo.end, type: graphinfo.type}); 
    478488                        $('#graph_datetool .range a.btn-slide').get(0).innerHTML = formated.join(' - '); 
  • ui/web/htdocs/js/recon.js

    ra3e35d2 r9f9dbe4  
    11//global objects to use for calling plot_ifram_data from stream 
     2//in addition to setting these to a div object and a initial value for the dirty bit,  
     3//you will also need to have a hidden div tag to use to insert the remote javascript 
     4// calls in an iframe, for example streambox for worksheets 
    25var stream_object; 
    36var stream_dirty; 
     
    316319            return this; 
    317320          } 
     321           
    318322          var o = this.data('__recon'); 
    319323          this.graphinfo = $.extend({}, o.graphinfo, options||{}); 
     
    321325          this.find(".plot-area") 
    322326              .html('<div class="centered"><div class="loading">&nbsp;</div></div>'); 
    323            
     327 
    324328          data = {'cnt':this.graphinfo.cnt, 
    325329                          'start':this.graphinfo.start, 
     
    731735        } 
    732736      } 
    733     }); 
     737       }); 
    734738 
    735739    $.getJSON("json/graph/info/" + graph_id, 
     
    788792  } 
    789793 
     794  function zoom_inpage(divid, id, start, end) { 
     795 
     796$.getJSON("json/graph/info/" + id, function (ginfo) { 
     797              var streaming = false; 
     798              plot_graph = $('#'+divid); 
     799              stream_graph = plot_graph; 
     800              plot_graph.ReconGraph({graphid: ginfo.id, type: ginfo.type}); 
     801              plot_graph.ReconGraphRefresh({graphid: ginfo.id, start: start, end: end, stacks: ginfo.stacks}); 
     802 
     803var dtool =  $("<div id='mini_ws_datetool'>"); 
     804    dtool.append('<div class="zoom"> \ 
     805                <dl> \ 
     806                        <dt>Zoom:</dt> \ 
     807                        <dd><a href="#" class="first datechoice">1d</a></dd> \ 
     808                        <dd><a href="#" class="datechoice">2d</a></dd> \ 
     809                        <dd><a href="#" class="datechoice">1w</a></dd> \ 
     810                        <dd><a href="#" class="datechoice">2w</a></dd> \ 
     811                        <dd><a href="#" class="datechoice">4w</a></dd> \ 
     812                        <dd><a href="#" class="datechoice">1y</a></dd> \ 
     813                </dl>\ 
     814                 </div>\ 
     815                  </div>'); 
     816 
     817var mheader = $("<div id='stream-header'>").append(dtool); 
     818    mheader.append("<span class='zoomStream'>Stream Data</span><br>"); 
     819    plot_graph.prepend(mheader); 
     820    plot_graph.append("<div class='stream-log' style='display:none'></div>"); 
     821    $(".zoomStream").click(function() { 
     822      if(!streaming) { 
     823        streaming = true; 
     824        $(".zoomStream").html('Streaming!').fadeIn('slow'); 
     825        $(".stream-log").removeAttr("style").html("stream log_"); 
     826        stream_data(ginfo.id); 
     827      } 
     828      else if(streaming) { 
     829        streaming = false; 
     830        $('#streambox').html(''); 
     831        $(".zoomStream").html('Stream Data').fadeIn('slow'); 
     832        $(".stream-log").attr("style", "display:none;"); 
     833        plot_graph.ReconGraphRefresh({graphid: ginfo.id, stacks: ginfo.stacks}); 
     834      } 
     835    }); //end stream click function 
     836 
     837$("#mini_ws_datetool .datechoice").click(function(){ 
     838      $(".datechoice").removeClass("selected"); 
     839      $(this).addClass("selected"); 
     840      plot_graph.ReconGraphRefresh({graphid: ginfo.id, stacks: ginfo.stacks, start: time_window_to_seconds($(this).html()), end: ''}); 
     841      return false; 
     842    }); 
     843 
     844    });//end json call 
     845 
     846  } 
    790847  function zoom_modal (id, gtype) { 
    791848 
     
    10221079    unlock: unlock_wforms, 
    10231080    zoom: zoom_modal, 
     1081    zoom_inpage: zoom_inpage, 
    10241082    stream: stream_data, 
    10251083    islocked: function () { return locked; }