mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Improve display of role options. Fixes #1729
This commit is contained in:
parent
a3622a380a
commit
c2d9c0bb7c
@ -67,10 +67,25 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) {
|
|||||||
|
|
||||||
var switchOptions = {
|
var switchOptions = {
|
||||||
'onText': 'Yes', 'offText': 'No',
|
'onText': 'Yes', 'offText': 'No',
|
||||||
'onColor': 'warning', 'offColor': 'primary',
|
|
||||||
'size': 'mini'
|
'size': 'mini'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var RoleCustomSwitchControl = Backform.SwitchControl.extend({
|
||||||
|
template: _.template([
|
||||||
|
'<label class="control-label pg-el-sm-9 pg-el-xs-12"><%=label%></label>',
|
||||||
|
'<div class="pgadmin-controls pg-el-sm-3 pg-el-xs-12">',
|
||||||
|
' <div class="checkbox" style="float:right">',
|
||||||
|
' <label>',
|
||||||
|
' <input type="checkbox" class="<%=extraClasses.join(\' \')%>" name="<%=name%>" <%=value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
|
||||||
|
' </label>',
|
||||||
|
' </div>',
|
||||||
|
' <% if (helpMessage && helpMessage.length) { %>',
|
||||||
|
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
|
||||||
|
' <% } %>',
|
||||||
|
'</div>',
|
||||||
|
].join("\n"))
|
||||||
|
});
|
||||||
|
|
||||||
var RoleMembersControl = Backform.Control.extend({
|
var RoleMembersControl = Backform.Control.extend({
|
||||||
defaults: _.defaults(
|
defaults: _.defaults(
|
||||||
{extraClasses: ['col-xs-12 col-sm-12 col-md-12']},
|
{extraClasses: ['col-xs-12 col-sm-12 col-md-12']},
|
||||||
@ -414,11 +429,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) {
|
|||||||
},{
|
},{
|
||||||
id: 'rolcanlogin', label:'{{ _('Can login?') }}', type: 'switch',
|
id: 'rolcanlogin', label:'{{ _('Can login?') }}', type: 'switch',
|
||||||
group: '{{ _('Privileges') }}', options: switchOptions,
|
group: '{{ _('Privileges') }}', options: switchOptions,
|
||||||
disabled: 'readonly'
|
disabled: 'readonly', control: RoleCustomSwitchControl
|
||||||
},{
|
},{
|
||||||
id: 'rolsuper', label:'{{ _('Superuser') }}', type: 'switch',
|
id: 'rolsuper', label:'{{ _('Superuser') }}', type: 'switch',
|
||||||
group: '{{ _('Privileges') }}', options: switchOptions,
|
group: '{{ _('Privileges') }}', options: switchOptions,
|
||||||
control: Backform.SwitchControl.extend({
|
control: RoleCustomSwitchControl.extend({
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
Backform.SwitchControl.prototype.onChange.apply(this, arguments);
|
Backform.SwitchControl.prototype.onChange.apply(this, arguments);
|
||||||
|
|
||||||
@ -431,7 +446,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) {
|
|||||||
},{
|
},{
|
||||||
id: 'rolcreaterole', label:'{{ _('Create roles?') }}',
|
id: 'rolcreaterole', label:'{{ _('Create roles?') }}',
|
||||||
group: '{{ _('Privileges') }}', type: 'switch',
|
group: '{{ _('Privileges') }}', type: 'switch',
|
||||||
options: switchOptions, disabled: 'readonly'
|
options: switchOptions, disabled: 'readonly',
|
||||||
|
control: RoleCustomSwitchControl
|
||||||
},{
|
},{
|
||||||
id: 'description', label:'{{ _('Comments') }}', type: 'multiline',
|
id: 'description', label:'{{ _('Comments') }}', type: 'multiline',
|
||||||
group: null, mode: ['properties', 'edit', 'create'],
|
group: null, mode: ['properties', 'edit', 'create'],
|
||||||
@ -439,22 +455,25 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) {
|
|||||||
},{
|
},{
|
||||||
id: 'rolcreatedb', label:'{{ _('Create databases?') }}',
|
id: 'rolcreatedb', label:'{{ _('Create databases?') }}',
|
||||||
group: '{{ _('Privileges') }}', type: 'switch',
|
group: '{{ _('Privileges') }}', type: 'switch',
|
||||||
options: switchOptions, disabled: 'readonly'
|
options: switchOptions, disabled: 'readonly',
|
||||||
|
control: RoleCustomSwitchControl
|
||||||
},{
|
},{
|
||||||
id: 'rolcatupdate', label:'{{ _('Update catalog?') }}',
|
id: 'rolcatupdate', label:'{{ _('Update catalog?') }}',
|
||||||
type: 'switch', max_version: 90400, options: switchOptions,
|
type: 'switch', max_version: 90400, options: switchOptions,
|
||||||
|
control: RoleCustomSwitchControl,
|
||||||
group: '{{ _('Privileges') }}', disabled: function(m) {
|
group: '{{ _('Privileges') }}', disabled: function(m) {
|
||||||
return (m.get('read_only') || (!m.get('rolsuper')));
|
return (m.get('read_only') || (!m.get('rolsuper')));
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'rolinherit', group: '{{ _('Privileges') }}',
|
id: 'rolinherit', group: '{{ _('Privileges') }}',
|
||||||
label:'{{ _('Inherit rights from the parent roles?') }}',
|
label:'{{ _('Inherit rights from the parent roles?') }}',
|
||||||
type: 'switch', options: switchOptions, disabled: 'readonly'
|
type: 'switch', options: switchOptions, disabled: 'readonly',
|
||||||
|
control: RoleCustomSwitchControl
|
||||||
},{
|
},{
|
||||||
id: 'rolreplication', group: '{{ _('Privileges') }}',
|
id: 'rolreplication', group: '{{ _('Privileges') }}',
|
||||||
label:'{{ _('Can initiate streaming replication and backups?') }}',
|
label:'{{ _('Can initiate streaming replication and backups?') }}',
|
||||||
type: 'switch', min_version: 90100, options: switchOptions,
|
type: 'switch', min_version: 90100, options: switchOptions,
|
||||||
disabled: 'readonly'
|
disabled: 'readonly', control: RoleCustomSwitchControl
|
||||||
},{
|
},{
|
||||||
id: 'rolmembership', label: '{{ _('Roles') }}',
|
id: 'rolmembership', label: '{{ _('Roles') }}',
|
||||||
group: '{{ _('Membership') }}', type: 'collection',
|
group: '{{ _('Membership') }}', type: 'collection',
|
||||||
|
Loading…
Reference in New Issue
Block a user