Allow connections to be coloured in the treeview and query tool. Fixes #1383. Fixes #2802

This commit is contained in:
Murtuza Zabuawala
2017-11-21 16:28:01 +00:00
committed by Dave Page
parent 9212699936
commit b284572afe
19 changed files with 365 additions and 30 deletions

View File

@@ -26,7 +26,7 @@ from pgadmin.utils.ajax import make_json_response, bad_request, \
from config import PG_DEFAULT_DRIVER
from pgadmin.utils.preferences import Preferences
from pgadmin.model import Server
class DataGridModule(PgAdminModule):
"""
@@ -216,6 +216,23 @@ def panel(trans_id, is_query_tool, editor_title):
else:
new_browser_tab = 'false'
# Fetch the server details
#
bgcolor = None
fgcolor = None
if str(trans_id) in session['gridData']:
# Fetch the object for the specified transaction id.
# Use pickle.loads function to get the command object
session_obj = session['gridData'][str(trans_id)]
trans_obj = pickle.loads(session_obj['command_obj'])
s = Server.query.filter_by(id=trans_obj.sid).first()
if s and s.bgcolor:
# If background is set to white means we do not have to change the
# title background else change it as per user specified background
if s.bgcolor != '#ffffff':
bgcolor = s.bgcolor
fgcolor = s.fgcolor or 'black'
return render_template(
"datagrid/index.html", _=gettext, uniqueId=trans_id,
is_query_tool=is_query_tool,
@@ -224,7 +241,9 @@ def panel(trans_id, is_query_tool, editor_title):
is_linux=is_linux_platform,
is_new_browser_tab=new_browser_tab,
server_type=server_type,
client_platform=user_agent.platform
client_platform=user_agent.platform,
bgcolor=bgcolor,
fgcolor=fgcolor
)

View File

@@ -284,7 +284,7 @@
</button>
</div>
</div>
<div class="editor-title"></div>
<div class="editor-title" style="background-color: {% if fgcolor %}{{ bgcolor or '#FFFFFF' }}{% else %}{{ bgcolor or '#2C76B4' }}{% endif %}; color: {{ fgcolor or 'white' }};"></div>
<div id="filter" class="filter-container hidden">
<div class="filter-title">Filter</div>
<div class="sql-textarea">

View File

@@ -34,9 +34,7 @@
}
.editor-title {
background-color: #2C76B4;
padding: 4px 5px;
color: white;
font-size: 13px;
}