webui: sshkey widget - usability fixes

- save one click by opening edit dialog right after adding new row
- add margin between fingerprint and "show/edit" button
- fix honoring of writable/read-only flags upon row creation

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-07-31 12:57:53 +02:00
parent 356059e07d
commit d138b44480
2 changed files with 19 additions and 3 deletions

View File

@ -78,3 +78,9 @@
line-height: @input-height-base + 2; line-height: @input-height-base + 2;
margin-bottom: 2px; margin-bottom: 2px;
} }
// SSH Key Widget
.sshkey-status {
margin-right: 5px;
}

View File

@ -1116,6 +1116,12 @@ IPA.multivalued_widget = function(spec) {
row.container.insertBefore(that.add_link); row.container.insertBefore(that.add_link);
that.toggle_remove_link(row, remove_link_visible); that.toggle_remove_link(row, remove_link_visible);
return row;
};
that.new_row = function() {
that.add_row('');
that.focus_last();
}; };
that.toggle_remove_link = function(row, show) { that.toggle_remove_link = function(row, show) {
@ -1141,8 +1147,7 @@ IPA.multivalued_widget = function(spec) {
title: text.get('@i18n:buttons.add'), title: text.get('@i18n:buttons.add'),
html: text.get('@i18n:buttons.add'), html: text.get('@i18n:buttons.add'),
click: function() { click: function() {
that.add_row(''); that.new_row();
that.focus_last();
return false; return false;
} }
}).appendTo(container); }).appendTo(container);
@ -5213,10 +5218,15 @@ exp.widget_builder = IPA.widget_builder = function(spec) {
IPA.sshkeys_widget = function(spec) { IPA.sshkeys_widget = function(spec) {
spec = spec || {}; spec = spec || {};
spec.child_spec = IPA.sshkey_widget; spec.child_spec = { $factory: IPA.sshkey_widget };
var that = IPA.multivalued_widget(spec); var that = IPA.multivalued_widget(spec);
that.new_row = function() {
var row = that.add_row('');
row.widget.open_edit_dialog();
};
that.test_dirty_row = function(row) { that.test_dirty_row = function(row) {
if(row.deleted || row.is_new) return true; if(row.deleted || row.is_new) return true;