mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Web UI:Choose different search option for cert-find
This extends certificate search page by search option select. Therefore the search is not restricted to 'subject'. It should be replaced by https://fedorahosted.org/freeipa/ticket/191 in a future. https://fedorahosted.org/freeipa/ticket/3419
This commit is contained in:
parent
070fc176ae
commit
8d36951911
@ -727,6 +727,15 @@ div[name=settings].facet-group li a {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.search-option {
|
||||
border: 1px solid #9f9e9e;
|
||||
background: url(images/search-background.png);
|
||||
border-radius: 15px !important;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding: 0 8px 0;
|
||||
}
|
||||
|
||||
.search-filter {
|
||||
width: 215px;
|
||||
-moz-border-radius: 15px !important;
|
||||
|
@ -1066,6 +1066,56 @@ IPA.cert.entity = function(spec) {
|
||||
name: 'status',
|
||||
width: '120px'
|
||||
}
|
||||
],
|
||||
search_options: [
|
||||
{
|
||||
value: 'subject',
|
||||
label: IPA.messages.objects.cert.find_subject
|
||||
},
|
||||
{
|
||||
value: 'revocation_reason',
|
||||
label: IPA.messages.objects.cert.find_revocation_reason
|
||||
},
|
||||
{
|
||||
value: 'min_serial_number',
|
||||
label: IPA.messages.objects.cert.find_min_serial_number
|
||||
},
|
||||
{
|
||||
value: 'max_serial_number',
|
||||
label: IPA.messages.objects.cert.find_max_serial_number
|
||||
},
|
||||
{
|
||||
value: 'validnotafter_from',
|
||||
label: IPA.messages.objects.cert.find_validnotafter_from
|
||||
},
|
||||
{
|
||||
value: 'validnotafter_to',
|
||||
label: IPA.messages.objects.cert.find_validnotafter_to
|
||||
},
|
||||
{
|
||||
value: 'validnotbefore_from',
|
||||
label: IPA.messages.objects.cert.find_validnotbefore_from
|
||||
},
|
||||
{
|
||||
value: 'validnotbefore_to',
|
||||
label: IPA.messages.objects.cert.find_validnotbefore_to
|
||||
},
|
||||
{
|
||||
value: 'issuedon_from',
|
||||
label: IPA.messages.objects.cert.find_issuedon_from
|
||||
},
|
||||
{
|
||||
value: 'issuedon_to',
|
||||
label: IPA.messages.objects.cert.find_issuedon_to
|
||||
},
|
||||
{
|
||||
value: 'revokedon_from',
|
||||
label: IPA.messages.objects.cert.find_revokedon_from
|
||||
},
|
||||
{
|
||||
value: 'revokedon_to',
|
||||
label: IPA.messages.objects.cert.find_revokedon_to
|
||||
}
|
||||
]
|
||||
}).
|
||||
details_facet({
|
||||
@ -1134,19 +1184,70 @@ IPA.cert.search_facet = function(spec) {
|
||||
|
||||
var that = IPA.search_facet(spec);
|
||||
|
||||
that.search_options = spec.search_options || [];
|
||||
|
||||
that.create_header = function(container) {
|
||||
that.search_facet_create_header(container);
|
||||
|
||||
that.search_option = $('<select/>', {
|
||||
name: 'search_option',
|
||||
'class': 'search-option'
|
||||
});
|
||||
|
||||
that.filter_container.before(that.search_option);
|
||||
|
||||
for (var i=0; i<that.search_options.length; i++) {
|
||||
var option = that.search_options[i];
|
||||
|
||||
var metadata = IPA.get_command_option('cert_find', option.value);
|
||||
var doc = metadata.doc || '';
|
||||
|
||||
$('<option/>', {
|
||||
text: option.label,
|
||||
value: option.value,
|
||||
title: doc
|
||||
}).appendTo(that.search_option);
|
||||
}
|
||||
};
|
||||
|
||||
that.create_refresh_command = function() {
|
||||
|
||||
var command = that.search_facet_create_refresh_command();
|
||||
var arg = command.args.pop();
|
||||
|
||||
var option = that.search_option.val();
|
||||
|
||||
if (arg) {
|
||||
command.set_option('subject', arg);
|
||||
command.set_option(option, arg);
|
||||
}
|
||||
|
||||
return command;
|
||||
};
|
||||
|
||||
// parent method only sets expired flag when filter change, it doesn't
|
||||
// expect that option can change -> set expire flag for every search
|
||||
that.find = function() {
|
||||
var filter = that.filter.val();
|
||||
var search_opt = that.search_option.val();
|
||||
var old_filter = IPA.nav.get_state(that.managed_entity.name+'-filter');
|
||||
var state = {};
|
||||
state[that.managed_entity.name + '-filter'] = filter;
|
||||
state[that.managed_entity.name + '-search-option'] = search_opt;
|
||||
|
||||
that.set_expired_flag();
|
||||
|
||||
IPA.nav.push_state(state);
|
||||
};
|
||||
|
||||
that.show = function() {
|
||||
that.search_facet_show();
|
||||
|
||||
if (that.search_option) {
|
||||
var search_opt = IPA.nav.get_state(that.entity.name+'-search-option');
|
||||
that.search_option.val(search_opt);
|
||||
}
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
@ -83,14 +83,14 @@ IPA.search_facet = function(spec, no_init) {
|
||||
|
||||
div.append(IPA.create_network_spinner());
|
||||
|
||||
var filter_container = $('<div/>', {
|
||||
that.filter_container = $('<div/>', {
|
||||
'class': 'search-filter'
|
||||
}).appendTo(div);
|
||||
|
||||
that.filter = $('<input/>', {
|
||||
type: 'text',
|
||||
name: 'filter'
|
||||
}).appendTo(filter_container);
|
||||
}).appendTo(that.filter_container);
|
||||
|
||||
that.filter.keypress(function(e) {
|
||||
/* if the key pressed is the enter key */
|
||||
@ -106,7 +106,7 @@ IPA.search_facet = function(spec, no_init) {
|
||||
that.find();
|
||||
return false;
|
||||
}
|
||||
}).appendTo(filter_container);
|
||||
}).appendTo(that.filter_container);
|
||||
|
||||
that.create_control_buttons(that.controls);
|
||||
};
|
||||
@ -258,6 +258,8 @@ IPA.search_facet = function(spec, no_init) {
|
||||
// methods that should be invoked by subclasses
|
||||
that.search_facet_refresh = that.refresh;
|
||||
that.search_facet_create_refresh_command = that.create_refresh_command;
|
||||
that.search_facet_create_header = that.create_header;
|
||||
that.search_facet_show = that.show;
|
||||
|
||||
return that;
|
||||
};
|
||||
|
@ -183,6 +183,18 @@
|
||||
"common_name": "Common Name",
|
||||
"expires_on": "Expires On",
|
||||
"fingerprints": "Fingerprints",
|
||||
"find_issuedon_from": "Issued on from",
|
||||
"find_issuedon_to": "Issued on to",
|
||||
"find_max_serial_number": "Maximum serial number",
|
||||
"find_min_serial_number": "Minimum serial number",
|
||||
"find_revocation_reason": "Revocation reason",
|
||||
"find_revokedon_from": "Revoked on from",
|
||||
"find_revokedon_to": "Revoked on to",
|
||||
"find_subject": "Subject",
|
||||
"find_validnotafter_from": "Valid not after from",
|
||||
"find_validnotafter_to": "Valid not after to",
|
||||
"find_validnotbefore_from": "Valid not before from",
|
||||
"find_validnotbefore_to": "Valid not before to",
|
||||
"issue_certificate": "Issue New Certificate for ${entity} ${primary_key}",
|
||||
"issued_by": "Issued By",
|
||||
"issued_on": "Issued On",
|
||||
|
@ -318,6 +318,18 @@ class i18n_messages(Command):
|
||||
"cessation_of_operation": _("Cessation of Operation"),
|
||||
"common_name": _("Common Name"),
|
||||
"expires_on": _("Expires On"),
|
||||
"find_issuedon_from": _("Issued on from"),
|
||||
"find_issuedon_to": _("Issued on to"),
|
||||
"find_max_serial_number": _("Maximum serial number"),
|
||||
"find_min_serial_number": _("Minimum serial number"),
|
||||
"find_revocation_reason": _("Revocation reason"),
|
||||
"find_revokedon_from": _("Revoked on from"),
|
||||
"find_revokedon_to": _("Revoked on to"),
|
||||
"find_subject": _("Subject"),
|
||||
"find_validnotafter_from": _("Valid not after from"),
|
||||
"find_validnotafter_to": _("Valid not after to"),
|
||||
"find_validnotbefore_from": _("Valid not before from"),
|
||||
"find_validnotbefore_to": _("Valid not before to"),
|
||||
"fingerprints": _("Fingerprints"),
|
||||
"issue_certificate": _("Issue New Certificate for ${entity} ${primary_key}"),
|
||||
"issued_by": _("Issued By"),
|
||||
|
Loading…
Reference in New Issue
Block a user