mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
parent
7c481b1e90
commit
cf8b56cc75
@ -131,5 +131,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Certificate Widget
|
||||
|
||||
.certificate-widget {
|
||||
label {
|
||||
padding-right: 10px;
|
||||
}
|
||||
.certificate {
|
||||
word-wrap: break-word;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
// workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=409254
|
||||
tbody:empty { display: none; }
|
@ -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);
|
||||
|
||||
|
@ -140,9 +140,8 @@ return {
|
||||
name: 'certificate',
|
||||
fields: [
|
||||
{
|
||||
$type: 'certificate_status',
|
||||
name: 'certificate_status',
|
||||
label: '@i18n:objects.host.status'
|
||||
$type: 'certificate',
|
||||
name: 'usercertificate'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -134,9 +134,8 @@ return {
|
||||
name: 'certificate',
|
||||
fields: [
|
||||
{
|
||||
$type: 'certificate_status',
|
||||
name: 'certificate_status',
|
||||
label: '@i18n:objects.service.status'
|
||||
$type: 'certificate',
|
||||
name: 'usercertificate'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -174,6 +174,10 @@ return {
|
||||
name: 'ipasshpubkey',
|
||||
label: '@i18n:objects.sshkeystore.keys'
|
||||
},
|
||||
{
|
||||
$type: 'certificate',
|
||||
name: 'usercertificate'
|
||||
},
|
||||
{
|
||||
$type: 'checkboxes',
|
||||
name: 'ipauserauthtype',
|
||||
|
@ -73,6 +73,7 @@
|
||||
"filter": "Filter",
|
||||
"find": "Find",
|
||||
"get": "Get",
|
||||
"hide": "Hide",
|
||||
"issue": "Issue",
|
||||
"ok": "OK",
|
||||
"refresh": "Refresh",
|
||||
@ -85,6 +86,7 @@
|
||||
"revoke": "Revoke",
|
||||
"save": "Save",
|
||||
"set": "Set",
|
||||
"show": "Show",
|
||||
"unapply": "Un-apply",
|
||||
"update": "Update",
|
||||
"view": "View"
|
||||
@ -253,6 +255,7 @@
|
||||
"note": "Note",
|
||||
"organization": "Organization",
|
||||
"organizational_unit": "Organizational Unit",
|
||||
"present": "${count} certificate(s) present",
|
||||
"privilege_withdrawn": "Privilege Withdrawn",
|
||||
"reason": "Reason for Revocation",
|
||||
"remove_from_crl": "Remove from CRL",
|
||||
|
@ -216,6 +216,7 @@ class i18n_messages(Command):
|
||||
"filter": _("Filter"),
|
||||
"find": _("Find"),
|
||||
"get": _("Get"),
|
||||
"hide": _("Hide"),
|
||||
"issue": _("Issue"),
|
||||
"ok": _("OK"),
|
||||
"refresh": _("Refresh"),
|
||||
@ -228,6 +229,7 @@ class i18n_messages(Command):
|
||||
"revoke": _("Revoke"),
|
||||
"save": _("Save"),
|
||||
"set": _("Set"),
|
||||
"show": _("Show"),
|
||||
"unapply": ("Un-apply"),
|
||||
"update": _("Update"),
|
||||
"view": _("View"),
|
||||
@ -397,6 +399,7 @@ class i18n_messages(Command):
|
||||
"note": _("Note"),
|
||||
"organization": _("Organization"),
|
||||
"organizational_unit": _("Organizational Unit"),
|
||||
"present": _("${count} certificate(s) present"),
|
||||
"privilege_withdrawn": _("Privilege Withdrawn"),
|
||||
"reason": _("Reason for Revocation"),
|
||||
"remove_from_crl": _("Remove from CRL"),
|
||||
|
Loading…
Reference in New Issue
Block a user