From 341c3aded6edc771dc9f43ba31fc67874146118f Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Fri, 3 Jul 2020 11:47:40 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20dark=20theme-related=20CSS=20and=20modi?= =?UTF-8?q?fy=20the=20color=20codes.=20Fixes=20#5287=20Fixed=20backgrid=20?= =?UTF-8?q?row=20hover=20issue=C2=A0where=20on=20hover=20background=20colo?= =?UTF-8?q?r=20is=20set=20for=20edit=20and=20delete=20cell=20only.=20Fixes?= =?UTF-8?q?=20#5470?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en_US/release_notes_4_24.rst | 2 ++ .../schemas/tables/columns/static/js/column.js | 12 ++---------- .../databases/schemas/types/static/js/type.js | 13 +++---------- web/pgadmin/dashboard/static/js/dashboard.js | 5 +++++ .../static/js/alertify.pgadmin.defaults.js | 6 +++--- web/pgadmin/static/scss/_alert.scss | 16 ++++++++++------ .../static/scss/_alertify.overrides.scss | 15 +++++++++------ .../static/scss/_backgrid.overrides.scss | 18 +++++++++++++----- .../static/scss/_bootstrap.overrides.scss | 7 ------- web/pgadmin/static/scss/pgadmin.scss | 5 +++++ .../static/scss/resources/_default.style.scss | 8 -------- .../scss/resources/_default.variables.scss | 9 ++++++++- .../resources/_theme.variables.scss.sample | 8 +++++++- .../scss/resources/dark/_theme.variables.scss | 11 ++++++++++- web/pgadmin/static/vendor/backgrid/backgrid.js | 9 ++++++++- .../static/js/search_objects_dialog_wrapper.js | 4 ++-- .../static/js/user_management.js | 1 + 17 files changed, 88 insertions(+), 61 deletions(-) diff --git a/docs/en_US/release_notes_4_24.rst b/docs/en_US/release_notes_4_24.rst index 19581cdf8..834108d0b 100644 --- a/docs/en_US/release_notes_4_24.rst +++ b/docs/en_US/release_notes_4_24.rst @@ -22,6 +22,8 @@ Bug fixes | `Issue #3851 `_ - Add proper indentation to the code while generating functions, procedures, and trigger functions. | `Issue #4235 `_ - Fixed tab indent issue on a selection of lines is deleting the content when 'use spaces == true' in the preferences. +| `Issue #5287 `_ - Fixed dark theme-related CSS and modify the color codes. +| `Issue #5470 `_ - Fixed backgrid row hover issue where on hover background color is set for edit and delete cell only. | `Issue #5530 `_ - Ensure that the referenced table should be displayed on foreign key constraints. | `Issue #5621 `_ - Remove extra brackets from reverse engineering SQL of RLS Policy. | `Issue #5629 `_ - Fixed an issue where the user is able to edit properties when some of the collection nodes are selected. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js index a987a46bd..698a63939 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js @@ -71,16 +71,8 @@ define('pgadmin.node.column', [ Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments); }, dependentChanged: function () { - this.$el.empty(); - var model = this.model, - column = this.column, - editable = this.column.get('editable'), - is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable; - - if (is_editable){ this.$el.addClass('editable'); } - else { this.$el.removeClass('editable'); } - - this.delegateEvents(); + this.model.set(this.column.get('name'), null); + this.render(); return this; }, render: function() { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js index 4c252ae05..8cb83f31a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type.js @@ -36,16 +36,8 @@ define('pgadmin.node.type', [ Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments); }, dependentChanged: function () { - this.$el.empty(); - var model = this.model; - var column = this.column; - var editable = this.column.get('editable'); - - var is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable; - if (is_editable){ this.$el.addClass('editable'); } - else { this.$el.removeClass('editable'); } - - this.delegateEvents(); + this.model.set(this.column.get('name'), null); + this.render(); return this; }, remove: Backgrid.Extension.DependentCell.prototype.remove, @@ -269,6 +261,7 @@ define('pgadmin.node.type', [ collection_type: 'coll-type', hasSQL: true, hasDepends: true, + width: pgBrowser.stdW.md + 'px', Init: function() { /* Avoid multiple registration of menus */ if (this.initialized) diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js index 275c36e1a..bb2503feb 100644 --- a/web/pgadmin/dashboard/static/js/dashboard.js +++ b/web/pgadmin/dashboard/static/js/dashboard.js @@ -801,6 +801,7 @@ define('pgadmin.dashboard', [ reflectPreferences: function() { var self = this; + var tickColor = getComputedStyle(document.documentElement).getPropertyValue('--border-color'); /* We will use old preferences for selective graph updates on preference change */ if(self.preferences) { @@ -829,6 +830,10 @@ define('pgadmin.dashboard', [ yaxis: { autoscale: 1, }, + grid: { + color: 'transparent', + tickColor: tickColor, + }, }; if(self.preferences.graph_data_points) { diff --git a/web/pgadmin/static/js/alertify.pgadmin.defaults.js b/web/pgadmin/static/js/alertify.pgadmin.defaults.js index 4b9338e84..8b0f8acd6 100644 --- a/web/pgadmin/static/js/alertify.pgadmin.defaults.js +++ b/web/pgadmin/static/js/alertify.pgadmin.defaults.js @@ -440,7 +440,7 @@ define([ var alertMessage = `
- +
${message}
`; @@ -450,7 +450,7 @@ define([ var alertMessage = `
- +
${message}
`; @@ -460,7 +460,7 @@ define([ var alertMessage = `
- +
${message}
`; diff --git a/web/pgadmin/static/scss/_alert.scss b/web/pgadmin/static/scss/_alert.scss index 0e7e234d1..bcbb5762e 100644 --- a/web/pgadmin/static/scss/_alert.scss +++ b/web/pgadmin/static/scss/_alert.scss @@ -44,6 +44,7 @@ align-self: center; // To make sure IE picks up the correct font font-family: $font-family-primary; + color: $color-fg; } .alert-info { @@ -114,20 +115,23 @@ .error-in-footer { border-radius: $border-radius; - border: 1px solid $color-danger-light; - background: $color-danger-lighter; + background: $alert-danger-bg; + border: $border-width solid $alert-danger-color; + color: $alert-danger-color; } .success-in-footer { border-radius: $border-radius; - border: 1px solid $color-success-light; - background: $color-success-light; + background: $alert-success-bg; + border: $border-width solid $alert-success-color; + color: $alert-success-color; } .info-in-footer { border-radius: $border-radius; - border: 1px solid $color-primary; - background: $color-primary-light; + background: $alert-primary-bg; + border: $border-width solid $alert-primary-color; + color: $alert-primary-color; .fa { font-size: 1rem; diff --git a/web/pgadmin/static/scss/_alertify.overrides.scss b/web/pgadmin/static/scss/_alertify.overrides.scss index abbe4646a..74cbabb51 100644 --- a/web/pgadmin/static/scss/_alertify.overrides.scss +++ b/web/pgadmin/static/scss/_alertify.overrides.scss @@ -214,20 +214,23 @@ } .ajs-message.ajs-error.ajs-visible { - background: $color-danger-lighter; - border: $border-width solid $color-danger; + background: $alert-danger-bg; + border: $border-width solid $alert-danger-color; + color: $alert-danger-color; @extend .ajs-text-smoothing; } .ajs-message.ajs-success.ajs-visible { - background: $color-success-light; - border: $border-width solid $color-success; + background: $alert-success-bg; + border: $border-width solid $alert-success-color; + color: $alert-success-color; @extend .ajs-text-smoothing; } .ajs-message.ajs-visible { - background: $color-primary-light; - border: $border-width solid $color-primary; + background: $alert-primary-bg; + border: $border-width solid $alert-primary-color; + color: $alert-primary-color; @extend .ajs-text-smoothing; } diff --git a/web/pgadmin/static/scss/_backgrid.overrides.scss b/web/pgadmin/static/scss/_backgrid.overrides.scss index 6b7eada28..48c2f07c1 100644 --- a/web/pgadmin/static/scss/_backgrid.overrides.scss +++ b/web/pgadmin/static/scss/_backgrid.overrides.scss @@ -5,6 +5,13 @@ .backgrid td { font-weight: normal!important; + &.editable { + & .display-text { + overflow: hidden; + text-overflow: ellipsis; + @extend .form-control; + } + } } .backgrid.table th.sortable > button { @@ -62,6 +69,12 @@ z-index: 10 !important; } +.backgrid td.editor { + & input[type=text], & input[type=password] { + @extend .form-control; + } +} + .backgrid .string-cell.editor input[type=password] { text-align: left; } @@ -97,7 +110,6 @@ } .backgrid:not(.presentation) td.renderable:not(.editable):not(.delete-cell) { - background-color: $color-gray-lighter; // if transparent border then setting color will help border-bottom-color: $color-gray-lighter; } @@ -106,10 +118,6 @@ background-color: $color-gray-light; } -.backgrid:not(.presentation) td.renderable.editable:not(.delete-cell):not(.edit-cell) { - background-color: $input-bg; -} - .sql-editor-grid-container .backgrid > thead > th.renderable, .sql-editor-grid-container .backgrid > tbody > td.renderable { white-space: pre-wrap; diff --git a/web/pgadmin/static/scss/_bootstrap.overrides.scss b/web/pgadmin/static/scss/_bootstrap.overrides.scss index 025fe5fe3..6db8314d7 100644 --- a/web/pgadmin/static/scss/_bootstrap.overrides.scss +++ b/web/pgadmin/static/scss/_bootstrap.overrides.scss @@ -297,13 +297,6 @@ td.switch-cell > div.toggle { font-weight: bold; } -.navbar-brand:hover { - color: $color-brand !important; -} -.navbar-brand:focus { - color: $color-brand !important; -} - .btn-sm-sq { @extend .btn-sm; line-height: 0.7rem; diff --git a/web/pgadmin/static/scss/pgadmin.scss b/web/pgadmin/static/scss/pgadmin.scss index 1513df430..118554ba8 100644 --- a/web/pgadmin/static/scss/pgadmin.scss +++ b/web/pgadmin/static/scss/pgadmin.scss @@ -5,6 +5,11 @@ $theme-colors: ( "warning": $color-warning, ); +/* Certain variables are required in JS directly */ +:root { + --border-color: #{$border-color}; +} + @import "node_modules/bootstrap/scss/bootstrap"; @import 'webcabin.pgadmin'; diff --git a/web/pgadmin/static/scss/resources/_default.style.scss b/web/pgadmin/static/scss/resources/_default.style.scss index 2d6a40b8e..46030715e 100644 --- a/web/pgadmin/static/scss/resources/_default.style.scss +++ b/web/pgadmin/static/scss/resources/_default.style.scss @@ -10,10 +10,6 @@ &-light{ background-color: $color-primary-light; } - - &-dark{ - background-color: $color-primary-dark; - } } .bg-danger { @@ -69,10 +65,6 @@ &-light { border-color: $color-primary-light; } - - &-dark { - border-color: $color-primary-dark; - } } .border-danger { diff --git a/web/pgadmin/static/scss/resources/_default.variables.scss b/web/pgadmin/static/scss/resources/_default.variables.scss index ad71c7227..670e6ecf2 100644 --- a/web/pgadmin/static/scss/resources/_default.variables.scss +++ b/web/pgadmin/static/scss/resources/_default.variables.scss @@ -11,7 +11,6 @@ $color-primary: #326690 !default; $color-primary-fg: $white !default; $color-primary-light: #d6effc !default; $color-primary-light-fg: $color-primary !default; -$color-primary-dark: #295c85 !default; $color-secondary: $white !default; @@ -65,6 +64,13 @@ $header-bg: $color-bg !default; $tree-font-size: 0.815rem; +$alert-primary-bg: $color-primary-light !default; +$alert-primary-color: $color-primary !default; +$alert-danger-bg: $color-danger-lighter !default; +$alert-danger-color: $color-danger !default; +$alert-success-bg: $color-success-light !default; +$alert-success-color: $color-success !default; + $navbar-bg: $color-primary; $navbar-font-size: 0.925rem; $navbar-height: 32px; @@ -130,6 +136,7 @@ $nav-tabs-link-active-border-color: none; $table-cell-padding: 0.25rem; $table-header-cell-padding: 0.75rem; $table-hover-bg: none; //we will use our own classes +$table-hover-color: #000 !default; $table-active-bg: $color-primary-light; $table-border-width: $border-width; $table-border-color: $border-color; diff --git a/web/pgadmin/static/scss/resources/_theme.variables.scss.sample b/web/pgadmin/static/scss/resources/_theme.variables.scss.sample index e3f37278c..a07c3c178 100644 --- a/web/pgadmin/static/scss/resources/_theme.variables.scss.sample +++ b/web/pgadmin/static/scss/resources/_theme.variables.scss.sample @@ -4,7 +4,6 @@ $color-primary: #326690; $color-primary-fg: $white; $color-primary-light: #d6effc; $color-primary-light-fg: $color-primary; -$color-primary-dark: #295c85; $color-secondary: $white; $color-ternary: #5b6d7c; $color-ternary-fg: $white; @@ -27,9 +26,16 @@ $border-color: #dde0e6; $shadow-base-color: $color-gray-dark; $text-muted: $color-gray-dark; $header-bg: $color-bg; +$alert-primary-bg: $color-primary-light !default; +$alert-primary-color: $color-primary !default; +$alert-danger-bg: $color-danger-lighter !default; +$alert-danger-color: $color-danger !default; +$alert-success-bg: $color-success-light !default; +$alert-success-color: $color-success !default; $negative-bg: $color-gray-light; $popover-bg: $color-gray-dark; $popover-body-color: $white; +$table-hover-color: #000; $input-bg: $white; $input-color: $color-fg; $input-border-color: $border-color; diff --git a/web/pgadmin/static/scss/resources/dark/_theme.variables.scss b/web/pgadmin/static/scss/resources/dark/_theme.variables.scss index 21d5b4a14..8a9fb7aa9 100644 --- a/web/pgadmin/static/scss/resources/dark/_theme.variables.scss +++ b/web/pgadmin/static/scss/resources/dark/_theme.variables.scss @@ -8,7 +8,6 @@ $color-primary: #234d6e; $color-primary-fg: $color-fg; $color-primary-light: #323E43; $color-primary-light-fg: $color-primary-fg; -$color-primary-dark: #15354f; $color-secondary: #6b6b6b; @@ -36,6 +35,9 @@ $border-color: #4a4a4a; $shadow-base-color: #111111; $text-muted: #8A8A8A; + +$table-hover-color: #fff; + $input-bg: $color-bg; $input-color: $color-fg; $input-border-color: #6b6b6b; @@ -48,6 +50,13 @@ $active-color: $color-fg; $header-bg: $color-gray-lighter; +$alert-primary-bg: $color-bg; +$alert-primary-color: #50B0F0; +$alert-danger-bg: $color-bg; +$alert-danger-color: $color-danger; +$alert-success-bg: $color-bg; +$alert-success-color: $color-success; + $table-bg: $color-gray-lighter; $color-editor-fg: #7dc9f1; diff --git a/web/pgadmin/static/vendor/backgrid/backgrid.js b/web/pgadmin/static/vendor/backgrid/backgrid.js index 5075e0735..bb9806347 100644 --- a/web/pgadmin/static/vendor/backgrid/backgrid.js +++ b/web/pgadmin/static/vendor/backgrid/backgrid.js @@ -889,7 +889,8 @@ var Cell = Backgrid.Cell = Backbone.View.extend({ $el.empty(); var model = this.model; var columnName = this.column.get("name"); - $el.text(this.formatter.fromRaw(model.get(columnName), model)); + var value = this.formatter.fromRaw(model.get(columnName), model); + $el.append($(`${value}`)); $el.addClass(columnName); this.updateStateClassesMaybe(); this.delegateEvents(); @@ -932,9 +933,15 @@ var Cell = Backgrid.Cell = Backbone.View.extend({ // Need to redundantly undelegate events for Firefox this.undelegateEvents(); + var dispText = this.$el.find('.display-text'); + var width = '100%'; + if(dispText.length === 1) { + width = dispText.width(); + } this.$el.empty(); this.$el.append(this.currentEditor.$el); this.currentEditor.render(); + this.currentEditor.$el.css('min-width',width); this.$el.addClass("editor"); model.trigger("backgrid:editing", model, column, this, this.currentEditor); diff --git a/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js b/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js index 925376e68..8f052a86a 100644 --- a/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js +++ b/web/pgadmin/tools/search_objects/static/js/search_objects_dialog_wrapper.js @@ -29,7 +29,7 @@ export default class SearchObjectsDialogWrapper extends DialogWrapper {