public function dispatch() { $storage = $this->getStorage(); if (!empty($_REQUEST['dir'])) { $storage->setCurrentDirectory($_REQUEST['dir']); } if (isset($_GET['q'])) { $controller = new TypeAheadController(); } elseif (isset($_GET['callgraph'])) { $controller = new CallGraphController(); } elseif (isset($_GET['run'])) { if (isset($_GET['page'])) { switch ($_GET['page']) { case 'sql': $controller = new SqlController(); break; case 'elastic': $controller = new ElasticController(); break; default: throw new \RuntimeException('Unknown page: ' . $_GET['page']); } } else { $controller = new RunController(); } } else { $controller = new RunsListController(); } $controller->setStorage($storage); CurrentPageHelper::setCurrentController($controller); $controller->indexAction(); }
public static function render() { ?> <div class="input-group input-group-sm input-group-symbol"> <span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span> <table class="input-suggestions"> </table> <input class="form-control input-group-sm" style="width:20vw;" name="search" placeholder="Search Functions Here" autocomplete="off" type="text" list="symbols"> </div> <?php if (CurrentPage::getParam('symbol')) { ?> <a class="btn btn-primary btn-sm" href="<?php echo CurrentPage::url(array('symbol' => '')); ?> "> <span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span> View Top Level Run Report </a> <?php } }
public static function render($runData, $sqlData) { ?> <!DOCTYPE HTML><html> <?php HtmlHead::render('SQL Queries - ' . $runData['namespace'] . ' - SugarCRM XHProf Viewer', array('xhprof/css/xhprof.css', 'bower_components/bootstrap/dist/css/bootstrap.min.css', 'bower_components/highlightjs/styles/default.css', 'bower_components/font-awesome/css/font-awesome.min.css', 'xhprof/css/run-page.css'), array('bower_components/jquery/dist/jquery.min.js', 'bower_components/bootstrap/dist/js/bootstrap.min.js', 'bower_components/highlightjs/highlight.pack.min.js', 'xhprof/js/queries.js', 'bower_components/lexer/lexer.js', 'xhprof/js/sql-formatter.js')); ?> <body class="container-fluid"> <div> <div class="page-header form-inline" style="margin-top: 20px;"> <div class="navbar-form pull-right" style="padding-right:0;"> <a class="btn btn-default btn-overall-summary"> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <!-- <div>--><?php //static::renderOverallSummary(); ?> <!--</div>--> </a> <a class="btn btn-primary" href="<?php echo htmlspecialchars(CurrentPageHelper::getParam('list_url')); ?> "> <span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span> Back To List </a> </div> <h1><p>SugarCRM XHProf Viewer </p><small><?php echo htmlspecialchars($runData['namespace']); ?> </small></h1> </div> </div> <?php TopTabsTemplate::render($runData); ?> <?php SqlQueriesTableTemplate::render('SQL Queries', $sqlData, 'sql'); ?> <script type="text/javascript"> $(function () { $('[data-toggle="tooltip"]').tooltip({html: true}) }); </script> </body> </html><?php }
public static function render() { ?> <thead> <tr> <?php foreach (static::getColumns() as $column => $meta) { ?> <th <?php if (!empty($meta['percentage'])) { ?> colspan="2"<?php } ?> > <a href="<?php echo CurrentPageHelper::url(array('sort' => $column)); ?> "> <?php echo stat_description($column); ?> <?php if (CurrentPageHelper::getParam('sort') == $column) { ?> <i class="fa fa-sort-amount-desc" aria-hidden="true"></i> <?php } ?> </a> </th> <?php } ?> </tr> </thead> <?php }
protected static function thisPageFilterUrl($sortBy) { $controller = CurrentPage::getCurrentController(); $dir = $controller->getParam('f_sort_by') == $sortBy ? $controller->getParam('f_sort_dir') == 'desc' ? 'asc' : 'desc' : 'desc'; return CurrentPage::url(array('f_sort_by' => $sortBy, 'f_sort_dir' => $dir)); }
public static function render($runData) { ?> <ul class="nav nav-tabs"> <li role="presentation" <?php if (!CurrentPageHelper::getParam('page')) { ?> class="active"<?php } ?> > <a href="<?php echo UrlHelper::url(array('dir' => CurrentPageHelper::getParam('dir'), 'run' => CurrentPageHelper::getParam('run'), 'list_url' => CurrentPageHelper::getParam('list_url'))); ?> ">Function Calls</a> </li> <li role="presentation" <?php if (CurrentPageHelper::getParam('page') == 'sql') { ?> class="active"<?php } ?> > <a href="<?php echo UrlHelper::url(array('dir' => CurrentPageHelper::getParam('dir'), 'run' => CurrentPageHelper::getParam('run'), 'page' => 'sql', 'list_url' => CurrentPageHelper::getParam('list_url'))); ?> ">SQL Queries <?php if (isset($runData['sql_queries'])) { ?> <span class="badge"><?php echo FormatHelper::number($runData['sql_queries']); ?> </span> <?php } ?> </a> </li> <li role="presentation" <?php if (CurrentPageHelper::getParam('page') == 'elastic') { ?> class="active"<?php } ?> > <a href="<?php echo UrlHelper::url(array('dir' => CurrentPageHelper::getParam('dir'), 'run' => CurrentPageHelper::getParam('run'), 'page' => 'elastic', 'list_url' => CurrentPageHelper::getParam('list_url'))); ?> ">Elastic Queries <?php if (isset($runData['elastic_queries'])) { ?> <span class="badge"><?php echo FormatHelper::number($runData['elastic_queries']); ?> </span> <?php } ?> </a> </li> </ul> <?php }
protected static function typeAheadUrl() { return UrlHelper::url(array('dir' => CurrentPageHelper::getParam('dir'), 'run' => CurrentPageHelper::getParam('run'))); }
public static function renderTopButtons() { ?> <form method="get" class="form-inline" style="display:inline-block; margin:0"> <?php foreach (CurrentPage::getParams() as $key => $value) { ?> <input type="hidden" name="<?php echo htmlspecialchars($key); ?> " value="<?php echo htmlspecialchars($value); ?> "/> <?php } ?> <div class="input-group input-group-sm"> <div class="input-group-addon">/</div> <input type="text" class="form-control" name="regex_text" style="width: 350px" placeholder="RegEx" value="<?php echo htmlspecialchars(CurrentPage::getParam('regex_text')); ?> "> <div class="input-group-addon" style="border-left: 0; border-right: 0;">/</div> <input type="text" class="form-control" name="regex_mod" style="width: 50px" placeholder="" value="<?php echo htmlspecialchars(CurrentPage::getParam('regex_mod')); ?> "> </div> <div class="btn-group" role="group"> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('type') == 'all' ? 'active' : ''; ?> " href="<?php echo CurrentPage::url(array('type' => 'all')); ?> ">All Queries</a> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('type') == 'select' ? 'active' : ''; ?> " href="<?php echo CurrentPage::url(array('type' => 'select')); ?> ">Selects</a> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('type') == 'modify' ? 'active' : ''; ?> " href="<?php echo CurrentPage::url(array('type' => 'modify')); ?> ">Inserts/Updates</a> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('type') == 'other' ? 'active' : ''; ?> " href="<?php echo CurrentPage::url(array('type' => 'other')); ?> ">Others</a> </div> <div class="btn-group" role="group"> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('sort_by') == 'time' ? 'active' : ''; ?> " href="<?php echo CurrentPage::url(array('sort_by' => 'time')); ?> ">Sort by Time</a> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('sort_by') == 'hits' ? 'active' : ''; ?> " href="<?php echo CurrentPage::url(array('sort_by' => 'hits')); ?> ">Sort by Hits</a> <a class="btn btn-primary btn-sm <?php echo CurrentPage::getParam('sort_by') == 'exec_order' ? 'active' : ''; ?> " data-toggle="tooltip" title="Sort in Execution Order" href="<?php echo CurrentPage::url(array('sort_by' => 'exec_order')); ?> ">Exec. Order</a> </div> <input type="submit" style="display:none;"/> </form> <?php }
protected static function callgraphUrl($symbol) { return UrlHelper::url(array('dir' => CurrentPageHelper::getParam('dir'), 'run' => CurrentPageHelper::getParam('run'), 'func' => $symbol)); }
/** * Generates a tabular report for all functions. This is the top-level report. * * @author Kannan */ function full_report($url_params, $symbol_tab) { $callgraph_report_title = '<i class="fa fa-pie-chart"></i> View Full Callgraph'; $callGraphUrl = \Sugarcrm\XHProf\Viewer\Templates\Helpers\UrlHelper::url(array('callgraph' => 1, 'dir' => CurrentPageHelper::getParam('dir'), 'run' => CurrentPageHelper::getParam('run'))); $callGraphButton = '<a class="btn btn-primary btn-sm" target="_blank" href="' . $callGraphUrl . '">' . $callgraph_report_title . '</a>'; $flat_data = array(); foreach ($symbol_tab as $symbol => $info) { $tmp = $info; $tmp["fn"] = $symbol; if (!isset($tmp['bcc'])) { $tmp['bcc'] = ''; } $flat_data[] = $tmp; } usort($flat_data, 'sort_cbk'); if (!empty($url_params['all'])) { $limit = 0; // display all rows } else { $limit = 100; // display only limited number of rows } print_flat_data('Top-Level Report ', $flat_data, $limit, $callGraphButton); }