summaryrefslogtreecommitdiffstats
path: root/install/static
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2011-01-04 15:21:18 -0500
committerAdam Young <ayoung@redhat.com>2011-01-04 21:56:38 -0500
commit2f2c67cb59f1a797e6f2e0b033cb480489c0df0b (patch)
tree4dbc3df041b8a1893887f67048fa7f8cf7774e2e /install/static
parentd6d579ead469e0b4690d6d1eec0f137dd3c40940 (diff)
downloadfreeipa-2f2c67cb59f1a797e6f2e0b033cb480489c0df0b.tar.gz
freeipa-2f2c67cb59f1a797e6f2e0b033cb480489c0df0b.tar.xz
freeipa-2f2c67cb59f1a797e6f2e0b033cb480489c0df0b.zip
Improvements to enrollments in the webUI.
TAKE 1 - Enrollement links in the action panel are now sorted by relationships. - You can only enroll members. (The webUI made the impression you can enroll parents as well, but it was broken.) - When enrolling new members, you can choose not to display already enrolled ones. (On by default.) - Couple cosmetic changes.
Diffstat (limited to 'install/static')
-rw-r--r--install/static/associate.js72
-rw-r--r--install/static/entity.js45
-rw-r--r--install/static/group.js9
-rw-r--r--install/static/ipa.css10
-rwxr-xr-xinstall/static/widget.js21
5 files changed, 124 insertions, 33 deletions
diff --git a/install/static/associate.js b/install/static/associate.js
index 66db171f3..6517ccaab 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -140,6 +140,7 @@ function ipa_association_adder_dialog(spec) {
that.entity_name = spec.entity_name;
that.pkey = spec.pkey;
that.other_entity = spec.other_entity;
+ that.attribute_member = spec.attribute_member;
that.init = function() {
if (!that.columns.length) {
@@ -152,6 +153,9 @@ function ipa_association_adder_dialog(spec) {
});
}
+ /* FIXME: event not firing? */
+ $('input[name=hidememb]', that.container).click(that.search);
+
that.adder_dialog_init();
};
@@ -166,7 +170,31 @@ function ipa_association_adder_dialog(spec) {
}
}
- ipa_cmd('find', [that.get_filter()], {'all': true}, on_success, null, that.other_entity);
+ var hide_checkbox = $('input[name=hidememb]', that.container);
+
+ var options = {'all': true};
+ if (hide_checkbox.attr('checked')) {
+ var relationships = IPA.metadata[that.other_entity].relationships;
+
+ /* TODO: better generic handling of different relationships! */
+ var other_attribute_member = '';
+ if (that.attribute_member == 'member')
+ other_attribute_member = 'memberof';
+ else if (that.attribute_member == 'memberuser')
+ other_attribute_member = 'memberof';
+ else if (that.attribute_member == 'memberhost')
+ other_attribute_member = 'memberof';
+ else if (that.attribute_member == 'memberof')
+ other_attribute_member = 'member';
+
+ var relationship = relationships[other_attribute_member];
+ if (relationship) {
+ var param_name = relationship[2] + that.entity_name;
+ options[param_name] = that.pkey;
+ }
+ }
+
+ ipa_cmd('find', [that.get_filter()], options, on_success, null, that.other_entity);
};
that.association_adder_dialog_init = that.init;
@@ -234,6 +262,7 @@ function ipa_association_table_widget(spec) {
var that = ipa_table_widget(spec);
that.other_entity = spec.other_entity;
+ that.attribute_member = spec.attribute_member;
that.associator = spec.associator || bulk_associator;
that.add_method = spec.add_method || 'add_member';
@@ -398,7 +427,8 @@ function ipa_association_table_widget(spec) {
'title': title,
'entity_name': that.entity_name,
'pkey': pkey,
- 'other_entity': that.other_entity
+ 'other_entity': that.other_entity,
+ 'attribute_member': that.attribute_member,
});
};
@@ -513,6 +543,8 @@ function ipa_association_facet(spec) {
var that = ipa_facet(spec);
that.other_entity = spec.other_entity;
+ that.facet_group = spec.facet_group;
+ that.attribute_member = spec.attribute_member;
that.associator = spec.associator || bulk_associator;
that.add_method = spec.add_method || 'add_member';
@@ -636,9 +668,20 @@ function ipa_association_facet(spec) {
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
- //TODO I18N
- var header_message = that.other_entity + '(s) enrolled in ' +
- that.entity_name + ' ' + that.pkey;
+ var relationships = IPA.metadata[that.entity_name].relationships;
+ var relationship = relationships[that.attribute_member];
+ if (!relationship)
+ relationship = ['', '', ''];
+
+ /* TODO: I18N and some generic handling of different relationships */
+ var header_message = '';
+ if (relationship[0] == 'Member') {
+ header_message = that.other_entity + '(s) enrolled in ' +
+ that.entity_name + ' ' + that.pkey;
+ } else if (relationship[0] == 'Parent') {
+ header_message = that.entity_name + ' ' + that.pkey +
+ ' is enrolled in the following ' + that.other_entity + '(s)';
+ }
$('<div/>', {
'id': that.entity_name+'-'+that.other_entity,
@@ -659,12 +702,14 @@ function ipa_association_facet(spec) {
'value': IPA.messages.button.remove
}).appendTo(li);
- $('<input/>', {
- 'type': 'button',
- 'name': 'add',
- 'value': IPA.messages.button.enroll
- }).appendTo(li);
-
+ /* TODO: genering handling of different relationships */
+ if (relationship[0] == 'Member') {
+ $('<input/>', {
+ 'type': 'button',
+ 'name': 'add',
+ 'value': IPA.messages.button.enroll
+ }).appendTo(li);
+ }
};
that.setup = function(container) {
@@ -697,13 +742,14 @@ function ipa_association_facet(spec) {
var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity;
- var title = 'Enroll '+that.entity_name+' '+pkey+' in '+label;
+ var title = 'Enroll ' + label + ' in ' + that.entity_name + ' ' + pkey;
var dialog = ipa_association_adder_dialog({
'title': title,
'entity_name': that.entity_name,
'pkey': pkey,
- 'other_entity': that.other_entity
+ 'other_entity': that.other_entity,
+ 'attribute_member': that.attribute_member,
});
if (that.adder_columns.length) {
diff --git a/install/static/entity.js b/install/static/entity.js
index 76f1c0d52..8620ef09d 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -137,7 +137,7 @@ function ipa_entity(spec) {
return config;
};
- that.create_association_facet = function(attribute_member, other_entity, label) {
+ that.create_association_facet = function(attribute_member, other_entity, label, facet_group) {
if (!attribute_member) {
attribute_member = ipa_get_member_attribute(
@@ -148,7 +148,9 @@ function ipa_entity(spec) {
return ipa_association_facet({
'name': attribute_member+'_'+other_entity,
'label': label,
- 'other_entity': other_entity
+ 'other_entity': other_entity,
+ 'facet_group': facet_group,
+ 'attribute_member': attribute_member,
});
};
@@ -170,18 +172,19 @@ function ipa_entity(spec) {
var label = other_entity_name;
- if (attribute_member.match(/^memberof$/)) {
- label = IPA.messages.association.membershipin+' '+other_entity_name;
+ var relationships = IPA.metadata[that.name].relationships;
- } else if (attribute_member.match(/^member/)) {
- label = other_entity_name+' '+IPA.messages.association.members;
+ var relationship = relationships[attribute_member];
+ if (!relationship)
+ relationship = ['Member', '', 'no_'];
+ var facet_group = relationship[0];
- } else if (attribute_member.match(/^managedby$/)) {
- label = IPA.messages.association.managedby+' '+other_entity_name;
- }
+ var facet = that.create_association_facet(
+ attribute_member, other_entity, label, facet_group
+ );
- var facet = that.create_association_facet(attribute_member, other_entity, label);
if (that.get_facet(facet.name)) continue;
+
that.add_facet(facet);
}
}
@@ -488,10 +491,30 @@ function ipa_facet_create_action_panel(container) {
main_facet.appendTo(ul);
ul.append($('<li><span class="action-controls"/></li>'));
+ var facet_groups = {};
for (var i=1; i<entity.facets.length; i++) {
other_facet = entity.facets[i];
other_facet_name = other_facet.name;
- ul.append(build_link(other_facet,other_facet.label));
+
+ if (other_facet.facet_group) {
+ var facet_group = other_facet.facet_group;
+ if (!facet_groups[facet_group]) {
+ var li = $('<li/>', {
+ 'class': 'entity-facet-relation-label',
+ 'text': other_facet.facet_group,
+ 'title': other_facet.facet_group,
+ })
+ ul.append(li);
+ facet_groups[facet_group] = li;
+ }
+ var li = facet_groups[facet_group];
+ li.after(
+ build_link(other_facet, other_facet.label)
+ );
+ facet_groups[facet_group] = li.next();
+ } else {
+ ul.append(build_link(other_facet, other_facet.label));
+ }
}
}else{
$('<li/>', {
diff --git a/install/static/group.js b/install/static/group.js
index 0e7fd070e..21345acc3 100644
--- a/install/static/group.js
+++ b/install/static/group.js
@@ -62,13 +62,6 @@ function ipa_group() {
});
that.add_facet(facet);
- facet = ipa_group_member_user_facet({
- 'name': 'member_user',
- 'label': IPA.metadata['user'].label+' '+IPA.messages.association.members,
- 'other_entity': 'user'
- });
- that.add_facet(facet);
-
that.create_association_facets();
that.entity_init();
@@ -195,4 +188,4 @@ function ipa_group_member_user_facet(spec) {
};
return that;
-} \ No newline at end of file
+}
diff --git a/install/static/ipa.css b/install/static/ipa.css
index f5c4ee742..42625ec7e 100644
--- a/install/static/ipa.css
+++ b/install/static/ipa.css
@@ -485,6 +485,14 @@ span.main-separator{
text-transform: none;
}
+.action-panel li.entity-facet-relation-label {
+ font-family: "FreeWayBold", "Liberation Sans", Arial, Sans;
+ color: #333333;
+ cursor: default;
+ text-transform: uppercase;
+ font-size: 1.2em;
+}
+
.action-button {
background: none;
background-image:none;
@@ -687,4 +695,4 @@ table.scrollable tbody {
bottom: 0px;
width: 250px;
height: 40px;
-} \ No newline at end of file
+}
diff --git a/install/static/widget.js b/install/static/widget.js
index 4da5df03f..dcc173411 100755
--- a/install/static/widget.js
+++ b/install/static/widget.js
@@ -1023,6 +1023,23 @@ function ipa_adder_dialog(spec) {
value: 'Find'
}).appendTo(search_panel);
+ $('<input/>', {
+ type: 'checkbox',
+ name: 'hidememb',
+ id: 'hidememb',
+ checked: 'checked',
+ style: 'margin-left: 5px; vertical-align: middle',
+ }).appendTo(search_panel);
+
+ var label = $('<label/>', {
+ 'for': 'hidememb',
+ style: 'margin-left: 3px',
+ });
+
+ label.text('Hide already enrolled.');
+
+ label.appendTo(search_panel);
+
var results_panel = $('<div/>', {
'class': 'adder-dialog-results'
}).appendTo(that.container);
@@ -1141,6 +1158,10 @@ function ipa_adder_dialog(spec) {
return that.filter_field.val();
};
+ that.get_hide_checkbox = function() {
+ return that.hide_checkbox.checked;
+ };
+
that.clear_available_values = function() {
that.available_table.empty();
};