Schema Diff Improvements:

1. Grid header should be center aligned vertically.
2. Increase the space between object counts.
3. The previous selected objects should not be re-selected on comparison.
This commit is contained in:
Khushboo Vashi 2020-01-13 18:19:07 +05:30 committed by Akshay Joshi
parent 9dccd20bb3
commit d59816054f
3 changed files with 23 additions and 8 deletions

View File

@ -52,6 +52,7 @@
.slick-header-column.ui-state-default {
height: 32px !important;
line-height: 25px !important;
}
#schema-diff-grid .grid-header label {
@ -187,3 +188,7 @@
flex-wrap: wrap;
max-width: 40% !important;
}
.slick-cell .ml-2 {
margin-left: 2rem !important;
}

View File

@ -318,7 +318,7 @@ export default class SchemaDiffUI {
// Format Schema object title with appropriate icon
var formatColumnTitle = function (row, cell, value, columnDef, dataContext) {
let icon = 'icon-' + dataContext.type;
return '<i class="ml-5 wcTabIcon '+ icon +'"></i><span>' + value + '</span>';
return '<i class="ml-2 wcTabIcon '+ icon +'"></i><span>' + value + '</span>';
};
// Grid Columns
@ -349,7 +349,14 @@ export default class SchemaDiffUI {
getter: 'type',
formatter: function (g) {
let icon = 'icon-coll-' + g.value;
return '<i class="wcTabIcon '+ icon +'"></i><span>' + g.rows[0].label + '</span>';
let identical=0, different=0, source_only=0, target_only=0;
for (var i = 0; i < g.rows.length; i++) {
if (g.rows[i]['status'] == self.filters[0]) identical++;
else if (g.rows[i]['status'] == self.filters[1]) different++;
else if (g.rows[i]['status'] == self.filters[2]) source_only++;
else if (g.rows[i]['status'] == self.filters[3]) target_only++;
}
return '<i class="wcTabIcon '+ icon +'"></i><span>' + g.rows[0].label + ' - ' + gettext('Identical') + ': <strong>' + identical + '</strong>&nbsp;&nbsp;' + gettext('Different') + ': <strong>' + different + '</strong>&nbsp;&nbsp;' + gettext('Source Only') + ': <strong>' + source_only + '</strong>&nbsp;&nbsp;' + gettext('Target Only') + ': <strong>' + target_only + '</strong></span>';
},
aggregateCollapsed: true,
lazyTotalsCalculation: true,
@ -406,6 +413,8 @@ export default class SchemaDiffUI {
grid.setSelectionModel(new Slick.RowSelectionModel({selectActiveRow: false}));
grid.registerPlugin(checkboxSelector);
self.dataView.syncGridSelection(grid, true, true);
grid.onClick.subscribe(function(e, args) {
if (args.row) {
data = args.grid.getData().getItem(args.row);
@ -431,11 +440,13 @@ export default class SchemaDiffUI {
render_grid_data(data) {
var self = this;
self.grid.setSelectedRows([]);
self.dataView.beginUpdate();
self.dataView.setItems(data);
self.dataView.setFilter(self.filter.bind(self));
self.groupBySchemaObject();
self.dataView.endUpdate();
self.dataView.refresh();
self.resize_grid();
}

View File

@ -35,13 +35,12 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
column_types[col['name']] = col_type
if not is_query_tool:
if key in rset['rows']:
col_type['not_null'] = col['not_null'] = \
rset['rows'][key]['not_null']
col_type['not_null'] = col['not_null'] = \
rset['rows'][key]['not_null']
col_type['has_default_val'] = \
col['has_default_val'] = \
rset['rows'][key]['has_default_val']
col_type['has_default_val'] = \
col['has_default_val'] = \
rset['rows'][key]['has_default_val']
else:
for row in rset['rows']: