Skip to content
Snippets Groups Projects
Commit c0540a6b authored by Allen Gilliland's avatar Allen Gilliland
Browse files

remove old ace editor directive which is no longer used.

parent 4c5965da
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,6 @@ var Card = angular.module('metabase.card', [
'metabase.filters',
'metabase.directives',
'metabase.services',
'metabase.aceeditor.directives',
'metabase.card.services',
'metabase.card.controllers',
'metabase.card.directives'
......
'use strict';
/*global ace*/
import { Provider } from 'react-redux';
import { DevTools, DebugPanel } from 'redux-devtools/lib/react';
......@@ -232,67 +230,3 @@ NavbarDirectives.directive('mbProfileLink', [function () {
},
};
}]);
var MetabaseACEEditorDirectives = angular.module('metabase.aceeditor.directives', ['ui.ace']);
MetabaseACEEditorDirectives.directive('mbAceSqlEditor', function() {
function controller($scope, Metabase) {
$scope.aceLoaded = function(aceEditor) {
if ($scope.onLoad) {
var fn = $scope.onLoad();
if (fn) fn(aceEditor);
}
var aceLanguageTools = ace.require('ace/ext/language_tools');
aceEditor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
aceLanguageTools.addCompleter({
getCompletions: function(editor, session, pos, prefix, callback) {
if (prefix.lengh === 0 || !$scope.database) {
console.log("$scope.database is not set, unable to perform autocompletions for ACE Editor :'(");
callback(null, []);
return;
}
Metabase.db_autocomplete_suggestions({
dbId: $scope.database,
prefix: prefix
}, function(results) {
// transform results of the API call into what ACE expects
var js_results = results.map(function(result) {
return {
name: result[0],
value: result[0],
meta: result[1]
};
});
callback(null, js_results);
}, function(error) {
console.log(error);
callback(null, []);
});
}
});
// focus the editor on load to allow faster editing of query
aceEditor.focus();
};
}
return {
restrict: 'E',
templateUrl: '/app/components/editor/editor.html',
controller: ['$scope', 'Metabase', controller],
scope: {
sql: '=', // the text of the editor itself
database: '=', // int ID of DB to use for autocompletion
onLoad: '&onload' // optional callback of the form fn(aceEditor) in case we need a reference to it (e.g. so we can aceEditor.focus())
}
};
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment