summaryrefslogtreecommitdiffstats
path: root/install/ui
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-05-16 14:40:09 -0500
committerAdam Young <ayoung@redhat.com>2011-05-16 21:05:49 -0400
commita7f9814ab702cfa42988e47e80f44b57a195ad1e (patch)
tree6ea1bb746d3a28cb39906f11b744cc26293a2363 /install/ui
parentf9a8d772e35982bed1c39b286b3120b9b5f64c0c (diff)
downloadfreeipa-a7f9814ab702cfa42988e47e80f44b57a195ad1e.tar.gz
freeipa-a7f9814ab702cfa42988e47e80f44b57a195ad1e.tar.xz
freeipa-a7f9814ab702cfa42988e47e80f44b57a195ad1e.zip
Read-only association facet.
The IPA.association_facet has been modified to take a read_only parameters. If the parameter is set to true, the Enroll and Delete buttons will not be shown. All facets under the memberindirect and memberofindirect facet groups are marked as read-only. Ticket #1030
Diffstat (limited to 'install/ui')
-rw-r--r--install/ui/associate.js65
-rw-r--r--install/ui/details.js2
-rw-r--r--install/ui/entitle.js2
-rw-r--r--install/ui/entity.js71
-rw-r--r--install/ui/hbac.js5
-rw-r--r--install/ui/search.js2
-rw-r--r--install/ui/sudo.js5
-rw-r--r--install/ui/test/data/i18n_messages.json2
-rw-r--r--install/ui/test/data/ipa_init.json2
9 files changed, 83 insertions, 73 deletions
diff --git a/install/ui/associate.js b/install/ui/associate.js
index 679e00700..9d04b0c85 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -668,7 +668,6 @@ IPA.association_facet = function (spec) {
that.other_entity = spec.other_entity;
that.facet_group = spec.facet_group;
- that.label = that.label ? that.label : (IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity);
that.read_only = spec.read_only;
that.associator = spec.associator || IPA.bulk_associator;
@@ -734,18 +733,15 @@ IPA.association_facet = function (spec) {
var column;
var i;
-
-
-
var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity;
var pkey_name = IPA.metadata.objects[that.other_entity].primary_key;
that.table = IPA.table_widget({
- 'id': that.entity_name+'-'+that.other_entity,
- 'name': pkey_name,
- 'label': label,
- 'entity_name': that.entity_name,
- 'other_entity': that.other_entity
+ id: that.entity_name+'-'+that.other_entity,
+ name: pkey_name,
+ label: label,
+ entity_name: that.entity_name,
+ other_entity: that.other_entity
});
if (that.columns.length) {
@@ -801,47 +797,34 @@ IPA.association_facet = function (spec) {
that.facet_create_header(container);
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
-
- var relationships = IPA.metadata.objects[that.entity_name].relationships;
- var relationship = relationships[that.attribute_member];
- if (!relationship) {
- relationship = ['', '', ''];
- }
-
var other_label = IPA.metadata.objects[that.other_entity].label;
- /* TODO: generic handling of different relationships */
- var title = '';
- if (relationship[0] == 'Member') {
- title = IPA.messages.association.member;
-
- } else if (relationship[0] == 'Member Of') {
- title = IPA.messages.association.parent;
- }
-
+ var title = that.title;
title = title.replace('${entity}', that.entity_name);
title = title.replace('${primary_key}', that.pkey);
title = title.replace('${other_entity}', other_label);
that.set_title(container, title);
- that.remove_button = IPA.action_button({
- label: IPA.messages.buttons.remove,
- icon: 'ui-icon-trash',
- click: function() {
- that.show_remove_dialog();
- return false;
- }
- }).appendTo(that.controls);
+ if (!that.read_only) {
+ that.remove_button = IPA.action_button({
+ label: IPA.messages.buttons.remove,
+ icon: 'ui-icon-trash',
+ click: function() {
+ that.show_remove_dialog();
+ return false;
+ }
+ }).appendTo(that.controls);
- that.add_button = IPA.action_button({
- label: IPA.messages.buttons.enroll,
- icon: 'ui-icon-plus',
- click: function() {
- that.show_add_dialog();
- return false;
- }
- }).appendTo(that.controls);
+ that.add_button = IPA.action_button({
+ label: IPA.messages.buttons.enroll,
+ icon: 'ui-icon-plus',
+ click: function() {
+ that.show_add_dialog();
+ return false;
+ }
+ }).appendTo(that.controls);
+ }
};
that.create_content = function(container) {
diff --git a/install/ui/details.js b/install/ui/details.js
index 44560b5b0..e8033b306 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -324,7 +324,7 @@ IPA.details_facet = function(spec) {
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
var label = IPA.metadata.objects[that.entity_name].label;
- var title = IPA.messages.details.settings;
+ var title = that.title;
title = title.replace('${entity}', label);
title = title.replace('${primary_key}', that.pkey);
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index 604bea907..7d56415c6 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -38,7 +38,7 @@ IPA.entity_factories.entitle = function() {
factory: IPA.entitle.entity,
name: 'entitle'
}).
- facet({
+ search_facet({
factory: IPA.entitle.search_facet,
columns: [
{
diff --git a/install/ui/entity.js b/install/ui/entity.js
index dbee2b32d..22d3eaffc 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -34,6 +34,7 @@ IPA.facet = function (spec) {
that.display_class = spec.display_class || 'entity-facet';
that.name = spec.name;
that.label = spec.label;
+ that.title = spec.title || that.label;
that._entity_name = spec.entity_name;
that.dialogs = [];
@@ -86,13 +87,13 @@ IPA.facet = function (spec) {
that.create_header = function(container) {
- that.title = $('<div/>', {
+ that.title_container = $('<div/>', {
'class': 'facet-title'
}).appendTo(container);
- $('<h1/>').append(IPA.create_network_spinner()).appendTo(that.title);
+ $('<h1/>').append(IPA.create_network_spinner()).appendTo(that.title_container);
- that.set_title(container, that.label);
+ that.set_title(container, that.title);
that.controls = $('<div/>', {
'class': 'facet-controls'
@@ -103,7 +104,7 @@ IPA.facet = function (spec) {
};
that.set_title = function(container, title) {
- var element = $('h1', that.title);
+ var element = $('h1', that.title_container);
element.html(title);
};
@@ -533,13 +534,13 @@ IPA.entity_header = function(spec) {
that.create = function(container) {
- that.title = $('<div/>', {
+ that.title_container = $('<div/>', {
'class': 'entity-title'
}).appendTo(container);
var title_text = $('<h3/>', {
text: that.entity.metadata.label
- }).appendTo(that.title);
+ }).appendTo(that.title_container);
that.pkey = $('<span/>').appendTo(title_text);
@@ -611,8 +612,10 @@ IPA.entity_builder = function(){
that.facet_groups([
'member',
+ 'memberindirect',
'settings',
'memberof',
+ 'memberofindirect',
'managedby'
]);
@@ -658,31 +661,42 @@ IPA.entity_builder = function(){
};
that.facet = function(spec) {
+
spec.entity_name = entity.name;
+
facet = spec.factory(spec);
entity.add_facet(facet);
+
return that;
};
that.search_facet = function(spec) {
- facet = IPA.search_facet({
- entity_name: entity.name,
- search_all: spec.search_all || false,
- columns: spec.columns
- });
+
+ spec.entity_name = entity.name;
+ spec.label = spec.label || IPA.messages.facets.search;
+
+ var factory = spec.factory || IPA.search_facet;
+ facet = factory(spec);
entity.add_facet(facet);
+
return that;
};
that.details_facet = function(spec) {
+
var sections = spec.sections;
spec.sections = null;
spec.entity_name = entity.name;
- facet = IPA.details_facet(spec);
+ spec.label = IPA.messages.details.settings;
+
+ var factory = spec.factory || IPA.details_facet;
+ facet = factory(spec);
entity.add_facet(facet);
- for (var i=0; i<sections.length; i++) {
- that.section(sections[i]);
+ if (sections) {
+ for (var i=0; i<sections.length; i++) {
+ that.section(sections[i]);
+ }
}
return that;
@@ -698,7 +712,24 @@ IPA.entity_builder = function(){
spec.facet_group = spec.facet_group || spec.attribute_member;
- entity.add_facet(IPA.association_facet(spec));
+ if (spec.facet_group == 'memberindirect' || spec.facet_group == 'memberofindirect') {
+ spec.read_only = true;
+ }
+
+ spec.label = spec.label || (IPA.metadata.objects[spec.other_entity] ? IPA.metadata.objects[spec.other_entity].label : spec.other_entity);
+
+ if (!spec.title) {
+ if (spec.facet_group == 'member' || spec.facet_group == 'memberindirect') {
+ spec.title = IPA.messages.association.member;
+
+ } else if (spec.facet_group == 'memberof' || spec.facet_group == 'memberofindirect') {
+ spec.title = IPA.messages.association.memberof;
+ }
+ }
+
+ var factory = spec.factory || IPA.association_facet;
+ facet = factory(spec);
+ entity.add_facet(facet);
return that;
};
@@ -737,14 +768,14 @@ IPA.entity_builder = function(){
that.section = function(spec) {
spec.entity_name = entity.name;
- if (!spec.label){
+ if (!spec.label) {
var obj_messages = IPA.messages.objects[entity.name];
- spec.label = obj_messages[spec.name];
+ spec.label = obj_messages[spec.name];
}
- if (spec.factory){
- section = spec.factory(spec);
- }else{
+ if (spec.factory) {
+ section = spec.factory(spec);
+ } else {
section = IPA.details_list_section(spec);
}
facet.add_section(section);
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index a7e36282c..2b5e66545 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -29,9 +29,8 @@ IPA.entity_factories.hbacrule = function () {
columns:['cn','usercategory','hostcategory','ipaenabledflag',
'servicecategory','sourcehostcategory']
}).
- facet({
- factory: IPA.hbacrule_details_facet,
- 'name': 'details'
+ details_facet({
+ factory: IPA.hbacrule_details_facet
}).
adder_dialog({
fields:[
diff --git a/install/ui/search.js b/install/ui/search.js
index 0047bdd47..dad11f1a9 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -29,8 +29,6 @@ IPA.search_facet = function(spec) {
spec = spec || {};
spec.name = spec.name || 'search';
- spec.label = spec.label || IPA.messages.facets.search;
-
spec.display_class = 'search-facet';
var that = IPA.table_facet(spec);
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index e8489bcb2..0f830acaa 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -30,9 +30,8 @@ IPA.entity_factories.sudorule = function () {
search_facet({
columns:['cn','description','cmdcategory']
}).
- facet({
- factory: IPA.sudorule_details_facet,
- 'name': 'details'
+ details_facet({
+ factory: IPA.sudorule_details_facet
}).
adder_dialog({
fields:['cn']
diff --git a/install/ui/test/data/i18n_messages.json b/install/ui/test/data/i18n_messages.json
index f40cba0ed..7a1d498e0 100644
--- a/install/ui/test/data/i18n_messages.json
+++ b/install/ui/test/data/i18n_messages.json
@@ -9,7 +9,7 @@
"association": {
"add": "Add ${other_entity} into ${entity} ${primary_key}",
"member": "${other_entity} enrolled in ${entity} ${primary_key}",
- "parent": "${entity} ${primary_key} is enrolled in the following ${other_entity}",
+ "memberof": "${entity} ${primary_key} is enrolled in the following ${other_entity}",
"remove": "Remove ${other_entity} from ${entity} ${primary_key}"
},
"buttons": {
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 4e4f06238..84eecba77 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -9963,7 +9963,7 @@
"association": {
"add": "Add ${other_entity} into ${entity} ${primary_key}",
"member": "${other_entity} enrolled in ${entity} ${primary_key}",
- "parent": "${entity} ${primary_key} is enrolled in the following ${other_entity}",
+ "memberof": "${entity} ${primary_key} is enrolled in the following ${other_entity}",
"remove": "Remove ${other_entity} from ${entity} ${primary_key}"
},
"buttons": {