summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install/ui/ipa.js31
-rw-r--r--install/ui/test/details_tests.js1
-rw-r--r--install/ui/test/entity_tests.js1
-rw-r--r--install/ui/test/navigation_tests.js9
-rw-r--r--install/ui/webui.js2
5 files changed, 18 insertions, 26 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index 8f11b92df..13c894fa6 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -131,31 +131,28 @@ var IPA = ( function () {
};
that.get_entity = function(name) {
- return that.entities.get(name);
- };
-
- that.add_entity = function(entity) {
- that.entities.put(entity.name, entity);
- };
-
- that.remove_entity = function(name) {
- that.entities.remove(name);
- };
-
- that.start_entities = function() {
- var factory;
- var name;
- for (name in that.entity_factories) {
- factory = that.entity_factories[name];
+ var entity = that.entities.get(name);
+ if (!entity){
+ var factory = that.entity_factories[name];
try {
- var entity = factory();
+ entity = factory();
that.add_entity(entity);
entity.init();
} catch (e) {
/*exceptions thrown by builder just mean that entities
are not to be registered. */
+ return null;
}
}
+ return entity;
+ };
+
+ that.add_entity = function(entity) {
+ that.entities.put(entity.name, entity);
+ };
+
+ that.remove_entity = function(name) {
+ that.entities.remove(name);
};
that.test_dirty = function(){
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 8f98f1fef..ca4658f87 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -43,7 +43,6 @@ module('details', {
return IPA.entity({name:obj_name,
metadata:IPA.metadata.objects.user});
};
- IPA.start_entities();
},
teardown: function() {
details_container.remove();
diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js
index c258976f8..41e4d5e47 100644
--- a/install/ui/test/entity_tests.js
+++ b/install/ui/test/entity_tests.js
@@ -39,7 +39,6 @@ module('entity',{
columns:['uid']}).
build();
};
- IPA.start_entities();
},
function(xhr, text_status, error_thrown) {
ok(false, "ipa_init() failed: "+error_thrown);
diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js
index 0f8f1be4a..d9bcc8eb6 100644
--- a/install/ui/test/navigation_tests.js
+++ b/install/ui/test/navigation_tests.js
@@ -20,6 +20,7 @@
module('navigation', {
+
setup: function() {
IPA.ajax_options.async = false;
IPA.init(
@@ -32,11 +33,14 @@ module('navigation', {
}
);
}
+
});
test("Testing IPA.navigation.create().", function() {
var entity;
+ var user_mock_called = false;
+ var group_mock_called = false;
IPA.entity_factories.user = function() {
var that = IPA.entity({name: 'user',
@@ -59,13 +63,8 @@ test("Testing IPA.navigation.create().", function() {
return that;
};
- IPA.start_entities();
-
- IPA.metadata = {};
var navigation_container = $('<div id="navigation"/>').appendTo(document.body);
var entity_container = $('<div id="content"/>').appendTo(document.body);
- var user_mock_called = false;
- var group_mock_called = false;
var navigation = IPA.navigation({
container: navigation_container,
diff --git a/install/ui/webui.js b/install/ui/webui.js
index b9d050c29..00c35b459 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -143,8 +143,6 @@ $(function() {
$('#loggedinas a').fragment(
{'user-facet': 'details', 'user-pkey': IPA.whoami_pkey}, 2);
- IPA.start_entities();
-
IPA.nav = create_navigation();
IPA.nav.create();
IPA.nav.update();