public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM-6890]: pgAdmin 4 version 6.0 Background Colors
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM-6890]: pgAdmin 4 version 6.0 Background Colors
@ 2021-10-15 05:53 Nikhil Mohite <[email protected]>
2021-10-16 07:29 ` Re: [pgAdmin][RM-6890]: pgAdmin 4 version 6.0 Background Colors Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Mohite @ 2021-10-15 05:53 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Please find the attached patch for
<https://redmine.postgresql.org/issues/6672>RM-6890:
<https://redmine.postgresql.org/issues/6890; pgAdmin 4 version 6.0
Background Colors
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM-6890.patch (4.1K, 3-RM-6890.patch)
download | inline diff:
diff --git a/web/package.json b/web/package.json
index 11f21aaf..4eb33745 100644
--- a/web/package.json
+++ b/web/package.json
@@ -136,7 +136,7 @@
"path-fx": "^2.0.0",
"pathfinding": "^0.4.18",
"paths-js": "^0.4.9",
- "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#ccf3327caaaeaf06e5e683b07330ba2555d79867",
+ "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#9e1e5efd6152a08ee1cf087816627d943e3c880e",
"postcss": "^8.2.15",
"raf": "^3.4.1",
"react": "^17.0.1",
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index 41139738..bd094dcf 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -954,27 +954,30 @@ define('pgadmin.browser.node', [
change_server_background: function(item, data) {
if (!item || !data)
return;
+ const treeH = pgBrowser.tree.getTreeNodeHierarchy(item);
+ const serverData = treeH['server'];
+ if (!serverData) {
+ return;
+ }
+ const index = item.path.indexOf(serverData.id);
// Go further only if node type is a Server
- if (data._type && data._type == 'server') {
- var element = $(item).find('span.aciTreeItem').first() || null,
- // First element will be icon and second will be colour code
- bgcolor = data.icon.split(' ')[1] || null,
- fgcolor = data.icon.split(' ')[2] || '';
+ if (index !== -1) {
+ // First element will be icon and second will be colour code
+ var bgcolor = serverData.icon.split(' ')[1] || null,
+ fgcolor = serverData.icon.split(' ')[2] || '';
if (bgcolor) {
- // li tag for the current branch
- var first_level_element = (element && element.parents()[3]) || null,
- dynamic_class = 'pga_server_' + data._id + '_bgcolor',
+ var dynamic_class = 'pga_server_' + serverData._id + '_bgcolor',
style_tag;
// Prepare dynamic style tag
style_tag = '<style id=' + dynamic_class + ' type=\'text/css\'> \n';
- style_tag += '.' + dynamic_class + ' .aciTreeItem {';
+ style_tag += '.' + dynamic_class + ' .file-label {';
style_tag += ' border-radius: 3px; margin-bottom: 2px;';
- style_tag += ' background: ' + bgcolor + '} \n';
+ style_tag += ' background: ' + bgcolor + ' !important;} \n';
if (fgcolor) {
- style_tag += '.' + dynamic_class + ' .aciTreeText {';
+ style_tag += '.' + dynamic_class + ' span.file-name {';
style_tag += ' color: ' + fgcolor + ' !important;} \n';
}
style_tag += '</style>';
@@ -982,9 +985,8 @@ define('pgadmin.browser.node', [
// Prepare dynamic style tag using template
$('#' + dynamic_class).remove();
$(style_tag).appendTo('head');
-
- if (first_level_element)
- $(first_level_element).addClass(dynamic_class);
+ // Add dynamic class to the tree node.
+ pgBrowser.tree.addCssClass(item, dynamic_class);
}
}
},
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 175320b3..18c82517 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -229,6 +229,10 @@ export class Tree {
return this.tree.getDOMFromItem(item);
}
+ addCssClass(item, cssClass) {
+ this.tree.addCssClass(item, cssClass);
+ }
+
path(item) {
if (item) return item.path;
}
diff --git a/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss b/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss
index e483852e..0623f693 100644
--- a/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss
+++ b/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss
@@ -125,7 +125,6 @@
white-space:normal;
cursor:pointer !important;
margin-left: 2px;
- width: 100%;
&:hover, &.pseudo-active {
color: $tree-fg-hover !important;
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM-6890]: pgAdmin 4 version 6.0 Background Colors
2021-10-15 05:53 [pgAdmin][RM-6890]: pgAdmin 4 version 6.0 Background Colors Nikhil Mohite <[email protected]>
@ 2021-10-16 07:29 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2021-10-16 07:29 UTC (permalink / raw)
To: Nikhil Mohite <[email protected]>; +Cc: pgadmin-hackers
Thanks, the patch applied.
On Fri, Oct 15, 2021 at 11:23 AM Nikhil Mohite <
[email protected]> wrote:
> Hi Hackers,
>
> Please find the attached patch for
> <https://redmine.postgresql.org/issues/6672>RM-6890:
> <https://redmine.postgresql.org/issues/6890; pgAdmin 4 version 6.0
> Background Colors
>
>
> --
> *Thanks & Regards,*
> *Nikhil Mohite*
> *Software Engineer.*
> *EDB Postgres* <https://www.enterprisedb.com/;
> *Mob.No: +91-7798364578.*
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-10-16 07:29 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 05:53 [pgAdmin][RM-6890]: pgAdmin 4 version 6.0 Background Colors Nikhil Mohite <[email protected]>
2021-10-16 07:29 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox