aleph_analytics 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (16) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/app/assets/javascripts/angular/aleph.js.es6 +2 -1
  4. data/app/assets/javascripts/angular/config/schema_completer_config.js.es6 +5 -1
  5. data/app/assets/javascripts/angular/controllers/query/query_repl_controller.js.es6 +9 -1
  6. data/app/assets/javascripts/angular/services/lib/matcher_runner.js.es6 +6 -1
  7. data/app/assets/javascripts/angular/services/lib/schema_completer.js.es6 +5 -4
  8. data/config/initializers/pester.rb +3 -2
  9. data/public/assets/{.sprockets-manifest-db701e8ddeb121fb438905e98c289832.json → .sprockets-manifest-ee5031d89f2eb0b53eb8eee944d985cf.json} +1 -1
  10. data/public/assets/angular/{aleph.js-5c6fb1f7eaa833a4e9fc35bca222deb7.es6 → aleph.js-48037f371a59a5ffaff68fd517163d50.es6} +2 -1
  11. data/public/assets/angular/config/{schema_completer_config.js-1b696920b5e04f75620630d75117b201.es6 → schema_completer_config.js-bf6c4caf7972760623f4faa48864aef0.es6} +5 -1
  12. data/public/assets/angular/controllers/query/{query_repl_controller.js-0afdd52039f0b9d6109c2acd45cc8307.es6 → query_repl_controller.js-6766572fd1d6a3e2ebd5915ca66f30d1.es6} +9 -1
  13. data/public/assets/angular/services/lib/{matcher_runner.js-bd63f4c6ad965716c5b793d3c4602563.es6 → matcher_runner.js-174426afcffcfdef46041dc7470655f7.es6} +6 -1
  14. data/public/assets/angular/services/lib/{schema_completer.js-d04d49642967fd9f8e2c95e0df81f2ae.es6 → schema_completer.js-45c62c500021d3e3a74d931c5a8d3dc2.es6} +5 -4
  15. data/public/assets/{application-2d39a2a295cb3e0266f72956b3a62534.js → application-b990345b1178d3d77974c9ea035650ae.js} +4 -4
  16. metadata +8 -8
@@ -38,7 +38,8 @@
38
38
  let keysForAce = {
39
39
  save: this._saveKb,
40
40
  detectParameters: this._detectParametersKb,
41
- run: this._runKb
41
+ run: this._runKb,
42
+ triggerAutoComplete: this._triggerAutoComplete
42
43
  };
43
44
 
44
45
  this.aceLoaded = function aceLoaded(editor) {
@@ -47,6 +48,7 @@
47
48
  editor.commands.addCommand(keysForAce.save.aceKeyCmd);
48
49
  editor.commands.addCommand(keysForAce.detectParameters.aceKeyCmd);
49
50
  editor.commands.bindKey(keysForAce.run.bindKey, keysForAce.run.keyFn);
51
+ editor.commands.bindKey(keysForAce.triggerAutoComplete.bindKey, keysForAce.triggerAutoComplete.keyFn);
50
52
  editor.setOptions({
51
53
  maxLines: 500,
52
54
  minLines: 2
@@ -143,6 +145,11 @@
143
145
  }
144
146
  });
145
147
 
148
+ this._triggerAutoComplete = KeyBindings.triggerAutoComplete.withKeyFn((editor) => {
149
+ editor.insert('.');
150
+ editor.execCommand("startAutocomplete");
151
+ });
152
+
146
153
  this._runKb = KeyBindings.runQuery.withKeyFn(() => {
147
154
  if(this.validToRun()) {
148
155
  this.runQuery();
@@ -157,6 +164,7 @@
157
164
  hotkeys.bindTo($scope)
158
165
  .add(this._saveKb.hotKey)
159
166
  .add(this._runKb.hotKey)
167
+ .add(this._triggerAutoComplete.hotKey)
160
168
  .add(this._detectParametersKb.hotKey);
161
169
  }
162
170
  }
@@ -10,6 +10,8 @@
10
10
 
11
11
  execute(currentContext, filterArgs, prefix) {
12
12
  let allMatches = [];
13
+ // override context if user has pressed "." -- which manifests as a prefix ""
14
+ currentContext = prefix == '' ? 'postDot' : currentContext;
13
15
 
14
16
  _.each(this._matchers, matcher => {
15
17
  if (this._isMatcherRelevant(matcher, currentContext)) {
@@ -36,7 +38,10 @@
36
38
  if (!this._matcherFiltersForContext(matcher, currentContext) ||
37
39
  this._itemSatisfiesFilters(matcher.contextItemFilters[currentContext], item, filterArgs)) {
38
40
  let itemName = _.exists(matcher.nameProperty) ? item[matcher.nameProperty] : item;
39
- if (itemName.indexOf(prefix) === 0) {
41
+
42
+ // We want to return everything on empty string because it means that
43
+ // the typing has just begun and anything matches
44
+ if (itemName.indexOf(prefix) === 0 || prefix == '') {
40
45
  return itemName;
41
46
  }
42
47
  }
@@ -6,6 +6,7 @@
6
6
  return class SchemaCompleter {
7
7
 
8
8
  constructor() {
9
+ this.identifierRegexps = [/[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/, /\./]
9
10
  this._columns = new SchemaColumns();
10
11
  this.loadColumnData();
11
12
  }
@@ -22,12 +23,13 @@
22
23
  }
23
24
 
24
25
  getCompletions(editor, session, pos, prefix, callback) {
25
- if (prefix.length === 0) { callback(null, []); return; }
26
-
27
26
  let parsedSql = aceSqlParse(session, pos);
28
27
  let currentClause = parsedSql.currentClause;
29
28
  let isSubstring = this._makeIsSubstringFn(parsedSql.fromClause);
30
- let matchingTables = _(this._columns.uniqueTables).filter(isSubstring);
29
+ let matchingTables = []
30
+ if (prefix != '') {
31
+ matchingTables = _(this._columns.uniqueTables).filter(isSubstring);
32
+ }
31
33
  let matchingSchemas = _(this._columns.uniqueSchemas).filter(isSubstring);
32
34
 
33
35
  if (_.exists(this._matcherRunner)) {
@@ -35,7 +37,6 @@
35
37
  tableRestrict: matchingTables,
36
38
  schemaRestrict: matchingSchemas
37
39
  }, prefix);
38
-
39
40
  callback(null, matches);
40
41
  }
41
42
  }