mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Clean up the unwanted extended versions of Backform Switch controls.
The Bootstrap Switch Control was extended only for alignment in most places. IIntroduce a configurable option to set the necessary class on the main div and also remove the extra extended controls.
This commit is contained in:
committed by
Dave Page
parent
3fae181c27
commit
4a75053514
@@ -17,25 +17,6 @@ define('pgadmin.node.trigger', [
|
||||
gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, alertify,
|
||||
SchemaChildTreeNode
|
||||
) {
|
||||
Backform.CustomSwitchControl = Backform.SwitchControl.extend({
|
||||
defaults: {
|
||||
label: '',
|
||||
options: {
|
||||
onText: gettext('Yes'),
|
||||
offText: gettext('No'),
|
||||
onColor: 'success',
|
||||
offColor: 'primary',
|
||||
size: 'mini',
|
||||
width: null,
|
||||
height: null,
|
||||
},
|
||||
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
|
||||
extraClasses: [],
|
||||
helpMessage: null,
|
||||
},
|
||||
className: 'pgadmin-control-group form-group col-6 row',
|
||||
});
|
||||
|
||||
if (!pgBrowser.Nodes['coll-trigger']) {
|
||||
pgAdmin.Browser.Nodes['coll-trigger'] =
|
||||
@@ -396,7 +377,9 @@ define('pgadmin.node.trigger', [
|
||||
id: 'evnt_insert', label: gettext('INSERT'),
|
||||
type: 'switch', mode: ['create','edit', 'properties'],
|
||||
group: gettext('Events'),
|
||||
control: Backform.CustomSwitchControl,
|
||||
extraToggleClasses: 'pg-el-sm-6',
|
||||
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
|
||||
disabled: function(m) {
|
||||
var evn_insert = m.get('evnt_insert');
|
||||
if (!_.isUndefined(evn_insert) && m.node_info['server']['server_type'] == 'ppas')
|
||||
@@ -407,7 +390,9 @@ define('pgadmin.node.trigger', [
|
||||
id: 'evnt_update', label: gettext('UPDATE'),
|
||||
type: 'switch', mode: ['create','edit', 'properties'],
|
||||
group: gettext('Events'),
|
||||
control: Backform.CustomSwitchControl,
|
||||
extraToggleClasses: 'pg-el-sm-6',
|
||||
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
|
||||
disabled: function(m) {
|
||||
var evn_update = m.get('evnt_update');
|
||||
if (!_.isUndefined(evn_update) && m.node_info['server']['server_type'] == 'ppas')
|
||||
@@ -418,7 +403,9 @@ define('pgadmin.node.trigger', [
|
||||
id: 'evnt_delete', label: gettext('DELETE'),
|
||||
type: 'switch', mode: ['create','edit', 'properties'],
|
||||
group: gettext('Events'),
|
||||
control: Backform.CustomSwitchControl,
|
||||
extraToggleClasses: 'pg-el-sm-6',
|
||||
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
|
||||
disabled: function(m) {
|
||||
var evn_delete = m.get('evnt_delete');
|
||||
if (!_.isUndefined(evn_delete) && m.node_info['server']['server_type'] == 'ppas')
|
||||
@@ -428,7 +415,9 @@ define('pgadmin.node.trigger', [
|
||||
},{
|
||||
id: 'evnt_truncate', label: gettext('TRUNCATE'),
|
||||
type: 'switch', group: gettext('Events'),
|
||||
control: Backform.CustomSwitchControl,
|
||||
extraToggleClasses: 'pg-el-sm-6',
|
||||
controlLabelClassName: 'control-label pg-el-sm-5 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-7 pg-el-12',
|
||||
disabled: function(m) {
|
||||
var is_constraint_trigger = m.get('is_constraint_trigger'),
|
||||
is_row_trigger = m.get('is_row_trigger'),
|
||||
|
||||
@@ -137,7 +137,8 @@ define('pgadmin.node.pga_jobstep', [
|
||||
id: 'jstname', label: gettext('Name'), type: 'text',
|
||||
disabled: false, cellHeaderClasses: 'width_percent_60',
|
||||
},{
|
||||
id: 'jstenabled', label: gettext('Enabled?'), type: 'switch',
|
||||
id: 'jstenabled', label: gettext('Enabled?'),
|
||||
type: 'switch',
|
||||
disabled: function() { return false; },
|
||||
},{
|
||||
id: 'jstkind', label: gettext('Kind'), type: 'switch',
|
||||
|
||||
@@ -70,32 +70,6 @@ define('pgadmin.node.role', [
|
||||
},
|
||||
});
|
||||
|
||||
var switchOptions = {
|
||||
'onText': gettext('Yes'), 'offText': gettext('No'),
|
||||
'size': 'mini', onColor: 'success',
|
||||
offColor: 'primary',
|
||||
};
|
||||
|
||||
var RoleCustomSwitchControl = Backform.SwitchControl.extend({
|
||||
defaults: {
|
||||
label: '',
|
||||
options: {
|
||||
onText: gettext('Yes'),
|
||||
offText: gettext('No'),
|
||||
onColor: 'success',
|
||||
offColor: 'primary',
|
||||
size: 'mini',
|
||||
width: null,
|
||||
height: null,
|
||||
},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
extraClasses: [],
|
||||
helpMessage: null,
|
||||
},
|
||||
className: 'pgadmin-control-group form-group pg-el-12 row',
|
||||
});
|
||||
|
||||
var RoleMembersControl = Backform.Control.extend({
|
||||
defaults: _.defaults(
|
||||
{extraClasses: ['col-12 col-sm-12 col-md-12']},
|
||||
@@ -439,13 +413,21 @@ define('pgadmin.node.role', [
|
||||
label: gettext('Connection limit'), cell: 'integer', min : -1,
|
||||
mode: ['properties', 'edit', 'create'], disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolcanlogin', label: gettext('Can login?'), type: 'switch',
|
||||
group: gettext('Privileges'), options: switchOptions,
|
||||
disabled: 'readonly', control: RoleCustomSwitchControl,
|
||||
id: 'rolcanlogin', label: gettext('Can login?'),
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
group: gettext('Privileges'),
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolsuper', label: gettext('Superuser'), type: 'switch',
|
||||
group: gettext('Privileges'), options: switchOptions,
|
||||
control: RoleCustomSwitchControl.extend({
|
||||
id: 'rolsuper', label: gettext('Superuser'),
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
group: gettext('Privileges'),
|
||||
control: Backform.SwitchControl.extend({
|
||||
onChange: function() {
|
||||
Backform.SwitchControl.prototype.onChange.apply(this, arguments);
|
||||
|
||||
@@ -457,35 +439,51 @@ define('pgadmin.node.role', [
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolcreaterole', label: gettext('Create roles?'),
|
||||
group: gettext('Privileges'), type: 'switch',
|
||||
options: switchOptions, disabled: 'readonly',
|
||||
control: RoleCustomSwitchControl,
|
||||
group: gettext('Privileges'),
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'description', label: gettext('Comments'), type: 'multiline',
|
||||
group: null, mode: ['properties', 'edit', 'create'],
|
||||
options: switchOptions, disabled: 'readonly',
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolcreatedb', label: gettext('Create databases?'),
|
||||
group: gettext('Privileges'), type: 'switch',
|
||||
options: switchOptions, disabled: 'readonly',
|
||||
control: RoleCustomSwitchControl,
|
||||
group: gettext('Privileges'),
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolcatupdate', label: gettext('Update catalog?'),
|
||||
type: 'switch', max_version: 90400, options: switchOptions,
|
||||
control: RoleCustomSwitchControl,
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
max_version: 90400,
|
||||
group: gettext('Privileges'), disabled: function(m) {
|
||||
return (m.get('read_only') || (!m.get('rolsuper')));
|
||||
},
|
||||
},{
|
||||
id: 'rolinherit', group: gettext('Privileges'),
|
||||
label: gettext('Inherit rights from the parent roles?'),
|
||||
type: 'switch', options: switchOptions, disabled: 'readonly',
|
||||
control: RoleCustomSwitchControl,
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolreplication', group: gettext('Privileges'),
|
||||
label: gettext('Can initiate streaming replication and backups?'),
|
||||
type: 'switch', min_version: 90100, options: switchOptions,
|
||||
disabled: 'readonly', control: RoleCustomSwitchControl,
|
||||
type: 'switch',
|
||||
options: {'onText': gettext('Yes'), 'offText': gettext('No')},
|
||||
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
|
||||
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
|
||||
min_version: 90100,
|
||||
disabled: 'readonly',
|
||||
},{
|
||||
id: 'rolmembership', label: gettext('Roles'),
|
||||
group: gettext('Membership'), type: 'collection',
|
||||
|
||||
Reference in New Issue
Block a user