Sha256: 59784bfef99090a2d2e1ff191b733c8265fd262b595b40f3455f0c2dfbb248b1

Contents?: true

Size: 1.71 KB

Versions: 32

Compression:

Stored size: 1.71 KB

Contents

!(angular => {
  'use strict';

  class QueryLoader {
    constructor($routeParams, Query, QueryVersions, Results, VisualizationService) {
      this._Query = Query;
      this._QueryVersion = QueryVersions;
      this._Results = Results;
      this._VisualizationService = VisualizationService;
      this._$routeParams = $routeParams;
    }

    initialize() {
      this.query = new this._Query();
      this.queryVersions = new this._QueryVersion();
      this.results = new this._Results();
      this.queryId = this._$routeParams.query_id;
      this.queryVersionId = this._$routeParams.query_version_id || 'latest';
    }

    load() {
      return this.query.initItem(this.queryId, this.queryVersionId)
        .then(this.loadQueryVersions.bind(this))
        .then(this.loadResults.bind(this))
        .then(this.loadVisualizations.bind(this));
    }

    loadQueryVersions(query) {
      return this.queryVersions.initCollection(query.id).then(versions => {
        return { query: query, queryVersions: versions };
      });
    }

    loadResults(prev) {
      let query = prev.query;
      return this.results.initCollection({
        query_id: query.id,
        query_version_id: query.version.id
      }).then(results => {
        return _.merge(prev, { results: results });
      });
    }

    loadVisualizations(prev) {
      let query = prev.query;
      return this._VisualizationService.load(query.id, query.version.id).then(visualizations => {
        return _.merge(prev, { visualizations: visualizations });
      });
    }
  }

  QueryLoader.$inject = ['$routeParams', 'Query', 'QueryVersions', 'Results', 'VisualizationService'];
  angular.module('alephServices.queryLoader', []).service('QueryLoader', QueryLoader);
}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.4.4 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.1.0 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/query/query_loader.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/query/query_loader.js-1fbc8b859778d46b73b9adc300984851.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/query/query_loader.js.es6