Sha256: 0cb6fe2c071363b883745684390f784b9d22fb35a659573c0adda4c7f75b7aab

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

function ReportsUrls(reportName) {
    this.url = reportName;

    // See com.ning.billing.osgi.bundles.analytics.reports.ReportSpecification
    this.reportSpecificationsSeparator = '^';
    this.reportSpecificationSeparator = ':';

    // See com.ning.billing.osgi.bundles.analytics.reports.sql.Cases
    this.groupsSeparator = '|';
}

ReportsUrls.prototype.addDimension = function(dimension, groups) {
    var dimensionWithGroups = dimension;

    var that = this;
    $.each(groups || [], function(i, group) {
        if (i == 0) {
            dimensionWithGroups += '(';
        }

        dimensionWithGroups += groups[i];

        if (i == groups.length - 1) {
            dimensionWithGroups += ')';
        } else {
            dimensionWithGroups += that.groupsSeparator;
        }
    });

    return this.addSpecification('dimension', dimensionWithGroups);
}

ReportsUrls.prototype.addMetric = function(metric) {
    return this.addSpecification('metric', metric);
}

ReportsUrls.prototype.addFilter = function(filter) {
    return this.addSpecification('filter', filter);
}

ReportsUrls.prototype.addSpecification = function(specificationString, specificationValue) {
    this.url += this.reportSpecificationsSeparator + specificationString + this.reportSpecificationSeparator + encodeURIComponent(specificationValue);
    return this;
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kanaui-0.5.0 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.4.2 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.4.1 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.4.0 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.3.0 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.2.0 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.1.0 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.0.4 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.0.3 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.0.2 app/assets/javascripts/kanaui/reports.urls.js
kanaui-0.0.1 app/assets/javascripts/kanaui/reports.urls.js