mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Removed the readonly mode from the properties panel for any object.
Changed UI as per feedback from Dave
This commit is contained in:
@@ -25,11 +25,6 @@ function($, _, pgAdmin, pgBrowser, alertify) {
|
|||||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||||
category: 'create', priority: 3, label: '{{ _('Server...') }}',
|
category: 'create', priority: 3, label: '{{ _('Server...') }}',
|
||||||
data: {action: 'create'}, icon: 'wcTabIcon icon-server'
|
data: {action: 'create'}, icon: 'wcTabIcon icon-server'
|
||||||
}, {
|
|
||||||
name: 'edit_server', node: 'server', module: this,
|
|
||||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
|
||||||
category: 'edit', priority: 4, label: '{{ _('Edit...') }}',
|
|
||||||
data: {action: 'edit'}, icon: 'fa fa-pencil-square-o'
|
|
||||||
},{
|
},{
|
||||||
name: 'drop_server', node: 'server', module: this,
|
name: 'drop_server', node: 'server', module: this,
|
||||||
applies: ['object', 'context'], callback: 'delete_obj',
|
applies: ['object', 'context'], callback: 'delete_obj',
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ function($, _, pgAdmin, Backbone) {
|
|||||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||||
category: 'create', priority: 1, label: '{{ _('Server Group...') }}',
|
category: 'create', priority: 1, label: '{{ _('Server Group...') }}',
|
||||||
data: {'action': 'create'}, icon: 'wcTabIcon icon-server-group'
|
data: {'action': 'create'}, icon: 'wcTabIcon icon-server-group'
|
||||||
},{
|
|
||||||
name: 'edit_server_group', node: 'server-group', module: this,
|
|
||||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
|
||||||
priority: 3, label: '{{ _('Edit...') }}', data: {'action': 'edit'},
|
|
||||||
icon: 'fa fa-pencil-square-o'
|
|
||||||
}, {
|
}, {
|
||||||
name: 'drop_server_group', node: 'server-group', module: this,
|
name: 'drop_server_group', node: 'server-group', module: this,
|
||||||
applies: ['object', 'context'], callback: 'delete_obj',
|
applies: ['object', 'context'], callback: 'delete_obj',
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ try {
|
|||||||
<li id="mnu_create_dropdown_obj" class="menu-item dropdown dropdown-submenu">
|
<li id="mnu_create_dropdown_obj" class="menu-item dropdown dropdown-submenu">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
<i class="fa fa-magic"></i>
|
<i class="fa fa-magic"></i>
|
||||||
<span> {{ _('Create') }}</span>
|
<span>{{ _('Create') }}</span>
|
||||||
</a>
|
</a>
|
||||||
<ul id="mnu_create_obj" class="dropdown-menu navbar-inverse">
|
<ul id="mnu_create_obj" class="dropdown-menu navbar-inverse">
|
||||||
<li class="menu-item">
|
<li class="menu-item">
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
name: 'show_obj_properties', node: this.type, module: this,
|
name: 'show_obj_properties', node: this.type, module: this,
|
||||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||||
priority: 3, label: '{{ _("Properties...") }}',
|
priority: 3, label: '{{ _("Properties...") }}',
|
||||||
data: {'action': 'properties'}, icon: 'fa fa-th-list'
|
data: {'action': 'edit'}, icon: 'fa fa-pencil-square-o'
|
||||||
}]);
|
}]);
|
||||||
},
|
},
|
||||||
///////
|
///////
|
||||||
@@ -333,8 +333,14 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
l = S('{{ _("Create - %%s") }}').sprintf(
|
l = S('{{ _("Create - %%s") }}').sprintf(
|
||||||
[this.label]).value();
|
[this.label]).value();
|
||||||
p = pgBrowser.docker.addPanel('node_props',
|
p = pgBrowser.docker.addPanel('node_props',
|
||||||
wcDocker.DOCK_FLOAT, undefined,
|
wcDocker.DOCK_FLOAT, undefined, {
|
||||||
{w: '500', h: '400'});
|
w: (screen.width < 700 ?
|
||||||
|
screen.width * 0.95 : screen.width * 0.5),
|
||||||
|
h: (screen.height < 500 ?
|
||||||
|
screen.height * 0.95 : screen.height * 0.5),
|
||||||
|
x: (screen.width < 700 ? '2%' : '25%'),
|
||||||
|
y: (screen.height < 500 ? '2%' : '25%')
|
||||||
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o.showProperties(i, d, p, args.action);
|
o.showProperties(i, d, p, args.action);
|
||||||
}, 10);
|
}, 10);
|
||||||
@@ -350,7 +356,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
if (mode) {
|
if (mode) {
|
||||||
var msg = '{{ _('Are you sure wish to stop editing the properties of the %%s - "%%s"?') }}';
|
var msg = '{{ _('Are you sure wish to stop editing the properties of the %%s - "%%s"?') }}';
|
||||||
if (args.action == 'edit') {
|
if (args.action == 'edit') {
|
||||||
msg = '{{ _('Are you sure wish to reset the current changes, and reopen the panel for %%s = "%%s"?') }}';
|
msg = '{{ _('Are you sure wish to reset the current changes, and reopen the panel for %%s - "%%s"?') }}';
|
||||||
}
|
}
|
||||||
|
|
||||||
Alertify.confirm(
|
Alertify.confirm(
|
||||||
@@ -369,8 +375,14 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p = pgBrowser.docker.addPanel('node_props',
|
p = pgBrowser.docker.addPanel('node_props',
|
||||||
wcDocker.DOCK_FLOAT, undefined,
|
wcDocker.DOCK_FLOAT, undefined, {
|
||||||
{w: '500', h: '400'});
|
w: (screen.width < 700 ?
|
||||||
|
screen.width * 0.95 : screen.width * 0.5),
|
||||||
|
h: (screen.height < 500 ?
|
||||||
|
screen.height * 0.95 : screen.height * 0.5),
|
||||||
|
x: (screen.width < 700 ? '2%' : '25%'),
|
||||||
|
y: (screen.height < 500 ? '2%' : '25%')
|
||||||
|
});
|
||||||
pgBrowser.Node.panels = pgBrowser.Node.panels || {};
|
pgBrowser.Node.panels = pgBrowser.Node.panels || {};
|
||||||
pgBrowser.Node.panels[d.id] = p;
|
pgBrowser.Node.panels[d.id] = p;
|
||||||
|
|
||||||
@@ -510,9 +522,9 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
j = panel.$container.find('.obj_properties').first(),
|
j = panel.$container.find('.obj_properties').first(),
|
||||||
view = j.data('obj-view'),
|
view = j.data('obj-view'),
|
||||||
content = $('<div></div>')
|
content = $('<div></div>')
|
||||||
.addClass('has-pg-prop-btn-group pg-prop-content col-xs-12'),
|
.addClass('pg-prop-content col-xs-12'),
|
||||||
// Template function to create the button-group
|
// Template function to create the button-group
|
||||||
createButtons = function(buttons) {
|
createButtons = function(buttons, extraClasses) {
|
||||||
// arguments must be non-zero length array of type
|
// arguments must be non-zero length array of type
|
||||||
// object, which contains following attributes:
|
// object, which contains following attributes:
|
||||||
// label, type, extraClasses, register
|
// label, type, extraClasses, register
|
||||||
@@ -521,15 +533,18 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
// div area.
|
// div area.
|
||||||
var btnGroup =
|
var btnGroup =
|
||||||
$('<div></div>').addClass(
|
$('<div></div>').addClass(
|
||||||
'pg-prop-btn-group col-xs-12'
|
'pg-prop-btn-group'
|
||||||
).appendTo(j),
|
).appendTo(j),
|
||||||
// Template used for creating a button
|
// Template used for creating a button
|
||||||
tmpl = _.template([
|
tmpl = _.template([
|
||||||
'<button type="<%= type %>" ',
|
'<button type="<%= type %>" ',
|
||||||
'class="btn <%=extraClasses.join(\' \')%>">',
|
'class="btn <%=extraClasses.join(\' \')%>">',
|
||||||
'<i class="<%= icon %>"></i> ',
|
'<i class="<%= icon %>"></i> ',
|
||||||
'<%-label%></button>'
|
'<%-label%></button>'
|
||||||
].join(' '));
|
].join(' '));
|
||||||
|
if (extraClasses) {
|
||||||
|
btnGroup.addClass(extraClasses);
|
||||||
|
}
|
||||||
_.each(buttons, function(btn) {
|
_.each(buttons, function(btn) {
|
||||||
// Create the actual button, and append to
|
// Create the actual button, and append to
|
||||||
// the group div
|
// the group div
|
||||||
@@ -550,6 +565,10 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
},
|
},
|
||||||
// Callback to show object properties
|
// Callback to show object properties
|
||||||
properties = function() {
|
properties = function() {
|
||||||
|
|
||||||
|
if (!content.hasClass('has-pg-prop-btn-group'))
|
||||||
|
content.addClass('has-pg-prop-btn-group');
|
||||||
|
|
||||||
// We need to release any existing view, before
|
// We need to release any existing view, before
|
||||||
// creating new view.
|
// creating new view.
|
||||||
if (view) {
|
if (view) {
|
||||||
@@ -570,18 +589,6 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
j.data('obj-view', view);
|
j.data('obj-view', view);
|
||||||
// Create proper buttons
|
// Create proper buttons
|
||||||
var buttons = [];
|
var buttons = [];
|
||||||
if (action) {
|
|
||||||
buttons.push({
|
|
||||||
label: '{{ _("Close") }}', type: 'close',
|
|
||||||
extraClasses: ['btn-danger'],
|
|
||||||
icon: 'fa fa-lg fa-close',
|
|
||||||
register: function(btn) {
|
|
||||||
btn.click(function() {
|
|
||||||
closePanel();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
buttons.push({
|
buttons.push({
|
||||||
label: '{{ _("Edit") }}', type: 'edit',
|
label: '{{ _("Edit") }}', type: 'edit',
|
||||||
extraClasses: ['btn-primary'],
|
extraClasses: ['btn-primary'],
|
||||||
@@ -592,7 +599,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
createButtons(buttons);
|
createButtons(buttons, 'pg-prop-btn-group-above');
|
||||||
}
|
}
|
||||||
j.append(content);
|
j.append(content);
|
||||||
},
|
},
|
||||||
@@ -620,6 +627,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
if (view) {
|
if (view) {
|
||||||
// Save it to release it later
|
// Save it to release it later
|
||||||
j.data('obj-view', view);
|
j.data('obj-view', view);
|
||||||
|
|
||||||
// Create proper buttons
|
// Create proper buttons
|
||||||
createButtons([{
|
createButtons([{
|
||||||
label: '{{ _("Save") }}', type: 'save',
|
label: '{{ _("Save") }}', type: 'save',
|
||||||
@@ -673,10 +681,15 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
setTimeout(function() { editFunc.call(); }, 0);
|
setTimeout(function() { editFunc.call(); }, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}]);
|
}], 'pg-prop-btn-group-below');
|
||||||
};
|
};
|
||||||
// Show contents after buttons
|
|
||||||
j.append(content);
|
// Add some space, so that - button group does not override the
|
||||||
|
// space
|
||||||
|
content.addClass('pg-prop-has-btn-group-below');
|
||||||
|
|
||||||
|
// Show contents before buttons
|
||||||
|
j.prepend(content);
|
||||||
},
|
},
|
||||||
closePanel = function() {
|
closePanel = function() {
|
||||||
// Closing this panel
|
// Closing this panel
|
||||||
@@ -686,7 +699,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
// Update the item lable (if lable is modified.)
|
// Update the item lable (if lable is modified.)
|
||||||
tree.setLabel(item, {label: view.model.get("name")});
|
tree.setLabel(item, {label: view.model.get("name")});
|
||||||
panel.$container.removeAttr('action-mode');
|
panel.$container.removeAttr('action-mode');
|
||||||
setTimeout(function() { properties(); }, 0);
|
setTimeout(function() { closePanel(); }, 0);
|
||||||
},
|
},
|
||||||
saveNewNode = function() {
|
saveNewNode = function() {
|
||||||
/* TODO:: Create new tree node for this */
|
/* TODO:: Create new tree node for this */
|
||||||
@@ -766,7 +779,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
}]);
|
}]);
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
onCancelFunc = properties,
|
onCancelFunc = closePanel,
|
||||||
onSaveFunc = updateTreeItem,
|
onSaveFunc = updateTreeItem,
|
||||||
onEdit = editFunc;
|
onEdit = editFunc;
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ iframe {
|
|||||||
color: #009DCF;
|
color: #009DCF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navbar-inverse .navbar-brand:hover {
|
||||||
|
color: #009DCF;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-menu > hr {
|
.dropdown-menu > hr {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@@ -338,15 +342,19 @@ iframe {
|
|||||||
border: 2px solid #A9A9A9;
|
border: 2px solid #A9A9A9;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-prop-btn-group-above {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
padding: 0px 7px;
|
}
|
||||||
|
|
||||||
|
.pg-prop-btn-group-below {
|
||||||
|
bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pg-prop-btn-group button {
|
.pg-prop-btn-group button {
|
||||||
margin-right: 5px;
|
padding: 0.2em 0.3em;
|
||||||
margin-top: 2px;
|
margin: 0.1em 0.3em;
|
||||||
margin-bottom: 2px;
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pg-prop-btn-group button:not(:first-child):not(:last-child) {
|
.pg-prop-btn-group button:not(:first-child):not(:last-child) {
|
||||||
@@ -354,23 +362,21 @@ iframe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pg-prop-content {
|
.pg-prop-content {
|
||||||
margin: 0 auto;
|
|
||||||
width: 100%;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
top: 0em;
|
top: 0em;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
margin-top: 1em;
|
padding: 0.5em 0px;
|
||||||
padding-right: 0;
|
}
|
||||||
padding-left: 0;
|
|
||||||
|
.pg-prop-has-btn-group-below {
|
||||||
|
margin-bottom: 2.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.has-pg-prop-btn-group {
|
.has-pg-prop-btn-group {
|
||||||
top: 2.5em;
|
top: 2.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.pg-prop-content > div {
|
.pg-prop-content > div {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
|||||||
Reference in New Issue
Block a user