summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-02-22 17:12:53 +0100
committerPetr Vobornik <pvoborni@redhat.com>2013-03-18 15:06:21 +0100
commit02e315f85994205257149b07cc870b30793d6921 (patch)
tree303789a7a2577cb6931cad7e6d37e98cf4f1ef3f /install
parent17266e99274ea6dfe8cb3f8a001f17d019e5e4df (diff)
downloadfreeipa.git-02e315f85994205257149b07cc870b30793d6921.tar.gz
freeipa.git-02e315f85994205257149b07cc870b30793d6921.tar.xz
freeipa.git-02e315f85994205257149b07cc870b30793d6921.zip
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
Diffstat (limited to 'install')
-rw-r--r--install/ui/ipa.css9
-rwxr-xr-xinstall/ui/src/freeipa/certificate.js103
-rw-r--r--install/ui/src/freeipa/search.js8
-rw-r--r--install/ui/test/data/ipa_init.json12
4 files changed, 128 insertions, 4 deletions
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 4e51c305..71cad420 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -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;
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 84cff41f..854a909a 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -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;
};
diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js
index d57c4012..be37f88b 100644
--- a/install/ui/src/freeipa/search.js
+++ b/install/ui/src/freeipa/search.js
@@ -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;
};
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 68536747..e4d9c2a9 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -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",