Sha256: 226c33353569c7c60130e09c4b5f87acc84f8ec43ab9167b40cf4f0377882462

Contents?: true

Size: 1.75 KB

Versions: 32

Compression:

Stored size: 1.75 KB

Contents

!(angular => {
  'use strict';

  class SchemaIndexController {
    constructor(SchemaColumnResource, SchemaColumn, SchemaColumns, PaginationComponents, SpinnerState) {
      this.pagination = new PaginationComponents(
        'Paginated Schema',
        SchemaColumnResource.index,
        SchemaColumn,
        {
          additionalParams: { with_comments: true },
          limit: 150
        }
      );

      this.columns = new SchemaColumns();
      let spinner = SpinnerState.withContext('SchemaColumns');
      spinner.on();
      this.columns.initCollection().then(spinner.off.bind(spinner));
    }

    directory() {
      return _.chain(this.columns.schemaTables).pairs()
        .reduce((acc, entry) => {
          return acc.concat(_.map(entry[1], table => {
            return {
              schema: entry[0],
              table: table
            };
          }));
        }, [])
        .value();
    }

    typeAheadValues(search) {
      let schemasRe = /^[A-z]+$/;
      let tablesRe = /^[A-z]+\.[A-z]*$/;

      if(schemasRe.test(search)) {
        return _.filter(this.columns.uniqueSchemas, str => str.indexOf(search) > -1);
      } else if(tablesRe.test(search)) {
        let schema = search.split('.')[0];
        let tables = this.columns.schemaTables[schema];
        return _.chain(tables)
          .map(table => schema + '.' + table)
          .filter(str => str.indexOf(search) > -1)
          .value();
      } else {
        return [];
      }
    }
  }

  SchemaIndexController.$inject = ['SchemaColumnResource', 'SchemaColumn', 'SchemaColumns', 'PaginationComponents',
    'SpinnerState'];

  angular
    .module('alephControllers.schemaIndexController', ['alephServices'])
    .controller('SchemaIndexController', SchemaIndexController);

}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.4.8 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.4.7 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.4.4 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.4.2 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.4.1 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.3.0 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.2.0 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.1.0 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6
aleph_analytics-0.0.6 public/assets/angular/controllers/schema/schema_index_controller.js-d0d790d168b49caefa4b8f7993c928f1.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/controllers/schema/schema_index_controller.js.es6