diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-07-09 00:12:00 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2015-07-09 10:58:40 +0200 |
commit | cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633 (patch) | |
tree | b1ee9fb72a5b9fb4a1184dad67fd6de66a7d92dd /install/ui/src/freeipa | |
parent | 7c481b1e90dbb6821b71707c4012b3857adb84e2 (diff) | |
download | freeipa-cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633.tar.gz freeipa-cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633.tar.xz freeipa-cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633.zip |
webui: show multiple cert
New certificate widget which replaced certificate status widget.
It can display multiple certs. Drawback is that it cannot display
if the certificate was revoked. Web UI does not have the information.
part of: https://fedorahosted.org/freeipa/ticket/5045
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa')
-rwxr-xr-x | install/ui/src/freeipa/certificate.js | 90 | ||||
-rw-r--r-- | install/ui/src/freeipa/host.js | 5 | ||||
-rw-r--r-- | install/ui/src/freeipa/service.js | 5 | ||||
-rw-r--r-- | install/ui/src/freeipa/user.js | 4 |
4 files changed, 98 insertions, 6 deletions
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 71f0dfbf5..93f3cfc68 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -1000,6 +1000,95 @@ IPA.cert.status_field = function(spec) { return that; }; +IPA.cert.cert_widget = function(spec) { + + spec = spec || {}; + spec.css_class = spec.css_class || 'certificate-widget'; + + var that = IPA.input_widget(spec); + that.certs_visible = false; + + that.create = function(container) { + + that.widget_create(container); + that.content_el = $('<div>').appendTo(container); + }; + + that.create_status = function(name, text, icon) { + + var status = $('<label/>', { + 'class': 'certificate-status' + }); + + $('<i/>', { + 'class': icon + }).appendTo(status); + + status.append(" " + text); + + return status; + }; + + that.create_certs = function() { + + that.content_el.empty(); + var l = that.certificates.length; + + if (l && that.certs_visible) { + for (var i=0; i<l; i++) { + $('<div/>', { + 'class': 'certificate', + text: that.certificates[i] + }).appendTo(that.content_el); + } + $('<div/>').append( + IPA.button({ + name: 'hide', + label: '@i18n:buttons.hide', + click: function() { + that.certs_visible = false; + that.create_certs(); + } + })). + appendTo(that.content_el); + } + + if (!l) { + that.content_el.append(that.create_status( + 'missing', + text.get('@i18n:objects.cert.missing'), + 'fa fa-warning')); + } + + if (l && !that.certs_visible) { + + var msg = text.get('@i18n:objects.cert.present'); + msg = msg.replace('${count}', l); + that.content_el.append( + that.create_status('present', msg, 'fa fa-check')); + + IPA.button({ + name: 'show', + label: '@i18n:buttons.show', + click: function() { + that.certs_visible = true; + that.create_certs(); + } + }).appendTo(that.content_el); + } + }; + + that.update = function(values) { + that.certificates = values; + that.create_certs(); + }; + + that.clear = function() { + that.content_el.empty(); + }; + + return that; +}; exp.create_cert_metadata = function() { @@ -1409,6 +1498,7 @@ exp.register = function() { var f = reg.field; var a = reg.action; + w.register('certificate', IPA.cert.cert_widget); w.register('certificate_status', IPA.cert.status_widget); f.register('certificate_status', IPA.cert.status_field); diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 17fe423e5..e033279b2 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -140,9 +140,8 @@ return { name: 'certificate', fields: [ { - $type: 'certificate_status', - name: 'certificate_status', - label: '@i18n:objects.host.status' + $type: 'certificate', + name: 'usercertificate' } ] }, diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js index 5b469b5e1..28a01f635 100644 --- a/install/ui/src/freeipa/service.js +++ b/install/ui/src/freeipa/service.js @@ -134,9 +134,8 @@ return { name: 'certificate', fields: [ { - $type: 'certificate_status', - name: 'certificate_status', - label: '@i18n:objects.service.status' + $type: 'certificate', + name: 'usercertificate' } ] }, diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 33bc6ec10..e30311bbf 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -175,6 +175,10 @@ return { label: '@i18n:objects.sshkeystore.keys' }, { + $type: 'certificate', + name: 'usercertificate' + }, + { $type: 'checkboxes', name: 'ipauserauthtype', flags: ['w_if_no_aci'], |