Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate generate query templates directly into search query input #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 25 additions & 8 deletions debug-db-base/src/main/assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ function deleteDb() {
}
}

function fillQuery(id){
switch(id){
case "select_query":
$('#query').val("Select * from <table_name>");
$('#query').focus();
break;
case "update_query":
$('#query').val("Update <table_name> set <column_name> = <value> where <condition>");
$('#query').focus();
break;
case "delete_query":
$('#query').val("Delete from <table_name> where <condition>");
$('#query').focus();
break;
}
}

function getDBList() {

$.ajax({url: "getDbList", success: function(result){
Expand Down Expand Up @@ -142,13 +159,13 @@ function openDatabaseAndGetTableList(db, isDownloadable) {
$('#table-list').empty()
for(var count = 0; count < tableList.length; count++){
var tableName = tableList[count];
$("#table-list").append("<a href='#table=" + tableName + "' data-db-name='" + db + "' data-table-name='" + tableName
+ "' class='list-group-item' onClick='getData(\"" + tableName + "\");'>" + tableName + "</a>");
}
$("#table-list").append("<a href='#table=" + tableName + "' data-db-name='" + db + "' data-table-name='" + tableName
+ "' class='list-group-item' onClick='getData(\"" + tableName + "\");'>" + tableName + "</a>");
}

if (lastTableName !== null) {
$('a[data-table-name=' + lastTableName + ']').trigger('click');
}
if (lastTableName !== null) {
$('a[data-table-name=' + lastTableName + ']').trigger('click');
}
}});

}
Expand Down Expand Up @@ -426,6 +443,6 @@ function showErrorInfo(message){
}

function getHashValue(key) {
var matches = location.hash.match(new RegExp(key + '=([^&]*)'));
return matches ? matches[1] : null;
var matches = location.hash.match(new RegExp(key + '=([^&]*)'));
return matches ? matches[1] : null;
}
3 changes: 3 additions & 0 deletions debug-db-base/src/main/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
<div class="col-sm-12">
<div class="form-group">
<label for="query">Query</label>
<button type="button" onclick="fillQuery(this.id)" id="select_query" style="color:#00E838" class="btn btn-link"><i>&lt;Select&gt;</i></button>
<button type="button" onclick="fillQuery(this.id)" id="update_query" style="color:#00E838" class="btn btn-link"><i>&lt;Update&gt;</i></button>
<button type="button" onclick="fillQuery(this.id)" id="delete_query" style="color:#00E838" class="btn btn-link"><i>&lt;Delete&gt;</i></button>
<input class="form-control" id="query">
</div>
<button id="selected-db-download" type="button" onclick="downloadDb()"
Expand Down