All Downloads are FREE. Search and download functionalities are using the official Maven repository.

asysmon-res.js.ctrl-aggregated.js Maven / Gradle / Ivy

There is a newer version: 1.0-pre28
Show newest version

angular.module('ASysMonApp').controller('CtrlAggregated', function($scope, $log, Rest, escapeHtml) {

    $('.button-segment').affix({
        offset: {
            top: 95
        }
    });

    function reinitTooltips() {
        $('.btn').tooltip({
            container: 'body',
            html: true
        });
    }

    reinitTooltips();
    $scope.$watch('isStarted', function() {
        $('.btn').tooltip('hide');
        setTimeout(reinitTooltips, 0);
    });


    $scope.expansionModel = {};
    $scope.rootLevel = 0;

    var nodesByFqn = {};

    function initFromResponse(data) {
//        $log.log('init from response');
        $scope.isStarted = data.isStarted;
        $scope.columnDefs = data.columnDefs.reverse();
        $scope.traces = data.traces;
        $scope.pickedTraces = $scope.traces; //TODO keep selection on 'refresh'

        nodesByFqn = {};
        initTraceNodes($scope.traces, 0, '');

//        $log.log('after init trace nodes');

        $scope.totalDataWidth = 0;
        for(var i=0; i' + curCol.name + '
'; }); return '' + '
 
' + titles + '
'; }()); var result = ''; angular.forEach($scope.pickedTraces, function(rootNode) { result += '
' + htmlForTableHeader + htmlForTreeNode(rootNode) + '
'; }); return result; } function htmlForTreeNode(curNode) { var dataRowSubdued = curNode.isSerial ? '' : 'data-row-subdued'; var dataCols = ''; angular.forEach($scope.columnDefs, function(curCol, colIdx) { dataCols += '
'; var formattedValue = $scope.formatNumber(curNode.data[revIdx(colIdx)], $scope.columnDefs[colIdx].numFracDigits); if(curCol.isPercentage) { if(curNode.isSerial) dataCols += '
' + formattedValue + '
'; else dataCols += '
' + formattedValue + '
'; } else { dataCols += '
' + formattedValue + '
'; } dataCols += '
'; }); var withChildrenClass = (curNode.children && curNode.children.length) ? ' with-children' : ''; var result = '
' + '
' + curNode.fqn + '
' + '
 
' + dataCols + '
' + escapeHtml(curNode.name) + '
' + '
'; result += htmlForChildrenDiv(curNode); return result; } function htmlForChildrenDiv(curNode, shouldRender) { if(! curNode.children || curNode.children.length === 0) { return ''; } if(shouldRender || $scope.isExpanded(curNode)) { var result = ''; result += '
'; angular.forEach(curNode.children, function(child) { result += htmlForTreeNode(child, $scope.rootLevel); }); result += '
'; return result; } else { return '
'; } } });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy