Allow the dashboard panel to be closed. Fixes #2506

This commit is contained in:
Khushboo Vashi
2017-06-30 10:11:34 +01:00
committed by Dave Page
parent 2d65312910
commit 501120701e
8 changed files with 73 additions and 21 deletions

View File

@@ -58,9 +58,11 @@ class DashboardModule(PgAdminModule):
title=gettext('Dashboard'),
icon='fa fa-tachometer',
content='',
isCloseable=False,
isPrivate=True,
isIframe=False)
isCloseable=True,
isPrivate=False,
limit=1,
isIframe=False,
canHide=True)
]
def register_preferences(self):

View File

@@ -11,6 +11,8 @@ function(r, $, pgAdmin, _, Backbone, gettext) {
if (pgAdmin.Dashboard)
return;
var dashboardVisible = true;
pgAdmin.Dashboard = {
init: function() {
if (this.initialized)
@@ -55,7 +57,7 @@ function(r, $, pgAdmin, _, Backbone, gettext) {
// Handle treeview clicks
object_selected: function(item, itemData, node) {
if (itemData && itemData._type) {
if (itemData && itemData._type && dashboardVisible) {
var treeHierarchy = node.getTreeNodeHierarchy(item),
url = '{{ url_for('dashboard.index') }}',
sid = -1, did = -1, b = pgAdmin.Browser,
@@ -124,6 +126,9 @@ function(r, $, pgAdmin, _, Backbone, gettext) {
// { data: [[0, y0], [1, y1]...], label: 'Label 3', [options] }
// ]
if (!dashboardVisible)
return;
y = 0;
if (dataset.length == 0) {
if (counter == true)
@@ -862,6 +867,9 @@ function(r, $, pgAdmin, _, Backbone, gettext) {
}
});
},
toggleVisibility: function(flag) {
dashboardVisible = flag;
}
};