Sha256: c180af1416e36a771ca73379f4f9b79a227371bec21d3146395b99eb468a6ed3

Contents?: true

Size: 1.58 KB

Versions: 32

Compression:

Stored size: 1.58 KB

Contents

!(angular => {
  'use strict';

  function ColumnModelImports(SchemaColumnResource, CollectionModelBase, UnpersistedModel) {

    return class SchemaColumns extends CollectionModelBase {

      constructor() {
        super(SchemaColumnResource, UnpersistedModel);
        this.uniqueSchemas = [];
        this.uniqueTables = [];
        this.uniqueColumns = [];
        this.schemaTables = {};
      }

      initCollection() {
        return super.initCollection().then(this._processUniqueAttributes.bind(this));
      }

      // private methods

      _processUniqueAttributes(columns) {
        let columnNames = [];
        let tables = [];
        let schemas = [];

        _.each(columns, column => {
          columnNames.push(column.item.column);
          tables.push(column.item.table);
          schemas.push(column.item.schema);
          this._addToSchemaTables(column);
        });

        this.uniqueColumns = _.uniq(columnNames);
        this.uniqueTables = _.uniq(tables);
        this.uniqueSchemas = _.uniq(schemas);
        return columns;
      }

      _addToSchemaTables(column) {
        let tables = this.schemaTables[column.item.schema];
        if(!tables) {
          tables = [];
          this.schemaTables[column.item.schema] = tables;
        }

        if(!_.contains(tables, column.item.table)) {
          tables.push(column.item.table);
        }
      }
    };
  }

  ColumnModelImports.$inject = ['SchemaColumnResource', 'CollectionModelBase', 'UnpersistedModel'];
  angular.module('alephServices.schema.columns', []).service('SchemaColumns', ColumnModelImports);

}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

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