Files
pgadmin4/web/pgadmin/tools/backup/static/js/backup_dialog.js

105 lines
2.8 KiB
JavaScript
Raw Normal View History

/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
2020-01-02 14:43:50 +00:00
// Copyright (C) 2013 - 2020, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import gettext from '../../../../static/js/gettext';
import Backform from '../../../../static/js/backform.pgadmin';
import {Dialog} from '../../../../static/js/alertify/dialog';
import url_for from 'sources/url_for';
import axios from 'axios/index';
export class BackupDialog extends Dialog {
constructor(pgBrowser, $, alertify, BackupModel, backform = Backform) {
super('Backup Error',
'<div class=\'backup_dialog\'></div>',
pgBrowser, $, alertify, BackupModel, backform
);
}
url_for_utility_exists(id, params){
return url_for('backup.utility_exists', {
'sid': id,
'backup_obj_type': params == null ? 'objects' : 'servers',
});
}
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:05:15 +05:30
draw(action, aciTreeItem, params, width=0, height=0) {
const serverInformation = this.retrieveAncestorOfTypeServer(aciTreeItem);
if (!serverInformation) {
return;
}
if (!this.hasBinariesConfiguration(serverInformation)) {
return;
}
var sid = serverInformation._type == 'database' ? serverInformation._pid : serverInformation._id;
const baseUrl = this.url_for_utility_exists(sid, params);
// Check pg_dump or pg_dumpall utility exists or not.
let that = this;
axios.get(
baseUrl
).then(function(res) {
if (!res.data.success) {
that.alertify.alert(
gettext('Utility not found'),
res.data.errormsg
);
return;
}
const typeOfDialog = BackupDialog.typeOfDialog(params);
if (!that.canExecuteOnCurrentDatabase(aciTreeItem)) {
return;
}
const dialog = that.createOrGetDialog(
BackupDialog.dialogTitle(typeOfDialog),
typeOfDialog
);
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:05:15 +05:30
dialog(true).resizeTo(width, height);
}).catch(function() {
that.alertify.alert(
gettext('Utility not found'),
gettext('Failed to fetch Utility information')
);
return;
});
}
static typeOfDialog(params) {
if (params === null) {
return 'backup_objects';
}
let typeOfDialog = 'server';
if (!_.isUndefined(params['globals']) && params['globals']) {
typeOfDialog = 'globals';
}
return typeOfDialog;
}
static dialogTitle(typeOfDialog) {
if (typeOfDialog === 'backup_objects') {
return null;
}
return ((typeOfDialog === 'globals') ?
gettext('Backup Globals...') :
gettext('Backup Server...'));
}
dialogName(typeOfDialog) {
if (typeOfDialog === 'backup_objects') {
return typeOfDialog;
}
return 'BackupDialog_' + typeOfDialog;
}
}