summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install/ui/add.js2
-rw-r--r--install/ui/association.js79
-rw-r--r--install/ui/dialog.js2
-rw-r--r--install/ui/entity.js29
-rw-r--r--install/ui/group.js2
-rw-r--r--install/ui/hbac.js21
-rw-r--r--install/ui/host.js22
-rw-r--r--install/ui/navigation.js2
-rw-r--r--install/ui/search.js28
-rw-r--r--install/ui/service.js22
-rw-r--r--install/ui/sudo.js4
-rw-r--r--install/ui/user.js21
-rw-r--r--install/ui/webui.js7
-rw-r--r--install/ui/widget.js34
14 files changed, 98 insertions, 177 deletions
diff --git a/install/ui/add.js b/install/ui/add.js
index 33df62abc..cde6d335b 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -83,7 +83,7 @@ IPA.add_dialog = function (spec) {
pkey = pkey[0];
}
- IPA.nav.show_page(that.entity_name, 'details', pkey);
+ IPA.nav.show_page(that.entity_name, 'default', pkey);
}
);
});
diff --git a/install/ui/association.js b/install/ui/association.js
index 2115e0fe1..8030631b4 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -277,25 +277,6 @@ IPA.association_config = function (spec) {
return that;
};
-
-IPA.association_pkey_setup = function (container, record) {
- var other_entity = this.entity_name;
- container.empty();
- var value = record[this.name];
- value = value ? value.toString() : '';
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- IPA.nav.show_page(other_entity, 'default', value);
- return false;
- };
- }(value)
- }).appendTo(container);
-};
-
-
IPA.association_table_widget = function (spec) {
spec = spec || {};
@@ -325,14 +306,6 @@ IPA.association_table_widget = function (spec) {
return column;
};
- that.super_create_column = that.create_column;
-
- that.create_column = function(spec){
- if (spec.link_entity){
- spec.setup = IPA.association_pkey_setup;
- }
- return that.super_create_column(spec);
- };
/*this is duplicated in the facet... should be unified*/
var i;
if (spec.columns){
@@ -363,6 +336,13 @@ IPA.association_table_widget = function (spec) {
for (var i=0; i<columns.length; i++) {
column = columns[i];
column.entity_name = that.other_entity;
+
+ if (column.link) {
+ column.link_handler = function(value) {
+ IPA.nav.show_page(that.other_entity, 'default', value);
+ return false;
+ };
+ }
}
var adder_columns = that.adder_columns.values;
@@ -698,6 +678,7 @@ IPA.association_facet = function (spec) {
that.facet_group = spec.facet_group;
that.read_only = spec.read_only;
+ that.link = spec.link === undefined ? true : spec.link;
that.associator = spec.associator || IPA.bulk_associator;
that.add_method = spec.add_method || 'add_member';
@@ -718,9 +699,6 @@ IPA.association_facet = function (spec) {
that.create_column = function(spec) {
var column = IPA.column(spec);
- if (spec.link_entity){
- column.setup = IPA.association_pkey_setup;
- }
that.add_column(column);
return column;
};
@@ -775,39 +753,26 @@ IPA.association_facet = function (spec) {
});
var columns = that.columns.values;
- if (columns.length) {
- that.table.set_columns(columns);
-
- } else {
-
- column = that.table.create_column({
- name: that.table.name,
- label: IPA.metadata.objects[that.other_entity].label,
- primary_key: true
+ if (!columns.length) {
+ that.create_column({
+ name: pkey_name,
+ primary_key: true,
+ link: that.link
});
-
- column.setup = function(container, record) {
- container.empty();
-
- var value = record[column.name];
- value = value ? value.toString() : '';
-
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- IPA.nav.show_page(that.other_entity, 'default', value);
- return false;
- };
- }(value)
- }).appendTo(container);
- };
}
+ that.table.set_columns(columns);
+
for (i=0; i<columns.length; i++) {
column = columns[i];
column.entity_name = that.other_entity;
+
+ if (column.link) {
+ column.link_handler = function(value) {
+ IPA.nav.show_page(that.other_entity, 'default', value);
+ return false;
+ };
+ }
}
var adder_columns = that.adder_columns.values;
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 3bcb4556d..ebd6c9968 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -526,6 +526,7 @@ IPA.adder_dialog = function (spec) {
'label': button.val(),
'click': function() {
that.remove();
+ return false;
}
});
button.replaceWith(that.remove_button);
@@ -535,6 +536,7 @@ IPA.adder_dialog = function (spec) {
'label': button.val(),
'click': function() {
that.add();
+ return false;
}
});
button.replaceWith(that.add_button);
diff --git a/install/ui/entity.js b/install/ui/entity.js
index 599bd2eec..783cfcbda 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -819,32 +819,29 @@ IPA.entity_builder = function(){
return that;
};
- that.standard_association_facets = function() {
+ that.standard_association_facets = function(spec) {
+
+ spec = spec || {};
var attribute_members = entity.metadata.attribute_members;
for (var attribute_member in attribute_members) {
- that.association_facets(attribute_member);
- }
-
- return that;
- };
- that.association_facets = function(attribute_member) {
+ var other_entities = entity.metadata.attribute_members[attribute_member];
- var other_entities = entity.metadata.attribute_members[attribute_member];
+ for (var i=0; i<other_entities.length; i++) {
- for (var i=0; i<other_entities.length; i++) {
+ var other_entity = other_entities[i];
+ var association_name = attribute_member+'_'+other_entity;
- var other_entity = other_entities[i];
- var association_name = attribute_member+'_'+other_entity;
+ var facet = entity.get_facet(association_name);
+ if (facet) continue;
- var facet = entity.get_facet(association_name);
- if (facet) continue;
+ var tmp_spec = $.extend({}, spec);
+ tmp_spec.name = association_name;
- that.association_facet({
- name: association_name
- });
+ that.association_facet(tmp_spec);
+ }
}
return that;
diff --git a/install/ui/group.js b/install/ui/group.js
index bc7925dc0..fbe89a4fd 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -42,7 +42,7 @@ IPA.entity_factories.group = function () {
{
name: 'uid',
primary_key: true,
- link_entity: true
+ link: true
},
{name: 'uidnumber'},
{name: 'mail'},
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index f18024e12..01370ec70 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -106,27 +106,10 @@ IPA.hbacsvcgroup_member_hbacsvc_table_widget = function (spec) {
var column = that.create_column({
name: 'cn',
primary_key: true,
- width: '150px'
+ width: '150px',
+ link: true
});
- column.setup = function(container, record) {
- container.empty();
-
- var value = record[column.name];
- value = value ? value.toString() : '';
-
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- IPA.nav.show_page(that.other_entity, 'details', value);
- return false;
- };
- }(value)
- }).appendTo(container);
- };
-
that.create_column({
name: 'description',
width: '350px'
diff --git a/install/ui/host.js b/install/ui/host.js
index cece90d11..fe35e0f1f 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -365,34 +365,16 @@ IPA.host_managedby_host_facet = function (spec) {
var column = that.create_column({
name: 'fqdn',
- primary_key: true
+ primary_key: true,
+ link: true
});
- column.setup = function(container, record) {
- container.empty();
-
- var value = record[column.name];
- value = value ? value.toString() : '';
-
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- IPA.nav.show_page(that.other_entity, 'details', value);
- return false;
- };
- }(value)
- }).appendTo(container);
- };
-
that.create_adder_column({
name: 'fqdn',
primary_key: true,
width: '200px'
});
-
that.association_facet_init();
};
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 875f4056c..8e332cf67 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -27,6 +27,8 @@ IPA.navigation = function(spec) {
var that = {};
+ that.name = spec.name;
+
that.container = spec.container;
that.content = spec.content;
that.tab_class = spec.tab_class || 'tabs';
diff --git a/install/ui/search.js b/install/ui/search.js
index 5a9b14f05..9d6e51369 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -51,26 +51,6 @@ IPA.search_facet = function(spec) {
that.init_table = function(entity){
- function setup_column(column,entity) {
- column.setup = function(container, record) {
- container.empty();
-
- var value = record[column.name];
- value = value ? value.toString() : '';
-
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- IPA.nav.show_page(entity.name, 'default', value);
- return false;
- };
- }(value)
- }).appendTo(container);
- };
- }
-
that.table = IPA.table_widget({
id: entity.name+'-search',
'class': 'content-table',
@@ -88,9 +68,13 @@ IPA.search_facet = function(spec) {
var param_info = IPA.get_entity_param(entity.name, column.name);
column.primary_key = param_info && param_info['primary_key'];
+ column.link = column.primary_key;
- if (column.primary_key) {
- setup_column(column,entity);
+ if (column.link) {
+ column.link_handler = function(value) {
+ IPA.nav.show_page(entity.name, 'default', value);
+ return false;
+ };
}
that.table.add_column(column);
diff --git a/install/ui/service.js b/install/ui/service.js
index 9b9b1d59b..7af80c7ee 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -355,28 +355,10 @@ IPA.service_managedby_host_facet = function(spec) {
var column = that.create_column({
name: 'fqdn',
- primary_key: true
+ primary_key: true,
+ link: true
});
- column.setup = function(container, record) {
- container.empty();
-
- var value = record[column.name];
- value = value ? value.toString() : '';
-
- $('<a/>', {
- 'href': '#'+value,
- 'html': value,
- 'click': function (value) {
- return function() {
- IPA.nav.show_page(that.other_entity, 'details', value);
- return false;
- };
- }(value)
- }).appendTo(container);
- };
-
-
that.create_adder_column({
name: 'fqdn',
primary_key: true,
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 9624ae824..b3882b05f 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -66,7 +66,7 @@ IPA.entity_factories.sudocmd = function () {
name: 'cn',
primary_key: true,
width: '150px',
- link_entity: true
+ link: true
},
{
name: 'description',
@@ -120,7 +120,7 @@ IPA.entity_factories.sudocmdgroup = function () {
name: 'sudocmd',
primary_key: true,
width: '150px',
- link_entity: true
+ link: true
},
{
name: 'description',
diff --git a/install/ui/user.js b/install/ui/user.js
index 63c2ec4c8..8a8f9443d 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -26,6 +26,11 @@
IPA.entity_factories.user = function() {
+ var link = true;
+ if (IPA.nav && IPA.nav.name == 'self-service') {
+ link = false;
+ }
+
var builder = IPA.entity_builder();
builder.
@@ -90,17 +95,22 @@ IPA.entity_factories.user = function() {
}]}).
association_facet({
name: 'memberof_group',
- associator: IPA.serial_associator
+ associator: IPA.serial_associator,
+ link: link
}).
association_facet({
name: 'memberof_netgroup',
- associator: IPA.serial_associator
+ associator: IPA.serial_associator,
+ link: link
}).
association_facet({
name: 'memberof_role',
- associator: IPA.serial_associator
+ associator: IPA.serial_associator,
+ link: link
+ }).
+ standard_association_facets({
+ link: link
}).
- standard_association_facets().
adder_dialog({
fields: ['uid', 'givenname', 'sn']
});
@@ -108,9 +118,6 @@ IPA.entity_factories.user = function() {
return builder.build();
};
-/* ATTRIBUTE CALLBACKS */
-
-
IPA.user_status_widget = function(spec) {
spec = spec || {};
diff --git a/install/ui/webui.js b/install/ui/webui.js
index 94c20d4a9..c014cea72 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -30,6 +30,8 @@ IPA.admin_navigation = function(spec) {
spec = spec || {};
+ spec.name = 'admin';
+
spec.tabs = [
{name: 'identity', label: IPA.messages.tabs.identity, children: [
{entity: 'user'},
@@ -79,10 +81,11 @@ IPA.self_serv_navigation = function(spec) {
spec = spec || {};
+ spec.name = 'self-service';
+
spec.tabs = [
{name: 'identity', label: IPA.messages.tabs.identity, children: [
- {entity: 'user'},
- {entity: 'group'}
+ {entity: 'user'}
]}];
var that = IPA.navigation(spec);
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 1af9fd839..3e31b4c4a 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1014,39 +1014,53 @@ IPA.column = function (spec) {
that.name = spec.name;
that.label = spec.label;
- that.primary_key = spec.primary_key;
that.width = spec.width;
+
that.entity_name = spec.entity_name;
- that.format = spec.format;
+ that.primary_key = spec.primary_key;
+ that.link = spec.link;
- that.setup = spec.setup || setup;
+ that.format = spec.format;
that.init = function() {
if (that.entity_name && !that.label) {
var param_info = IPA.get_entity_param(that.entity_name, that.name);
if (param_info) {
that.label = param_info.label;
- }else{
+ } else {
alert('cannot find label for ' + that.entity_name + ' ' +
that.name);
}
}
};
- function setup(container, record) {
-
+ that.setup = function(container, record) {
container.empty();
var value = record[that.name];
- if (that.format && value){
+ if (that.format && value) {
value = that.format(value);
}
-
value = value ? value.toString() : '';
+ if (that.link) {
+ $('<a/>', {
+ href: '#'+value,
+ html: value,
+ click: function() {
+ return that.link_handler(value);
+ }
+ }).appendTo(container);
+
+ } else {
+ container.append(value);
+ }
+
+ };
- container.append(value);
- }
+ that.link_handler = function(value) {
+ return false;
+ };
return that;
};