Add context menu to display database tables stats (#639)
* Add context menu to display database tables stats * Move table stats implementation into client
This commit is contained in:
@@ -310,6 +310,7 @@
|
||||
</div>
|
||||
<div id="current_database_context_menu">
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#" data-action="show_tables_stats">Show Tables Stats</a></li>
|
||||
<li><a href="#" data-action="export">Export SQL dump</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -99,6 +99,7 @@ function getTableRows(table, opts, cb) { apiCall("get", "/tables/" + table
|
||||
function getTableStructure(table, opts, cb) { apiCall("get", "/tables/" + table, opts, cb); }
|
||||
function getTableIndexes(table, cb) { apiCall("get", "/tables/" + table + "/indexes", {}, cb); }
|
||||
function getTableConstraints(table, cb) { apiCall("get", "/tables/" + table + "/constraints", {}, cb); }
|
||||
function getTablesStats(cb) { apiCall("get", "/tables_stats", {}, cb); }
|
||||
function getFunction(id, cb) { apiCall("get", "/functions/" + id, {}, cb); }
|
||||
function getHistory(cb) { apiCall("get", "/history", {}, cb); }
|
||||
function getBookmarks(cb) { apiCall("get", "/bookmarks", {}, cb); }
|
||||
@@ -619,6 +620,17 @@ function showPaginatedTableContent() {
|
||||
showTableContent(sortColumn, sortOrder);
|
||||
}
|
||||
|
||||
function showTablesStats() {
|
||||
getTablesStats(function(data) {
|
||||
buildTable(data);
|
||||
|
||||
setCurrentTab("table_structure");
|
||||
$("#input").hide();
|
||||
$("#body").prop("class", "full");
|
||||
$("#results").addClass("no-crop");
|
||||
});
|
||||
}
|
||||
|
||||
function showTableStructure() {
|
||||
var name = getCurrentObject().name;
|
||||
|
||||
@@ -1193,6 +1205,9 @@ function bindCurrentDatabaseMenu() {
|
||||
var menuItem = $(e.target);
|
||||
|
||||
switch(menuItem.data("action")) {
|
||||
case "show_tables_stats":
|
||||
showTablesStats();
|
||||
break;
|
||||
case "export":
|
||||
openInNewWindow("api/export");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user