Files
pgadmin4/web/pgadmin/static/js/sqleditor/query_tool_notifications.js
Aditya Toshniwal 86ecf9c84e Fixed following:
- Base font size changed from 0.815rem to 0.875rem, for navbar from 0.875rem to 0.925rem.
- Dialog sizes made consistent throughout the application. Now there are 3 size options for width and height each - sm, md, lg. Combination of any of these to be used hereafter
- Alignment fix for controls of Node properties dialogs which includes showing text and label in one line without dialog size change, checkbox alignment, switch control alignment at places and other minor improvements in other dialogs
- Error message design change in dialogs validation
- SQL Editor data grid editor popup design changes which were missed
- Design change for dashboard server activity grid
- Login page language dropdown color fix
- Properties accordion collapse design fix
- Help, Info icon fixed across all dialogs which were not working if clicked exactly on the text
- Added missing icon with buttons at few places
- Shadow behind the dialogs is increased to make it look clearly separated and depth.
- Control Alignment fix in maintenance dialog
- Min height of alertify dialogs set for better UX
- File dialog design fix when no files found
- Grant wizard fixes - Scroll bar visibility on first page, use full space for SQL generated on the last page
- Browser toolbar buttons changed to sync with SQL editor toolbar buttons
- Rounded corners for docker floating dialog (no properties)
- Renaming file in file dialog should show original file name
- SQL data grid text edit popup buttons behaviour was swapped. This is fixed.
- Import/Export dialog changes as per new design.
2019-01-02 15:07:59 +05:30

133 lines
3.6 KiB
JavaScript

import gettext from 'sources/gettext';
import Backgrid from 'pgadmin.backgrid';
import Backbone from 'backbone';
import Alertify from 'pgadmin.alertifyjs';
let NotificationsModel = Backbone.Model.extend({
defaults: {
recorded_time: undefined,
event: undefined,
pid: undefined,
payload: undefined,
},
schema: [{
id: 'recorded_time',
label: gettext('Recorded time'),
cell: 'string',
type: 'text',
editable: false,
cellHeaderClasses: 'width_percent_20',
headerCell: Backgrid.Extension.CustomHeaderCell,
},{
id: 'channel',
label: gettext('Event'),
cell: 'string',
type: 'text',
editable: false,
cellHeaderClasses: 'width_percent_20',
headerCell: Backgrid.Extension.CustomHeaderCell,
},{
id: 'pid',
label: gettext('Process ID'),
cell: 'string',
type: 'text',
editable: false,
cellHeaderClasses: 'width_percent_20',
headerCell: Backgrid.Extension.CustomHeaderCell,
},{
id: 'payload',
label: gettext('Payload'),
cell: 'string',
type: 'text',
editable: false,
cellHeaderClasses: 'width_percent_40',
headerCell: Backgrid.Extension.CustomHeaderCell,
}],
});
let NotificationCollection = Backbone.Collection.extend({
model: NotificationsModel,
});
let queryToolNotifications = {
collection: null,
/* This function is responsible to create and render the
* new backgrid for the notification tab.
*/
renderNotificationsGrid: function(notifications_panel) {
if (!queryToolNotifications.collection)
queryToolNotifications.collection = new NotificationCollection();
let gridCols = [{
name: 'recorded_time',
label: gettext('Recorded time'),
type: 'text',
editable: false,
cell: 'string',
}, {
name: 'channel',
label: gettext('Event'),
type: 'text',
editable: false,
cell: 'string',
}, {
name: 'pid',
label: gettext('Process ID'),
type: 'text',
editable: false,
cell: 'string',
}, {
name: 'payload',
label: gettext('Payload'),
type: 'text',
editable: false,
cell: 'string',
}];
// Set up the grid
let notifications_grid = new Backgrid.Grid({
emptyText: 'No data found',
columns: gridCols,
collection: queryToolNotifications.collection,
className: 'backgrid presentation table table-bordered table-hover table-noouter-border table-bottom-border',
});
// Render the grid
if (notifications_grid)
notifications_panel.$container.find('.sql-editor-notifications').append(notifications_grid.render().el);
},
// This function is used to raise notify messages and update the
// notification grid.
updateNotifications: function(notify_messages) {
if (notify_messages != null && notify_messages.length > 0) {
for (let i in notify_messages) {
let notify_msg = '';
if (notify_messages[i].payload != '') {
notify_msg = gettext('Asynchronous notification "')
+ notify_messages[i].channel
+ gettext('" with payload "')
+ notify_messages[i].payload
+ gettext('" received from server process with PID ')
+ notify_messages[i].pid;
}
else {
notify_msg = gettext('Asynchronous notification "')
+ notify_messages[i].channel
+ gettext('" received from server process with PID ')
+ notify_messages[i].pid;
}
Alertify.info(notify_msg);
}
// Add notify messages to the collection.
queryToolNotifications.collection.add(notify_messages);
}
},
};
module.exports = queryToolNotifications;