Sha256: fd4265cd155f993bc4fe3c2753d08af62a951363e17c9a846b31a6333203d8f2

Contents?: true

Size: 1.29 KB

Versions: 32

Compression:

Stored size: 1.29 KB

Contents

!(angular => {
  'use strict';

  /* QueryTab does the following:
    - Activate tabs
    - Access tab info from url parameter
    - Keeps state about which tab is active
    - Programatically 'navigate' to tabs by setting activity and url parameters
  */

  class QueryTab {
    constructor($location) {
      this._initTabs();
      this.$location = $location;
      this._defaultTab = 'query';
    }

    set defaultTag(dt) {
      this._defaultTab = dt;
    }

    get defaultTag() {
      return this._defaultTab;
    }

    setActiveTabFromUrl() {
      this._activateTab(this.getTab());
    }

    navigateToTab(tab) {
      this._activateTab(tab);
      this.setTab(tab);
    }

    setTab(s) {
      this.$location.search('tab', s);
    }

    getTab() {
      let rawTab = this.$location.search().tab;
      return (rawTab === 'visualizations' || rawTab === 'results') ? rawTab : 'query';
    }

    // private methods

    _initTabs() {
      this.state = {
        query: { active: false },
        results: { active: false },
        visualizations: { active: false }
      };
    }

    _activateTab(tab) {
      this._initTabs();
      this.state[tab].active = true;
    }
  }

  QueryTab.$inject = ['$location'];
  angular.module('alephServices.queryTab', []).service('QueryTab', QueryTab);

}(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_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.4.4 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.1.0 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/query/query_tab.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/query/query_tab.js-fe34f5e6d0c813d2d92838be14cd6783.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/query/query_tab.js.es6