diff --git a/inc/charts.php b/inc/charts.php index 618d122..ba799f5 100644 --- a/inc/charts.php +++ b/inc/charts.php @@ -1,9 +1,9 @@ width); $iHeight=round($this->height); - $sApp = ($this->app ? $this->app->name : cADApp::NO_APP); + $sApp = ($this->app ? $this->app->id : cADApp::NO_APP); ?>
="" + ="" + ="" + ="" + ="" style="position:relative;max-width:px;width:px;height=px;overflow-wrap:break-all" - showZoom="" - showCompare="" - hideIfNoData="hideIfNoData?>" - hideGroupIfNoData="" + ="" + ="" + ="hideIfNoData?>" + ="" go_URL){?> - goUrl="go_URL?>" - goLabel="go_hint?>" + ="go_URL?>" + ="go_hint?>" metrics); $i++){ $oMetric = $this->metrics[$i]; - ?>metric="metric?>" title="caption?>" + ="metric?>" + ="caption?>" + > @@ -83,7 +103,8 @@ class cChart{ const URL="u"; const STYLE="s"; const WIDTH="w"; - + + //************************************************************ const CHART_WIDTH_LARGER = 1800; const CHART_WIDTH_LARGE = 1024; @@ -93,10 +114,10 @@ class cChart{ const CHART_WIDTH_LETTERBOX = 1024; const CHART_HEIGHT_LETTERBOX = 250; - + const CHART_WIDTH_LETTERBOX2 = 1024; const CHART_HEIGHT_LETTERBOX2 = 200; - + //**************************************************************************** public static function do_header(){ global $home, $jsinc; @@ -106,9 +127,9 @@ public static function do_header(){
...
@@ -134,43 +155,43 @@ private static function pr_render_item($poApp, $paItem, $piHeight = null, $piWid break; default: if (!isset($paItem[self::METRIC])) throw new Exception("No Metric Provided"); - + $oItem = new cChartItem(); $oItem->app = $poApp; if (isset($paItem[self::HIDEIFNODATA])) $oItem->hideIfNoData = $paItem[self::HIDEIFNODATA]; - + $oItem->hideGroupIfNoData = cChart::$hideGroupIfNoData; //-------------------------------------------------- $oMetricItem = new cChartMetricItem(); $oMetricItem->metric = $paItem[self::METRIC]; - - if (isset($paItem[self::LABEL])){ + + if (isset($paItem[self::LABEL])){ $sLabel = $paItem[self::LABEL]; if ($sLabel == null) throw new Exception("No Label Provided"); $oMetricItem->caption = $sLabel; }else $oMetricItem->caption = $paItem[self::METRIC]; $oItem->metrics[] = $oMetricItem; - + //-------------------------------------------------- $oItem->width = self::$width; if ($piWidth) $oItem->width = $piWidth; if ($piHeight) $oItem->height = $piHeight; - + //if (isset($paItem[self::APP])) $oItem->app = $paItem[self::APP]; if (isset($paItem[self::GO_URL])) $oItem->go_URL = $paItem[self::GO_URL]; if (isset($paItem[self::GO_HINT])) $oItem->go_hint = $paItem[self::GO_HINT]; - + //-------------------------------------------------- //cDebug::vardump($oItem); $oItem->write_html(); - } + } } //##################################################################################### //##################################################################################### - public static function render_metrics($poApp, $paItems, $piWidth=cChart::CHART_WIDTH_LETTERBOX, $piHeight = cChart::CHART_HEIGHT_SMALL ){ + public static function render_metrics($poApp, $paItems, $piWidth=cChart::CHART_WIDTH_LETTERBOX, $piHeight = cChart::CHART_HEIGHT_SMALL ){ $sClass= cRender::getRowClass(); ?>
"; $end_tag = ""; @@ -220,7 +241,7 @@ public static function metrics_table($poApp, $paItems, $piMaxCols, $psRowClass, $start_tag = ""; } - + $iWidth = null; if ( isset( $aItem[self::WIDTH])) { $iWidth = $aItem[self::WIDTH]; @@ -237,8 +258,8 @@ public static function metrics_table($poApp, $paItems, $piMaxCols, $psRowClass, } } if ($iCol !== 0) echo ""; - ?>
"; $end_tag = "
- - - - - + + + > +
"; sHTML += ""; sHTML += cRenderMDL.action_start(); - sHTML += "
"+ - poApp.name+" .. please wait" + - "
"; + sHTML += cMenusCode.appfunctions( poApp, sHome, poApp.id+"menu"); var oParams = {}; oParams[ cRenderQS.APP_ID_QS ] = poApp.id; diff --git a/js/widgets/allapps.js b/js/widgets/allapps.js index e878a29..a450e86 100644 --- a/js/widgets/allapps.js +++ b/js/widgets/allapps.js @@ -14,37 +14,37 @@ $.widget( "ck.adallapps",{ //#################################################################` _create: function(){ var oThis = this; - + //set basic stuff var oElement = this.element; oElement.uniqueId(); - + //check for necessary attributes - if (!oElement.attr("metric1")) $.error("metric1 attr is missing!"); - if (!oElement.attr("metric2")) $.error("metric2 attr is missing!"); + if (!oElement.attr("metric1")) $.error("metric1 attr is missing!"); + if (!oElement.attr("metric2")) $.error("metric2 attr is missing!"); if (!oElement.attr("metric3")) $.error("metric3 attr is missing!"); - if (!oElement.attr("title1")) $.error("title1 attr is missing!"); - if (!oElement.attr("title2")) $.error("title2 attr is missing!"); + if (!oElement.attr("title1")) $.error("title1 attr is missing!"); + if (!oElement.attr("title2")) $.error("title2 attr is missing!"); if (!oElement.attr("title3")) $.error("title3 attr is missing!"); if (!oElement.attr("baseurl")) $.error("baseurl attr is missing!"); - + //check for necessary classes - if (!oElement.admenu) $.error("admenu widget is missing! check includes"); + if (!oElement.admenu) $.error("admenu widget is missing! check includes"); if (!oElement.attr(cRenderQS.LIST_MODE_QS) && !oElement.adchart) - $.error("charts widget is missing! check includes"); - if (!cQueueifVisible) $.error("Queue on visible class is missing! check includes"); - if (!bean) $.error("bean class is missing! check includes"); - + $.error("charts widget is missing! check includes"); + if (!cQueueifVisible) $.error("Queue on visible class is missing! check includes"); + if (!bean) $.error("bean class is missing! check includes"); + //check for required options - if (!oElement.attr(cRenderQS.HOME_QS)) $.error("home missing!"); - - + if (!oElement.attr(cRenderQS.HOME_QS)) $.error("home missing!"); + + //set behaviour for widget when it becomes visible var oQueue = new cQueueifVisible(); - bean.on(oQueue, "status", function(psStatus){oThis.onStatus(psStatus);} ); - bean.on(oQueue, "start", function(){oThis.onStart();} ); - bean.on(oQueue, "result", function(poHttp){oThis.onResponse(poHttp);} ); - bean.on(oQueue, "error", function(poHttp){oThis.onError(poHttp);} ); + bean.on(oQueue, "status", function(psStatus){oThis.onStatus(psStatus);} ); + bean.on(oQueue, "start", function(){oThis.onStart();} ); + bean.on(oQueue, "result", function(poHttp){oThis.onResponse(poHttp);} ); + bean.on(oQueue, "error", function(poHttp){oThis.onError(poHttp);} ); oQueue.go(oElement, this.get_url()); }, @@ -55,11 +55,11 @@ $.widget( "ck.adallapps",{ oElement.empty(); oElement.append("status: " +psMessage); }, - + //******************************************************************* onError: function(poHttp, psMessage){ var oElement = this.element; - + oElement.empty(); oElement.addClass("ui-state-error"); oElement.append("There was an error getting data "); @@ -71,19 +71,19 @@ $.widget( "ck.adallapps",{ oElement.empty(); oElement.removeClass(); - + var oLoader = $("
"); oLoader.gSpinner({scale: 0.25}); oElement.append(oLoader).append("Loading: "); }, - + //******************************************************************* onResponse: function(poHttp){ var oElement = this.element; - + oElement.empty(); oElement.removeClass(); - + var aResponse = poHttp.response; if (aResponse.length == 0 ) oElement.append(cRender.messagebox("no applications found")); @@ -96,53 +96,77 @@ $.widget( "ck.adallapps",{ } }, - + //################################################################# //# functions //#################################################################` get_url: function (){ var oElement = this.element; - + var sBaseUrl = oElement.attr(cRenderQS.HOME_QS)+this.consts.REST_API; return sBaseUrl; }, - + //******************************************************************* render_charts: function(paData){ var oElement = this.element; - var sStyle = 'type="adchart" style="position: relative; max-width: 341px; width: 341px; height: 125px;" class="chart_widget"'; var sHome = oElement.attr(cRenderQS.HOME_QS); var oThis = this; - + paData.forEach( function(poApp){ - var oParams = {}; - oParams[ cRenderQS.APP_ID_QS ] = poApp.name; - oParams[ cRenderQS.APP_QS ] = poApp.id; + var oUrlParams = {}; - var sHTML = cRenderMDL.card_start(); + if (i==1){ + oGoParams[ cRenderQS.APP_QS ] = poApp.name; + oGoParams[ cRenderQS.APP_ID_QS ] = poApp.id; + var sGoUrl = cBrowser.buildUrl(oElement.attr("baseurl"),oGoParams); + } + + var sHTML = cRenderMDL.card_start(); sHTML += cRenderMDL.body_start(); - sHTML += "
Please wait..
"; - sHTML += "
Please wait..
"; sHTML += "
Please wait..
"; + + for (var i=1; i<=3; i++){ + var oChartParams = { + type:"adchart", + style:"position: relative; max-width: 341px; width: 341px; height: 125px;", + class:"chart_widget", + id:"a"+poApp.id+"i"+i , + }; + oChartParams[cRenderQS.HOME_QS] = sHome ; + oChartParams[cRenderQS.APP_ID_QS] = poApp.id; + oChartParams[cChartConsts.ATTR_TITLE + "0"] = oElement.attr("title"+i) ; + oChartParams[cRenderQS.METRIC_QS + "0"] = oElement.attr("metric"+i); + oChartParams[cChartConsts.ATTR_SHOW_ZOOM] =1; + oChartParams[cChartConsts.ATTR_SHOW_COMPARE] = 1; + oChartParams[cChartConsts.ATTR_PREVIOUS] = 0; + oChartParams[cChartConsts.ATTR_WIDTH] = cChartConsts.WIDTH_3ACROSS; + oChartParams[cChartConsts.ATTR_HEIGHT] = cChartConsts.LETTERBOX_HEIGHT; + + if (i==1) oChartParams[cChartConsts.ATTR_GO_URL] = sGoUrl ; + var oDiv = $("
", oChartParams).append("please Wait"); + + sHTML += oDiv[0].outerHTML; + } sHTML += "
"; sHTML += cRenderMDL.action_start(); - sHTML += "
"+poApp.name+" .. please wait
"; - sHTML += "
"; + sHTML += cMenusCode.appfunctions( poApp, sHome, poApp.id+"menu"); + sHTML += ""; sHTML += "

"; oElement.append(sHTML); - - + + //- - - - -convert chart to Widgets if (cCharts.isGoogleChartsLoaded()) - convert_charts_to_widgets(poApp) + oThis.convert_charts_to_widgets(poApp) else cCharts.load_google_charts(function(){oThis.convert_charts_to_widgets(poApp);}); - + //- - - render the menus - $("#"+poApp.id+"menu").admenu(); + $("#"+poApp.id+"menu").admenu(); }); }, - + //******************************************************************* convert_charts_to_widgets: function(poApp){ var oElement = this.element; @@ -151,33 +175,15 @@ $.widget( "ck.adallapps",{ oParams[ cRenderQS.APP_QS ] = poApp.name; var sUrl = cBrowser.buildUrl(oElement.attr("baseurl"),oParams); var sHome = oElement.attr(cRenderQS.HOME_QS); - - $("#"+poApp.id+"1").adchart({ - home:sHome, - appName:poApp.name, - title:oElement.attr("title1"), metric:oElement.attr("metric1"), goUrl:sUrl, - width:cChartConsts.WIDTH_3ACROSS,height:cChartConsts.LETTERBOX_HEIGHT,showZoom:1,showCompare:1,previous_period:0 - }); - $("#"+poApp.id+"2").adchart({ - home:sHome, - appName:poApp.name, - title:oElement.attr("title2"), - metric:oElement.attr("metric2"), - width:cChartConsts.WIDTH_3ACROSS,height:cChartConsts.LETTERBOX_HEIGHT,showZoom:1,showCompare:1,previous_period:0 - }); - $("#"+poApp.id+"3").adchart({ - home:sHome, - appName:poApp.name, - title:oElement.attr("title3"), - metric:oElement.attr("metric3"), - width:cChartConsts.WIDTH_3ACROSS,height:cChartConsts.LETTERBOX_HEIGHT,showZoom:1,showCompare:1,previous_period:0 - }); + + for (var i=1; i<=3; i++) + $("#a"+poApp.id+"i"+i).adchart(); }, - + //******************************************************************* render_list: function(paData){ var oElement = this.element; - + var sHTML = cRenderMDL.card_start(); sHTML += cRenderMDL.body_start(); sHTML += "

"; @@ -187,7 +193,7 @@ $.widget( "ck.adallapps",{ var oParams = {}; oParams[ cRenderQS.APP_ID_QS ] = poApp.name; oParams[ cRenderQS.APP_QS ] = poApp.id; - + var sUrl = cBrowser.buildUrl(oElement.attr("baseurl"),oParams); var sCh = poApp.name[0]; if (sCh !== sLastCh){ @@ -198,7 +204,7 @@ $.widget( "ck.adallapps",{ }); sHTML += "
"; oElement.append(sHTML); - }, - + }, + }); \ No newline at end of file diff --git a/js/widgets/chart.js b/js/widgets/chart.js index 3956386..19ff7d9 100644 --- a/js/widgets/chart.js +++ b/js/widgets/chart.js @@ -3,25 +3,12 @@ $.widget( "ck.adchart",{ //################################################################# //# Definition //################################################################# + //TODO use attributes rather than options so that widget is self-contained and can work directly from DOM Element options:{ - title:null, - home:"", - appName:null, - metric: null, - width:null, - height:null, - onClick:null, - shortNoData:false, - showZoom:true, - onSelect: null, - previous_period:false, - goUrl:null, - goCaption:"Go", - hideIfNoData:false, pr__upper_div: null, pr__lower_div: null }, - + consts:{ METRIC_API:"rest/getMetric.php", CHART_PHP_FOLDER:"pages/charts", @@ -30,7 +17,13 @@ $.widget( "ck.adchart",{ csv_url:"allcsv.php", zoom_url:"metriczoom.php", compare_url:"compare.php", - + + ATTR_APP : "aap", + ATTR_TITLE : "ati", + ATTR_METRIC : "ame", + ATTR_WIDTH : "awi", + ATTR_HEIGHT : "ahe", + INFO_WIDTH:70, BUTTON_WIDTH:30 }, @@ -40,58 +33,55 @@ $.widget( "ck.adchart",{ //#################################################################` _create: function(){ var oThis, oElement; - + //set basic stuff oThis = this; oElement = oThis.element; oElement.uniqueId(); - + //check for necessary classes - if (!cQueueifVisible) $.error("Queue on visible class is missing! check includes"); - if (!bean) $.error("bean class is missing! check includes"); - if (!cHttp2) $.error("http2 class is missing! check includes"); - if (!oElement.gSpinner) $.error("gSpinner is missing! check includes"); - if (!oElement.slideout) $.error("slideout is missing! check includes"); - if (!$.event.special.inview) $.error("inview class is missing! check includes"); - if (!oElement.inViewport ) $.error("inViewport class is missing! check includes"); - + if (!cQueueifVisible) $.error("Queue on visible class is missing! check includes"); + if (!bean) $.error("bean class is missing! check includes"); + if (!cHttp2) $.error("http2 class is missing! check includes"); + if (!oElement.gSpinner) $.error("gSpinner is missing! check includes"); + if (!oElement.slideout) $.error("slideout is missing! check includes"); + //check for required options - var oOptions = this.options; - if (!oOptions.appName) $.error("appName missing!"); - if (!oOptions.title) $.error("title missing!"); - if (!oOptions.metric) $.error("metric missing!"); - if (!oOptions.width) $.error("width missing!"); - if (!oOptions.height) $.error("height missing!"); - + if (!oElement.attr(cRenderQS.APP_ID_QS)) $.error("app ID missing!"); + if (!oElement.attr(cChartConsts.ATTR_TITLE+"0")) $.error("title missing!") + if (!oElement.attr(cRenderQS.METRIC_QS+"0")) $.error("metric missing!"); + if (!oElement.attr(cChartConsts.ATTR_WIDTH)) $.error("width missing!"); + if (!oElement.attr(cChartConsts.ATTR_HEIGHT)) $.error("height missing!"); + //set display style oElement.removeClass(); oElement.addClass("chart_widget"); - + //set the DIV size - oElement.outerWidth(oOptions.width ); - oElement.outerHeight(oOptions.height ); - oElement.css("max-width",""+oOptions.width+"px"); - + oElement.outerWidth(oElement.attr(cChartConsts.ATTR_WIDTH) ); + oElement.outerHeight(oElement.attr(cChartConsts.ATTR_HEIGHT) ); + oElement.css("max-width",""+oElement.attr(cChartConsts.ATTR_WIDTH)+"px"); + //create overlapping divs this.pr__create_overlapping_divs(); - - + + //wait for widget to become visible this.pr__queue_element(); }, - + //******************************************************************* pr__queue_element: function(){ var oThis, oElement; oThis = this; oElement = oThis.element; - + var oQueue = new cQueueifVisible(); - bean.on(oQueue, "status", function(psStatus){oThis.onStatus(psStatus);} ); - bean.on(oQueue, "start", function(){oThis.onStart();} ); - bean.on(oQueue, "result", function(poHttp){oThis.onResponse(poHttp);} ); - bean.on(oQueue, "error", function(poHttp){oThis.onError(poHttp);} ); - oQueue.go(oElement, this.pr__get_chart_url()); + bean.on(oQueue, "status", function(psStatus){oThis.onStatus(psStatus);} ); + bean.on(oQueue, "start", function(){oThis.onStart();} ); + bean.on(oQueue, "result", function(poHttp){oThis.onResponse(poHttp);} ); + bean.on(oQueue, "error", function(poHttp){oThis.onError(poHttp);} ); + oQueue.go(oElement, this.pr__get_url()); }, //******************************************************************* @@ -100,14 +90,14 @@ $.widget( "ck.adchart",{ var oOptions = this.options; oThis = this; oElement = oThis.element; - + oOptions.pr__upper_div = oElement.attr("id") + "_U"; var oUpperDiv = $("
", {id:oOptions.pr__upper_div}).append("Please wait..."); - - oOptions.pr__lower_div = oElement.attr("id") + "_L"; + +oOptions.pr__lower_div = oElement.attr("id") + "_L"; var oLowerDiv = $("
", {id:oOptions.pr__lower_div}).append("Please wait..."); - oElement.slideout({width:oOptions.width, height:oOptions.height, uppercontent:oUpperDiv, lowercontent:oLowerDiv}); + oElement.slideout({width:oElement.attr(cChartConsts.ATTR_WIDTH), height:oElement.attr(cChartConsts.ATTR_HEIGHT), uppercontent:oUpperDiv, lowercontent:oLowerDiv}); }, @@ -117,180 +107,195 @@ $.widget( "ck.adchart",{ onStatus: function(psStatus){ var oThis = this; var oOptions = this.options; - var oElement = $("#"+oOptions.pr__upper_div ); + var oUpperElement = $("#"+oOptions.pr__upper_div ); - oElement.empty(); - oElement.addClass("chart_widget"); - oElement.addClass("chart_initialising"); - oElement.append(psStatus); + oUpperElement.empty(); + oUpperElement.addClass("chart_widget"); + oUpperElement.addClass("chart_initialising"); + oUpperElement.append(psStatus); }, - - + + //******************************************************************* onError: function(poHttp, psMessage){ var oThis = this; var oOptions = this.options; - var oElement = $("#"+oOptions.pr__upper_div ); + var oTopElement = this.element; + var oUpperElement = $("#"+oOptions.pr__upper_div ); var oConsts = this.consts; - - oElement.empty(); - oElement.addClass("ui-state-error"); - oElement.append("There was an error getting chart data for "+ oOptions.title); + + oUpperElement.empty(); + oUpperElement.addClass("ui-state-error"); + oUpperElement.append("There was an error getting chart data for "+ oTopElement.attr(cChartConsts.ATTR_TITLE+"0")); var btnForce = $("
"; sHTML += "
"; sHTML += cRenderMDL.action_start(); - sHTML += - ""; + sHTML += cMenusCode.tierfunctions(poTier, oElement.attr(cRenderQS.HOME_QS)); sHTML += ""; } sHTML += "

"; diff --git a/js/widgets/menu.js b/js/widgets/menu.js index 39bc0d1..8c6e22e 100644 --- a/js/widgets/menu.js +++ b/js/widgets/menu.js @@ -261,9 +261,9 @@ $.widget( "ck.admenu",{ oSelect.append(oOption); var iCount = 1; while (true){ - sTier = oElement.attr("tname."+iCount); + var sTier = oElement.attr("tname."+iCount); if (!sTier) break; - sTid = oElement.attr("tid."+iCount); + var sTid = oElement.attr("tid."+iCount); var oParams = {}; oParams[cRenderQS.TIER_QS] = sTier; diff --git a/js/widgets/tierserviceendpoints.js b/js/widgets/tierserviceendpoints.js new file mode 100644 index 0000000..e621bf8 --- /dev/null +++ b/js/widgets/tierserviceendpoints.js @@ -0,0 +1,190 @@ +'use strict'; +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +$.widget( "ck.adserviceendpoints",{ + //################################################################# + //# Definition + //################################################################# + consts:{ + REST_API:"/rest/tierserviceendpoints.php" + }, + + //################################################################# + //# Constructor + //#################################################################` + _create: function(){ + var oThis = this; + + //set basic stuff + var oElement = this.element; + oElement.uniqueId(); + + //check for necessary classes + if (!cQueueifVisible) $.error("Queue on visible class is missing! check includes"); + + //check for required options + if (!oElement.attr(cRenderQS.TIER_QS)) $.error("tier Name missing!"); + if (!oElement.attr(cRenderQS.TIER_ID_QS)) $.error("tier ID missing!"); + if (!oElement.attr(cRenderQS.APP_ID_QS)) $.error("app ID missing!"); + if (!oElement.attr(cRenderQS.HOME_QS)) $.error("home missing!"); + if (!oElement.attr(cRenderQS.LIST_MODE_QS) && !oElement.adchart) + $.error("charts widget is missing! check includes"); + if (!bean) $.error("bean class is missing! check includes"); + + + //set behaviour for widget when it becomes visible + var oQueue = new cQueueifVisible(); + bean.on(oQueue, "status", function(psStatus){oThis.onStatus(psStatus);} ); + bean.on(oQueue, "start", function(){oThis.onStart();} ); + bean.on(oQueue, "result", function(poHttp){oThis.onResponse(poHttp);} ); + bean.on(oQueue, "error", function(poHttp){oThis.onError(poHttp);} ); + oQueue.go(oElement, this.get_url()); + }, + + + //******************************************************************* + onStatus: function(psMessage){ + var oElement = this.element; + oElement.empty(); + oElement.append("status: " +psMessage); + }, + + //******************************************************************* + onError: function(poHttp, psMessage){ + var oThis = this; + var oElement = this.element; + + oElement.empty(); + oElement.addClass("ui-state-error"); + oElement.append("There was an error getting data "); + }, + +//******************************************************************* + onStart: function(poItem){ + var oElement = this.element; + + oElement.empty(); + oElement.removeClass(); + + var oLoader = $("

"); + oLoader.gSpinner({scale: .25}); + oElement.append(oLoader).append("Loading: "); + }, + + //******************************************************************* + onResponse: function(poHttp){ + var oThis = this; + var oElement = this.element; + + oElement.empty(); + oElement.removeClass(); + + var aResponse = poHttp.response; + if (aResponse.length == 0 ) + oElement.append(cRender.messagebox("no service end points found")); + else + this.render(poHttp.response); + }, + + + //################################################################# + //# functions + //#################################################################` + get_url: function (){ + var sUrl; + var oConsts = this.consts; + var oElement = this.element; + + var oParams = {}; + oParams[ cRenderQS.TIER_ID_QS ] = oElement.attr(cRenderQS.TIER_ID_QS); + oParams[ cRenderQS.APP_ID_QS ] = oElement.attr(cRenderQS.APP_ID_QS); + + var sBaseUrl = oElement.attr(cRenderQS.HOME_QS)+oConsts.REST_API; + sUrl = cBrowser.buildUrl(sBaseUrl, oParams); + return sUrl; + }, + + //******************************************************************* + render: function(paData){ + var oThis = this; + var oElement = this.element; + var sBaseMetric = "Service Endpoints|"+oElement.attr(cRenderQS.TIER_QS); + + oElement.empty(); + var oTable = $("", {border:1,cellspacing:0,style:"width:100%;overflow-wrap: break-word"}); + oTable.append(""); + paData.forEach( function(poSP){ + var sBaseUrl = oElement.attr(cRenderQS.HOME_QS) + "/pages/service/endpoint.php"; + var oParams = {}; + oParams[ cRenderQS.TIER_ID_QS ] = oElement.attr(cRenderQS.TIER_ID_QS); + oParams[ cRenderQS.APP_ID_QS ] = oElement.attr(cRenderQS.APP_ID_QS); + oParams[ cRenderQS.SERVICE_ID_QS ] = poSP.id; + oParams[ cRenderQS.SERVICE_QS ] = poSP.name; + var sUrl = cBrowser.buildUrl(sBaseUrl, oParams); + var sSPMetric = sBaseMetric + "|" + poSP.name; + + //----------------------------------------------------------------------- + var oRow = $(""); + oRow.append(""); + oTable.append(oRow); + + //----------------------------------------------------------------- + var oChartParams = {}; + oChartParams[cChartConsts.ATTR_TITLE + "0"] = poSP.name ; + oChartParams[cRenderQS.APP_ID_QS] = oElement.attr(cRenderQS.APP_ID_QS); + oChartParams["type"] = "spwidget"; + oChartParams["style"] = "position: relative; max-width: 341px; width: 341px; height: 125px;"; + oChartParams["class"] = "chart_widget"; + oChartParams[cRenderQS.HOME_QS] = oElement.attr(cRenderQS.HOME_QS) ; + oChartParams[cChartConsts.ATTR_SHOW_ZOOM] =1; + oChartParams[cChartConsts.ATTR_SHOW_COMPARE] = 1; + oChartParams[cChartConsts.ATTR_PREVIOUS] = 0; + oChartParams[cChartConsts.ATTR_WIDTH] = cChartConsts.WIDTH_3ACROSS; + oChartParams[cChartConsts.ATTR_HEIGHT] = cChartConsts.LETTERBOX_HEIGHT; + + //----------------------------------------------------------------- + var oRow = $(""); + oChartParams[cRenderQS.METRIC_QS + "0"] = sSPMetric + "|Calls per Minute"; + var oTD = $("
CallsResponse TimesErrors per minute
" + poSP.name + "
"); + var oChart = $("
", oChartParams); + oChart.append("please wait - chart loading...") + oTD.append(oChart); + oRow.append(oTD); + //----------------------------------------------------------------- + oChartParams[cRenderQS.METRIC_QS + "0"] = sSPMetric + "|Average Response Time (ms)"; + oTD = $("
"); + oChart = $("
", oChartParams); + oChart.append("please wait - chart loading...") + oTD.append(oChart); + oRow.append(oTD); + //----------------------------------------------------------------- + oChartParams[cRenderQS.METRIC_QS + "0"] = sSPMetric + "|Errors Per Minute"; + oTD = $("
"); + oChart = $("
", oChartParams); + oChart.append("please wait - chart loading...") + oTD.append(oChart); + oRow.append(oTD); + + //----------------------------------------------------------------- + + oTable.append(oRow); + }); + + oElement.append(oTable); + + //- - - - -convert chart to Widgets + if (cCharts.isGoogleChartsLoaded()) + this.convert_to_widgets() + else + cCharts.load_google_charts(function(){this.convert_to_widgets();}); + }, + + //******************************************************************* + convert_to_widgets: function(){ + $("DIV[type=spwidget]").each( + function(piIndex, poElement){ + $(poElement).adchart(); + } + ); + } +}); \ No newline at end of file diff --git a/pages/agents/allagentversions.php b/pages/agents/allagentversions.php index e55c31c..c38eaca 100644 --- a/pages/agents/allagentversions.php +++ b/pages/agents/allagentversions.php @@ -12,7 +12,7 @@ // USE AT YOUR OWN RISK - NO GUARANTEES OR ANY FORM ARE EITHER EXPRESSED OR IMPLIED **************************************************************************/ //#################################################################### -//TODO make asynchronous - separate calls for machine/db/app agents +//TBD make asynchronous - separate calls for machine/db/app agents $home="../.."; require_once "$home/inc/common.php"; diff --git a/pages/all/allbackendsbyname.php b/pages/all/allbackendsbyname.php index dc0ec77..aedb930 100644 --- a/pages/all/allbackendsbyname.php +++ b/pages/all/allbackendsbyname.php @@ -24,11 +24,7 @@ cRenderHtml::header("All Remote Services"); cRender::force_login(); ?> - - - - - +

name?>

GET_Tiers(); // work through each tier -?>

Availability for

Availability for name?>

name); $sUrl = cHttp::build_qs($sUrl, cRenderQS::TIER_ID_QS, $oTier->id); - ?> diff --git a/pages/app/appheatmap.php b/pages/app/appheatmap.php index 7b20895..3eb16ff 100644 --- a/pages/app/appheatmap.php +++ b/pages/app/appheatmap.php @@ -48,7 +48,7 @@ $metric = cADMetricPaths::tierCallsPerMin($tier); ?> -

Heatmap for

+

Heatmap for name?>

-

Overview for

+

Overview for name?>

  • Application Overview
  • Backends @@ -122,7 +122,7 @@ $sTierQS = cHttp::build_QS($gsAppQs, cRenderQS::TIER_QS, $sTier); $sTierQS = cHttp::build_QS($sTierQS, cRenderQS::TIER_ID_QS, $oTier->id); - ?>

    name?>

    GET_all_transaction_names(); if ($aTransactions==null) { cCommon::errorbox("unable to get transaction names"); diff --git a/pages/app/tiers.php b/pages/app/tiers.php index d322459..dc9d166 100644 --- a/pages/app/tiers.php +++ b/pages/app/tiers.php @@ -40,7 +40,7 @@ if (cRender::is_list_mode()){ cRenderCards::card_start(); cRenderCards::title_start(); - ?>List of tiers in List of tiers in name?>

    Link to page

    + + + + + id); + ?> + + + + +
    + Copy the following link:

    diff --git a/pages/rum/apprum.php b/pages/rum/apprum.php index cac09bb..57f80cc 100644 --- a/pages/rum/apprum.php +++ b/pages/rum/apprum.php @@ -47,7 +47,7 @@ $aMetrics[] = [cChart::LABEL=>"Overall response time in ms", cChart::METRIC=>cADMetricPaths::appResponseTimes()]; cChart::metrics_table($oApp, $aMetrics,2,cRender::getRowClass()); -?>

    Browser Stats for

    Browser Stats for name?>

    "Page requests per minute",cChart::METRIC=>cADWebRumMetric::CallsPerMin()]; diff --git a/pages/rum/synthetic.php b/pages/rum/synthetic.php index aac4a4b..63d6963 100644 --- a/pages/rum/synthetic.php +++ b/pages/rum/synthetic.php @@ -47,9 +47,9 @@ //******************************************************************** //#################################################################### -?>

    Synthetics for

    +?>

    Synthetics for name?>

    - +
    Loading Synthetic data...
    +name", $sUrl); + cRenderMenus::show_tier_menu("Show Service EndPoints for"); + }else + cRenderMenus::show_apps_menu("Show Service EndPoints for"); + cRenderCards::action_end(); cRenderCards::card_end(); //#################################################################### -//retrieve tiers -//******************************************************************** -$aTiers = $oApp->GET_Tiers(); - -function pr__sort_endpoints($a,$b){ - return strcmp($a->name, $b->name); -} +//TBD add a list mode - show the avg and max response times of each SEP -foreach ($aTiers as $oTier){ - //TODO make this asynchronous as this will crash when there are hundreds of tiers - - //**************************************************************************************** - $aEndPoints = $oTier->GET_ServiceEndPoints(); - cRenderCards::card_start("$oTier->name"); - cRenderCards::body_start(); - - if (count($aEndPoints) == 0) - cCommon::messagebox("no Service endpoints found for $oTier->name"); - else{ +//******************************************************************** +if (cHeader::get(cRenderQS::TIER_ID_QS)){ + $oTier = cRenderObjs::get_current_tier(); + cRenderCards::card_start("$oTier->name"); + cRenderCards::body_start(); + ?> +
    ="id?>" + ="id?>" + ="name?>" + ="" + > + Please Wait.. +
    + + GET_Tiers(); + cRenderCards::card_start("Select a Tier"); + cRenderCards::body_start(); + ?>

    name); - $sUrl = cHttp::build_qs($sUrl, cRenderQS::SERVICE_ID_QS, $oEndPoint->id); - $sUrl = cHttp::build_url("$home/pages/service/endpoint.php", $sUrl); - - $aMetrics[] = [cChart::TYPE=>cChart::LABEL, cChart::LABEL=>$oEndPoint->name, cChart::WIDTH=>150]; - $aMetrics[] = [cChart::LABEL=>"Calls", cChart::METRIC=>cADMetricPaths::endPointCallsPerMin($oTier->name, $oEndPoint->name), cChart::GO_URL=>$sUrl]; - $aMetrics[] = [cChart::LABEL=>"Response", cChart::METRIC=>cADMetricPaths::endPointResponseTimes($oTier->name, $oEndPoint->name)]; - $aMetrics[] = [cChart::LABEL=>"Errors", cChart::METRIC=>cADMetricPaths::endPointErrorsPerMin($oTier->name, $oEndPoint->name)]; - } - $sClass = cRender::getRowClass(); - cChart::metrics_table($oApp,$aMetrics,4,$sClass,null,(cChart::CHART_WIDTH_LETTERBOX-150)/3, $aHeaders); - } - cRenderCards::body_end(); + foreach ($aTiers as $oTier){ + $sTier = $oTier->name; + $sCh = strtoupper($sTier[0]); + if ($sCh !== $sLastCh){ + echo "

    $sCh

    "; + $sLastCh = $sCh; + } + + $sTierQS = cRenderQS::get_base_tier_QS($oTier); + $sUrl = cHttp::build_url(cCommon::filename(), $sTierQS); + cRender::button($oTier->name, $sUrl); + echo "
    "; + } + ?>
    "Overall Calls per min ($oApp->name) application", cChart::METRIC=>$sMetricUrl,cChart::STYLE=>cRender::getRowClass(), ]; @@ -55,7 +56,7 @@ $aMetrics[]= [cChart::LABEL=>"Overall response time in ms ($oApp->name) application", cChart::METRIC=>$sMetricUrl]; cRenderCards::card_start("Activity for $oApp->name"); cRenderCards::body_start(); - cChart::render_metrics($oApp, $aMetrics,cChart::CHART_WIDTH_LETTERBOX/2); + cChart::render_metrics($oApp, $aMetrics,cChart::CHART_WIDTH_LETTERBOX/3); cRenderCards::body_end(); cRenderCards::action_start(); cADCommon::button(cADControllerUI::tier($oApp, $oTier)); @@ -72,7 +73,7 @@ cRenderCards::card_end(); //#################################################################### -?>

    Activity for

    name); $sQs = cHttp::build_qs($sTierQS, cRenderQS::METRIC_TYPE_QS, cADMetricPaths::METRIC_TYPE_ACTIVITY); @@ -87,12 +88,14 @@ cChart::LABEL=>"Response times in ms for ($oTier->name) tier", cChart::METRIC=>$sMetricUrl, cChart::GO_HINT=>"All Nodes", cChart::GO_URL=>"tierallnodeinfra.php?$sQs" ]; - cChart::render_metrics($oApp, $aMetrics,cChart::CHART_WIDTH_LETTERBOX/2); - cDebug::flush(); -?> -

    Key Metrics for

    -name"); + cRenderCards::body_start(); + cChart::render_metrics($oApp, $aMetrics,cChart::CHART_WIDTH_LETTERBOX/3); + cRenderCards::body_end(); + cRenderCards::card_end(); + +//#################################################################### +//Tier Statistics $aMetrics = []; $aMetrics[] = [cChart::LABEL=>"Slow Calls", cChart::METRIC=>cADMetricPaths::tierSlowCalls($oTier->name),cChart::STYLE=>cRender::getRowClass()]; $aMetrics[] = [cChart::LABEL=>"Very Slow Calls", cChart::METRIC=>cADMetricPaths::tierVerySlowCalls($oTier->name)]; @@ -138,7 +141,11 @@ cChart::LABEL=>"Agent Availability", cChart::METRIC=>cADMetricPaths::InfrastructureAgentAvailability($oTier->name), cChart::HIDEIFNODATA=>1 ]; - cChart::render_metrics($oApp, $aMetrics,cChart::CHART_WIDTH_LETTERBOX/3); + cRenderCards::card_start("Key Metrics for $oTier->name"); + cRenderCards::body_start(); + cChart::render_metrics($oApp, $aMetrics,cChart::CHART_WIDTH_LETTERBOX/3); + cRenderCards::body_end(); + cRenderCards::card_end(); //#################################################################### cChart::do_footer(); diff --git a/pages/tier/tierallnodeinfra.php b/pages/tier/tierallnodeinfra.php index 360033c..bee3e80 100644 --- a/pages/tier/tierallnodeinfra.php +++ b/pages/tier/tierallnodeinfra.php @@ -67,7 +67,7 @@ $sDisabled = ($oCred->restricted_login? "disabled": ""); ?> + All short?> data for name?> Application -

    caption?> for all Servers in Tier

    +

    caption?> for all Servers in name?> Tier

    name"); cRenderCards::body_start(); if ($iCount ==0) - echo("no backends found"); - else - echo "there are $iCount backends that resolve to this tier"; + cCommon::messagebox("no backends found"); cRenderCards::body_end(); cRenderCards::action_start(); if ($oCred->restricted_login == null){ @@ -64,31 +62,35 @@ cRenderCards::card_end(); if ($iCount>0 ){ - //cDebug::vardump($aData[0]); - ?> - - - - - - - id); - ?> - - - - "; ?> -
    TypenameAction
    resolutionInfo->exitPointType?>displayName?>delete', - $sUrl, true,null,"delback" - ); - ?>
    - +

    TypenameAction
    resolutionInfo->exitPointType?>displayName?>delete', + $sUrl, true,null,"delback" + ); + ?>
    + -

    Overall Disks Metrics for

    +

    Overall Disks Metrics for name?>

    GET_DiskMetrics(); $sBaseMetric = cADMetricPaths::InfrastructureNodeDisks($oTier->name); diff --git a/pages/tier/tiererrorgraphs.php b/pages/tier/tiererrorgraphs.php index ae69fa9..d71f121 100644 --- a/pages/tier/tiererrorgraphs.php +++ b/pages/tier/tiererrorgraphs.php @@ -80,7 +80,7 @@ function render_table($paData){ //############################################################# //get the page metrics ?> -

    Errors for

    +

    Errors for name?>

    name, "*"); $aData = $oApp->GET_MetricData( $sMetricpath, $oTimes,true,false,true); diff --git a/pages/tier/tiererrors.php b/pages/tier/tiererrors.php index af95167..23994e2 100644 --- a/pages/tier/tiererrors.php +++ b/pages/tier/tiererrors.php @@ -103,7 +103,7 @@ function render_table($paData){ //############################################################# //get the page metrics ?> -

    Errors for

    +

    Errors for name?>

    name, "*"); diff --git a/pages/tier/tierextcalls.php b/pages/tier/tierextcalls.php index 03feb51..1fee0d1 100644 --- a/pages/tier/tierextcalls.php +++ b/pages/tier/tierextcalls.php @@ -20,6 +20,7 @@ set_time_limit(200); // huge time limit as this takes a long time +//TBD TBD make asynchornous //display the results $oApp = cRenderObjs::get_current_app(); @@ -97,7 +98,7 @@ function render_tier_ext($poApp, $poTier, $poData){ $oTimes = cRender::get_times(); $oResponse =$oTier->GET_ext_details($oTimes); cRender::button("show as graphs", "tierextgraph.php?$gsTierQs"); -?>

    External calls in

    External calls in name?>)

    - + diff --git a/pages/trans/tiertransgraph.php b/pages/trans/tiertransgraph.php index 41d5d3e..4263bba 100644 --- a/pages/trans/tiertransgraph.php +++ b/pages/trans/tiertransgraph.php @@ -131,7 +131,7 @@ function show_node_menu(){ ?>
    Business Transaction:btName)?>
    Business Transaction:btName?>
    URL:
    Timestamp:
    Number of Segments:segmentCount?>