diff --git a/static/index.html b/static/index.html
index c407dca..2303d97 100644
--- a/static/index.html
+++ b/static/index.html
@@ -36,6 +36,9 @@
+
diff --git a/static/js/app.js b/static/js/app.js
index bc6c97a..14aeba1 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -1502,9 +1502,18 @@ $(document).ready(function() {
loadDatabases();
});
+ $('#txtSearch').on('keypress', function(e) {
+ if (e.keyCode === 13) {
+ $('#btnSearchDB').trigger('click');
+ }
+ });
$('#btnSearchDB').on('click', function(e) {
var searchQuery = $.trim($('#txtSearch').val());
+ if (searchQuery.length === 0) {
+ return;
+ }
+
apiSearchDatabase(searchQuery, function(data) {
if (data.error) {
return;
@@ -1535,22 +1544,26 @@ $(document).ready(function() {
var dbTable = {
label: 'Table',
type: 'tbl-holder',
- children: []
+ children: [],
+ data_loaded: true
};
var dbProc = {
label: 'Procedure',
children: [],
- type: 'sp-holder'
+ type: 'sp-holder',
+ data_loaded: true
};
var dbFunc = {
label: 'Function',
children: [],
- type: 'fn-holder'
+ type: 'fn-holder',
+ data_loaded: true
};
var dbView = {
label: 'View',
children: [],
- type: 'vw-holder'
+ type: 'vw-holder',
+ data_loaded: true
};
@@ -1558,17 +1571,20 @@ $(document).ready(function() {
if (val.type === 'TBL') {
dbTable.children.push({
label: val.name,
- type: 'table'
+ type: 'table',
+ load_on_demand: true
});
} else if (val.type === 'PROC') {
dbProc.children.push({
label: val.name,
- type: 'procedure'
+ type: 'procedure',
+ load_on_demand: true
});
} else if (val.type === 'FUNC') {
dbFunc.children.push({
label: val.name,
- type: 'function'
+ type: 'function',
+ load_on_demand: true
});
}
});
@@ -1576,7 +1592,8 @@ $(document).ready(function() {
objTree.push({
label: dbName,
type: 'database',
- children: [dbTable, dbProc, dbFunc]
+ children: [dbTable, dbProc, dbFunc],
+ data_loaded: true
});
});
console.log(objTree);
@@ -1600,9 +1617,20 @@ $(document).ready(function() {
);
$tree.tree('selectNode', null);
+
+ //Show the clear search option
+ $('#dvClearSearch').removeClass('hide');
});
});
+ $('#btnClearSearch').on('click', function(e) {
+ loadDatabases();
+ //Show the clear search option
+ $('#dvClearSearch').addClass('hide');
+ $('#txtSearch').val('');
+ e.preventDefault();
+ });
+
initModals();
initEditor("custom_query");