Export database or table to sql

This commit is contained in:
Dan Sosedoff
2017-09-16 20:32:41 -05:00
parent 003a661c08
commit e771d6f49e
6 changed files with 106 additions and 8 deletions

View File

@@ -219,6 +219,11 @@ function performTableAction(table, action, el) {
var win = window.open(url, "_blank");
win.focus();
break;
case "dump":
var url = window.location.href.split("#")[0] + "api/export?table=" + table + "&_session_id=" + getSessionId();
var win = window.open(url, "_blank");
win.focus();
break;
}
}
@@ -809,8 +814,26 @@ function bindTableHeaderMenu() {
});
}
function bindCurrentDatabaseMenu() {
$("#current_database").contextmenu({
target: "#current_database_context_menu",
onItem: function(context, e) {
var menuItem = $(e.target);
switch(menuItem.data("action")) {
case "export":
var url = window.location.href.split("#")[0] + "api/export?_session_id=" + getSessionId();
var win = window.open(url, "_blank");
win.focus();
break;
}
}
});
}
function bindContextMenus() {
bindTableHeaderMenu();
bindCurrentDatabaseMenu();
$(".schema-group ul").each(function(id, el) {
$(el).contextmenu({
@@ -825,7 +848,7 @@ function bindContextMenus() {
});
});
$("#current_database").contextmenu({
$(".tables-list .title").contextmenu({
target: "#databases_context_menu",
onItem: function(context, e) {
var name = $(e.target).text();
@@ -1037,7 +1060,7 @@ $(document).ready(function() {
resp.forEach(function(name) {
$("<li><a href='#'>" + name + "</a></li>").appendTo("#databases_context_menu > ul");
});
$("#current_database").triggerHandler("contextmenu");
$(".tables-list .title").triggerHandler("contextmenu");
});
});