*
* Copyright (C) 2010-2011 Red Hat
* see file 'COPYING' for use and warranty information
@@ -23,442 +25,9 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js */
+/* REQUIRES: ipa.js, facet.js, details.js, search.js, add.js */
-IPA.facet = function (spec) {
-
- spec = spec || {};
-
- var that = {};
-
- that.entity = spec.entity;
-
- that.name = spec.name;
- that.label = spec.label;
- that.title = spec.title || that.label;
- that.display_class = spec.display_class;
-
- that.disable_breadcrumb = spec.disable_breadcrumb;
- that.disable_facet_tabs = spec.disable_facet_tabs;
-
- that.header = spec.header || IPA.facet_header({ facet: that });
-
- that.entity_name = spec.entity_name;
- that._needs_update = spec.needs_update;
-
- that.dialogs = $.ordered_map();
-
- // facet group name
- that.facet_group = spec.facet_group;
-
- that.state = {};
-
- that.get_dialog = function(name) {
- return that.dialogs.get(name);
- };
-
- that.dialog = function(dialog) {
- that.dialogs.put(dialog.name, dialog);
- return that;
- };
-
- that.create = function(container) {
-
- that.container = container;
-
- if (that.disable_facet_tabs) that.container.addClass('no-facet-tabs');
- that.container.addClass(that.display_class);
-
- that.header_container = $('', {
- 'class': 'facet-header'
- }).appendTo(container);
- that.create_header(that.header_container);
-
- that.content = $('', {
- 'class': 'facet-content'
- }).appendTo(container);
- that.create_content(that.content);
- };
-
- that.create_header = function(container) {
-
- that.header.create(container);
-
- that.controls = $('', {
- 'class': 'facet-controls'
- }).appendTo(container);
- };
-
- that.create_content = function(container) {
- };
-
- that.set_title = function(container, title) {
- var element = $('h1', that.title_container);
- element.html(title);
- };
-
- that.show = function() {
- that.container.css('display', 'block');
- };
-
- that.hide = function() {
- that.container.css('display', 'none');
- };
-
- that.load = function(data) {
- that.data = data;
- that.header.load(data);
- };
-
- that.clear = function() {
- };
-
- that.needs_update = function() {
- if (that._needs_update !== undefined) return that._needs_update;
- return true;
- };
-
- that.is_dirty = function() {
- return false;
- };
-
- that.report_error = function(error_thrown) {
- // TODO: The error message should be displayed in the facet footer.
- // There should be a standard footer section for all facets.
- that.content.empty();
- that.content.append(''+IPA.get_message('errors.error', 'Error')+': '+error_thrown.name+'
');
- that.content.append(''+error_thrown.message+'
');
- };
-
- that.redirect = function() {
- var entity = that.entity;
- while (entity.containing_entity) {
- entity = entity.get_containing_entity();
- }
-
- IPA.nav.show_page(
- entity.name,
- that.entity.redirect_facet);
- };
-
- var redirect_errors = [4001];
-
- that.on_error = function(xhr, text_status, error_thrown) {
-
- /*If the error is in talking to the server, don't attempt to redirect,
- as there is nothing any other facet can do either. */
- if (that.entity.redirect_facet) {
- for (var i=0; i', {
- 'class': 'breadcrumb-element',
- text: IPA.nav.get_state(entity.name+'-pkey'),
- title: entity.metadata.label_singular,
- click: function(entity) {
- return function() {
- IPA.nav.show_page(entity.name, 'default');
- return false;
- };
- }(entity)
- }));
-
- entity = entity.get_containing_entity();
- }
-
- that.path.empty();
-
- for (var i=0; i', {
- 'class': 'breadcrumb-element',
- text: value
- }).appendTo(that.path);
- }
-
- that.title_container.empty();
- var h3 = $('').appendTo(that.title_container);
- h3.append(that.facet.title);
- h3.append(': ');
-
- $('', {
- 'class': 'facet-pkey',
- text: value
- }).appendTo(h3);
- };
-
- that.create_facet_link = function(container, other_facet) {
-
- var li = $('', {
- name: other_facet.name,
- title: other_facet.name,
- click: function() {
- if (li.hasClass('entity-facet-disabled')) {
- return false;
- }
-
- var pkey = IPA.nav.get_state(that.facet.entity.name+'-pkey');
- IPA.nav.show_page(that.facet.entity.name, other_facet.name, pkey);
-
- return false;
- }
- }).appendTo(container);
-
- $('', {
- text: other_facet.label,
- id: other_facet.name
- }).appendTo(li);
- };
-
- that.create_facet_group = function(container, facet_group) {
-
- var section = $('', {
- name: facet_group.name,
- 'class': 'facet-group'
- }).appendTo(container);
-
- $('', {
- 'class': 'facet-group-label'
- }).appendTo(section);
-
- var ul = $('', {
- 'class': 'facet-tab'
- }).appendTo(section);
-
- var facets = facet_group.facets.values;
- for (var i=0; i', {
- 'class': 'breadcrumb'
- }).appendTo(container);
-
- that.back_link = $('', {
- 'class': 'back-link'
- }).appendTo(that.breadcrumb);
-
- var entity = that.facet.entity;
- while (entity.containing_entity) {
- entity = entity.get_containing_entity();
- }
-
- $('', {
- text: entity.metadata.label,
- click: function() {
- that.facet.redirect();
- return false;
- }
- }).appendTo(that.back_link);
-
-
- that.path = $('', {
- 'class': 'path'
- }).appendTo(that.breadcrumb);
- }
-
- that.title_container = $('', {
- 'class': 'facet-title'
- }).appendTo(container);
-
- var span = $('', {
- text: that.facet.entity.metadata.label
- }).appendTo(that.title_container);
-
- if (!that.facet.disable_facet_tabs) {
- that.facet_tabs = $('', {
- 'class': 'facet-tabs'
- }).appendTo(container);
-
- var facet_groups = that.facet.entity.facet_groups.values;
- for (var i=0; i -1) {
- return true;
- }
- }
- return false;
- };
-
- init();
-
- return that;
-};
-
IPA.dialog_builder = function(entity) {
var that = {};
diff --git a/install/ui/facet.js b/install/ui/facet.js
new file mode 100644
index 000000000..5b6d964df
--- /dev/null
+++ b/install/ui/facet.js
@@ -0,0 +1,588 @@
+/*jsl:import ipa.js */
+
+/* Authors:
+ * Pavel Zuna
+ * Endi Sukma Dewata
+ * Adam Young
+ * Petr Vobornik
+ *
+ * Copyright (C) 2010-2011 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/* REQUIRES: ipa.js, details.js, search.js, add.js */
+
+IPA.facet = function(spec) {
+
+ spec = spec || {};
+
+ var that = {};
+
+ that.entity = spec.entity;
+
+ that.name = spec.name;
+ that.label = spec.label;
+ that.title = spec.title || that.label;
+ that.display_class = spec.display_class;
+
+ that.disable_breadcrumb = spec.disable_breadcrumb;
+ that.disable_facet_tabs = spec.disable_facet_tabs;
+
+ that.header = spec.header || IPA.facet_header({ facet: that });
+
+ that.entity_name = spec.entity_name;
+ that._needs_update = spec.needs_update;
+
+ that.dialogs = $.ordered_map();
+
+ // facet group name
+ that.facet_group = spec.facet_group;
+
+ that.state = {};
+
+ that.get_dialog = function(name) {
+ return that.dialogs.get(name);
+ };
+
+ that.dialog = function(dialog) {
+ that.dialogs.put(dialog.name, dialog);
+ return that;
+ };
+
+ that.create = function(container) {
+
+ that.container = container;
+
+ if (that.disable_facet_tabs) that.container.addClass('no-facet-tabs');
+ that.container.addClass(that.display_class);
+
+ that.header_container = $('', {
+ 'class': 'facet-header'
+ }).appendTo(container);
+ that.create_header(that.header_container);
+
+ that.content = $('', {
+ 'class': 'facet-content'
+ }).appendTo(container);
+ that.create_content(that.content);
+ };
+
+ that.create_header = function(container) {
+
+ that.header.create(container);
+
+ that.controls = $('', {
+ 'class': 'facet-controls'
+ }).appendTo(container);
+ };
+
+ that.create_content = function(container) {
+ };
+
+ that.set_title = function(container, title) {
+ var element = $('h1', that.title_container);
+ element.html(title);
+ };
+
+ that.show = function() {
+ that.container.css('display', 'block');
+ };
+
+ that.hide = function() {
+ that.container.css('display', 'none');
+ };
+
+ that.load = function(data) {
+ that.data = data;
+ that.header.load(data);
+ };
+
+ that.clear = function() {
+ };
+
+ that.needs_update = function() {
+ if (that._needs_update !== undefined) return that._needs_update;
+ return true;
+ };
+
+ that.is_dirty = function() {
+ return false;
+ };
+
+ that.report_error = function(error_thrown) {
+ // TODO: The error message should be displayed in the facet footer.
+ // There should be a standard footer section for all facets.
+ that.content.empty();
+ that.content.append(''+IPA.get_message('errors.error', 'Error')+': '+error_thrown.name+'
');
+ that.content.append(''+error_thrown.message+'
');
+ };
+
+ that.redirect = function() {
+ var entity = that.entity;
+ while (entity.containing_entity) {
+ entity = entity.get_containing_entity();
+ }
+
+ IPA.nav.show_page(
+ entity.name,
+ that.entity.redirect_facet);
+ };
+
+ var redirect_errors = [4001];
+
+ that.on_error = function(xhr, text_status, error_thrown) {
+
+ /*If the error is in talking to the server, don't attempt to redirect,
+ as there is nothing any other facet can do either. */
+ if (that.entity.redirect_facet) {
+ for (var i=0; i', {
+ 'class': 'breadcrumb-element',
+ text: IPA.nav.get_state(entity.name+'-pkey'),
+ title: entity.metadata.label_singular,
+ click: function(entity) {
+ return function() {
+ IPA.nav.show_page(entity.name, 'default');
+ return false;
+ };
+ }(entity)
+ }));
+
+ entity = entity.get_containing_entity();
+ }
+
+ that.path.empty();
+
+ for (var i=0; i', {
+ 'class': 'breadcrumb-element',
+ text: value
+ }).appendTo(that.path);
+ }
+
+ that.title_container.empty();
+ var h3 = $('').appendTo(that.title_container);
+ h3.append(that.facet.title);
+ h3.append(': ');
+
+ $('', {
+ 'class': 'facet-pkey',
+ text: value
+ }).appendTo(h3);
+ };
+
+ that.create_facet_link = function(container, other_facet) {
+
+ var li = $('', {
+ name: other_facet.name,
+ title: other_facet.name,
+ click: function() {
+ if (li.hasClass('entity-facet-disabled')) {
+ return false;
+ }
+
+ var pkey = IPA.nav.get_state(that.facet.entity.name+'-pkey');
+ IPA.nav.show_page(that.facet.entity.name, other_facet.name, pkey);
+
+ return false;
+ }
+ }).appendTo(container);
+
+ $('', {
+ text: other_facet.label,
+ id: other_facet.name
+ }).appendTo(li);
+ };
+
+ that.create_facet_group = function(container, facet_group) {
+
+ var section = $('', {
+ name: facet_group.name,
+ 'class': 'facet-group'
+ }).appendTo(container);
+
+ $('', {
+ 'class': 'facet-group-label'
+ }).appendTo(section);
+
+ var ul = $('', {
+ 'class': 'facet-tab'
+ }).appendTo(section);
+
+ var facets = facet_group.facets.values;
+ for (var i=0; i', {
+ 'class': 'breadcrumb'
+ }).appendTo(container);
+
+ that.back_link = $('', {
+ 'class': 'back-link'
+ }).appendTo(that.breadcrumb);
+
+ var entity = that.facet.entity;
+ while (entity.containing_entity) {
+ entity = entity.get_containing_entity();
+ }
+
+ $('', {
+ text: entity.metadata.label,
+ click: function() {
+ that.facet.redirect();
+ return false;
+ }
+ }).appendTo(that.back_link);
+
+
+ that.path = $('', {
+ 'class': 'path'
+ }).appendTo(that.breadcrumb);
+ }
+
+ that.title_container = $('', {
+ 'class': 'facet-title'
+ }).appendTo(container);
+
+ var span = $('', {
+ text: that.facet.entity.metadata.label
+ }).appendTo(that.title_container);
+
+ if (!that.facet.disable_facet_tabs) {
+ that.facet_tabs = $('', {
+ 'class': 'facet-tabs'
+ }).appendTo(container);
+
+ var facet_groups = that.facet.entity.facet_groups.values;
+ for (var i=0; i -1) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ init();
+
+ return that;
+};
diff --git a/install/ui/group.js b/install/ui/group.js
index 8c18c14a2..418724e87 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -22,7 +22,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.group = function () {
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index e8c106ac7..4199c269f 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -21,7 +21,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.hbacrule = function() {
return IPA.entity_builder().
diff --git a/install/ui/host.js b/install/ui/host.js
index b1d16e645..fe0829414 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -22,7 +22,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.host = function () {
diff --git a/install/ui/hostgroup.js b/install/ui/hostgroup.js
index ef669960c..f01e5b5e8 100644
--- a/install/ui/hostgroup.js
+++ b/install/ui/hostgroup.js
@@ -20,7 +20,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.hostgroup = function() {
diff --git a/install/ui/index.html b/install/ui/index.html
index 5fc4c61ff..d1aab0c47 100644
--- a/install/ui/index.html
+++ b/install/ui/index.html
@@ -17,6 +17,7 @@
+
diff --git a/install/ui/jsl.conf b/install/ui/jsl.conf
index 09db97120..675e4b6c1 100644
--- a/install/ui/jsl.conf
+++ b/install/ui/jsl.conf
@@ -133,6 +133,7 @@
+process details.js
+process add.js
+process association.js
++process facet.js
+process entity.js
+process navigation.js
+process rule.js
diff --git a/install/ui/netgroup.js b/install/ui/netgroup.js
index 2b95c661b..a99c6c7ef 100644
--- a/install/ui/netgroup.js
+++ b/install/ui/netgroup.js
@@ -20,7 +20,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.netgroup = function() {
diff --git a/install/ui/policy.js b/install/ui/policy.js
index f773c4714..8a0571394 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -21,7 +21,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
/**pwpolicy*/
IPA.entity_factories.pwpolicy = function() {
diff --git a/install/ui/rule.js b/install/ui/rule.js
index 9744b0f2b..2ccdecd40 100644
--- a/install/ui/rule.js
+++ b/install/ui/rule.js
@@ -20,7 +20,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.rule_details_section = function(spec) {
diff --git a/install/ui/serverconfig.js b/install/ui/serverconfig.js
index eec47d2f7..be2a3df94 100644
--- a/install/ui/serverconfig.js
+++ b/install/ui/serverconfig.js
@@ -21,7 +21,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
diff --git a/install/ui/service.js b/install/ui/service.js
index 847641940..5f88f8f10 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -21,7 +21,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.service = function() {
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 3c581387e..1c79e0336 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -20,7 +20,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.sudorule = function() {
diff --git a/install/ui/test/aci_tests.html b/install/ui/test/aci_tests.html
index 4b024ec10..a89a97e23 100755
--- a/install/ui/test/aci_tests.html
+++ b/install/ui/test/aci_tests.html
@@ -17,6 +17,7 @@
+
diff --git a/install/ui/test/all_tests.html b/install/ui/test/all_tests.html
index 7af7e02b3..7c8b0dffb 100644
--- a/install/ui/test/all_tests.html
+++ b/install/ui/test/all_tests.html
@@ -14,6 +14,7 @@
+
diff --git a/install/ui/test/details_tests.html b/install/ui/test/details_tests.html
index e83e70e24..cce259de6 100644
--- a/install/ui/test/details_tests.html
+++ b/install/ui/test/details_tests.html
@@ -12,6 +12,7 @@
+
diff --git a/install/ui/test/entity_tests.html b/install/ui/test/entity_tests.html
index bd48db205..1b4918890 100644
--- a/install/ui/test/entity_tests.html
+++ b/install/ui/test/entity_tests.html
@@ -15,6 +15,7 @@
+
diff --git a/install/ui/test/navigation_tests.html b/install/ui/test/navigation_tests.html
index 3a4e6f7d4..9d7f1d0d9 100644
--- a/install/ui/test/navigation_tests.html
+++ b/install/ui/test/navigation_tests.html
@@ -9,6 +9,7 @@
+
diff --git a/install/ui/user.js b/install/ui/user.js
index eade0bbd2..8e2205686 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -21,7 +21,7 @@
* along with this program. If not, see .
*/
-/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
+/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.entity_factories.user = function() {