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 #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 #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 #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 #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 #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() {}
SelectAll.prototype.render = function(decorated) {
var self = this,
$rendered = decorated.call(this),
$selectAll = $([
'<button class="btn btn-xs btn-default" type="button"',
' style="width: 49%;margin: 0 0.5%;">',
'<i class="fa fa-check-square-o"></i>',
'<span style="padding: 0px 5px;">',
gettext('Select All'),
'</span></button>',
].join('')),
$unselectAll = $([
'<button class="btn btn-xs btn-default" type="button"',
' style="width: 49%;margin: 0 0.5%;">',
'<i class="fa fa-square-o"></i><span style="padding: 0px 5px;">',
gettext('Unselect All'),
'</span></button>',
].join('')),
$btnContainer = $(
'<div style="padding: 3px 0px; background-color: #2C76B4; margin-bottom: 3px;">'
).append($selectAll).append($unselectAll);
let self = this;
let $rendered = decorated.call(this);
let $selectAll = $([
'<button class="btn btn-xs btn-default" type="button"',
' style="width: 49%;margin: 0 0.5%;">',
'<i class="fa fa-check-square-o"></i>',
'<span style="padding: 0px 5px;">',
gettext('Select All'),
'</span></button>',
].join(''));
let $unselectAll = $([
'<button class="btn btn-xs btn-default" type="button"',
' style="width: 49%;margin: 0 0.5%;">',
'<i class="fa fa-square-o"></i><span style="padding: 0px 5px;">',
gettext('Unselect All'),
'</span></button>',
].join(''));
let $btnContainer = $(
'<div style="padding: 3px 0px; background-color: #2C76B4; margin-bottom: 3px;">'
).append($selectAll).append($unselectAll);
if (!this.$element.prop('multiple')) {
// this isn't a multi-select -> don't add the buttons!
return $rendered;
}
$rendered.find('.select2-dropdown').prepend($btnContainer);
// Select All button click
$selectAll.on('click', function() {
$rendered.find('.select2-results__option[aria-selected=false]').each(
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', {
data: $(this).data('data'),
data: data,
});
}
);
self.trigger('close');
});
// Unselect All button click
$unselectAll.on('click', function() {
$rendered.find('.select2-results__option[aria-selected=true]').each(
function() {
let data = Utils.GetData($(this)[0], 'data');
self.trigger('unselect', {
data: $(this).data('data'),
data: data,
});
}
);