Ensure 'select all' and 'unselect all' working properly for pgAgent schedule. Fixes #3313.

This commit is contained in:
Murtuza Zabuawala 2018-08-22 15:13:40 +05:30 committed by Akshay Joshi
parent 0ab1305ddf
commit 0f17b4f738
2 changed files with 33 additions and 23 deletions

View File

@ -17,11 +17,12 @@ Bug fixes
********* *********
| `Bug #3136 <https://redmine.postgresql.org/issues/3136>`_ - Stabilise feature tests for continuous running on CI systems. | `Bug #3136 <https://redmine.postgresql.org/issues/3136>`_ - Stabilise feature tests for continuous running on CI systems.
| `Bug #3313 <https://redmine.postgresql.org/issues/3313>`_ - Ensure 'select all' and 'unselect all' working properly for pgAgent schedule.
| `Bug #3325 <https://redmine.postgresql.org/issues/3325>`_ - Fix sort/filter dialog issue where it incorrectly requires ASC/DESC. | `Bug #3325 <https://redmine.postgresql.org/issues/3325>`_ - Fix sort/filter dialog issue where it incorrectly requires ASC/DESC.
| `Bug #3347 <https://redmine.postgresql.org/issues/3347>`_ - Ensure backup should work with '--data-only' and '--schema-only' for any format. | `Bug #3347 <https://redmine.postgresql.org/issues/3347>`_ - Ensure backup should work with '--data-only' and '--schema-only' for any format.
| `Bug #3407 <https://redmine.postgresql.org/issues/3407>`_ - Fix keyboard shortcuts layout in the preferences panel. | `Bug #3407 <https://redmine.postgresql.org/issues/3407>`_ - Fix keyboard shortcuts layout in the preferences panel.
| `Bug #3461 <https://redmine.postgresql.org/issues/3461>`_ - Ensure that refreshing a node also updates the Property list. | `Bug #3461 <https://redmine.postgresql.org/issues/3461>`_ - Ensure that refreshing a node also updates the Property list.
| `Bug #3528 <https://redmine.postgresql.org/issues/3528>`_ - Handle connection errors properly in the query tool. | `Bug #3528 <https://redmine.postgresql.org/issues/3528>`_ - Handle connection errors properly in the query tool.
| `Bug #3547 <https://redmine.postgresql.org/issues/3578>`_ - Make session implementation thread safe | `Bug #3547 <https://redmine.postgresql.org/issues/3547>`_ - Make session implementation thread safe
| `Bug #3558 <https://redmine.postgresql.org/issues/3558>`_ - Fix sort/filter dialog editing issue. | `Bug #3558 <https://redmine.postgresql.org/issues/3558>`_ - Fix sort/filter dialog editing issue.
| `Bug #3578 <https://redmine.postgresql.org/issues/3578>`_ - Ensure sql for Role should be visible in SQL panel for GPDB. | `Bug #3578 <https://redmine.postgresql.org/issues/3578>`_ - Ensure sql for Role should be visible in SQL panel for GPDB.

View File

@ -17,47 +17,56 @@ define([
function SelectAll() {} function SelectAll() {}
SelectAll.prototype.render = function(decorated) { SelectAll.prototype.render = function(decorated) {
var self = this, let self = this;
$rendered = decorated.call(this), let $rendered = decorated.call(this);
$selectAll = $([
'<button class="btn btn-xs btn-default" type="button"', let $selectAll = $([
' style="width: 49%;margin: 0 0.5%;">', '<button class="btn btn-xs btn-default" type="button"',
'<i class="fa fa-check-square-o"></i>', ' style="width: 49%;margin: 0 0.5%;">',
'<span style="padding: 0px 5px;">', '<i class="fa fa-check-square-o"></i>',
gettext('Select All'), '<span style="padding: 0px 5px;">',
'</span></button>', gettext('Select All'),
].join('')), '</span></button>',
$unselectAll = $([ ].join(''));
'<button class="btn btn-xs btn-default" type="button"',
' style="width: 49%;margin: 0 0.5%;">', let $unselectAll = $([
'<i class="fa fa-square-o"></i><span style="padding: 0px 5px;">', '<button class="btn btn-xs btn-default" type="button"',
gettext('Unselect All'), ' style="width: 49%;margin: 0 0.5%;">',
'</span></button>', '<i class="fa fa-square-o"></i><span style="padding: 0px 5px;">',
].join('')), gettext('Unselect All'),
$btnContainer = $( '</span></button>',
'<div style="padding: 3px 0px; background-color: #2C76B4; margin-bottom: 3px;">' ].join(''));
).append($selectAll).append($unselectAll);
let $btnContainer = $(
'<div style="padding: 3px 0px; background-color: #2C76B4; margin-bottom: 3px;">'
).append($selectAll).append($unselectAll);
if (!this.$element.prop('multiple')) { if (!this.$element.prop('multiple')) {
// this isn't a multi-select -> don't add the buttons! // this isn't a multi-select -> don't add the buttons!
return $rendered; return $rendered;
} }
$rendered.find('.select2-dropdown').prepend($btnContainer); $rendered.find('.select2-dropdown').prepend($btnContainer);
// Select All button click
$selectAll.on('click', function() { $selectAll.on('click', function() {
$rendered.find('.select2-results__option[aria-selected=false]').each( $rendered.find('.select2-results__option[aria-selected=false]').each(
function() { function() {
// Note: With latest version we do not get data in the data attribute of a element
// Hence as per new logic we will fetch the data from the cache created by Select2.
let data = Utils.GetData($(this)[0], 'data');
self.trigger('select', { self.trigger('select', {
data: $(this).data('data'), data: data,
}); });
} }
); );
self.trigger('close'); self.trigger('close');
}); });
// Unselect All button click
$unselectAll.on('click', function() { $unselectAll.on('click', function() {
$rendered.find('.select2-results__option[aria-selected=true]').each( $rendered.find('.select2-results__option[aria-selected=true]').each(
function() { function() {
let data = Utils.GetData($(this)[0], 'data');
self.trigger('unselect', { self.trigger('unselect', {
data: $(this).data('data'), data: data,
}); });
} }
); );