diff --git a/README.md b/README.md index adee330..820ef02 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,13 @@ Online Demos Download -------- -Latest CubesViewer stable release is 2.0.1: +Latest CubesViewer stable release is 2.0.2: -* CubesViewer 2.0.1 - * [cubesviewer-v2.0.1.zip](https://github.com/jjmontesl/cubesviewer/archive/v2.0.1.zip) - * [cubesviewer-server-v2.0.1.zip](https://github.com/jjmontesl/cubesviewer-server/archive/v2.0.1.zip) - * [Changelog](http://github.com/jjmontesl/cubesviewer/blob/v2.0.1/CHANGES.txt) - * [Release Notes](http://github.com/jjmontesl/cubesviewer/blob/v2.0.1/RELEASE-NOTES.txt) +* CubesViewer 2.0.2 + * [cubesviewer-v2.0.2.zip](https://github.com/jjmontesl/cubesviewer/archive/v2.0.2.zip) + * [cubesviewer-server-v2.0.2.zip](https://github.com/jjmontesl/cubesviewer-server/archive/v2.0.2.zip) + * [Changelog](http://github.com/jjmontesl/cubesviewer/blob/v2.0.2/CHANGES.txt) + * [Release Notes](http://github.com/jjmontesl/cubesviewer/blob/v2.0.2/RELEASE-NOTES.txt) * Works with *Cubes 1.0.x* and *Cubes 1.1.x* CubesViewer Server already includes the CubesViewer library so you just need that package diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index b0f57c7..f197655 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -74,9 +74,10 @@ Your Cubes model may need some extra configuration if you wish to use features l Upgrading from 2.0.1 -------------------- -1. A new Javascript dependency has been added to the Studio application (this does - not apply if you are using embedding CubesViewer views, only Studio). - Check the sample `html/studio.html` for an up to date list of dependencies. +1. A new Javascript dependency (masonry) has been added to the Studio application + (this does not apply if you are using embedding CubesViewer views, only if + embedding CubesViewer Studio). Check the sample `html/studio.html` for an up to + date list of dependencies. Upgrading from 0.10 or 0.11 diff --git a/TODO.txt b/TODO.txt index 93bc753..3bf1bb8 100644 --- a/TODO.txt +++ b/TODO.txt @@ -122,9 +122,9 @@ Consider contributing to CubesViewer! This is a possible roadmap (reverse order) * Map representations from facts, including segments from individual points in facts (plot paths, with metrics and filtering!) * Map charts. Design already available. -[2.0.2] +[2.0.3] - * Remove -devel from version, -beta from doc, generate files, copy to web and server, same on server. + * Remove -devel from version, -beta from doc, package.json version cubesviewer version, generate files, copy to web and server, same on server. Release notes, Tag repo (release), Announcement, Move this todo item to next release top. * Submenu loading issue. @@ -133,7 +133,7 @@ Consider contributing to CubesViewer! This is a possible roadmap (reverse order) * Fix: toggling legend does not redraw chart (just moves legend?). Redrawing the chart (ie switching view mode) actually works. Same for sometimes drilling down or changing a filter, grid doens't get correct size. - * Size change when switching views is very irritating. Hack that (fix height during changes/reloads?). + * Size change when switching views is irritating. Hack that (fix height during changes/reloads?). * Fix to grid sort function cache was incorrect? If two grids are loaded, clicking on a column in grid A could affect sorting in grid B (#71). * Error: [$parse:lexerr] Lexer Error: Unexpected next character at columns 45-45 [Í] in expression [entity['SECRETARÍA XERAL TÉCNICA '](CONSELLERÍA DE CULTURA, EDUCACIÓN E ORDENACIÓN UNIVERSITARIA)]. diff --git a/cubesviewer/core/cubesviewer.js b/cubesviewer/core/cubesviewer.js index 2185af2..ad83158 100644 --- a/cubesviewer/core/cubesviewer.js +++ b/cubesviewer/core/cubesviewer.js @@ -133,7 +133,7 @@ angular.module('cv').run([ '$timeout', '$log', 'cvOptions', 'cubesService', 'cub function CubesViewer() { // CubesViewer version - this.version = "2.0.2-devel"; + this.version = "2.0.2"; /** * State of a view that has not yet been fully initialized, and cannot be interacted with. diff --git a/cubesviewer/cubesviewer.templates.js b/cubesviewer/cubesviewer.templates.js index f3a02ef..0c50ddb 100644 --- a/cubesviewer/cubesviewer.templates.js +++ b/cubesviewer/cubesviewer.templates.js @@ -240,10 +240,10 @@ angular.module('cv').run(['$templateCache', function($templateCache) { "
\n" + "\n" + "
  • 2 column\n" + - " {{ cvOptions.studioTwoColumn ? \"ON\" : \"OFF\" }}\n" + + " {{ cvOptions.studioTwoColumn ? \"ON\" : \"OFF\" }}\n" + "
  • \n" + "
  • Hide controls\n" + - " {{ cvOptions.hideControls ? \"ON\" : \"OFF\" }}\n" + + " {{ cvOptions.hideControls ? \"ON\" : \"OFF\" }}\n" + "
  • \n" + "\n" + "
    \n" + @@ -289,9 +289,11 @@ angular.module('cv').run(['$templateCache', function($templateCache) { " \n" + " \n" + "\n" + - "
    \n" + + "
    \n" + + "\n" + + "
    \n" + "\n" + - "
    \n" + + "
    \n" + "
    \n" + "
    \n" + "
    \n" + @@ -842,9 +844,13 @@ angular.module('cv').run(['$templateCache', function($templateCache) { "
    \n" + "\n" + "\n" + - "
    \n" + - " Drilldown: {{ view.cube.dimensionParts(drilldown).labelShort }}\n" + + "
    \n" + + " Drilldown: {{ parts.labelShort }}\n" + " \n" + + "\n" + + " \n" + + " \n" + + "\n" + " \n" + " \n" + "
    \n" + @@ -857,10 +863,10 @@ angular.module('cv').run(['$templateCache', function($templateCache) { " var depth = $(this).parents('.cv-view-infopiece-cut').first().attr('data-value').split(';')[0].split(\",\").length;\n" + " cubesviewer.views.cube.dimensionfilter.drawDimensionFilter(view, dimensionString + \":\" + parts.hierarchy.levels[depth - 1] );\n" + " -->\n" + - "
    {{ equality }} {{ cut.value }}\n" + + "
    {{ equality }} {{ cut.value }}\n" + " \n" + - " \n" + + " \n" + " \n" + "
    \n" + "
    \n" + @@ -877,6 +883,10 @@ angular.module('cv').run(['$templateCache', function($templateCache) { "
    \n" + " Horizontal dimension: {{ (view.params.xaxis != null) ? view.cube.dimensionParts(view.params.xaxis).labelShort : \"None\" }}\n" + " \n" + + "\n" + + " \n" + + " \n" + + "\n" + " \n" + " \n" + "
    \n" + @@ -1048,20 +1058,29 @@ angular.module('cv').run(['$templateCache', function($templateCache) { "\n" + "
    \n" + " \n" + - " \n" + + " \n" + " \n" + "
    \n" + "\n" + - "
    \n" + + "
    \n" + " \n" + " \n" + "
    \n" + "\n" + - "
    \n" + - " \n" + + "\n" + + "
    \n" + + " \n" + + " \n" + + " \n" + + "
    \n" + + "\n" + + "
    \n" + + "
    \n" + + " Show all\n" + + "
    \n" + "
    \n" + "\n" + - "
    \n" + + "
    \n" + "\n" + "
    \n" + " \n" + @@ -1079,16 +1098,16 @@ angular.module('cv').run(['$templateCache', function($templateCache) { "
    \n" + "\n" + "
    \n" + - "
    \n" + + "
    \n" + "
    \n" + "
    \n" + "
    Loading...
    \n" + "\n" + "
    \n" + - "
    \n" + + "
    \n" + " \n" + "
    \n" + "
    \n" + @@ -1101,7 +1120,7 @@ angular.module('cv').run(['$templateCache', function($templateCache) { "
    \n" + "
    \n" + "\n" + - "
    = cubesService.cubesserver.info.json_record_limit\" class=\"alert alert-warning\" style=\"margin-bottom: 0px;\">\n" + + "
    = cubesService.cubesserver.info.json_record_limit\" class=\"alert alert-warning\" style=\"margin-bottom: 0px;\">\n" + "
    \n" + "
    \n" + " Limit of {{ cubesService.cubesserver.info.json_record_limit }} items has been hit. Dimension value list is incomplete.
    \n" + diff --git a/dist/cubesviewer.css b/dist/cubesviewer.css index c9b0fa7..ea6aaa9 100644 --- a/dist/cubesviewer.css +++ b/dist/cubesviewer.css @@ -6843,6 +6843,9 @@ button.cv-bootstrap .close { .cv-grid-header-dimension { color: #004400; } +.cv-grid-header-dimensionattribute { + color: #666666; +} .cv-grid-header-measure { color: #444477; } @@ -6984,8 +6987,7 @@ div.nvtooltip { width: 100%; /* Full Width */ height: 3px; - margin: 0px 0px 3px 0px; - /*position: fixed;*/ + margin: -4px 0px 1px 0px; position: relative; overflow-x: hidden; } diff --git a/dist/cubesviewer.js b/dist/cubesviewer.js index b800248..a20d2ae 100644 --- a/dist/cubesviewer.js +++ b/dist/cubesviewer.js @@ -234,12 +234,19 @@ angular.module('bootstrapSubmenu', []).directive("submenu", ['$timeout', functio }; cubes.Server.prototype.get_cube = function(name, callback, errCallback) { - var self = this; + + var self = this; // Return the cube if already loaded if((name in this._cubes) && callback){ - callback(this._cubes[name]); - return null; + var jqxhr = $.Deferred(); + jqxhr.error = function() { }; + setTimeout(function() { + // TODO: What is the correct ordering of success/complete callbacks? + callback(self._cubes[name]); + jqxhr.resolve(); //.promise(); + }, 0); + return jqxhr; } var options = {dataType : 'json', type : "GET"}; @@ -893,6 +900,8 @@ cubes.Dimension.prototype.isDateDimension = function() { /** * List date dimensions. + * + * @returns An array with the dimensions that are date dimensions (role: time). */ cubes.Cube.prototype.dateDimensions = function() { var result = []; @@ -916,9 +925,19 @@ cubes.Cube.prototype.cvdim_dim = function(dimensionString) { return this.dimension(dimname); }; +cubes.Cube.prototype.dimensionPartsFromCut = function(cut) { + var parts = this.dimensionParts(cut.dimension); + var depth = (cut.value.split(';')[0].match(/,/g) || []).length + 1; + + var dimstring = parts.dimension.name + '@' + parts.hierarchy.name + ':' + parts.hierarchy.levels[depth - 1].name; + return this.dimensionParts(dimstring); +}; + cubes.Cube.prototype.dimensionParts = function(dimensionString) { // Get a dimension info by name. Accepts dimension hierarchy and level in the input string. + if (!dimensionString) return null; + var dim = this.cvdim_dim(dimensionString); var hie = dim.default_hierarchy(); @@ -928,9 +947,11 @@ cubes.Cube.prototype.dimensionParts = function(dimensionString) { } var lev = null; + var levelIndex = 0; if (dimensionString.indexOf(":") > 0) { var levelname = dimensionString.split(":")[1]; lev = dim.level(levelname); + for (levelIndex = 0; levelIndex < hie.levels.length && hie.levels[levelIndex] != lev; levelIndex++); } else { lev = dim.level(hie.levels[0]); } @@ -946,13 +967,19 @@ cubes.Cube.prototype.dimensionParts = function(dimensionString) { return { dimension: dim, level: lev, + levelIndex: levelIndex, depth: depth, hierarchy: hie, label: dim.label + ( hie.name != "default" ? (" - " + hie.label) : "" ) + ( hie.levels.length > 1 ? (" / " + lev.label) : "" ), labelShort: (dim.label + ( hie.levels.length > 1 ? (" / " + lev.label) : "" )), labelNoLevel: dim.label + ( hie.name != "default" ? (" - " + hie.label) : "" ), + fullDrilldownValue: dim.name + ( hie.name != "default" ? ("@" + hie.name) : "" ) + ":" + lev.name, - fullCutValue: dim.name + ( hie.name != "default" ? ("@" + hie.name) : "" ) + drilldownDimension: dim.name + '@' + hie.name + ':' + lev.name, + drilldownDimensionPlus: (hie.levels.length > 1 && levelIndex < hie.levels.length - 1) ? (dim.name + '@' + hie.name + ':' + hie.levels[levelIndex + 1].name) : null, + drilldownDimensionMinus: (hie.levels.length > 1 && levelIndex > 0) ? (dim.name + '@' + hie.name + ':' + hie.levels[levelIndex - 1].name) : null, + + cutDimension: dim.name + ( hie.name != "default" ? "@" + hie.name : "" ) }; }; @@ -960,6 +987,8 @@ cubes.Cube.prototype.dimensionParts = function(dimensionString) { /** * Returns the aggregates for the given measure, by name. * If passed null, returns aggregates with no measure. + * + * @returns The list of aggregates of a measure. */ cubes.Cube.prototype.measureAggregates = function(measureName) { var aggregates = $.grep(this.aggregates, function(ia) { return measureName ? ia.measure == measureName : !ia.measure; } ); @@ -1197,7 +1226,7 @@ angular.module('cv.cubes').service("cubesService", ['$rootScope', '$log', 'cvOpt /* * Builds Query Cuts */ - this.buildQueryCuts = function(view) { + this.buildQueryCutsStrings = function(view) { var cuts = []; @@ -1207,20 +1236,29 @@ angular.module('cv.cubes').service("cubesService", ['$rootScope', '$log', 'cvOpt var dimParts = view.cube.dimensionParts(e.dimension); var cutDim = dimParts.dimension.name + ( dimParts.hierarchy.name != "default" ? "@" + dimParts.hierarchy.name : "" ); - cuts.push(cubes.cut_from_string(view.cube, invert + cutDim + ":" + e.value.replace("-", "\\-"))); + cuts.push(invert + cutDim + ":" + e.value.replace("-", "\\-")); }); // Date filters $(view.params.datefilters).each(function(idx, e) { var datefilterval = cubesService.datefilterValue(view, e); if (datefilterval != null) { - cuts.push(cubes.cut_from_string(view.cube, e.dimension + ":" + datefilterval)); + cuts.push(e.dimension + ":" + datefilterval); } }); return cuts; }; + this.buildQueryCuts = function(view) { + var cuts = []; + var cutsStrings = cubesService.buildQueryCutsStrings(view); + $(cutsStrings).each(function(idx, e) { + cuts.push(cubes.cut_from_string(view.cube, e)); + }); + return cuts; + }; + /* * Composes a filter with appropriate syntax and time grain from a * datefilter @@ -1590,7 +1628,7 @@ angular.module('cv').run([ '$timeout', '$log', 'cvOptions', 'cubesService', 'cub function CubesViewer() { // CubesViewer version - this.version = "2.0.2-devel"; + this.version = "2.0.2"; /** * State of a view that has not yet been fully initialized, and cannot be interacted with. @@ -2011,8 +2049,8 @@ angular.module('cv.views.cube', []); * * FIXME: Some of this code shall be on a parent generic "view" directive. */ -angular.module('cv.views.cube').controller("CubesViewerViewsCubeController", ['$rootScope', '$log', '$window','$injector', '$scope', '$timeout', 'cvOptions', 'cubesService', 'viewsService', 'exportService', 'rowSorter', - function ($rootScope, $log, $window, $injector, $scope, $timeout, cvOptions, cubesService, viewsService, exportService, rowSorter) { +angular.module('cv.views.cube').controller("CubesViewerViewsCubeController", ['$rootScope', '$log', '$window','$injector', '$scope', '$timeout', 'cvOptions', 'cubesService', 'viewsService', 'exportService', 'rowSorter', 'dialogService', + function ($rootScope, $log, $window, $injector, $scope, $timeout, cvOptions, cubesService, viewsService, exportService, rowSorter, dialogService) { // TODO: Functions shall be here? $scope.viewController = {}; @@ -2091,7 +2129,7 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeController", ['$ }; $scope.requestErrorHandler = function() { - $scope.view._requestFailed = true; + $scope.view.requestFailed = true; }; @@ -2243,7 +2281,7 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeController", ['$ //return; } else {*/ view.params.cuts = $.grep(view.params.cuts, function(e) { - return view.cube.dimensionParts(e.dimension).fullCutValue == view.cube.dimensionParts(dimension).fullCutValue; + return view.cube.dimensionParts(e.dimension).cutDimension == view.cube.dimensionParts(dimension).cutDimension; }, true); view.params.cuts.push({ "dimension" : dimension, @@ -2253,7 +2291,7 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeController", ['$ /*}*/ } else { view.params.cuts = $.grep(view.params.cuts, function(e) { - return view.cube.dimensionParts(e.dimension).fullCutValue == view.cube.dimensionParts(dimension).fullCutValue; + return view.cube.dimensionParts(e.dimension).cutDimension == view.cube.dimensionParts(dimension).cutDimension; }, true); } } else { @@ -2295,10 +2333,11 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeController", ['$ $scope.showDimensionFilter = function(dimension) { - if ($scope.view.dimensionFilter && $scope.view.dimensionFilter == dimension) { + var parts = $scope.view.cube.dimensionParts(dimension); + if ($scope.view.dimensionFilter && $scope.view.dimensionFilter == parts.drilldownDimension) { $scope.view.dimensionFilter = null; } else { - $scope.view.dimensionFilter = dimension; + $scope.view.dimensionFilter = parts.drilldownDimension; } }; @@ -2605,6 +2644,18 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeExploreControlle }; }; + $scope.exploreCut = function(dimension, value, invert) { + $scope.selectCut(dimension, value, invert); + if ($scope.view.params.drilldown.length == 1) { + // A single item has been selected, so automatically drill one more level + var dimparts = $scope.view.cube.dimensionParts($scope.view.params.drilldown[0]); + if (dimparts.levelIndex < dimparts.hierarchy.levels.length - 1) { + var drilldown = dimparts.dimension.name + ( dimparts.hierarchy.name != "default" ? ("@" + dimparts.hierarchy.name) : "" ) + ":" + dimparts.hierarchy.levels[dimparts.levelIndex + 1].name; + $scope.selectDrill(drilldown, true); + } + } + }; + $scope.processData = function(data) { var view = $scope.view; @@ -2697,7 +2748,7 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeExploreControlle enableHiding: false, cutDimension: cutDimension, width : $scope.defineColumnWidth("key" + i, 190), - cellTemplate: '', + cellTemplate: '', footerCellTemplate: '
    ' + footer + '
    ', sort: $scope.defineColumnSort("key" + i), sortingAlgorithm: $scope.sortDimensionParts(parts) @@ -2908,15 +2959,17 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFilterDimensionC $scope.searchString = ""; $scope.selectedValues = null; $scope.filterInverted = null; + $scope.filterShowAll = false; + + $scope.currentDataId = null; $scope.initialize = function() { // Check if current filter is inverted var view = $scope.view; var parts = view.cube.dimensionParts($scope.view.dimensionFilter); - var cutDimension = parts.dimension.name + ( parts.hierarchy.name != "default" ? "@" + parts.hierarchy.name : "" ); for (var i = 0; i < view.params.cuts.length ; i++) { - if (view.params.cuts[i].dimension == cutDimension) { + if (view.params.cuts[i].dimension == parts.cutDimension) { $scope.filterInverted = view.params.cuts[i].invert; break; } @@ -2930,8 +2983,12 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFilterDimensionC $scope.$on("ViewRefresh", function(view) { // FIXME: Update checkboxes, but do not reload. - //$scope.loadDimensionValues(); + $scope.loadDimensionValues(); }); + $scope.$watch("filterShowAll", function(view) { + $scope.loadDimensionValues(); + }); + $scope.closeDimensionFilter = function() { $scope.view.dimensionFilter = null; @@ -2943,17 +3000,38 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFilterDimensionC $scope.loadDimensionValues = function() { var params = { - "hierarchy": $scope.parts.hierarchy.name, - "depth": $scope.parts.depth + "hierarchy": $scope.parts.hierarchy.name, + "depth": $scope.parts.depth }; //view.cubesviewer.views.blockViewLoading(view); + if (! $scope.filterShowAll) { + + var parts = $scope.view.cube.dimensionParts($scope.view.dimensionFilter); + var buildQueryCutsStrings = cubesService.buildQueryCutsStrings($scope.view); + + if (buildQueryCutsStrings.length > 0) { + // Remove current dimension + buildQueryCutsStrings = $.grep(buildQueryCutsStrings, function(cs) { + return ((cs.indexOf(parts.dimension.name) != 0) && (cs.indexOf("!" + parts.dimension.name) != 0)); + }); + + params["cut"] = buildQueryCutsStrings.join(cubes.CUT_STRING_SEPARATOR_CHAR); + } + + }; + + var path = "/cube/" + $scope.view.cube.name + "/members/" + $scope.parts.dimension.name; + var dataId = path + "?" + $.param(params); + if ($scope.currentDataId == dataId) { return; } + $scope.currentDataId = dataId; + var tdimension = $scope.view.dimensionFilter; $scope.loadingDimensionValues = true; var jqxhr = cubesService.cubesRequest( // Doc says it's dimension, not members - "/cube/" + $scope.view.cube.name + "/members/" + $scope.parts.dimension.name, + path, params, $scope._loadDimensionValuesCallback(tdimension)); jqxhr.always(function() { @@ -3026,8 +3104,8 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFilterDimensionC var drilldownLevelLabels = []; $(infos).each(function(idx, info) { - drilldownLevelValues.push (info.key); - drilldownLevelLabels.push (info.label); + drilldownLevelValues.push(info.key); + drilldownLevelLabels.push(info.label); }); dimensionValues.push({ @@ -3321,6 +3399,32 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFactsController" sortingAlgorithm: $scope.sortDimensionLevel(level) }; view.grid.columnDefs.push(col); + + // Additional dimension attributes + $(level.attributes).each(function(idx, e) { + if (e.ref != level.key().ref && e.ref != level.label_attribute().ref) { + var col = { + name: e.name, + field: e.ref, + index : e.ref, + headerCellClass: "cv-grid-header-dimensionattribute", + //cellClass : "text-right", + //sorttype : "number", + cellTemplate: '
    {{ row.entity[col.colDef.field] }}
    ', + //formatter: $scope.columnFormatFunction(ag), + //footerValue: $scope.columnFormatFunction(ag)(data.summary[ag.ref], null, col) + //formatoptions: {}, + //cellattr: cubesviewer.views.cube.explore.columnTooltipAttr(ag.ref), + //footerCellTemplate = '
    {{ col.colDef.footerValue }}
    ' + visible: ! view.params.columnHide[e.ref], + width : $scope.defineColumnWidth(e.ref, 85), + sort: $scope.defineColumnSort(e.ref), + //sortingAlgorithm: $scope.sortDimensionLevel(level) + }; + view.grid.columnDefs.push(col); + } + }); + } } @@ -3402,10 +3506,16 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFactsController" for (var i = 0; i < dimension.levels.length; i++) { var level = dimension.levels[i]; - var levelData = level.readCell (e); + var levelData = level.readCell(e); row[level.key().ref] = levelData.label; + $(level.attributes).each(function(aidx, ae) { + if (ae.ref != level.key().ref && ae.ref != level.label_attribute().ref) { + row[ae.ref] = levelData.info[ae.ref]; + } + }); + } } @@ -3420,7 +3530,7 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFactsController" } // Set key - row["id"] = counter++; + row["id"] = counter++; if ("id" in e) row["id"] = e["id"]; row["key"] = row["id"]; @@ -3429,7 +3539,6 @@ angular.module('cv.views.cube').controller("CubesViewerViewsCubeFactsController" rows.push(row); }); - }; $scope.$on("$destroy", function() { @@ -5512,7 +5621,7 @@ angular.module('cv.views.cube').service("exportService", ['$rootScope', '$timeou $(dataRows).each(function(idxr, r) { values = []; $(view.grid.columnDefs).each(function(idx, e) { - if (r[e.field].title) { + if (r[e.field] && r[e.field].title) { // Explore view uses objects as values, where "title" is the label values.push('"' + r[e.field].title + '"'); } else { @@ -5523,9 +5632,9 @@ angular.module('cv.views.cube').service("exportService", ['$rootScope', '$timeou content = content + (values.join(",")) + "\n"; }); - var uri = "data:text/csv;charset=utf-8," + encodeURIComponent(content); + //window.open (url, "_blank"); - this.saveAs(uri, view.cube.name + "-summary.csv") + this.saveAs(content, "text/csv", view.cube.name + "-summary.csv") }; /** @@ -5533,14 +5642,22 @@ angular.module('cv.views.cube').service("exportService", ['$rootScope', '$timeou * * @memberof cv.views.cube.exportService */ - this.saveAs = function(uri, filename) { - var link = document.createElement('a'); + this.saveAs = function(content, mime, filename) { + + // Method 1 + //var uri = "data:" + mime + ";charset=utf-8," + encodeURIComponent(content); + + // Method 2 + var csvData = new Blob([content], { type: mime }); + var uri = URL.createObjectURL(csvData); + + var link = document.createElement('a'); if (typeof link.download === 'string') { document.body.appendChild(link); // Firefox requires the link to be in the body link.download = filename; link.href = uri; link.click(); - document.body.removeChild(link); // remove the link when done + document.body.removeChild(link); // remove the link when done } else { location.replace(uri); } @@ -5759,6 +5876,7 @@ angular.module('cv.studio').service("studioViewsService", ['$rootScope', '$ancho * Adds a new clean view of type "cube" given a cube name. * * @memberof cv.studio.studioViewsService + * @returns The created view object. */ this.addViewCube = function(cubename) { @@ -5772,7 +5890,13 @@ angular.module('cv.studio').service("studioViewsService", ['$rootScope', '$ancho var view = viewsService.createView("cube", { "cubename": cubename, "name": name }); this.views.push(view); - $timeout(function() { $anchorScroll('cvView' + view.id); }, 100); + $timeout(function() { + $('.cv-views-container').masonry('appended', $('.cv-views-container').find(".sv" + view.id).show()); + //$('.cv-views-container').masonry('reloadItems'); + //$('.cv-views-container').masonry('layout'); + $timeout(function() { $anchorScroll("cvView" + view.id); }, 500); + }, 0); + return view; }; @@ -5781,6 +5905,7 @@ angular.module('cv.studio').service("studioViewsService", ['$rootScope', '$ancho * a JSON string. * * @memberof cv.studio.studioViewsService + * @returns The created view object. */ this.addViewObject = function(data) { @@ -5796,7 +5921,13 @@ angular.module('cv.studio').service("studioViewsService", ['$rootScope', '$ancho var view = viewsService.createView("cube", data); this.views.push(view); - $timeout(function() { $anchorScroll('cvView' + view.id); }, 250); + + $timeout(function() { + $('.cv-views-container').masonry('appended', $('.cv-views-container').find(".sv" + view.id).show()); + //$('.cv-views-container').masonry('reloadItems'); + //$('.cv-views-container').masonry('layout'); + $timeout(function() { $anchorScroll("cvView" + view.id); }, 500); + }, 0); return view; }; @@ -5809,11 +5940,13 @@ angular.module('cv.studio').service("studioViewsService", ['$rootScope', '$ancho this.closeView = function(view) { var viewIndex = this.views.indexOf(view); if (viewIndex >= 0) { + $('.cv-views-container').masonry('remove', $('.cv-views-container').find(".sv" + view.id)); this.views.splice(viewIndex, 1); + //$('.cv-views-container').masonry('reloadItems'); + $('.cv-views-container').masonry('layout'); } - }; - + }; /** * Collapses the panel of the given view. @@ -5822,6 +5955,9 @@ angular.module('cv.studio').service("studioViewsService", ['$rootScope', '$ancho */ this.toggleCollapseView = function(view) { view.collapsed = !view.collapsed; + $timeout(function() { + $('.cv-views-container').masonry('layout'); + }, 100); }; @@ -5839,13 +5975,24 @@ angular.module('cv.studio').controller("CubesViewerStudioViewController", ['$roo $scope.cvOptions = cvOptions; $scope.reststoreService = reststoreService; + $scope.$watch('__height', function() { + $('.cv-views-container').masonry('layout'); + }); + }]).directive("cvStudioView", function() { return { restrict: 'A', templateUrl: 'studio/panel.html', scope: { view: "=" - } + }, + link: function( scope, elem, attrs ) { + + scope.$watch( function() { + scope.__height = elem.height(); + } ); + + } }; }); @@ -5863,6 +6010,8 @@ angular.module('cv.studio').controller("CubesViewerStudioController", ['$rootSco $scope.studioViewsService.studioScope = $scope; + $scope.initialize = function() { + }; $scope.showSerializeAdd = function() { @@ -5950,6 +6099,9 @@ angular.module('cv.studio').controller("CubesViewerStudioController", ['$rootSco */ $scope.toggleTwoColumn = function() { cvOptions.studioTwoColumn = ! cvOptions.studioTwoColumn; + $timeout(function() { + $('.cv-views-container').masonry('layout'); + }, 100); }; /** @@ -5957,8 +6109,13 @@ angular.module('cv.studio').controller("CubesViewerStudioController", ['$rootSco */ $scope.toggleHideControls = function() { cvOptions.hideControls = ! cvOptions.hideControls; + $timeout(function() { + $('.cv-views-container').masonry('layout'); + }, 100); }; + $scope.initialize(); + }]); @@ -6732,10 +6889,10 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "
    \n" + "\n" + "
  • 2 column\n" + - " {{ cvOptions.studioTwoColumn ? \"ON\" : \"OFF\" }}\n" + + " {{ cvOptions.studioTwoColumn ? \"ON\" : \"OFF\" }}\n" + "
  • \n" + "
  • Hide controls\n" + - " {{ cvOptions.hideControls ? \"ON\" : \"OFF\" }}\n" + + " {{ cvOptions.hideControls ? \"ON\" : \"OFF\" }}\n" + "
  • \n" + "\n" + "
    \n" + @@ -6781,9 +6938,11 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "
    \n" + "
    \n" + "\n" + - "
    \n" + + "
    \n" + + "\n" + + "
    \n" + "\n" + - "
    \n" + + "
    \n" + "
    \n" + "
    \n" + "
    \n" + @@ -7334,9 +7493,13 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "
    \n" + "\n" + "\n" + - "
    \n" + - " Drilldown: {{ view.cube.dimensionParts(drilldown).labelShort }}\n" + + "
    \n" + + " Drilldown: {{ parts.labelShort }}\n" + " \n" + + "\n" + + " \n" + + " \n" + + "\n" + " \n" + " \n" + "
    \n" + @@ -7349,10 +7512,10 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie " var depth = $(this).parents('.cv-view-infopiece-cut').first().attr('data-value').split(';')[0].split(\",\").length;\n" + " cubesviewer.views.cube.dimensionfilter.drawDimensionFilter(view, dimensionString + \":\" + parts.hierarchy.levels[depth - 1] );\n" + " -->\n" + - "
    {{ equality }} {{ cut.value }}\n" + + "
    {{ equality }} {{ cut.value }}\n" + " \n" + - " \n" + + " \n" + " \n" + "
    \n" + "
    \n" + @@ -7369,6 +7532,10 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "
    \n" + " Horizontal dimension: {{ (view.params.xaxis != null) ? view.cube.dimensionParts(view.params.xaxis).labelShort : \"None\" }}\n" + " \n" + + "\n" + + " \n" + + " \n" + + "\n" + " \n" + " \n" + "
    \n" + @@ -7540,20 +7707,29 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "\n" + "
    \n" + " \n" + - " \n" + + " \n" + " \n" + "
    \n" + "\n" + - "
    \n" + + "
    \n" + " \n" + " \n" + "
    \n" + "\n" + - "
    \n" + - " \n" + + "\n" + + "
    \n" + + " \n" + + " \n" + + " \n" + + "
    \n" + + "\n" + + "
    \n" + + "
    \n" + + " Show all\n" + + "
    \n" + "
    \n" + "\n" + - "
    \n" + + "
    \n" + "\n" + "
    \n" + " \n" + @@ -7571,16 +7747,16 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "
    \n" + "\n" + "
    \n" + - "
    \n" + + "
    \n" + "
    \n" + "
    \n" + "
    Loading...
    \n" + "\n" + "
    \n" + - "
    \n" + + "
    \n" + " \n" + "
    \n" + "
    \n" + @@ -7593,7 +7769,7 @@ angular.module('cv.cubes').service("gaService", ['$rootScope', '$http', '$cookie "
    \n" + "
    \n" + "\n" + - "
    = cubesService.cubesserver.info.json_record_limit\" class=\"alert alert-warning\" style=\"margin-bottom: 0px;\">\n" + + "
    = cubesService.cubesserver.info.json_record_limit\" class=\"alert alert-warning\" style=\"margin-bottom: 0px;\">\n" + "
    \n" + "
    \n" + " Limit of {{ cubesService.cubesserver.info.json_record_limit }} items has been hit. Dimension value list is incomplete.
    \n" + diff --git a/dist/cubesviewer.min.js b/dist/cubesviewer.min.js index 9b86cb8..6273fb0 100644 --- a/dist/cubesviewer.min.js +++ b/dist/cubesviewer.min.js @@ -1,6 +1,6 @@ -/*! cubesviewer 08-06-2016 */ -"use strict";function CubesViewer(){this.version="2.0.2-devel",this.VIEW_STATE_INITIALIZING=1,this.VIEW_STATE_INITIALIZED=2,this.VIEW_STATE_ERROR=3,this._configure=function(a){$(".cv-version").html(cubesviewer.version),angular.module("cv").constant("cvOptions",a)},this.init=function(a){this._configure(a),angular.element(document).ready(function(){angular.bootstrap(document,["cv"])})},this.createView=function(a,b,c){var d=angular.element(document).injector().get("$compile"),e=angular.element(document).injector().get("viewsService"),f=e.createView("cube",c),g='
    ';$(a).first().html(g);var h=angular.element(document).scope().$root,i=h.$new();return i.view=f,d($(a).first().contents())(i),f},this.apply=function(a){angular.element(document).scope()?angular.element(document).scope().$apply(a):(console.debug("Delaying"),setTimeout(function(){cubesviewer.apply(a)},1e3))}}function cubesviewerViewCubeExplore(){this._drilldownSortFunction=function(a,b){var c=a.params.drilldown.slice(0);return b&&c.splice(0,0,a.params.xaxis),function(b,d){for(var e=0;ed[f.name])return 1}else for(var g=0;gd[h])return 1}}return 0}},this.columnTooltipAttr=function(a){return function(b,c,d){return'title="'+a+" = "+c+'"'}}}function cubesviewerViewCubeDynamicChart(){this.onViewDraw=function(a,b){$(".cv-view-series-horizontal-menu",$(b.container)).remove(),$(".cv-view-series-horizontal-info",$(b.container)).parents(".infopiece").remove()},this.loadData=function(a){var b=this.cubesviewer.views.cube.buildQueryParams(a,!1,!1);$("#"+a.id).find(".cv-view-viewdata").empty().append('

    Dynamic Chart

    Loading'),$.get(a.cubesviewer.options.cubesUrl+"/cube/"+a.cube.name+"/aggregate",b,a.cubesviewer.views.cube.dynamicchart._loadDataCallback(a),"json")}}function CubesViewerStudio(){this._configure=function(a){cubesviewer._configure(a)},this.init=function(a){this._configure(a),angular.element(document).ready(function(){angular.bootstrap(document,["cv.studio"])})}}angular.module("bootstrapSubmenu",[]).directive("submenu",["$timeout",function(a){return{restrict:"A",link:function(b,c,d){a(function(){$(c).submenupicker()},500)}}}]),function(){var a={};a.map=function(a,b){for(var c=[],d=0;d0&&(d.default_hierarchy_name=a.hierarchies[0].name)},c.Dimension.prototype.hierarchy=function(b){return a.isObject(b)?b:b?this.hierarchies[b]:this.hierarchies[this.default_hierarchy_name]},c.Dimension.prototype.level=function(b){return a.isObject(b)?b:a.find(this.levels,function(a){return a.name==b})},c.Dimension.prototype.toString=function(a){return this.name},c.Dimension.prototype.display_label=function(){return this.label||this.name},c.Dimension.prototype.hierarchy=function(b){return a.isObject(b)?b:null!=b?this.hierarchies[b]:this.hierarchies[this.default_hierarchy_name]},c.Hierarchy=function(a,b){this.parse(a,b)},c.Hierarchy.prototype.parse=function(b,c){var d=this;d.name=b.name,d.label=d.name,!b.label||(d.label=b.label),!b.description||(d.description=b.description),!b.info||(d.info=b.info);var e=b.levels||[];d.levels=a.map(e,function(a){return c.level(a)})},c.Hierarchy.prototype.toString=function(){return c.HIERARCHY_PREFIX_CHAR+this.name},c.Hierarchy.prototype.display_label=function(){return this.label||this.name},c.Level=function(a,b){this.parse(a,b)},c.Level.prototype.parse=function(a,b){var d,e=this;if(e.dimension_name=a,e.name=b.name,!b.label||(e.label=b.label),!b.description||(e.description=b.description),!b.info||(e.info=b.info),e._key=b.key,e._label_attribute=b.label_attribute,e._order_attribute=b.order_attribute,!b.role||(e.role=b.role),!b.cardinality||(e.cardinality=b.cardinality),e.nonadditive=b.nonadditive,e.attributes=[],b.attributes)for(d in b.attributes){var f=new c.Attribute(b.attributes[d]);e.attributes.push(f)}},c.Level.prototype.key=function(){var b=this._key,c=a.find(this.attributes,function(a){return a.name===b});return c||this.attributes[0]},c.Level.prototype.label_attribute=function(){var b=null;if(this._label_attribute){var c=this._label_attribute;b=a.find(this.attributes,function(a){return a.name===c})}return b||this.key()},c.Level.prototype.order_attribute=function(){var b=null,c=this._order_attribute;return c&&(b=a.find(this.attributes,function(a){return a.name===c})),b||this.label_attribute()},c.Level.prototype.toString=function(){return this.name},c.Level.prototype.display_name=function(){return this.label||this.name},c.Level.prototype.full_name=function(){return this.dimension_name+c.ATTRIBUTE_STRING_SEPARATOR_CHAR+this.name},c.Level.prototype.full_name_for_drilldown=function(){return this.dimension_name+c.DIMENSION_STRING_SEPARATOR_CHAR+this.name},c.Attribute=function(a){this.ref=a.ref,this.name=a.name,this.label=a.label,this.order=a.order,this.info=a.info||{},this.description=a.description,this.format=a.format,this.missing_value=a.missing_value,this.locales=a.locales},c.Measure=function(a){this.ref=a.ref,this.name=a.name,this.label=a.label,this.order=a.order,this.info=a.info||{},this.description=a.description,this.format=a.format,this.missing_value=a.missing_value,this.nonadditive=a.nonadditive,a.aggregates&&(this.aggregates=a.aggregates)},c.MeasureAggregate=function(a){this.ref=a.ref,this.name=a.name,this.label=a.label,this.order=a.order,this.locales=a.locales,this.info=a.info||{},this.description=a.description,this.format=a.format,this.missing_value=a.missing_value,this.nonadditive=a.nonadditive,this["function"]=a["function"],this.measure=a.measure},c.Browser=function(a,b){this.cube=b,this.server=a},c.Browser.prototype.full_cube=function(){return new c.Cell(this.cube)},c.Browser.prototype.aggregate=function(a,b){a||(a={});var c={};return a.cut&&(c.cut=a.cut.toString()),a.measure&&(c.measure=a.measure.toString()),a.drilldown&&(c.drilldown=a.drilldown.toString()),a.split&&(c.split=a.split.toString()),a.order&&(c.order=a.order.toString()),a.page&&(c.page=a.page),a.pagesize&&(c.pagesize=a.pagesize),this.server.query("aggregate",this.cube,a,b)},c.Browser.prototype.facts=function(a,b){a||(a={});var c={};return a.cut&&(c.cut=a.cut.toString()),a.order&&(c.order=a.order.toString()),a.page&&(c.page=a.page),a.pagesize&&(c.pagesize=a.pagesize),this.server.query("facts",this.cube,a,b)},c.Drilldown=function(b,c,d){if(!a.isObject(b))throw"Drilldown requires a Dimension object as first argument";if(this.dimension=b,this.hierarchy=b.hierarchy(c),this.level=b.level(d)||this.hierarchy.levels[0],!this.hierarchy)throw"Drilldown cannot recognize hierarchy "+c+" for dimension "+b;if(!this.level)throw"Drilldown cannot recognize level "+d+" for dimension "+b},c.Drilldown.prototype.toString=function(){return""+this.dimension+this.hierarchy+c.DIMENSION_STRING_SEPARATOR_CHAR+this.level},c.Drilldown.prototype.keysInResultCell=function(){var b=this,c=!1,d=a.filter(b.hierarchy.levels,function(a){return a.key()===b.level.key()&&(c=!0)||!c});return a.map(d,function(a){return a.key().ref})},c.Drilldown.prototype.labelsInResultCell=function(){var b=this,c=!1,d=a.filter(b.hierarchy.levels,function(a){return a.key()===b.level.key()&&(c=!0)||!c});return a.map(d,function(a){return a.label_attribute().ref})},c.Cell=function(b,c){this.cube=b,this.cuts=a.map(c||[],function(a){return a})},c.Cell.prototype.slice=function(a){for(var b=[],d=!1,e=0;e1)return new c.SetCut(j,h,a.map(k,function(a){return c.path_from_string(a)}),f);if(k=c._split_with_negative_lookbehind(i,c.RANGE_CUT_SEPARATOR,"\\"),2==k.length){var l=k[0]?c.path_from_string(k[0]):null,m=k[1]?c.path_from_string(k[1]):null;return new c.RangeCut(j,h,l,m,f)}return new c.PointCut(j,h,c.path_from_string(i),f)},c.cuts_from_string=function(b,d){var e=c._split_with_negative_lookbehind(d,c.CUT_STRING_SEPARATOR,"\\");return a.map(e||[],function(a){return c.cut_from_string(b,a)})},c.cell_from_string=function(a,b){return new c.Cell(a,c.cuts_from_string(a,b))},c.drilldown_from_string=function(a,b){var d=c.DRILLDOWN_PARSE_REGEXP.exec(b);if(!d)return null;var e=d[1],f=d[2]||null,g=d[3]||null,h=a.dimension(e);if(!h){if(e!==c.SPLIT_DIMENSION_STRING)return null;h=c.SPLIT_DIMENSION}return new c.Drilldown(h,f,g)},c.drilldowns_from_string=function(b,d){var e=c._split_with_negative_lookbehind(d,c.CUT_STRING_SEPARATOR,"\\");return a.map(e||[],function(a){return c.drilldown_from_string(b,a)})},c.drilldowns_to_string=function(b){return a.map(b,function(a){return a.toString()}).join(c.CUT_STRING_SEPARATOR_CHAR)},b.cubes=c}.call(this),cubes.Dimension.prototype.hierarchies_count=function(){var a=0;for(var b in this.hierarchies)this.hierarchies.hasOwnProperty(b)&&a++;return a},cubes.Dimension.prototype.default_hierarchy=function(){return this.hierarchies[this.default_hierarchy_name]},cubes.Dimension.prototype.isDateDimension=function(){return!("time"!=this.role||"cv-datefilter"in this.info&&1!=this.info["cv-datefilter"])},cubes.Cube.prototype.dateDimensions=function(){var a=[];for(var b in this.dimensions){var c=this.dimensions[b];c.isDateDimension()&&a.push(c)}return a},cubes.Cube.prototype.cvdim_dim=function(a){var b=a;return a.indexOf("@")>0?b=a.split("@")[0]:a.indexOf(":")>0&&(b=a.split(":")[0]),this.dimension(b)},cubes.Cube.prototype.dimensionParts=function(a){var b=this.cvdim_dim(a),c=b.default_hierarchy();if(a.indexOf("@")>0){var d=a.split("@")[1].split(":")[0];c=b.hierarchy(d)}var e=null;if(a.indexOf(":")>0){var f=a.split(":")[1];e=b.level(f)}else e=b.level(c.levels[0]);for(var g=null,h=0;h1?" / "+e.label:""),labelShort:b.label+(c.levels.length>1?" / "+e.label:""),labelNoLevel:b.label+("default"!=c.name?" - "+c.label:""),fullDrilldownValue:b.name+("default"!=c.name?"@"+c.name:"")+":"+e.name,fullCutValue:b.name+("default"!=c.name?"@"+c.name:"")}},cubes.Cube.prototype.measureAggregates=function(a){var b=$.grep(this.aggregates,function(b){return a?b.measure==a:!b.measure});return b},cubes.Cube.prototype.aggregateFromName=function(a){var b=$.grep(this.aggregates,function(b){return a?b.name==a:!b.measure});return 1==b.length?b[0]:null},cubes.Level.prototype.readCell=function(a){if(!(this.key().ref in a))return null;var b={};return b.key=a[this.key().ref],b.label=a[this.label_attribute().ref],b.orderValue=a[this.order_attribute().ref],b.info={},$(this.attributes).each(function(c,d){b.info[d.ref]=a[d.ref]}),b},cubes.Hierarchy.prototype.readCell=function(a,b){for(var c=[],d=0;d0&&(d.drilldown=cubes.drilldowns_to_string(e))}var g=this.buildQueryCuts(a);return g.length>0&&(d.cut=new cubes.Cell(a.cube,g)),d},this.buildQueryCuts=function(a){var b=[];return $(a.params.cuts).each(function(c,d){var e=d.invert?"!":"",f=a.cube.dimensionParts(d.dimension),g=f.dimension.name+("default"!=f.hierarchy.name?"@"+f.hierarchy.name:"");b.push(cubes.cut_from_string(a.cube,e+g+":"+d.value.replace("-","\\-")))}),$(a.params.datefilters).each(function(c,d){var f=e.datefilterValue(a,d);null!=f&&b.push(cubes.cut_from_string(a.cube,d.dimension+":"+f))}),b},this.datefilterValue=function(a,b){var c=null,d=null;if(0==b.mode.indexOf("auto-")?"auto-last1m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-1)):"auto-last3m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-3)):"auto-last6m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-6)):"auto-last12m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-12)):"auto-last24m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-24)):"auto-january1st"==b.mode?(c=new Date,c.setMonth(0),c.setDate(1)):"auto-yesterday"==b.mode&&(c=new Date,c.setDate(c.getDate()-1),d=new Date,d.setDate(c.getDate()-1)):"custom"==b.mode&&(null!=b.date_from&&""!=b.date_from&&(c=new Date(b.date_from)),null!=b.date_to&&""!=b.date_to&&(d=new Date(b.date_to))),null!=c||null!=d){var f="";return null!=c&&(f+=e._datefiltercell(a,b,c)),f+="-",null!=d&&(f+=e._datefiltercell(a,b,d)),f}return null},this._datefiltercell=function(a,b,c){for(var d=[],e=a.cube.dimensionParts(b.dimension),f=0;fc.cacheNotice&&b.debug("Data loaded from cache ("+Math.floor(k/60,2)+" minutes old)"),j=$.Deferred(),j.error=function(){},setTimeout(function(){g(f.cache[i].data),j.resolve()},0),e.trackRequest(a)}else j=f._cacheOverridedCubesRequest(a,d,f._cacheCubesRequestSuccess(g,i),h);return j},this._cacheCleanup=function(){var a=c.cacheDuration,b=c.cacheSize,d=(new Date).getTime()-1e3*a,e=[];for(var g in f.cache)f.cache[g].time=b)for(var h=0;h
    ')},this.show=function(a){var c=b.open({animation:!0,templateUrl:"dialog/dialog.html",controller:"CubesViewerViewsDialogController",appendTo:angular.element($("body").find(".cv-modals")[0]),resolve:{dialog:function(){return{text:a}}}});c.result.then(function(a){},function(){})},this.initialize()}]),angular.module("cv.views").controller("CubesViewerViewsDialogController",["$rootScope","$scope","$timeout","$uibModalInstance","cvOptions","cubesService","viewsService","dialog",function(a,b,c,d,e,f,g,h){b.$rootScope=a,b.dialog=h,b.close=function(){d.dismiss("cancel")}}]),cubesviewer.CubeView=function(a,b,c){var d=cubesviewer.View(a,b,c);return d.resultLimitHit=!1,d.requestFailed=!1,d.pendingRequests=0,d.dimensionFilter=null,d._invalidatedData=!0,d._invalidatedDefs=!0,d.grid={api:null,data:[],columnDefs:[]},d.invalidateData=function(){d._invalidatedData=!0},d.invalidateDefs=function(){d._invalidatedData=!0,d._invalidatedDefs=!0},d.setViewMode=function(a){d.params.mode=a,d.invalidateDefs()},d},angular.module("cv.views.cube",[]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeController",["$rootScope","$log","$window","$injector","$scope","$timeout","cvOptions","cubesService","viewsService","exportService","rowSorter",function($rootScope,$log,$window,$injector,$scope,$timeout,cvOptions,cubesService,viewsService,exportService,rowSorter){$scope.viewController={},$scope.$rootScope=$rootScope,$scope.viewsService=viewsService,$scope.cvOptions=cvOptions,$scope.cubesService=cubesService,$scope.exportService=exportService,$scope.reststoreService=null,$injector.has("reststoreService")&&($scope.reststoreService=$injector.get("reststoreService")),$scope.refreshView=function(){$scope.view&&$scope.view.cube&&$scope.$broadcast("ViewRefresh",$scope.view)},$scope.setViewMode=function(a){console.debug("Remove setViewMode call on the controller?"),$scope.view.setViewMode(a)},$scope.initCube=function(){$scope.view.cube=null;var a={mode:"explore",drilldown:[],cuts:[],datefilters:[],columnHide:{},columnWidths:{},columnSort:{}},b=cubesService.cubesserver.get_cube($scope.view.params.cubename,function(b){$scope.view.cube=b,$log.debug($scope.view.cube),"cv-view-params"in $scope.view.cube.info?$scope.view.params=$.extend({},a,$scope.view.cube.info["cv-view-params"],$scope.view.params):$scope.view.params=$.extend({},a,$scope.view.params),$scope.view.state=cubesviewer.VIEW_STATE_INITIALIZED,$scope.view.error="",$rootScope.$apply()});b.fail(function(a){var b=a.responseJSON;$scope.view.state=cubesviewer.VIEW_STATE_ERROR,$scope.view.error="Error loading model: "+b.message+" ("+b.error+")",console.debug(b),$rootScope.$apply()})},$scope.requestErrorHandler=function(){$scope.view._requestFailed=!0},$scope.resetGrid=function(){rowSorter.colSortFnCache={}},$scope.onGridRegisterApi=function(a){$scope.view.grid.api=a,a.selection.on.rowSelectionChanged($scope,function(a){}),a.selection.on.rowSelectionChangedBatch($scope,function(a){}),a.core.on.columnVisibilityChanged($scope,function(a){a.visible?delete $scope.view.params.columnHide[a.field]:($scope.view.params.columnHide[a.field]=!0,delete $scope.view.params.columnWidths[a.field]),$scope.view.updateUndo()}),a.core.on.sortChanged($scope,function(a,b){$scope.view.params.columnSort[$scope.view.params.mode]={},$(b).each(function(a,b){$scope.view.params.columnSort[$scope.view.params.mode][b.field]={direction:b.sort.direction,priority:b.sort.priority}}),$scope.view.updateUndo()}),a.colResizable.on.columnSizeChanged($scope,function(b,c){var d=-1;$(a.grid.columns).each(function(a,c){c.field==b.field&&(d=a)}),d>=0&&($scope.view.params.columnWidths[b.field]=a.grid.columns[d].width),$scope.view.updateUndo()})},$scope.view.grid.onRegisterApi=$scope.onGridRegisterApi,$scope.validateData=function(a,b){$scope.view.requestFailed=!1,$scope.view.resultLimitHit=!1,("cells"in a&&a.cells.length>=cubesService.cubesserver.info.json_record_limit||a.length&&a.length>=cubesService.cubesserver.info.json_record_limit)&&($scope.view.resultLimitHit=!0)},$scope.newViewStateKey=function(){return $scope._viewStateKey=Math.floor(999999999999*Math.random()),$scope._viewStateKey},$scope.selectDrill=function(a,b){$scope.view.cube;a?($scope.removeDrill(a),1==b&&$scope.view.params.drilldown.push(a)):$scope.view.params.drilldown=[],$scope.refreshView()},$scope.removeDrill=function(a){$scope.view.params.drilldown=$.grep($scope.view.params.drilldown,function(b){return $scope.view.cube.dimensionParts(b).dimension.name==$scope.view.cube.dimensionParts(a).dimension.name},!0),$scope.refreshView()},$scope.columnFormatFunction=function(agmes){var view=$scope.view,measure=agmes;if(!measure)return function(a){return a};"measure"in agmes&&(measure=$.grep(view.cube.measures,function(a,b){return a.ref==agmes.measure})[0]);var formatterFunction=null;return formatterFunction=measure&&"cv-formatter"in measure.info?function(value,row){return eval(measure.info["cv-formatter"])}:function(a){return Math.formatnumber(a,"record_count"==agmes.ref?0:2)}},$scope.selectCut=function(a,b,c){var d=$scope.view;a?b?(d.params.cuts=$.grep(d.params.cuts,function(b){return d.cube.dimensionParts(b.dimension).fullCutValue==d.cube.dimensionParts(a).fullCutValue},!0),d.params.cuts.push({dimension:a,value:b,invert:c})):d.params.cuts=$.grep(d.params.cuts,function(b){return d.cube.dimensionParts(b.dimension).fullCutValue==d.cube.dimensionParts(a).fullCutValue},!0):d.params.cuts=[],$scope.refreshView()},$scope.filterSelected=function(){var a=$scope.view;if(1!=a.params.drilldown.length)return void dialogService.show("Can only filter multiple values in a view with one level of drilldown.");if(a.grid.api.selection.getSelectedCount()<=0)return void dialogService.show("Cannot filter. No rows are selected.");var b=[],c=a.grid.api.selection.getSelectedRows();$(c).each(function(a,c){b.push(c.key0.cutValue)});var d=!1;$scope.selectCut(a.grid.columnDefs[0].cutDimension,b.join(";"),d)},$scope.showDimensionFilter=function(a){$scope.view.dimensionFilter&&$scope.view.dimensionFilter==a?$scope.view.dimensionFilter=null:$scope.view.dimensionFilter=a},$scope.selectMeasure=function(a){$scope.view.params.yaxis=a,$scope.refreshView()},$scope.selectXAxis=function(a){$scope.view.params.xaxis=""==a?null:a,$scope.refreshView()},$scope.selectChartType=function(a){$scope.view.params.charttype=a,$scope.refreshView(); -},$scope.selectCalculation=function(a){$scope.view.params.calculation=a,$scope.refreshView()},$scope.showSerializeView=function(a){studioViewsService.studioScope.showSerializeView(a)},$scope.selectDateFilter=function(a,b){var c=$scope.view;c.cube;if(""!=a){if("1"==b)c.params.datefilters.push({dimension:a,mode:"auto-last3m",date_from:null,date_to:null});else for(var d=0;d0&&i%3==0&&(e+=d)}return b>0&&(e+=parseFloat(f-Math.floor(f)).toFixed(b).toString().replace(".",c).substring(1)),0>a&&(e="-"+e),e},angular.module("cv.views.cube").controller("CubesViewerViewsCubeExploreController",["$rootScope","$scope","$timeout","cvOptions","cubesService","viewsService","dialogService","uiGridConstants",function(a,b,c,d,e,f,g,h){b.view.grid.enableRowSelection=!0,b.view.grid.enableRowHeaderSelection=!0,b.initialize=function(){b.refreshView()},b.$on("ViewRefresh",function(a){b.loadData()}),b.loadData=function(){var c=e.buildBrowserArgs(b.view,!1,!1),d=new cubes.Browser(e.cubesserver,b.view.cube),f=b.newViewStateKey(),g=d.aggregate(c,b._loadDataCallback(f));b.view.pendingRequests++,g.always(function(){b.view.pendingRequests--,a.$apply()}),g.error(b.requestErrorHandler)},b._loadDataCallback=function(c){return function(d,e){c==b._viewStateKey&&(b.validateData(d,e),b.processData(d),a.$apply())}},b.processData=function(c){var f=b.view;b.resetGrid(),b.view.grid.data=[],b.view.grid.columnDefs=[],a.$apply(),angular.extend(f.grid,{data:[],rowHeight:24,onRegisterApi:b.onGridRegisterApi,enableColumnResizing:!0,showColumnFooter:!0,enableGridMenu:!0,paginationPageSizes:d.pagingOptions,paginationPageSize:d.pagingOptions[0],enableRowSelection:f.params.drilldown.length>0,enablePinning:!1,multiSelect:!0,selectionRowHeaderWidth:20,columnDefs:[]}),$(f.cube.aggregates).each(function(a,d){var e={name:d.label,field:d.ref,index:d.ref,cellClass:"text-right",type:"number",headerCellClass:"cv-grid-header-measure",width:b.defineColumnWidth(d.ref,115),visible:!f.params.columnHide[d.ref],cellTemplate:'
    {{ col.colDef.formatter(COL_FIELD, row, col) }}
    ',formatter:b.columnFormatFunction(d),sort:b.defineColumnSort(d.ref)};e.footerValue=b.columnFormatFunction(d)(c.summary[d.ref],null,e),e.footerCellTemplate='
    {{ col.colDef.footerValue }}
    ',f.grid.columnDefs.push(e)}),b._addRows(c);var g=[];$(f.params.drilldown).each(function(a,b){g.push(f.cube.cvdim_dim(b).label)});for(var h=0;hSummary":'Summary (Filtered)'),f.grid.columnDefs.splice(h,0,{name:g[h],field:"key"+h,index:"key"+h,headerCellClass:"cv-grid-header-dimension",enableHiding:!1,cutDimension:j,width:b.defineColumnWidth("key"+h,190),cellTemplate:'',footerCellTemplate:'
    '+k+"
    ",sort:b.defineColumnSort("key"+h),sortingAlgorithm:b.sortDimensionParts(i)})}0==f.params.drilldown.length&&f.grid.columnDefs.splice(0,0,{name:f.cube.label,field:"key0",index:"key0",enableHiding:!1,align:"left",width:b.defineColumnWidth("key0",190),sort:b.defineColumnSort("key0")})},b._addRows=function(a){var c=b.view,d=c.grid.data;if($(a.cells).each(function(a,b){for(var e=[],f={},g=[],h=0;h=0}},b.selectAll=function(){var a=b.filterDimensionValue(b.searchString);$(b.dimensionValues).each(function(b,c){a(c)&&(c.selected=!0)})},b.selectNone=function(){var a=b.filterDimensionValue(b.searchString);$(b.dimensionValues).each(function(b,c){a(c)&&(c.selected=!1)})},b._processData=function(a){for(var c=b.view,d=(b.view.cube.cvdim_dim(b.view.dimensionFilter),[]),e=(c.cube.dimensionParts(b.view.dimensionFilter),b.view.dimensionFilter),f=[],g=0;g=0})}),b.dimensionValues=d,b.$apply()},b.applyFilter=function(){var a=(b.view,[]);$(b.dimensionValues).each(function(b,c){c.selected&&a.push(c.value)}),a.length>=b.dimensionValues.length&&(a=[]);var c=b.parts.dimension.name+("default"!=b.parts.hierarchy.name?"@"+b.parts.hierarchy.name:"")+":"+b.parts.level.name;b.selectCut(c,a.join(";"),b.filterInverted)},b.initialize()}]),angular.module("cv.views.cube").filter("datefilterMode",["$rootScope","cvOptions",function(a,b){return function(a){var b="None";switch(a){case"custom":b="Custom";break;case"auto-last1m":b="Last month";break;case"auto-last3m":b="Last 3 months";break;case"auto-last6m":b="Last 6 months";break;case"auto-last12m":b="Last year";break;case"auto-last24m":b="Last 2 years";break;case"auto-january1st":b="From January 1st";break;case"auto-yesterday":b="Yesterday"}return b}}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeFilterDateController",["$rootScope","$scope","$filter","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f){b.initialize=function(){b.dateStart.value=b.datefilter.date_from?new Date(b.datefilter.date_from):null,b.dateEnd.value=b.datefilter.date_to?new Date(b.datefilter.date_to):null},b.dateStart={opened:!1,value:null,options:{formatYear:"yyyy",startingDay:d.datepickerFirstDay,showWeeks:d.datepickerShowWeeks}},b.dateEnd={opened:!1,value:null,options:{formatYear:"yyyy",startingDay:d.datepickerFirstDay,showWeeks:d.datepickerShowWeeks}},b.dateStartOpen=function(){b.dateStart.opened=!0},b.dateEndOpen=function(){b.dateEnd.opened=!0},b.setMode=function(a){b.datefilter.mode=a},b.updateDateFilter=function(){b.datefilter.date_from=b.dateStart.value?c("date")(b.dateStart.value,"yyyy-MM-dd"):null,b.datefilter.date_to=b.dateEnd.value?c("date")(b.dateEnd.value,"yyyy-MM-dd"):null,b.refreshView()},b.$watch("dateStart.value",b.updateDateFilter),b.$watch("dateEnd.value",b.updateDateFilter),b.$watch("datefilter.mode",b.updateDateFilter),b.initialize()}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeFactsController",["$rootScope","$scope","$timeout","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f){b.view.grid.enableRowSelection=!1,b.view.grid.enableRowHeaderSelection=!1,b.initialize=function(){b.refreshView()},b.$on("ViewRefresh",function(a){b.loadData()}),b.loadData=function(){var c=e.buildBrowserArgs(b.view,!1,!1),d=new cubes.Browser(e.cubesserver,b.view.cube),f=b.newViewStateKey(),g=d.facts(c,b._loadDataCallback(f));b.view.pendingRequests++,g.always(function(){b.view.pendingRequests--,a.$apply()}),g.error(b.requestErrorHandler)},b._loadDataCallback=function(c){return function(d,e){c==b._viewStateKey&&(b.validateData(d,e),b.processData(d),a.$apply())}},b.processData=function(c){var e=b.view;b.resetGrid(),b.view.grid.data=[],b.view.grid.columnDefs=[],a.$apply();var f=e.cube.dimensions,g=e.cube.measures,h=e.cube.details;angular.extend(b.view.grid,{data:[],rowHeight:24,onRegisterApi:b.onGridRegisterApi,enableColumnResizing:!0,showColumnFooter:!1,enableGridMenu:!0,paginationPageSizes:d.pagingOptions,paginationPageSize:d.pagingOptions[0],enableRowSelection:!1,enableRowHeaderSelection:!1,enablePinning:!1,multiSelect:!1,columnDefs:[]}),e.grid.columnDefs.push({name:"id",field:"id",index:"id",enableHiding:!1,width:80});for(var i in f)for(var j=f[i],k=0;k{{ row.entity[col.colDef.field] }}
    ',visible:!e.params.columnHide[l.key().ref],width:b.defineColumnWidth(l.key().ref,95),sort:b.defineColumnSort(l.key().ref),sortingAlgorithm:b.sortDimensionLevel(l)};e.grid.columnDefs.push(m)}for(var n in g){var o=g[n],m={name:o.label,field:o.ref,index:o.ref,cellClass:"text-right",headerCellClass:"cv-grid-header-measure",cellTemplate:'
    {{ col.colDef.formatter(COL_FIELD, row, col) }}
    ',formatter:b.columnFormatFunction(o),visible:!e.params.columnHide[o.ref],width:b.defineColumnWidth(o.ref,75),sort:b.defineColumnSort(o.ref)};e.grid.columnDefs.push(m)}for(var p in h){var q=h[p],m={name:q.name,field:q.ref,index:q.ref,visible:!e.params.columnHide[q.ref],width:b.defineColumnWidth(q.ref,95),sort:b.defineColumnSort(q.ref),sortingAlgorithm:b.sortValues};e.grid.columnDefs.push(m)}b._addRows(c)},b._addRows=function(a){var c=b.view,d=c.grid.data,e=0,f=c.cube.dimensions,g=c.cube.measures,h=c.cube.details;$(a).each(function(a,b){var c=[];for(var i in f)for(var j=f[i],k=0;k0)i[0][p]=q,i[0]._cell=h;else{var s={};s.key=r,s[p]=q;for(var k=f;k{{ col.colDef.formatter(COL_FIELD, row, col) }}
    ',formatter:a.columnFormatFunction(t),enableHiding:!1,width:a.defineColumnWidth(p,90),sort:a.defineColumnSort(p)};c.grid.columnDefs.push(u)}}),$(c.params.drilldown).each(function(b,d){var e={name:c.cube.cvdim_dim(d).label,field:"key"+b,index:"key"+b,headerCellClass:"cv-grid-header-dimension",enableHiding:!1,width:a.defineColumnWidth("key"+b,190),sort:a.defineColumnSort("key"+b),sortingAlgorithm:a.sortDimensionParts(c.cube.dimensionParts(d))};c.grid.columnDefs.splice(b,0,e)}),0==c.params.drilldown.length&&d.length>0){d[0].key0=c.cube.aggregateFromName(c.params.yaxis).label;var h={name:"Measure",field:"key0",index:"key0",headerCellClass:"cv-grid-header-measure",enableHiding:!1,width:a.defineColumnWidth("key0",190),sort:a.defineColumnSort("key0")};c.grid.columnDefs.splice(0,0,h)}},angular.module("cv.views").service("seriesOperationsService",["$rootScope","cvOptions","cubesService",function(a,b,c){this.calculateDifferentials=function(a,b,c){console.debug("FIXME: Differentials are ignoring drilldown.length columns, but fails in some cases."),$(b).each(function(b,d){for(var e=null,f=a.params.drilldown.length;f0&&(g.splice(0,e.params.drilldown.length,{name:"key"}),$(f).each(function(a,b){for(var c=[],d=0;d","");var j=new Blob([a+h],{type:"image/svg+xml;charset=utf-8"}),k=window.URL.createObjectURL(j),l=d3.select("body").append("img").attr("visibility","hidden").attr("width",e.width()).attr("height",e.height()).node();l.onload=function(){var a=d3.select("body").append("canvas").node();$(a).addClass("cv-bootstrap"),$(a).attr("visibility","hidden"),a.width=e.width(),a.height=e.height();var c=a.getContext("2d");c.drawImage(l,0,0,e.width(),e.height());var d=a.toDataURL("image/png");$(l).remove(),$(a).remove(),i.saveAs(d,b.view.cube.name+"-"+b.view.params.charttype+".png")},l.src=k},b.$on("$destroy",function(){j.cleanupNvd3(),b.view.grid.data=[],b.view.grid.columnDefs=[]}),this.initialize()}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeChartBarsVerticalController",["$rootScope","$scope","$element","$timeout","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f,g){b.chart=null,b.initialize=function(){},b.$on("gridDataUpdated",function(){b.chartCtrl.cleanupNvd3(),d(function(){b.drawChartBarsVertical()},0)}),b.drawChartBarsVertical=function(){var a=b.view,d=b.view.grid.data,e=a.grid.columnDefs,f=$(c).find("svg").get(0),g=null!=a.params.xaxis?a.cube.dimensionParts(a.params.xaxis).label:"None",h=[],i=(d.length,0);$(d).each(function(b,c){for(var d=[],f=1;fb.key?1:0});var j={delay:1200,groupSpacing:.1},k=$.grep(a.cube.aggregates,function(b){return b.ref==a.params.yaxis})[0],l=b.columnFormatFunction(k);nv.addGraph(function(){var c=nv.models.multiBarChart().showLegend(!!a.params.chartoptions.showLegend).margin({left:120});return a.params["chart-barsvertical-stacked"]&&c.stacked(a.params["chart-barsvertical-stacked"]),c.options(j),c.multibar.hideable(!0),c.xAxis.axisLabel(g),c.yAxis.tickFormat(function(a,b){return l(a)}),d3.select(f).datum(h).call(c),c.dispatch.on("stateChange",function(b){a.params["chart-barsvertical-stacked"]=b.stacked,a.params["chart-disabledseries"]={key:a.params.drilldown.join(","),disabled:{}};for(var c=0;cb.key?1:0});var i={delay:1200,groupSpacing:.1},j=$.grep(a.cube.aggregates,function(b){return b.ref==a.params.yaxis})[0],k=b.columnFormatFunction(j);nv.addGraph(function(){var c=nv.models.multiBarHorizontalChart().showLegend(!!a.params.chartoptions.showLegend).margin({left:120}).showControls(!0);return a.params["chart-barsvertical-stacked"]&&c.stacked(a.params["chart-barsvertical-stacked"]),c.options(i),c.yAxis.tickFormat(function(b,c){return 2==d.length&&a.params.chartoptions.mirrorSerie2&&0>b&&(b=-b),k(b)}),d3.select(f).datum(g).call(c),c.dispatch.on("stateChange",function(b){a.params["chart-barsvertical-stacked"]=b.stacked,a.params["chart-disabledseries"]={key:a.params.drilldown.join(","),disabled:{}};for(var c=0;cb.key?1:0});var j=$.grep(a.cube.aggregates,function(b){return b.ref==a.params.yaxis})[0],k=b.columnFormatFunction(j);"lines-stacked"!=a.params.charttype?nv.addGraph(function(){var c=nv.models.lineChart().useInteractiveGuideline(!0).interpolate(b.view.params.chartoptions.lineInterpolation).showLegend(!!a.params.chartoptions.showLegend).margin({left:120});return c.xAxis.axisLabel(g).tickFormat(function(a,b){return e[a].name}),c.yAxis.tickFormat(function(a,b){return k(a)}),d3.select(f).datum(h).call(c),c.dispatch.on("stateChange",function(b){a.params["chart-disabledseries"]={key:a.params.drilldown.join(","),disabled:{}};for(var c=0;c0){var f={y:d,key:""!=c.key?c.key:e[0].name};a.params["chart-disabledseries"]&&a.params["chart-disabledseries"].key==a.params.drilldown.join(",")&&(f.disabled=!!a.params["chart-disabledseries"].disabled[f.key]),g.push(f),h++}}),g.sort(function(a,b){return a.yb.y?1:0});for(var i=[],j=1;jb.label?1:0});for(var i=[],j=1;jh,fillOpacity:.2},mouse:{track:!1,relative:!0},grid:{circular:!0,minorHorizontalLines:!0},xaxis:{ticks:i},yaxis:{},legend:{show:!!a.params.chartoptions.showLegend,position:"se",backgroundColor:"#D2E8FF"}};b.flotrDraw=Flotr.draw(f,g,k)},b.initialize()}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeChartSunburstController",["$rootScope","$scope","$element","$timeout","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f,g){b.chart=null,b.initialize=function(){},b.$on("gridDataUpdated",function(){d(function(){b.drawChartSunburst()},2e3)}),b.drawChartSunburst=function(){var a=b.view,c=b.rawData,d=(b.view.grid.data,a.grid.columnDefs,b.prepareDrilldownTree(c));b.draw3DJSSunburst(d)},b.prepareDrilldownTree=function(a){var c=b.view,d=[{children:[],name:"Current Slice"}],e=null;return $(a.cells).each(function(a,b){e=d[0];for(var f=0;f0?e=c[0]:(c={children:[],name:String(b.key),label:b.label},e.children.push(c),e=c)})}e.measure=b[c.params.yaxis]}),d[0].children},String.prototype.hashCode=function(){var a,b,c,d=0;if(0===this.length)return d;for(a=0,c=this.length;c>a;a++)b=this.charCodeAt(a),d=(d<<5)-d+b,d|=0;return d},b.draw3DJSSunburst=function(a){function d(a,b){return a===b?!0:a.children&&a.children.length>0?a.children.some(function(a){ -return d(a,b)}):!1}function e(a){if(!a)return"#ffaaaa";if(void 0!=a.color)return a.color;if(null!=a.parent&&null!=a.parent.parent){a.color=e(a.parent);var b=u(Math.abs(String(a.name).hashCode())%20);a.color=d3.scale.linear().domain([0,100]).interpolate(d3.interpolateRgb).range([a.color,b])(30),a.color=b}else"name"in a?a.color=u(Math.abs(String(a.name).hashCode())%20):a.color="#ffffff";return a.color}function f(a){var b=g(a),c=d3.interpolate(q.domain(),[a.x,a.x+a.dx]),d=d3.interpolate(r.domain(),[a.y,b]),e=d3.interpolate(r.range(),[20,p]);return function(a){return function(b){return q.domain(c(b)),r.domain(d(b)).range(e(b)),z(a)}}}function g(a){return 1}function h(a){return.299*a.r+.587*a.g+.114*a.b}function i(a,b){var c=a.split(" "),d=c.length>8;return c.length<=2?0==b?a:"":(c=c.slice(0,8),c=0==b?c.slice(0,Math.floor(c.length/2)):c.slice(Math.floor(c.length/2)),c.join(" ")+(d&&1==b?"...":""))}function j(a){C.style("visibility",function(a){var b=Math.abs(q(a.x+a.dx)-q(a.x))>Math.PI/48;return b?null:"hidden"}).transition().duration(t).attrTween("text-anchor",function(a){return function(){return q(a.x+a.dx/2)>Math.PI?"end":"start"}}).attrTween("transform",function(a){var b=(a.name||"").split(" ").length>1;return function(){var c=180*q(a.x+a.dx/2)/Math.PI-90,d=c+(b?-.5:0);return"rotate("+d+")translate("+(r(a.y)+s)+")rotate("+(c>90?-180:0)+")"}}).style("fill-opacity",function(b){return d(a,b)?1:1e-6}).each("end",function(a){var b=Math.abs(q(a.x+a.dx)-q(a.x))>Math.PI/48;d3.select(this).style("visibility",b?null:"hidden")})}function k(a){v=a,B.transition().duration(t).attrTween("d",f(a)),j(a)}var l=b.view,a=a,m=(b.rawData,l.grid.columnDefs,$(c).find("svg").parent().empty().get(0)),n=(null!=l.params.xaxis?l.cube.dimensionParts(l.params.xaxis).label:"None",470),o=n,p=n/2,q=d3.scale.linear().range([0*Math.PI,2*Math.PI]),r=d3.scale.linear().domain([0,1]).range([20,p]),s=5,t=1e3,u=d3.scale.category20b().domain([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),v=null,w=d3.select(m),x=w.append("svg").attr("width",n+2*s).attr("height",o+2*s).append("g").attr("transform","translate("+(p+s)+","+(p+s)+")"),y=d3.layout.partition().sort(null).value(function(a){return a.measure}),z=d3.svg.arc().startAngle(function(a){return Math.max(0,Math.min(2*Math.PI,q(a.x)))}).endAngle(function(a){return Math.max(0,Math.min(2*Math.PI,q(a.x+a.dx)))}).innerRadius(function(a){return Math.max(0,a.y?r(a.y):a.y)}).outerRadius(function(a){return Math.max(0,r(a.y+a.dy))}),A=y.nodes({children:a}),B=x.selectAll("path").data(A);B.enter().append("path").attr("id",function(a,b){return"path-"+b}).attr("d",z).attr("fill-rule","evenodd").style("fill",e).on("click",k).each(function(a,b){var c=this;$(c).hover(function(){d3.select(c).style("stroke","#ffffff").style("stroke-width","2").style("stroke-opacity","1"),$(c).insertBefore($("text").first())},function(){d3.select(c).style("stroke","#000000").style("stroke-width","0").style("stroke-opacity","0")})}),v=A[0];var C=x.selectAll("text").data(A),D=C.enter().append("text").style("fill-opacity",1).style("fill",function(a){return h(d3.rgb(e(a)))<125?"#eee":"#000"}).style("font-size",9).style("-webkit-touch-callout","none").style("-webkit-user-select","none").style("-khtml-user-select","none").style("-moz-user-select","none").style("-ms-user-select","none").style("user-select","none").style("pointer-events","none").style("visibility",function(a){var b=Math.abs(q(a.x+a.dx)-q(a.x))>Math.PI/48;return b=!0,b?null:"hidden"}).attr("text-anchor",function(a){return q(a.x+a.dx/2)>Math.PI?"end":"start"}).attr("dy",".2em").attr("transform",function(a){var b=(("label"in a?String(a.label):"")||"").split(" ").length>1,c=180*q(a.x+a.dx/2)/Math.PI-90,d=c+(b?-.5:0);return"rotate("+d+")translate("+(r(a.y)+s)+")rotate("+(c>90?-180:0)+")"}).on("click",k);D.append("tspan").attr("x",0).text(function(a){return a.depth?i(a.label,0):""}),D.append("tspan").attr("x",0).attr("dy","1em").text(function(a){return a.depth?i(a.label,1)||"":""})}}]),angular.module("cv.views.cube").service("exportService",["$rootScope","$timeout","cvOptions","cubesService","viewsService","seriesOperationsService",function(a,b,c,d,e,f){this.exportFacts=function(a){var b=d.buildBrowserArgs(a,!1,!0),e={};e.format="csv",b.cut&&(e.cut=b.cut.toString()),b.order&&(e.order=b.order.toString());var f=c.cubesUrl+"/cube/"+a.cube.name+"/facts?"+$.param(e);window.open(f,"_blank"),window.focus()},this.exportGridAsCsv=function(a){if(!a.grid)return void console.debug("View has no grid that can be exported.");var b=(a.grid,a.grid.data),c="",d=[];$(a.grid.columnDefs).each(function(a,b){d.push('"'+b.name+'"')}),c=c+d.join(",")+"\n",$(b).each(function(b,e){d=[],$(a.grid.columnDefs).each(function(a,b){e[b.field].title?d.push('"'+e[b.field].title+'"'):d.push('"'+e[b.field]+'"')}),c=c+d.join(",")+"\n"});var e="data:text/csv;charset=utf-8,"+encodeURIComponent(c);this.saveAs(e,a.cube.name+"-summary.csv")},this.saveAs=function(a,b){var c=document.createElement("a");"string"==typeof c.download?(document.body.appendChild(c),c.download=b,c.href=a,c.click(),document.body.removeChild(c)):location.replace(a)},this.getDocumentStyles=function(){function a(b){try{if(b.cssRules){console.debug(b);for(var d=0;d")&&(c+="\n"+e.cssText)}}}catch(f){console.debug("Could not access document stylesheet.")}}var b=window.document,c="",d=b.styleSheets;if(d)for(var e=0;ee.undoSize&&(c.undoList.splice(0,c.undoList.length-e.undoSize),c.undoPos=c.undoList.length-1)},b.view.updateUndo=function(){var a=b.view,c=g.serializeView(a);a.undoList[a.undoPos]&&(a.undoList[a.undoPos]=c)},b.getCurrentUndoState=function(){return 0==b.view.undoList.length?"{}":b.view.undoList[b.view.undoPos]},b.undo=function(){b.view.undoPos=b.view.undoPos-1,b.view.undoPos<0&&(b.view.undoPos=0),b.applyCurrentUndoState()},b.redo=function(){b.view.undoPos=b.view.undoPos+1,b.applyCurrentUndoState()},b.applyCurrentUndoState=function(){var a=b.getCurrentUndoState();b.view.params=$.parseJSON(a),b.refreshView()}}]),angular.module("cv.studio",["cv"]),angular.module("cv.studio").service("studioViewsService",["$rootScope","$anchorScroll","$timeout","cvOptions","cubesService","viewsService","dialogService",function(a,b,c,d,e,f,g){this.views=[],this.studioScope=null,f.studioViewsService=this,cubesviewerStudio.studioViewsService=this,this.addViewCube=function(a){var d=e.cubesserver.cubeinfo(a),g=d.label+" ("+(f.lastViewId+1)+")",h=f.createView("cube",{cubename:a,name:g});return this.views.push(h),c(function(){b("cvView"+h.id)},100),h},this.addViewObject=function(a){if("string"==typeof a)try{$.parseJSON(a)}catch(d){return void g.show("Could not process serialized data: JSON parse error.")}var e=f.createView("cube",a);return this.views.push(e),c(function(){b("cvView"+e.id)},250),e},this.closeView=function(a){var b=this.views.indexOf(a);b>=0&&this.views.splice(b,1)},this.toggleCollapseView=function(a){a.collapsed=!a.collapsed}}]),angular.module("cv.studio").controller("CubesViewerStudioViewController",["$rootScope","$scope","cvOptions","cubesService","studioViewsService","reststoreService",function(a,b,c,d,e,f){b.cubesService=d,b.studioViewsService=e,b.cvOptions=c,b.reststoreService=f}]).directive("cvStudioView",function(){return{restrict:"A",templateUrl:"studio/panel.html",scope:{view:"="}}}),angular.module("cv.studio").controller("CubesViewerStudioController",["$rootScope","$scope","$uibModal","$element","$timeout","cvOptions","cubesService","studioViewsService","viewsService","reststoreService",function(a,b,c,d,e,f,g,h,i,j){b.cvVersion=cubesviewer.version,b.cvOptions=f,b.cubesService=g,b.studioViewsService=h,b.reststoreService=j,b.studioViewsService.studioScope=b,b.showSerializeAdd=function(){var a=c.open({animation:!0,templateUrl:"studio/serialize-add.html",controller:"CubesViewerSerializeAddController",appendTo:angular.element($(d).find(".cv-gui-modals")[0])});a.result.then(function(a){},function(){})},b.showSerializeView=function(a){var b=c.open({animation:!0,templateUrl:"studio/serialize-view.html",controller:"CubesViewerSerializeViewController",appendTo:angular.element($(d).find(".cv-gui-modals")[0]),resolve:{view:function(){return a},element:function(){return $(d).find(".cv-gui-modals")[0]}}});b.result.then(function(a){},function(){})},b.showRenameView=function(a){var b=c.open({animation:!0,templateUrl:"studio/rename.html",controller:"CubesViewerRenameController",appendTo:angular.element($(d).find(".cv-gui-modals")[0]),size:"md",resolve:{view:function(){return a},element:function(){return $(d).find(".cv-gui-modals")[0]}}});b.result.then(function(a){},function(){})},b.cloneView=function(a){var b=$.parseJSON(i.serializeView(a));b.name="Clone of "+b.name;var a=h.addViewObject(b);a.savedId=0,a.owner=f.user,a.shared=!1},b.toggleTwoColumn=function(){f.studioTwoColumn=!f.studioTwoColumn},b.toggleHideControls=function(){f.hideControls=!f.hideControls}}]),angular.module("cv.studio").controller("CubesViewerRenameController",["$rootScope","$scope","$uibModalInstance","cvOptions","cubesService","studioViewsService","view",function(a,b,c,d,e,f,g){b.cvVersion=cubesviewer.version,b.cvOptions=d,b.cubesService=e,b.studioViewsService=f,b.viewName=g.params.name,b.renameView=function(a){null!=a&&""!=a&&(g.params.name=a),c.close(g)},b.close=function(){c.dismiss("cancel")}}]),angular.module("cv.studio").config(["$compileProvider",function(a){}]),angular.module("cv.studio").run(["$rootScope","$compile","$controller","$http","$templateCache","cvOptions",function(a,b,c,d,e,f){console.debug("Bootstrapping CubesViewer Studio.");var g={container:null,user:null,studioTwoColumn:!1,hideControls:!1,backendUrl:null};$.extend(g,f),$.extend(f,g),d.get("studio/studio.html",{cache:e}).then(function(c){var d=a.$new();$(f.container).html(c.data),b($(f.container).contents())(d)})}]);var cubesviewerStudio=new CubesViewerStudio;angular.module("cv.studio").controller("CubesViewerSerializeViewController",["$rootScope","$scope","$timeout","$uibModalInstance","element","cvOptions","cubesService","studioViewsService","viewsService","view",function(a,b,c,d,e,f,g,h,i,j){b.cvVersion=cubesviewer.version,b.cvOptions=f,b.cubesService=g,b.studioViewsService=h,b.serializedView="",b.initialize=function(){b.serializedView=i.serializeView(j),console.log("Serialized view: "+b.serializedView),c(function(){window.getSelection().removeAllRanges();var a=document.createRange();a.selectNodeContents($(e).find(".cv-serialized-view")[0]),window.getSelection().addRange(a)},0)},b.close=function(){d.dismiss("cancel")},b.initialize()}]),angular.module("cv.studio").controller("CubesViewerSerializeAddController",["$rootScope","$scope","$uibModalInstance","cvOptions","cubesService","studioViewsService",function(a,b,c,d,e,f){b.cvVersion=cubesviewer.version,b.cvOptions=d,b.cubesService=e,b.studioViewsService=f,b.serializedView=null,b.addSerializedView=function(a){if(null!=a){f.addViewObject(a)}c.close(a)},b.close=function(){c.dismiss("cancel")}}]),angular.module("cv.studio").service("reststoreService",["$rootScope","$http","$cookies","cvOptions","cubesService","viewsService","dialogService","studioViewsService",function(a,b,c,d,e,f,g,h){var i=this;i.savedViews=[],i.initialize=function(){d.backendUrl&&i.viewList()},i.getSavedView=function(a){var b=$.grep(i.savedViews,function(b){return b.id==a});return b.length>0?b[0]:null},i.saveView=function(a){if(a.owner!=d.user)return void g.show("Cannot save a view that belongs to other user (try cloning the view).");var h={id:a.savedId,name:a.params.name,shared:a.shared,data:f.serializeView(a)};b({method:"POST",url:d.backendUrl+"/view/save/",data:JSON.stringify(h),headers:{"X-CSRFToken":c.get("csrftoken")}}).then(i._viewSaveCallback(a),e.defaultRequestErrorHandler)},i._viewSaveCallback=function(a){var a=a;return function(b,c){if(b=b.data,null!=a){a.savedId=b.id;var d=i.getSavedView(a.savedId);null!=d&&(d.name=a.params.name,d.shared=a.shared,d.data=f.serializeView(a))}i.viewList(),g.show("View saved.")}},i.deleteView=function(a){if(0==a.savedId)return void g.show("Cannot delete this view as it hasn't been saved.");if(a.owner!=d.user)return void g.show("Cannot delete a view that belongs to other user.");if(confirm("Are you sure you want to delete and close this view?")){var e={id:a.savedId,data:""};h.closeView(a),b({method:"POST",url:d.backendUrl+"/view/save/",data:JSON.stringify(e),headers:{"X-CSRFToken":c.get("csrftoken")}}).then(i._viewDeleteCallback,cubesviewer.defaultRequestErrorHandler)}},i._viewDeleteCallback=function(){i.viewList()},i.viewList=function(){b.get(d.backendUrl+"/view/list/").then(i._viewListCallback,e.defaultRequestErrorHandler)},i._viewListCallback=function(a,b){i.savedViews=a.data},i.isViewChanged=function(a){if(0==a.savedId)return!1;var b=i.getSavedView(a.savedId);if(null!=b){if(a.params.name!=b.name)return!0;if(a.shared!=b.shared)return!0;if(f.serializeView(a)!=b.data)return!0}return!1},i.shareView=function(a,b){return a.owner!=d.user?void g.show("Cannot share/unshare a view that belongs to other user (try cloning the view)."):(a.shared=1==b?!0:!1,void i.saveView(a))},i.addSavedView=function(a){var b=i.getSavedView(a),c=$.parseJSON(b.data),e=h.addViewObject(c);b.owner==d.user?(e.savedId=b.id,e.owner=b.owner,e.shared=b.shared):(e.savedId=0,e.owner=d.user,e.shared=!1)},i.initialize()}]),angular.module("cv.cubes").service("gaService",["$rootScope","$http","$cookies","$log","cvOptions",function(a,b,c,d,e){this.ignorePeriod=12,this.initTime=new Date,this.initialize=function(){e.gaTrackEvents&&d.debug("Google Analytics events tracking plugin enabled.")},this.trackRequest=function(a){if(e.gaTrackEvents&&!((new Date-this.initTime)/1e3=0&&(c=c.slice(f+1),"model"==c[1]?b=["model",c[0]]:"aggregate"==c[1]?b=["aggregate",c[0]]:"facts"==c[1]?b=["facts",c[0]]:"members"==c[1]&&(b=["dimension",c[2]])),b?"undefined"!=typeof ga?(ga("send","event","CubesViewer",b[0],b[1]),d.debug("Tracking GA event: "+b[0]+"/"+b[1])):d.debug("Cannot track CubesViewer events: GA object 'ga' not available."):d.warn("Unknown cubes operation, cannot be tracked by GA service: "+a)}},this.initialize()}]),angular.module("cv").run(["$templateCache",function(a){a.put("dialog/dialog.html",' \n \n \n\n'),a.put("studio/about.html",'\n\n\n'),a.put("studio/panel.html",'
    \n\n
    \n
    \n\n \n \n\n {{ view.params.name }}\n\n Modified\n Saved\n Shared\n\n \n\n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n\n
    \n'),a.put("studio/rename.html",' \n \n \n\n'),a.put("studio/serialize-add.html",' \n \n \n\n'),a.put("studio/serverinfo.html",'\n\n\n'),a.put("studio/studio.html",'
    \n\n
    \n\n \n\n\n \n\n\n \n\n
    \n\n \n
    \n \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n\n
    \n\n
    \n\n
    \n
    \n
    \n

    Could not connect to server: {{ cubesService.stateText }}

    \n

    Please try again and contact your administrator if the problem persists.

    \n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n
    \n\n
    \n\n
    \n\n
    \n\n\n'),a.put("views/cube/alerts.html",'
    \n\n
    \n
    \n
    \n An error has occurred. Cannot present view.
    \n Please try again and contact your administrator if the problem persists.\n
    \n
    \n\n
    \n \n
    \n
    \n Limit of {{ cubesService.cubesserver.info.json_record_limit }} items has been hit. Results are incomplete.
    \n Tip: reduce level of drilldown or filter your selection to reduce the number of items in the result.\n
    \n
    \n\n
    \n'),a.put("views/cube/chart/chart-common.html",'
    \n
    \n
    \n \n
    \n
    \n Small\n Medium\n Tall\n
    \n
    \n
    \n\n
    \n

    \n Cannot present chart: no measure has been selected.\n

    \n

    \n Tip: use the View > Measure menu.\n

    \n
    \n\n
    \n

    \n Cannot present chart: no rows returned by the current filtering, horizontal dimension, and drilldown combination.\n

    \n

    \n Tip: use the View menu to select an horizontal dimension.\n

    \n
    \n\n
    \n

    \n Cannot present a pie chart when more than one column is present.
    \n

    \n

    \n Tip: review chart data and columns in series mode,\n or remove horizontal dimension.\n

    \n
    \n\n
    \n Cannot present a radar chart when less than 3 columns are present.
    \n Tip: review chart data and columns in series mode.\n
    \n'), -a.put("views/cube/chart/chart.html",'
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n'),a.put("views/cube/cube-menu-drilldown.html",' \n\n \n\n'),a.put("views/cube/cube-menu-filter.html",' \n\n \n'),a.put("views/cube/cube-menu-panel.html",' \n\n \n'),a.put("views/cube/cube-menu-view.html",' \n\n \n\n'),a.put("views/cube/cube.html",'
    \n\n
    \n
    \n

    An error occurred. Cannot present view.

    \n

    {{ view.error }}

    \n

    Could not connect to data server: {{ cubesService.stateText }}

    \n

    Please try again and contact your administrator if the problem persists.

    \n

    \n CubesViewer Data Visualizer\n

    \n
    \n
    \n\n
    \n

    \n {{ view.params.name }}\n

    \n\n
    \n
    \n\n
    \n\n
    \n\n
    \n\n
    \n \n \n
    \n\n
    \n \n \n \n \n
    \n\n \n\n \n\n \n\n \n\n
    \n\n
    \n\n
    \n\n
    \n\n
    \n
    \n
    \n {{ view.cube.label }}\n \n
    \n\n
    \n\n\n
    \n {{ view.cube.dimensionParts(drilldown).labelShort }}\n \n \n \n
    \n\n
    \n
    \n \n
    \n {{ dimparts.labelShort }} {{ equality }} {{ cut.value }}\n \n \n \n
    \n
    \n\n
    \n\n
    \n\n
    \n {{ (view.params.yaxis != null) ? view.cube.aggregateFromName(view.params.yaxis).label : "None" }}\n \n
    \n\n
    \n {{ (view.params.xaxis != null) ? view.cube.dimensionParts(view.params.xaxis).labelShort : "None" }}\n \n \n \n
    \n\n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n\n
    \n
    \n\n
    \n\n
    \n\n
    \n'), -a.put("views/cube/explore/explore.html",'
    \n\n \n

    Aggregated data\n \n

    \n\n
    \n \n
    \n\n
    \n
    \n
     
    \n\n
    \n'),a.put("views/cube/facts/facts.html",'
    \n\n \n

    Facts data\n \n

    \n\n
    \n \n
    \n\n
    \n
    \n
     
    \n\n
    No facts are returned by the current filtering combination.
    \n\n
    \n'),a.put("views/cube/filter/datefilter.html",'
    \n
    \n {{ dimparts.labelNoLevel }}:\n\n \n\n
    \n\n
    \n\n
    \n \n
    \n\n
    \n\n ⇒\n\n
    \n

    \n \n \n \n \n

    \n
    \n\n -\n -\n\n
    \n

    \n \n \n \n \n

    \n
    \n\n
    \n\n
    \n\n
    \n\n \n \n\n\n
    \n
    \n\n'),a.put("views/cube/filter/dimension.html",'
    \n\n
    \n
    \n \n

    Dimension filter: {{ parts.label }}

    \n
    \n
    \n\n
    \n
    \n\n
    \n \n \n \n
    \n\n
    \n \n \n
    \n\n
    \n \n
    \n\n
    \n\n
    \n \n Invert\n
    \n\n
    \n\n
    \n \n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n
    Loading...
    \n\n
    \n
    \n \n
    \n
    \n\n
    \n\n
    \n
    \n {{ dimensionValues.length }} items\n
    \n
    \n\n
    \n
    \n
    \n Limit of {{ cubesService.cubesserver.info.json_record_limit }} items has been hit. Dimension value list is incomplete.
    \n
    \n
    \n\n
    \n
    \n
    \n\n
    \n\n
    \n
    \n\n\n
    \n'),a.put("views/cube/series/series.html",'
    \n\n \n

    Series table\n \n

    \n\n
    \n XXXX\n
    \n\n
    \n
    \n
     
    \n\n
    \n

    \n Cannot present series table: no measure has been selected.\n

    \n

    \n Tip: use the View > Measure menu.\n

    \n
    \n\n
    \n

    \n Cannot present series table: no rows are returned by the current horizontal dimension, drilldown or filtering combination.\n

    \n

    \n Tip: use the View menu to select an horizontal dimension.\n

    \n
    \n\n
    \n')}]); \ No newline at end of file +/*! cubesviewer 13-06-2016 */ +"use strict";function CubesViewer(){this.version="2.0.2",this.VIEW_STATE_INITIALIZING=1,this.VIEW_STATE_INITIALIZED=2,this.VIEW_STATE_ERROR=3,this._configure=function(a){$(".cv-version").html(cubesviewer.version),angular.module("cv").constant("cvOptions",a)},this.init=function(a){this._configure(a),angular.element(document).ready(function(){angular.bootstrap(document,["cv"])})},this.createView=function(a,b,c){var d=angular.element(document).injector().get("$compile"),e=angular.element(document).injector().get("viewsService"),f=e.createView("cube",c),g='
    ';$(a).first().html(g);var h=angular.element(document).scope().$root,i=h.$new();return i.view=f,d($(a).first().contents())(i),f},this.apply=function(a){angular.element(document).scope()?angular.element(document).scope().$apply(a):(console.debug("Delaying"),setTimeout(function(){cubesviewer.apply(a)},1e3))}}function cubesviewerViewCubeExplore(){this._drilldownSortFunction=function(a,b){var c=a.params.drilldown.slice(0);return b&&c.splice(0,0,a.params.xaxis),function(b,d){for(var e=0;ed[f.name])return 1}else for(var g=0;gd[h])return 1}}return 0}},this.columnTooltipAttr=function(a){return function(b,c,d){return'title="'+a+" = "+c+'"'}}}function cubesviewerViewCubeDynamicChart(){this.onViewDraw=function(a,b){$(".cv-view-series-horizontal-menu",$(b.container)).remove(),$(".cv-view-series-horizontal-info",$(b.container)).parents(".infopiece").remove()},this.loadData=function(a){var b=this.cubesviewer.views.cube.buildQueryParams(a,!1,!1);$("#"+a.id).find(".cv-view-viewdata").empty().append('

    Dynamic Chart

    Loading'),$.get(a.cubesviewer.options.cubesUrl+"/cube/"+a.cube.name+"/aggregate",b,a.cubesviewer.views.cube.dynamicchart._loadDataCallback(a),"json")}}function CubesViewerStudio(){this._configure=function(a){cubesviewer._configure(a)},this.init=function(a){this._configure(a),angular.element(document).ready(function(){angular.bootstrap(document,["cv.studio"])})}}angular.module("bootstrapSubmenu",[]).directive("submenu",["$timeout",function(a){return{restrict:"A",link:function(b,c,d){a(function(){$(c).submenupicker()},500)}}}]),function(){var a={};a.map=function(a,b){for(var c=[],d=0;d0&&(d.default_hierarchy_name=a.hierarchies[0].name)},c.Dimension.prototype.hierarchy=function(b){return a.isObject(b)?b:b?this.hierarchies[b]:this.hierarchies[this.default_hierarchy_name]},c.Dimension.prototype.level=function(b){return a.isObject(b)?b:a.find(this.levels,function(a){return a.name==b})},c.Dimension.prototype.toString=function(a){return this.name},c.Dimension.prototype.display_label=function(){return this.label||this.name},c.Dimension.prototype.hierarchy=function(b){return a.isObject(b)?b:null!=b?this.hierarchies[b]:this.hierarchies[this.default_hierarchy_name]},c.Hierarchy=function(a,b){this.parse(a,b)},c.Hierarchy.prototype.parse=function(b,c){var d=this;d.name=b.name,d.label=d.name,!b.label||(d.label=b.label),!b.description||(d.description=b.description),!b.info||(d.info=b.info);var e=b.levels||[];d.levels=a.map(e,function(a){return c.level(a)})},c.Hierarchy.prototype.toString=function(){return c.HIERARCHY_PREFIX_CHAR+this.name},c.Hierarchy.prototype.display_label=function(){return this.label||this.name},c.Level=function(a,b){this.parse(a,b)},c.Level.prototype.parse=function(a,b){var d,e=this;if(e.dimension_name=a,e.name=b.name,!b.label||(e.label=b.label),!b.description||(e.description=b.description),!b.info||(e.info=b.info),e._key=b.key,e._label_attribute=b.label_attribute,e._order_attribute=b.order_attribute,!b.role||(e.role=b.role),!b.cardinality||(e.cardinality=b.cardinality),e.nonadditive=b.nonadditive,e.attributes=[],b.attributes)for(d in b.attributes){var f=new c.Attribute(b.attributes[d]);e.attributes.push(f)}},c.Level.prototype.key=function(){var b=this._key,c=a.find(this.attributes,function(a){return a.name===b});return c||this.attributes[0]},c.Level.prototype.label_attribute=function(){var b=null;if(this._label_attribute){var c=this._label_attribute;b=a.find(this.attributes,function(a){return a.name===c})}return b||this.key()},c.Level.prototype.order_attribute=function(){var b=null,c=this._order_attribute;return c&&(b=a.find(this.attributes,function(a){return a.name===c})),b||this.label_attribute()},c.Level.prototype.toString=function(){return this.name},c.Level.prototype.display_name=function(){return this.label||this.name},c.Level.prototype.full_name=function(){return this.dimension_name+c.ATTRIBUTE_STRING_SEPARATOR_CHAR+this.name},c.Level.prototype.full_name_for_drilldown=function(){return this.dimension_name+c.DIMENSION_STRING_SEPARATOR_CHAR+this.name},c.Attribute=function(a){this.ref=a.ref,this.name=a.name,this.label=a.label,this.order=a.order,this.info=a.info||{},this.description=a.description,this.format=a.format,this.missing_value=a.missing_value,this.locales=a.locales},c.Measure=function(a){this.ref=a.ref,this.name=a.name,this.label=a.label,this.order=a.order,this.info=a.info||{},this.description=a.description,this.format=a.format,this.missing_value=a.missing_value,this.nonadditive=a.nonadditive,a.aggregates&&(this.aggregates=a.aggregates)},c.MeasureAggregate=function(a){this.ref=a.ref,this.name=a.name,this.label=a.label,this.order=a.order,this.locales=a.locales,this.info=a.info||{},this.description=a.description,this.format=a.format,this.missing_value=a.missing_value,this.nonadditive=a.nonadditive,this["function"]=a["function"],this.measure=a.measure},c.Browser=function(a,b){this.cube=b,this.server=a},c.Browser.prototype.full_cube=function(){return new c.Cell(this.cube)},c.Browser.prototype.aggregate=function(a,b){a||(a={});var c={};return a.cut&&(c.cut=a.cut.toString()),a.measure&&(c.measure=a.measure.toString()),a.drilldown&&(c.drilldown=a.drilldown.toString()),a.split&&(c.split=a.split.toString()),a.order&&(c.order=a.order.toString()),a.page&&(c.page=a.page),a.pagesize&&(c.pagesize=a.pagesize),this.server.query("aggregate",this.cube,a,b)},c.Browser.prototype.facts=function(a,b){a||(a={});var c={};return a.cut&&(c.cut=a.cut.toString()),a.order&&(c.order=a.order.toString()),a.page&&(c.page=a.page),a.pagesize&&(c.pagesize=a.pagesize),this.server.query("facts",this.cube,a,b)},c.Drilldown=function(b,c,d){if(!a.isObject(b))throw"Drilldown requires a Dimension object as first argument";if(this.dimension=b,this.hierarchy=b.hierarchy(c),this.level=b.level(d)||this.hierarchy.levels[0],!this.hierarchy)throw"Drilldown cannot recognize hierarchy "+c+" for dimension "+b;if(!this.level)throw"Drilldown cannot recognize level "+d+" for dimension "+b},c.Drilldown.prototype.toString=function(){return""+this.dimension+this.hierarchy+c.DIMENSION_STRING_SEPARATOR_CHAR+this.level},c.Drilldown.prototype.keysInResultCell=function(){var b=this,c=!1,d=a.filter(b.hierarchy.levels,function(a){return a.key()===b.level.key()&&(c=!0)||!c});return a.map(d,function(a){return a.key().ref})},c.Drilldown.prototype.labelsInResultCell=function(){var b=this,c=!1,d=a.filter(b.hierarchy.levels,function(a){return a.key()===b.level.key()&&(c=!0)||!c});return a.map(d,function(a){return a.label_attribute().ref})},c.Cell=function(b,c){this.cube=b,this.cuts=a.map(c||[],function(a){return a})},c.Cell.prototype.slice=function(a){for(var b=[],d=!1,e=0;e1)return new c.SetCut(j,h,a.map(k,function(a){return c.path_from_string(a)}),f);if(k=c._split_with_negative_lookbehind(i,c.RANGE_CUT_SEPARATOR,"\\"),2==k.length){var l=k[0]?c.path_from_string(k[0]):null,m=k[1]?c.path_from_string(k[1]):null;return new c.RangeCut(j,h,l,m,f)}return new c.PointCut(j,h,c.path_from_string(i),f)},c.cuts_from_string=function(b,d){var e=c._split_with_negative_lookbehind(d,c.CUT_STRING_SEPARATOR,"\\");return a.map(e||[],function(a){return c.cut_from_string(b,a)})},c.cell_from_string=function(a,b){return new c.Cell(a,c.cuts_from_string(a,b))},c.drilldown_from_string=function(a,b){var d=c.DRILLDOWN_PARSE_REGEXP.exec(b);if(!d)return null;var e=d[1],f=d[2]||null,g=d[3]||null,h=a.dimension(e);if(!h){if(e!==c.SPLIT_DIMENSION_STRING)return null;h=c.SPLIT_DIMENSION}return new c.Drilldown(h,f,g)},c.drilldowns_from_string=function(b,d){var e=c._split_with_negative_lookbehind(d,c.CUT_STRING_SEPARATOR,"\\");return a.map(e||[],function(a){return c.drilldown_from_string(b,a)})},c.drilldowns_to_string=function(b){return a.map(b,function(a){return a.toString()}).join(c.CUT_STRING_SEPARATOR_CHAR)},b.cubes=c}.call(this),cubes.Dimension.prototype.hierarchies_count=function(){var a=0;for(var b in this.hierarchies)this.hierarchies.hasOwnProperty(b)&&a++;return a},cubes.Dimension.prototype.default_hierarchy=function(){return this.hierarchies[this.default_hierarchy_name]},cubes.Dimension.prototype.isDateDimension=function(){return!("time"!=this.role||"cv-datefilter"in this.info&&1!=this.info["cv-datefilter"])},cubes.Cube.prototype.dateDimensions=function(){var a=[];for(var b in this.dimensions){var c=this.dimensions[b];c.isDateDimension()&&a.push(c)}return a},cubes.Cube.prototype.cvdim_dim=function(a){var b=a;return a.indexOf("@")>0?b=a.split("@")[0]:a.indexOf(":")>0&&(b=a.split(":")[0]),this.dimension(b)},cubes.Cube.prototype.dimensionPartsFromCut=function(a){var b=this.dimensionParts(a.dimension),c=(a.value.split(";")[0].match(/,/g)||[]).length+1,d=b.dimension.name+"@"+b.hierarchy.name+":"+b.hierarchy.levels[c-1].name;return this.dimensionParts(d)},cubes.Cube.prototype.dimensionParts=function(a){if(!a)return null;var b=this.cvdim_dim(a),c=b.default_hierarchy();if(a.indexOf("@")>0){var d=a.split("@")[1].split(":")[0];c=b.hierarchy(d)}var e=null,f=0;if(a.indexOf(":")>0){var g=a.split(":")[1];for(e=b.level(g),f=0;f1?" / "+e.label:""),labelShort:b.label+(c.levels.length>1?" / "+e.label:""),labelNoLevel:b.label+("default"!=c.name?" - "+c.label:""),fullDrilldownValue:b.name+("default"!=c.name?"@"+c.name:"")+":"+e.name,drilldownDimension:b.name+"@"+c.name+":"+e.name,drilldownDimensionPlus:c.levels.length>1&&f1&&f>0?b.name+"@"+c.name+":"+c.levels[f-1].name:null,cutDimension:b.name+("default"!=c.name?"@"+c.name:"")}},cubes.Cube.prototype.measureAggregates=function(a){var b=$.grep(this.aggregates,function(b){return a?b.measure==a:!b.measure});return b},cubes.Cube.prototype.aggregateFromName=function(a){var b=$.grep(this.aggregates,function(b){return a?b.name==a:!b.measure});return 1==b.length?b[0]:null},cubes.Level.prototype.readCell=function(a){if(!(this.key().ref in a))return null;var b={};return b.key=a[this.key().ref],b.label=a[this.label_attribute().ref],b.orderValue=a[this.order_attribute().ref],b.info={},$(this.attributes).each(function(c,d){b.info[d.ref]=a[d.ref]}),b},cubes.Hierarchy.prototype.readCell=function(a,b){for(var c=[],d=0;d0&&(d.drilldown=cubes.drilldowns_to_string(e))}var g=this.buildQueryCuts(a);return g.length>0&&(d.cut=new cubes.Cell(a.cube,g)),d},this.buildQueryCutsStrings=function(a){var b=[];return $(a.params.cuts).each(function(c,d){var e=d.invert?"!":"",f=a.cube.dimensionParts(d.dimension),g=f.dimension.name+("default"!=f.hierarchy.name?"@"+f.hierarchy.name:"");b.push(e+g+":"+d.value.replace("-","\\-"))}),$(a.params.datefilters).each(function(c,d){var f=e.datefilterValue(a,d);null!=f&&b.push(d.dimension+":"+f)}),b},this.buildQueryCuts=function(a){var b=[],c=e.buildQueryCutsStrings(a);return $(c).each(function(c,d){b.push(cubes.cut_from_string(a.cube,d))}),b},this.datefilterValue=function(a,b){var c=null,d=null;if(0==b.mode.indexOf("auto-")?"auto-last1m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-1)):"auto-last3m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-3)):"auto-last6m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-6)):"auto-last12m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-12)):"auto-last24m"==b.mode?(c=new Date,c.setMonth(c.getMonth()-24)):"auto-january1st"==b.mode?(c=new Date,c.setMonth(0),c.setDate(1)):"auto-yesterday"==b.mode&&(c=new Date,c.setDate(c.getDate()-1),d=new Date,d.setDate(c.getDate()-1)):"custom"==b.mode&&(null!=b.date_from&&""!=b.date_from&&(c=new Date(b.date_from)),null!=b.date_to&&""!=b.date_to&&(d=new Date(b.date_to))),null!=c||null!=d){var f="";return null!=c&&(f+=e._datefiltercell(a,b,c)),f+="-",null!=d&&(f+=e._datefiltercell(a,b,d)),f}return null},this._datefiltercell=function(a,b,c){for(var d=[],e=a.cube.dimensionParts(b.dimension),f=0;fc.cacheNotice&&b.debug("Data loaded from cache ("+Math.floor(k/60,2)+" minutes old)"),j=$.Deferred(),j.error=function(){},setTimeout(function(){g(f.cache[i].data),j.resolve()},0),e.trackRequest(a)}else j=f._cacheOverridedCubesRequest(a,d,f._cacheCubesRequestSuccess(g,i),h);return j},this._cacheCleanup=function(){var a=c.cacheDuration,b=c.cacheSize,d=(new Date).getTime()-1e3*a,e=[];for(var g in f.cache)f.cache[g].time=b)for(var h=0;h
    ')},this.show=function(a){var c=b.open({animation:!0,templateUrl:"dialog/dialog.html",controller:"CubesViewerViewsDialogController",appendTo:angular.element($("body").find(".cv-modals")[0]),resolve:{dialog:function(){return{text:a}}}});c.result.then(function(a){},function(){})},this.initialize()}]),angular.module("cv.views").controller("CubesViewerViewsDialogController",["$rootScope","$scope","$timeout","$uibModalInstance","cvOptions","cubesService","viewsService","dialog",function(a,b,c,d,e,f,g,h){b.$rootScope=a,b.dialog=h,b.close=function(){d.dismiss("cancel")}}]),cubesviewer.CubeView=function(a,b,c){var d=cubesviewer.View(a,b,c);return d.resultLimitHit=!1,d.requestFailed=!1,d.pendingRequests=0,d.dimensionFilter=null,d._invalidatedData=!0,d._invalidatedDefs=!0,d.grid={api:null,data:[],columnDefs:[]},d.invalidateData=function(){d._invalidatedData=!0},d.invalidateDefs=function(){d._invalidatedData=!0,d._invalidatedDefs=!0},d.setViewMode=function(a){d.params.mode=a,d.invalidateDefs()},d},angular.module("cv.views.cube",[]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeController",["$rootScope","$log","$window","$injector","$scope","$timeout","cvOptions","cubesService","viewsService","exportService","rowSorter","dialogService",function($rootScope,$log,$window,$injector,$scope,$timeout,cvOptions,cubesService,viewsService,exportService,rowSorter,dialogService){$scope.viewController={},$scope.$rootScope=$rootScope,$scope.viewsService=viewsService,$scope.cvOptions=cvOptions,$scope.cubesService=cubesService,$scope.exportService=exportService,$scope.reststoreService=null,$injector.has("reststoreService")&&($scope.reststoreService=$injector.get("reststoreService")),$scope.refreshView=function(){$scope.view&&$scope.view.cube&&$scope.$broadcast("ViewRefresh",$scope.view)},$scope.setViewMode=function(a){console.debug("Remove setViewMode call on the controller?"),$scope.view.setViewMode(a)},$scope.initCube=function(){$scope.view.cube=null;var a={mode:"explore",drilldown:[],cuts:[],datefilters:[],columnHide:{},columnWidths:{},columnSort:{}},b=cubesService.cubesserver.get_cube($scope.view.params.cubename,function(b){$scope.view.cube=b,$log.debug($scope.view.cube),"cv-view-params"in $scope.view.cube.info?$scope.view.params=$.extend({},a,$scope.view.cube.info["cv-view-params"],$scope.view.params):$scope.view.params=$.extend({},a,$scope.view.params),$scope.view.state=cubesviewer.VIEW_STATE_INITIALIZED,$scope.view.error="",$rootScope.$apply()});b.fail(function(a){var b=a.responseJSON;$scope.view.state=cubesviewer.VIEW_STATE_ERROR,$scope.view.error="Error loading model: "+b.message+" ("+b.error+")",console.debug(b),$rootScope.$apply()})},$scope.requestErrorHandler=function(){$scope.view.requestFailed=!0},$scope.resetGrid=function(){rowSorter.colSortFnCache={}},$scope.onGridRegisterApi=function(a){$scope.view.grid.api=a,a.selection.on.rowSelectionChanged($scope,function(a){}),a.selection.on.rowSelectionChangedBatch($scope,function(a){}),a.core.on.columnVisibilityChanged($scope,function(a){a.visible?delete $scope.view.params.columnHide[a.field]:($scope.view.params.columnHide[a.field]=!0,delete $scope.view.params.columnWidths[a.field]),$scope.view.updateUndo()}),a.core.on.sortChanged($scope,function(a,b){$scope.view.params.columnSort[$scope.view.params.mode]={},$(b).each(function(a,b){$scope.view.params.columnSort[$scope.view.params.mode][b.field]={direction:b.sort.direction,priority:b.sort.priority}}),$scope.view.updateUndo()}),a.colResizable.on.columnSizeChanged($scope,function(b,c){var d=-1;$(a.grid.columns).each(function(a,c){c.field==b.field&&(d=a)}),d>=0&&($scope.view.params.columnWidths[b.field]=a.grid.columns[d].width),$scope.view.updateUndo()})},$scope.view.grid.onRegisterApi=$scope.onGridRegisterApi,$scope.validateData=function(a,b){$scope.view.requestFailed=!1,$scope.view.resultLimitHit=!1,("cells"in a&&a.cells.length>=cubesService.cubesserver.info.json_record_limit||a.length&&a.length>=cubesService.cubesserver.info.json_record_limit)&&($scope.view.resultLimitHit=!0)},$scope.newViewStateKey=function(){return $scope._viewStateKey=Math.floor(999999999999*Math.random()),$scope._viewStateKey},$scope.selectDrill=function(a,b){$scope.view.cube;a?($scope.removeDrill(a),1==b&&$scope.view.params.drilldown.push(a)):$scope.view.params.drilldown=[],$scope.refreshView()},$scope.removeDrill=function(a){$scope.view.params.drilldown=$.grep($scope.view.params.drilldown,function(b){return $scope.view.cube.dimensionParts(b).dimension.name==$scope.view.cube.dimensionParts(a).dimension.name},!0),$scope.refreshView()},$scope.columnFormatFunction=function(agmes){var view=$scope.view,measure=agmes;if(!measure)return function(a){return a};"measure"in agmes&&(measure=$.grep(view.cube.measures,function(a,b){return a.ref==agmes.measure})[0]);var formatterFunction=null;return formatterFunction=measure&&"cv-formatter"in measure.info?function(value,row){return eval(measure.info["cv-formatter"])}:function(a){return Math.formatnumber(a,"record_count"==agmes.ref?0:2)}},$scope.selectCut=function(a,b,c){var d=$scope.view;a?b?(d.params.cuts=$.grep(d.params.cuts,function(b){return d.cube.dimensionParts(b.dimension).cutDimension==d.cube.dimensionParts(a).cutDimension},!0),d.params.cuts.push({dimension:a,value:b,invert:c})):d.params.cuts=$.grep(d.params.cuts,function(b){return d.cube.dimensionParts(b.dimension).cutDimension==d.cube.dimensionParts(a).cutDimension},!0):d.params.cuts=[],$scope.refreshView()},$scope.filterSelected=function(){var a=$scope.view;if(1!=a.params.drilldown.length)return void dialogService.show("Can only filter multiple values in a view with one level of drilldown."); +if(a.grid.api.selection.getSelectedCount()<=0)return void dialogService.show("Cannot filter. No rows are selected.");var b=[],c=a.grid.api.selection.getSelectedRows();$(c).each(function(a,c){b.push(c.key0.cutValue)});var d=!1;$scope.selectCut(a.grid.columnDefs[0].cutDimension,b.join(";"),d)},$scope.showDimensionFilter=function(a){var b=$scope.view.cube.dimensionParts(a);$scope.view.dimensionFilter&&$scope.view.dimensionFilter==b.drilldownDimension?$scope.view.dimensionFilter=null:$scope.view.dimensionFilter=b.drilldownDimension},$scope.selectMeasure=function(a){$scope.view.params.yaxis=a,$scope.refreshView()},$scope.selectXAxis=function(a){$scope.view.params.xaxis=""==a?null:a,$scope.refreshView()},$scope.selectChartType=function(a){$scope.view.params.charttype=a,$scope.refreshView()},$scope.selectCalculation=function(a){$scope.view.params.calculation=a,$scope.refreshView()},$scope.showSerializeView=function(a){studioViewsService.studioScope.showSerializeView(a)},$scope.selectDateFilter=function(a,b){var c=$scope.view;c.cube;if(""!=a){if("1"==b)c.params.datefilters.push({dimension:a,mode:"auto-last3m",date_from:null,date_to:null});else for(var d=0;d0&&i%3==0&&(e+=d)}return b>0&&(e+=parseFloat(f-Math.floor(f)).toFixed(b).toString().replace(".",c).substring(1)),0>a&&(e="-"+e),e},angular.module("cv.views.cube").controller("CubesViewerViewsCubeExploreController",["$rootScope","$scope","$timeout","cvOptions","cubesService","viewsService","dialogService","uiGridConstants",function(a,b,c,d,e,f,g,h){b.view.grid.enableRowSelection=!0,b.view.grid.enableRowHeaderSelection=!0,b.initialize=function(){b.refreshView()},b.$on("ViewRefresh",function(a){b.loadData()}),b.loadData=function(){var c=e.buildBrowserArgs(b.view,!1,!1),d=new cubes.Browser(e.cubesserver,b.view.cube),f=b.newViewStateKey(),g=d.aggregate(c,b._loadDataCallback(f));b.view.pendingRequests++,g.always(function(){b.view.pendingRequests--,a.$apply()}),g.error(b.requestErrorHandler)},b._loadDataCallback=function(c){return function(d,e){c==b._viewStateKey&&(b.validateData(d,e),b.processData(d),a.$apply())}},b.exploreCut=function(a,c,d){if(b.selectCut(a,c,d),1==b.view.params.drilldown.length){var e=b.view.cube.dimensionParts(b.view.params.drilldown[0]);if(e.levelIndex0,enablePinning:!1,multiSelect:!0,selectionRowHeaderWidth:20,columnDefs:[]}),$(f.cube.aggregates).each(function(a,d){var e={name:d.label,field:d.ref,index:d.ref,cellClass:"text-right",type:"number",headerCellClass:"cv-grid-header-measure",width:b.defineColumnWidth(d.ref,115),visible:!f.params.columnHide[d.ref],cellTemplate:'
    {{ col.colDef.formatter(COL_FIELD, row, col) }}
    ',formatter:b.columnFormatFunction(d),sort:b.defineColumnSort(d.ref)};e.footerValue=b.columnFormatFunction(d)(c.summary[d.ref],null,e),e.footerCellTemplate='
    {{ col.colDef.footerValue }}
    ',f.grid.columnDefs.push(e)}),b._addRows(c);var g=[];$(f.params.drilldown).each(function(a,b){g.push(f.cube.cvdim_dim(b).label)});for(var h=0;hSummary":'Summary (Filtered)'),f.grid.columnDefs.splice(h,0,{name:g[h],field:"key"+h,index:"key"+h,headerCellClass:"cv-grid-header-dimension",enableHiding:!1,cutDimension:j,width:b.defineColumnWidth("key"+h,190),cellTemplate:'',footerCellTemplate:'
    '+k+"
    ",sort:b.defineColumnSort("key"+h),sortingAlgorithm:b.sortDimensionParts(i)})}0==f.params.drilldown.length&&f.grid.columnDefs.splice(0,0,{name:f.cube.label,field:"key0",index:"key0",enableHiding:!1,align:"left",width:b.defineColumnWidth("key0",190),sort:b.defineColumnSort("key0")})},b._addRows=function(a){var c=b.view,d=c.grid.data;if($(a.cells).each(function(a,b){for(var e=[],f={},g=[],h=0;h0&&(d=$.grep(d,function(a){return 0!=a.indexOf(c.dimension.name)&&0!=a.indexOf("!"+c.dimension.name)}),a.cut=d.join(cubes.CUT_STRING_SEPARATOR_CHAR))}var f="/cube/"+b.view.cube.name+"/members/"+b.parts.dimension.name,g=f+"?"+$.param(a);if(b.currentDataId!=g){b.currentDataId=g;var h=b.view.dimensionFilter;b.loadingDimensionValues=!0;var i=e.cubesRequest(f,a,b._loadDimensionValuesCallback(h));i.always(function(){b.loadingDimensionValues=!1,b.$apply()})}},b._loadDimensionValuesCallback=function(a){var a=a;return function(c,d){b.view.dimensionFilter==a&&b._processData(c)}},b.filterDimensionValue=function(a){return function(b){var c=a.toLowerCase();return""==a||b.label.toLowerCase().indexOf(c)>=0}},b.selectAll=function(){var a=b.filterDimensionValue(b.searchString);$(b.dimensionValues).each(function(b,c){a(c)&&(c.selected=!0)})},b.selectNone=function(){var a=b.filterDimensionValue(b.searchString);$(b.dimensionValues).each(function(b,c){a(c)&&(c.selected=!1)})},b._processData=function(a){for(var c=b.view,d=(b.view.cube.cvdim_dim(b.view.dimensionFilter),[]),e=(c.cube.dimensionParts(b.view.dimensionFilter),b.view.dimensionFilter),f=[],g=0;g=0})}),b.dimensionValues=d,b.$apply()},b.applyFilter=function(){var a=(b.view,[]);$(b.dimensionValues).each(function(b,c){c.selected&&a.push(c.value)}),a.length>=b.dimensionValues.length&&(a=[]);var c=b.parts.dimension.name+("default"!=b.parts.hierarchy.name?"@"+b.parts.hierarchy.name:"")+":"+b.parts.level.name;b.selectCut(c,a.join(";"),b.filterInverted)},b.initialize()}]),angular.module("cv.views.cube").filter("datefilterMode",["$rootScope","cvOptions",function(a,b){return function(a){var b="None";switch(a){case"custom":b="Custom";break;case"auto-last1m":b="Last month";break;case"auto-last3m":b="Last 3 months";break;case"auto-last6m":b="Last 6 months";break;case"auto-last12m":b="Last year";break;case"auto-last24m":b="Last 2 years";break;case"auto-january1st":b="From January 1st";break;case"auto-yesterday":b="Yesterday"}return b}}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeFilterDateController",["$rootScope","$scope","$filter","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f){b.initialize=function(){b.dateStart.value=b.datefilter.date_from?new Date(b.datefilter.date_from):null,b.dateEnd.value=b.datefilter.date_to?new Date(b.datefilter.date_to):null},b.dateStart={opened:!1,value:null,options:{formatYear:"yyyy",startingDay:d.datepickerFirstDay,showWeeks:d.datepickerShowWeeks}},b.dateEnd={opened:!1,value:null,options:{formatYear:"yyyy",startingDay:d.datepickerFirstDay,showWeeks:d.datepickerShowWeeks}},b.dateStartOpen=function(){b.dateStart.opened=!0},b.dateEndOpen=function(){b.dateEnd.opened=!0},b.setMode=function(a){b.datefilter.mode=a},b.updateDateFilter=function(){b.datefilter.date_from=b.dateStart.value?c("date")(b.dateStart.value,"yyyy-MM-dd"):null,b.datefilter.date_to=b.dateEnd.value?c("date")(b.dateEnd.value,"yyyy-MM-dd"):null,b.refreshView()},b.$watch("dateStart.value",b.updateDateFilter),b.$watch("dateEnd.value",b.updateDateFilter),b.$watch("datefilter.mode",b.updateDateFilter),b.initialize()}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeFactsController",["$rootScope","$scope","$timeout","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f){b.view.grid.enableRowSelection=!1,b.view.grid.enableRowHeaderSelection=!1,b.initialize=function(){b.refreshView()},b.$on("ViewRefresh",function(a){b.loadData()}),b.loadData=function(){var c=e.buildBrowserArgs(b.view,!1,!1),d=new cubes.Browser(e.cubesserver,b.view.cube),f=b.newViewStateKey(),g=d.facts(c,b._loadDataCallback(f));b.view.pendingRequests++,g.always(function(){b.view.pendingRequests--,a.$apply()}),g.error(b.requestErrorHandler)},b._loadDataCallback=function(c){return function(d,e){c==b._viewStateKey&&(b.validateData(d,e),b.processData(d),a.$apply())}},b.processData=function(c){var e=b.view;b.resetGrid(),b.view.grid.data=[],b.view.grid.columnDefs=[],a.$apply();var f=e.cube.dimensions,g=e.cube.measures,h=e.cube.details;angular.extend(b.view.grid,{data:[],rowHeight:24,onRegisterApi:b.onGridRegisterApi,enableColumnResizing:!0,showColumnFooter:!1,enableGridMenu:!0,paginationPageSizes:d.pagingOptions,paginationPageSize:d.pagingOptions[0],enableRowSelection:!1,enableRowHeaderSelection:!1,enablePinning:!1,multiSelect:!1,columnDefs:[]}),e.grid.columnDefs.push({name:"id",field:"id",index:"id",enableHiding:!1,width:80});for(var i in f)for(var j=f[i],k=0;k{{ row.entity[col.colDef.field] }}
    ',visible:!e.params.columnHide[l.key().ref],width:b.defineColumnWidth(l.key().ref,95),sort:b.defineColumnSort(l.key().ref),sortingAlgorithm:b.sortDimensionLevel(l)};e.grid.columnDefs.push(m),$(l.attributes).each(function(a,c){if(c.ref!=l.key().ref&&c.ref!=l.label_attribute().ref){var d={name:c.name,field:c.ref,index:c.ref,headerCellClass:"cv-grid-header-dimensionattribute",cellTemplate:'
    {{ row.entity[col.colDef.field] }}
    ',visible:!e.params.columnHide[c.ref],width:b.defineColumnWidth(c.ref,85),sort:b.defineColumnSort(c.ref)};e.grid.columnDefs.push(d)}})}for(var n in g){var o=g[n],m={name:o.label,field:o.ref,index:o.ref,cellClass:"text-right",headerCellClass:"cv-grid-header-measure",cellTemplate:'
    {{ col.colDef.formatter(COL_FIELD, row, col) }}
    ',formatter:b.columnFormatFunction(o),visible:!e.params.columnHide[o.ref],width:b.defineColumnWidth(o.ref,75),sort:b.defineColumnSort(o.ref)};e.grid.columnDefs.push(m)}for(var p in h){var q=h[p],m={name:q.name,field:q.ref,index:q.ref,visible:!e.params.columnHide[q.ref],width:b.defineColumnWidth(q.ref,95),sort:b.defineColumnSort(q.ref),sortingAlgorithm:b.sortValues};e.grid.columnDefs.push(m)}b._addRows(c)},b._addRows=function(a){var c=b.view,d=c.grid.data,e=0,f=c.cube.dimensions,g=c.cube.measures,h=c.cube.details;$(a).each(function(a,b){var c=[];for(var i in f)for(var j=f[i],k=0;k0)i[0][p]=q,i[0]._cell=h;else{var s={};s.key=r,s[p]=q;for(var k=f;k{{ col.colDef.formatter(COL_FIELD, row, col) }}
    ',formatter:a.columnFormatFunction(t),enableHiding:!1,width:a.defineColumnWidth(p,90),sort:a.defineColumnSort(p)};c.grid.columnDefs.push(u)}}),$(c.params.drilldown).each(function(b,d){var e={name:c.cube.cvdim_dim(d).label,field:"key"+b,index:"key"+b,headerCellClass:"cv-grid-header-dimension",enableHiding:!1,width:a.defineColumnWidth("key"+b,190),sort:a.defineColumnSort("key"+b),sortingAlgorithm:a.sortDimensionParts(c.cube.dimensionParts(d))};c.grid.columnDefs.splice(b,0,e)}),0==c.params.drilldown.length&&d.length>0){d[0].key0=c.cube.aggregateFromName(c.params.yaxis).label;var h={name:"Measure",field:"key0",index:"key0",headerCellClass:"cv-grid-header-measure",enableHiding:!1,width:a.defineColumnWidth("key0",190),sort:a.defineColumnSort("key0")};c.grid.columnDefs.splice(0,0,h)}},angular.module("cv.views").service("seriesOperationsService",["$rootScope","cvOptions","cubesService",function(a,b,c){this.calculateDifferentials=function(a,b,c){console.debug("FIXME: Differentials are ignoring drilldown.length columns, but fails in some cases."),$(b).each(function(b,d){for(var e=null,f=a.params.drilldown.length;f0&&(g.splice(0,e.params.drilldown.length,{name:"key"}),$(f).each(function(a,b){for(var c=[],d=0;d","");var j=new Blob([a+h],{type:"image/svg+xml;charset=utf-8"}),k=window.URL.createObjectURL(j),l=d3.select("body").append("img").attr("visibility","hidden").attr("width",e.width()).attr("height",e.height()).node();l.onload=function(){var a=d3.select("body").append("canvas").node();$(a).addClass("cv-bootstrap"),$(a).attr("visibility","hidden"),a.width=e.width(),a.height=e.height();var c=a.getContext("2d");c.drawImage(l,0,0,e.width(),e.height());var d=a.toDataURL("image/png");$(l).remove(),$(a).remove(),i.saveAs(d,b.view.cube.name+"-"+b.view.params.charttype+".png")},l.src=k},b.$on("$destroy",function(){j.cleanupNvd3(),b.view.grid.data=[],b.view.grid.columnDefs=[]}),this.initialize()}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeChartBarsVerticalController",["$rootScope","$scope","$element","$timeout","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f,g){b.chart=null,b.initialize=function(){},b.$on("gridDataUpdated",function(){b.chartCtrl.cleanupNvd3(),d(function(){b.drawChartBarsVertical()},0)}),b.drawChartBarsVertical=function(){var a=b.view,d=b.view.grid.data,e=a.grid.columnDefs,f=$(c).find("svg").get(0),g=null!=a.params.xaxis?a.cube.dimensionParts(a.params.xaxis).label:"None",h=[],i=(d.length,0);$(d).each(function(b,c){for(var d=[],f=1;fb.key?1:0});var j={delay:1200,groupSpacing:.1},k=$.grep(a.cube.aggregates,function(b){return b.ref==a.params.yaxis})[0],l=b.columnFormatFunction(k);nv.addGraph(function(){var c=nv.models.multiBarChart().showLegend(!!a.params.chartoptions.showLegend).margin({left:120});return a.params["chart-barsvertical-stacked"]&&c.stacked(a.params["chart-barsvertical-stacked"]),c.options(j),c.multibar.hideable(!0),c.xAxis.axisLabel(g),c.yAxis.tickFormat(function(a,b){return l(a)}),d3.select(f).datum(h).call(c),c.dispatch.on("stateChange",function(b){a.params["chart-barsvertical-stacked"]=b.stacked,a.params["chart-disabledseries"]={key:a.params.drilldown.join(","),disabled:{}};for(var c=0;cb.key?1:0});var i={delay:1200,groupSpacing:.1},j=$.grep(a.cube.aggregates,function(b){return b.ref==a.params.yaxis})[0],k=b.columnFormatFunction(j);nv.addGraph(function(){var c=nv.models.multiBarHorizontalChart().showLegend(!!a.params.chartoptions.showLegend).margin({left:120}).showControls(!0);return a.params["chart-barsvertical-stacked"]&&c.stacked(a.params["chart-barsvertical-stacked"]),c.options(i),c.yAxis.tickFormat(function(b,c){return 2==d.length&&a.params.chartoptions.mirrorSerie2&&0>b&&(b=-b),k(b)}),d3.select(f).datum(g).call(c),c.dispatch.on("stateChange",function(b){a.params["chart-barsvertical-stacked"]=b.stacked,a.params["chart-disabledseries"]={key:a.params.drilldown.join(","),disabled:{}};for(var c=0;cb.key?1:0});var j=$.grep(a.cube.aggregates,function(b){return b.ref==a.params.yaxis})[0],k=b.columnFormatFunction(j);"lines-stacked"!=a.params.charttype?nv.addGraph(function(){var c=nv.models.lineChart().useInteractiveGuideline(!0).interpolate(b.view.params.chartoptions.lineInterpolation).showLegend(!!a.params.chartoptions.showLegend).margin({left:120});return c.xAxis.axisLabel(g).tickFormat(function(a,b){return e[a].name}),c.yAxis.tickFormat(function(a,b){return k(a)}),d3.select(f).datum(h).call(c),c.dispatch.on("stateChange",function(b){a.params["chart-disabledseries"]={key:a.params.drilldown.join(","),disabled:{}};for(var c=0;c0){var f={y:d,key:""!=c.key?c.key:e[0].name};a.params["chart-disabledseries"]&&a.params["chart-disabledseries"].key==a.params.drilldown.join(",")&&(f.disabled=!!a.params["chart-disabledseries"].disabled[f.key]),g.push(f),h++}}),g.sort(function(a,b){return a.yb.y?1:0});for(var i=[],j=1;jb.label?1:0});for(var i=[],j=1;jh,fillOpacity:.2},mouse:{track:!1,relative:!0},grid:{circular:!0,minorHorizontalLines:!0},xaxis:{ticks:i},yaxis:{},legend:{show:!!a.params.chartoptions.showLegend,position:"se",backgroundColor:"#D2E8FF"}};b.flotrDraw=Flotr.draw(f,g,k)},b.initialize()}]),angular.module("cv.views.cube").controller("CubesViewerViewsCubeChartSunburstController",["$rootScope","$scope","$element","$timeout","cvOptions","cubesService","viewsService",function(a,b,c,d,e,f,g){b.chart=null,b.initialize=function(){},b.$on("gridDataUpdated",function(){d(function(){b.drawChartSunburst()},2e3)}),b.drawChartSunburst=function(){var a=b.view,c=b.rawData,d=(b.view.grid.data,a.grid.columnDefs,b.prepareDrilldownTree(c));b.draw3DJSSunburst(d)},b.prepareDrilldownTree=function(a){var c=b.view,d=[{children:[],name:"Current Slice"}],e=null;return $(a.cells).each(function(a,b){e=d[0];for(var f=0;f0?e=c[0]:(c={children:[],name:String(b.key),label:b.label},e.children.push(c),e=c)})}e.measure=b[c.params.yaxis]}),d[0].children},String.prototype.hashCode=function(){var a,b,c,d=0;if(0===this.length)return d;for(a=0,c=this.length;c>a;a++)b=this.charCodeAt(a),d=(d<<5)-d+b,d|=0;return d},b.draw3DJSSunburst=function(a){function d(a,b){return a===b?!0:a.children&&a.children.length>0?a.children.some(function(a){return d(a,b)}):!1}function e(a){if(!a)return"#ffaaaa";if(void 0!=a.color)return a.color;if(null!=a.parent&&null!=a.parent.parent){a.color=e(a.parent);var b=u(Math.abs(String(a.name).hashCode())%20);a.color=d3.scale.linear().domain([0,100]).interpolate(d3.interpolateRgb).range([a.color,b])(30),a.color=b}else"name"in a?a.color=u(Math.abs(String(a.name).hashCode())%20):a.color="#ffffff";return a.color}function f(a){var b=g(a),c=d3.interpolate(q.domain(),[a.x,a.x+a.dx]),d=d3.interpolate(r.domain(),[a.y,b]),e=d3.interpolate(r.range(),[20,p]);return function(a){return function(b){return q.domain(c(b)),r.domain(d(b)).range(e(b)),z(a)}}}function g(a){return 1}function h(a){return.299*a.r+.587*a.g+.114*a.b}function i(a,b){var c=a.split(" "),d=c.length>8;return c.length<=2?0==b?a:"":(c=c.slice(0,8),c=0==b?c.slice(0,Math.floor(c.length/2)):c.slice(Math.floor(c.length/2)),c.join(" ")+(d&&1==b?"...":""))}function j(a){C.style("visibility",function(a){var b=Math.abs(q(a.x+a.dx)-q(a.x))>Math.PI/48;return b?null:"hidden"}).transition().duration(t).attrTween("text-anchor",function(a){return function(){return q(a.x+a.dx/2)>Math.PI?"end":"start"}}).attrTween("transform",function(a){var b=(a.name||"").split(" ").length>1;return function(){var c=180*q(a.x+a.dx/2)/Math.PI-90,d=c+(b?-.5:0);return"rotate("+d+")translate("+(r(a.y)+s)+")rotate("+(c>90?-180:0)+")"}}).style("fill-opacity",function(b){return d(a,b)?1:1e-6}).each("end",function(a){var b=Math.abs(q(a.x+a.dx)-q(a.x))>Math.PI/48;d3.select(this).style("visibility",b?null:"hidden")})}function k(a){v=a,B.transition().duration(t).attrTween("d",f(a)),j(a)}var l=b.view,a=a,m=(b.rawData,l.grid.columnDefs,$(c).find("svg").parent().empty().get(0)),n=(null!=l.params.xaxis?l.cube.dimensionParts(l.params.xaxis).label:"None",470),o=n,p=n/2,q=d3.scale.linear().range([0*Math.PI,2*Math.PI]),r=d3.scale.linear().domain([0,1]).range([20,p]),s=5,t=1e3,u=d3.scale.category20b().domain([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),v=null,w=d3.select(m),x=w.append("svg").attr("width",n+2*s).attr("height",o+2*s).append("g").attr("transform","translate("+(p+s)+","+(p+s)+")"),y=d3.layout.partition().sort(null).value(function(a){return a.measure}),z=d3.svg.arc().startAngle(function(a){return Math.max(0,Math.min(2*Math.PI,q(a.x)))}).endAngle(function(a){return Math.max(0,Math.min(2*Math.PI,q(a.x+a.dx)))}).innerRadius(function(a){return Math.max(0,a.y?r(a.y):a.y)}).outerRadius(function(a){return Math.max(0,r(a.y+a.dy))}),A=y.nodes({children:a}),B=x.selectAll("path").data(A);B.enter().append("path").attr("id",function(a,b){return"path-"+b}).attr("d",z).attr("fill-rule","evenodd").style("fill",e).on("click",k).each(function(a,b){var c=this;$(c).hover(function(){d3.select(c).style("stroke","#ffffff").style("stroke-width","2").style("stroke-opacity","1"),$(c).insertBefore($("text").first())},function(){d3.select(c).style("stroke","#000000").style("stroke-width","0").style("stroke-opacity","0")})}),v=A[0];var C=x.selectAll("text").data(A),D=C.enter().append("text").style("fill-opacity",1).style("fill",function(a){return h(d3.rgb(e(a)))<125?"#eee":"#000"}).style("font-size",9).style("-webkit-touch-callout","none").style("-webkit-user-select","none").style("-khtml-user-select","none").style("-moz-user-select","none").style("-ms-user-select","none").style("user-select","none").style("pointer-events","none").style("visibility",function(a){var b=Math.abs(q(a.x+a.dx)-q(a.x))>Math.PI/48;return b=!0,b?null:"hidden"}).attr("text-anchor",function(a){return q(a.x+a.dx/2)>Math.PI?"end":"start"}).attr("dy",".2em").attr("transform",function(a){var b=(("label"in a?String(a.label):"")||"").split(" ").length>1,c=180*q(a.x+a.dx/2)/Math.PI-90,d=c+(b?-.5:0);return"rotate("+d+")translate("+(r(a.y)+s)+")rotate("+(c>90?-180:0)+")"}).on("click",k);D.append("tspan").attr("x",0).text(function(a){return a.depth?i(a.label,0):""}),D.append("tspan").attr("x",0).attr("dy","1em").text(function(a){return a.depth?i(a.label,1)||"":""})}}]),angular.module("cv.views.cube").service("exportService",["$rootScope","$timeout","cvOptions","cubesService","viewsService","seriesOperationsService",function(a,b,c,d,e,f){this.exportFacts=function(a){var b=d.buildBrowserArgs(a,!1,!0),e={};e.format="csv",b.cut&&(e.cut=b.cut.toString()),b.order&&(e.order=b.order.toString());var f=c.cubesUrl+"/cube/"+a.cube.name+"/facts?"+$.param(e);window.open(f,"_blank"),window.focus()},this.exportGridAsCsv=function(a){if(!a.grid)return void console.debug("View has no grid that can be exported.");var b=(a.grid,a.grid.data),c="",d=[];$(a.grid.columnDefs).each(function(a,b){d.push('"'+b.name+'"')}),c=c+d.join(",")+"\n",$(b).each(function(b,e){d=[],$(a.grid.columnDefs).each(function(a,b){e[b.field]&&e[b.field].title?d.push('"'+e[b.field].title+'"'):d.push('"'+e[b.field]+'"')}),c=c+d.join(",")+"\n"}),this.saveAs(c,"text/csv",a.cube.name+"-summary.csv")},this.saveAs=function(a,b,c){var d=new Blob([a],{type:b}),e=URL.createObjectURL(d),f=document.createElement("a");"string"==typeof f.download?(document.body.appendChild(f),f.download=c,f.href=e,f.click(),document.body.removeChild(f)):location.replace(e)},this.getDocumentStyles=function(){function a(b){try{if(b.cssRules){console.debug(b);for(var d=0;d")&&(c+="\n"+e.cssText)}}}catch(f){console.debug("Could not access document stylesheet.")}}var b=window.document,c="",d=b.styleSheets;if(d)for(var e=0;ee.undoSize&&(c.undoList.splice(0,c.undoList.length-e.undoSize),c.undoPos=c.undoList.length-1)},b.view.updateUndo=function(){var a=b.view,c=g.serializeView(a);a.undoList[a.undoPos]&&(a.undoList[a.undoPos]=c)},b.getCurrentUndoState=function(){return 0==b.view.undoList.length?"{}":b.view.undoList[b.view.undoPos]},b.undo=function(){b.view.undoPos=b.view.undoPos-1,b.view.undoPos<0&&(b.view.undoPos=0),b.applyCurrentUndoState()},b.redo=function(){b.view.undoPos=b.view.undoPos+1,b.applyCurrentUndoState()},b.applyCurrentUndoState=function(){var a=b.getCurrentUndoState();b.view.params=$.parseJSON(a),b.refreshView()}}]),angular.module("cv.studio",["cv"]),angular.module("cv.studio").service("studioViewsService",["$rootScope","$anchorScroll","$timeout","cvOptions","cubesService","viewsService","dialogService",function(a,b,c,d,e,f,g){this.views=[],this.studioScope=null,f.studioViewsService=this,cubesviewerStudio.studioViewsService=this,this.addViewCube=function(a){var d=e.cubesserver.cubeinfo(a),g=d.label+" ("+(f.lastViewId+1)+")",h=f.createView("cube",{cubename:a,name:g});return this.views.push(h),c(function(){$(".cv-views-container").masonry("appended",$(".cv-views-container").find(".sv"+h.id).show()),c(function(){b("cvView"+h.id)},500)},0),h},this.addViewObject=function(a){if("string"==typeof a)try{$.parseJSON(a)}catch(d){return void g.show("Could not process serialized data: JSON parse error.")}var e=f.createView("cube",a);return this.views.push(e),c(function(){$(".cv-views-container").masonry("appended",$(".cv-views-container").find(".sv"+e.id).show()),c(function(){b("cvView"+e.id)},500)},0),e},this.closeView=function(a){var b=this.views.indexOf(a);b>=0&&($(".cv-views-container").masonry("remove",$(".cv-views-container").find(".sv"+a.id)),this.views.splice(b,1),$(".cv-views-container").masonry("layout"))},this.toggleCollapseView=function(a){a.collapsed=!a.collapsed,c(function(){$(".cv-views-container").masonry("layout")},100)}}]),angular.module("cv.studio").controller("CubesViewerStudioViewController",["$rootScope","$scope","cvOptions","cubesService","studioViewsService","reststoreService",function(a,b,c,d,e,f){b.cubesService=d,b.studioViewsService=e,b.cvOptions=c,b.reststoreService=f,b.$watch("__height",function(){$(".cv-views-container").masonry("layout")})}]).directive("cvStudioView",function(){return{restrict:"A",templateUrl:"studio/panel.html",scope:{view:"="},link:function(a,b,c){a.$watch(function(){a.__height=b.height()})}}}),angular.module("cv.studio").controller("CubesViewerStudioController",["$rootScope","$scope","$uibModal","$element","$timeout","cvOptions","cubesService","studioViewsService","viewsService","reststoreService",function(a,b,c,d,e,f,g,h,i,j){b.cvVersion=cubesviewer.version,b.cvOptions=f,b.cubesService=g,b.studioViewsService=h,b.reststoreService=j,b.studioViewsService.studioScope=b,b.initialize=function(){},b.showSerializeAdd=function(){var a=c.open({animation:!0,templateUrl:"studio/serialize-add.html",controller:"CubesViewerSerializeAddController",appendTo:angular.element($(d).find(".cv-gui-modals")[0])});a.result.then(function(a){},function(){})},b.showSerializeView=function(a){var b=c.open({animation:!0,templateUrl:"studio/serialize-view.html",controller:"CubesViewerSerializeViewController",appendTo:angular.element($(d).find(".cv-gui-modals")[0]),resolve:{view:function(){return a},element:function(){return $(d).find(".cv-gui-modals")[0]}}});b.result.then(function(a){},function(){})},b.showRenameView=function(a){var b=c.open({animation:!0,templateUrl:"studio/rename.html",controller:"CubesViewerRenameController",appendTo:angular.element($(d).find(".cv-gui-modals")[0]),size:"md",resolve:{view:function(){return a},element:function(){return $(d).find(".cv-gui-modals")[0]}}});b.result.then(function(a){},function(){})},b.cloneView=function(a){var b=$.parseJSON(i.serializeView(a));b.name="Clone of "+b.name;var a=h.addViewObject(b);a.savedId=0,a.owner=f.user,a.shared=!1},b.toggleTwoColumn=function(){f.studioTwoColumn=!f.studioTwoColumn,e(function(){$(".cv-views-container").masonry("layout")},100)},b.toggleHideControls=function(){f.hideControls=!f.hideControls,e(function(){$(".cv-views-container").masonry("layout")},100)},b.initialize()}]),angular.module("cv.studio").controller("CubesViewerRenameController",["$rootScope","$scope","$uibModalInstance","cvOptions","cubesService","studioViewsService","view",function(a,b,c,d,e,f,g){b.cvVersion=cubesviewer.version,b.cvOptions=d,b.cubesService=e,b.studioViewsService=f,b.viewName=g.params.name,b.renameView=function(a){null!=a&&""!=a&&(g.params.name=a),c.close(g)},b.close=function(){c.dismiss("cancel")}}]),angular.module("cv.studio").config(["$compileProvider",function(a){}]),angular.module("cv.studio").run(["$rootScope","$compile","$controller","$http","$templateCache","cvOptions",function(a,b,c,d,e,f){console.debug("Bootstrapping CubesViewer Studio.");var g={container:null,user:null,studioTwoColumn:!1,hideControls:!1,backendUrl:null};$.extend(g,f),$.extend(f,g),d.get("studio/studio.html",{cache:e}).then(function(c){var d=a.$new();$(f.container).html(c.data),b($(f.container).contents())(d)})}]);var cubesviewerStudio=new CubesViewerStudio;angular.module("cv.studio").controller("CubesViewerSerializeViewController",["$rootScope","$scope","$timeout","$uibModalInstance","element","cvOptions","cubesService","studioViewsService","viewsService","view",function(a,b,c,d,e,f,g,h,i,j){b.cvVersion=cubesviewer.version,b.cvOptions=f,b.cubesService=g,b.studioViewsService=h,b.serializedView="",b.initialize=function(){b.serializedView=i.serializeView(j),console.log("Serialized view: "+b.serializedView),c(function(){window.getSelection().removeAllRanges();var a=document.createRange();a.selectNodeContents($(e).find(".cv-serialized-view")[0]),window.getSelection().addRange(a)},0)},b.close=function(){d.dismiss("cancel")},b.initialize()}]),angular.module("cv.studio").controller("CubesViewerSerializeAddController",["$rootScope","$scope","$uibModalInstance","cvOptions","cubesService","studioViewsService",function(a,b,c,d,e,f){b.cvVersion=cubesviewer.version,b.cvOptions=d,b.cubesService=e,b.studioViewsService=f,b.serializedView=null,b.addSerializedView=function(a){if(null!=a){f.addViewObject(a)}c.close(a)},b.close=function(){c.dismiss("cancel")}}]),angular.module("cv.studio").service("reststoreService",["$rootScope","$http","$cookies","cvOptions","cubesService","viewsService","dialogService","studioViewsService",function(a,b,c,d,e,f,g,h){var i=this;i.savedViews=[],i.initialize=function(){d.backendUrl&&i.viewList()},i.getSavedView=function(a){var b=$.grep(i.savedViews,function(b){return b.id==a});return b.length>0?b[0]:null},i.saveView=function(a){if(a.owner!=d.user)return void g.show("Cannot save a view that belongs to other user (try cloning the view).");var h={id:a.savedId,name:a.params.name,shared:a.shared,data:f.serializeView(a)};b({method:"POST",url:d.backendUrl+"/view/save/",data:JSON.stringify(h),headers:{"X-CSRFToken":c.get("csrftoken")}}).then(i._viewSaveCallback(a),e.defaultRequestErrorHandler)},i._viewSaveCallback=function(a){var a=a;return function(b,c){if(b=b.data,null!=a){a.savedId=b.id;var d=i.getSavedView(a.savedId);null!=d&&(d.name=a.params.name,d.shared=a.shared,d.data=f.serializeView(a))}i.viewList(),g.show("View saved.")}},i.deleteView=function(a){if(0==a.savedId)return void g.show("Cannot delete this view as it hasn't been saved.");if(a.owner!=d.user)return void g.show("Cannot delete a view that belongs to other user.");if(confirm("Are you sure you want to delete and close this view?")){var e={id:a.savedId,data:""};h.closeView(a),b({method:"POST",url:d.backendUrl+"/view/save/",data:JSON.stringify(e),headers:{"X-CSRFToken":c.get("csrftoken")}}).then(i._viewDeleteCallback,cubesviewer.defaultRequestErrorHandler)}},i._viewDeleteCallback=function(){i.viewList()},i.viewList=function(){b.get(d.backendUrl+"/view/list/").then(i._viewListCallback,e.defaultRequestErrorHandler)},i._viewListCallback=function(a,b){i.savedViews=a.data},i.isViewChanged=function(a){if(0==a.savedId)return!1;var b=i.getSavedView(a.savedId);if(null!=b){if(a.params.name!=b.name)return!0;if(a.shared!=b.shared)return!0;if(f.serializeView(a)!=b.data)return!0}return!1},i.shareView=function(a,b){return a.owner!=d.user?void g.show("Cannot share/unshare a view that belongs to other user (try cloning the view)."):(a.shared=1==b?!0:!1,void i.saveView(a))},i.addSavedView=function(a){var b=i.getSavedView(a),c=$.parseJSON(b.data),e=h.addViewObject(c);b.owner==d.user?(e.savedId=b.id,e.owner=b.owner,e.shared=b.shared):(e.savedId=0,e.owner=d.user,e.shared=!1)},i.initialize()}]),angular.module("cv.cubes").service("gaService",["$rootScope","$http","$cookies","$log","cvOptions",function(a,b,c,d,e){this.ignorePeriod=12,this.initTime=new Date,this.initialize=function(){e.gaTrackEvents&&d.debug("Google Analytics events tracking plugin enabled.")},this.trackRequest=function(a){if(e.gaTrackEvents&&!((new Date-this.initTime)/1e3=0&&(c=c.slice(f+1),"model"==c[1]?b=["model",c[0]]:"aggregate"==c[1]?b=["aggregate",c[0]]:"facts"==c[1]?b=["facts",c[0]]:"members"==c[1]&&(b=["dimension",c[2]])),b?"undefined"!=typeof ga?(ga("send","event","CubesViewer",b[0],b[1]),d.debug("Tracking GA event: "+b[0]+"/"+b[1])):d.debug("Cannot track CubesViewer events: GA object 'ga' not available."):d.warn("Unknown cubes operation, cannot be tracked by GA service: "+a)}},this.initialize()}]),angular.module("cv").run(["$templateCache",function(a){a.put("dialog/dialog.html",' \n \n \n\n'),a.put("studio/about.html",'\n\n\n'),a.put("studio/panel.html",'
    \n\n
    \n
    \n\n \n \n\n {{ view.params.name }}\n\n Modified\n Saved\n Shared\n\n \n\n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n\n
    \n'),a.put("studio/rename.html",' \n \n \n\n'),a.put("studio/serialize-add.html",' \n \n \n\n'),a.put("studio/serverinfo.html",'\n\n\n'),a.put("studio/studio.html",'
    \n\n
    \n\n \n\n\n \n\n\n \n\n
    \n\n \n
    \n \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n\n
    \n\n
    \n\n
    \n
    \n
    \n

    Could not connect to server: {{ cubesService.stateText }}

    \n

    Please try again and contact your administrator if the problem persists.

    \n
    \n
    \n
    \n\n
    \n\n
    \n\n \n\n
    \n\n
    \n\n
    \n\n\n'), +a.put("views/cube/alerts.html",'
    \n\n
    \n
    \n
    \n An error has occurred. Cannot present view.
    \n Please try again and contact your administrator if the problem persists.\n
    \n
    \n\n
    \n \n
    \n
    \n Limit of {{ cubesService.cubesserver.info.json_record_limit }} items has been hit. Results are incomplete.
    \n Tip: reduce level of drilldown or filter your selection to reduce the number of items in the result.\n
    \n
    \n\n
    \n'),a.put("views/cube/chart/chart-common.html",'
    \n
    \n
    \n \n
    \n
    \n Small\n Medium\n Tall\n
    \n
    \n
    \n\n
    \n

    \n Cannot present chart: no measure has been selected.\n

    \n

    \n Tip: use the View > Measure menu.\n

    \n
    \n\n
    \n

    \n Cannot present chart: no rows returned by the current filtering, horizontal dimension, and drilldown combination.\n

    \n

    \n Tip: use the View menu to select an horizontal dimension.\n

    \n
    \n\n
    \n

    \n Cannot present a pie chart when more than one column is present.
    \n

    \n

    \n Tip: review chart data and columns in series mode,\n or remove horizontal dimension.\n

    \n
    \n\n
    \n Cannot present a radar chart when less than 3 columns are present.
    \n Tip: review chart data and columns in series mode.\n
    \n'),a.put("views/cube/chart/chart.html",'
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n

    Chart\n \n

    \n
    \n \n
    \n
    \n
    \n
    \n
    \n\n
    \n'),a.put("views/cube/cube-menu-drilldown.html",' \n\n \n\n'),a.put("views/cube/cube-menu-filter.html",' \n\n \n'),a.put("views/cube/cube-menu-panel.html",' \n\n \n'),a.put("views/cube/cube-menu-view.html",' \n\n \n\n'),a.put("views/cube/cube.html",'
    \n\n
    \n
    \n

    An error occurred. Cannot present view.

    \n

    {{ view.error }}

    \n

    Could not connect to data server: {{ cubesService.stateText }}

    \n

    Please try again and contact your administrator if the problem persists.

    \n

    \n CubesViewer Data Visualizer\n

    \n
    \n
    \n\n
    \n

    \n {{ view.params.name }}\n

    \n\n
    \n
    \n\n
    \n\n
    \n\n
    \n\n
    \n \n \n
    \n\n
    \n \n \n \n \n
    \n\n \n\n \n\n \n\n \n\n
    \n\n
    \n\n
    \n\n
    \n\n
    \n
    \n
    \n {{ view.cube.label }}\n \n
    \n\n
    \n\n\n
    \n {{ parts.labelShort }}\n \n\n \n \n\n \n \n
    \n\n
    \n
    \n \n
    \n {{ view.cube.dimensionPartsFromCut(cut).labelShort }} {{ equality }} {{ cut.value }}\n \n \n \n
    \n
    \n\n
    \n\n
    \n\n
    \n {{ (view.params.yaxis != null) ? view.cube.aggregateFromName(view.params.yaxis).label : "None" }}\n \n
    \n\n
    \n {{ (view.params.xaxis != null) ? view.cube.dimensionParts(view.params.xaxis).labelShort : "None" }}\n \n\n \n \n\n \n \n
    \n\n
    \n
    \n
    \n
    \n\n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n\n
    \n
    \n\n
    \n\n
    \n\n
    \n'), +a.put("views/cube/explore/explore.html",'
    \n\n \n

    Aggregated data\n \n

    \n\n
    \n \n
    \n\n
    \n
    \n
     
    \n\n
    \n'),a.put("views/cube/facts/facts.html",'
    \n\n \n

    Facts data\n \n

    \n\n
    \n \n
    \n\n
    \n
    \n
     
    \n\n
    No facts are returned by the current filtering combination.
    \n\n
    \n'),a.put("views/cube/filter/datefilter.html",'
    \n
    \n {{ dimparts.labelNoLevel }}:\n\n \n\n
    \n\n
    \n\n
    \n \n
    \n\n
    \n\n ⇒\n\n
    \n

    \n \n \n \n \n

    \n
    \n\n -\n -\n\n
    \n

    \n \n \n \n \n

    \n
    \n\n
    \n\n
    \n\n
    \n\n \n \n\n\n
    \n
    \n\n'),a.put("views/cube/filter/dimension.html",'
    \n\n
    \n
    \n \n

    Dimension filter: {{ parts.label }}

    \n
    \n
    \n\n
    \n
    \n\n
    \n \n \n \n
    \n\n
    \n \n \n
    \n\n\n
    \n \n \n \n
    \n\n
    \n
    \n Show all\n
    \n
    \n\n
    \n\n
    \n \n Invert\n
    \n\n
    \n\n
    \n \n
    \n
    \n
    \n\n
    \n\n
    \n
    \n
    \n
    \n
    Loading...
    \n\n
    \n
    \n \n
    \n
    \n\n
    \n\n
    \n
    \n {{ dimensionValues.length }} items\n
    \n
    \n\n
    \n
    \n
    \n Limit of {{ cubesService.cubesserver.info.json_record_limit }} items has been hit. Dimension value list is incomplete.
    \n
    \n
    \n\n
    \n
    \n
    \n\n
    \n\n
    \n
    \n\n\n
    \n'),a.put("views/cube/series/series.html",'
    \n\n \n

    Series table\n \n

    \n\n
    \n XXXX\n
    \n\n
    \n
    \n
     
    \n\n
    \n

    \n Cannot present series table: no measure has been selected.\n

    \n

    \n Tip: use the View > Measure menu.\n

    \n
    \n\n
    \n

    \n Cannot present series table: no rows are returned by the current horizontal dimension, drilldown or filtering combination.\n

    \n

    \n Tip: use the View menu to select an horizontal dimension.\n

    \n
    \n\n
    \n')}]); \ No newline at end of file diff --git a/package.json b/package.json index e085094..38c115b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cubesviewer", - "version": "2.0.1", + "version": "2.0.2", "devDependencies": { "bower": "^1.7.9", "grunt": "^0.4.5",