summaryrefslogtreecommitdiffstats
path: root/install/ui/ipa.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-05-16 22:23:20 -0500
committerAdam Young <ayoung@redhat.com>2011-05-20 12:11:47 -0400
commit46137fdf898690836ae61e54b1cb2711492287f3 (patch)
treeb64b936fca3f738bdd19862113d8005b72e4eb82 /install/ui/ipa.js
parent00abd47de4d3238295cbe5dc30210b913c0f07a1 (diff)
downloadfreeipa.git-46137fdf898690836ae61e54b1cb2711492287f3.tar.gz
freeipa.git-46137fdf898690836ae61e54b1cb2711492287f3.tar.xz
freeipa.git-46137fdf898690836ae61e54b1cb2711492287f3.zip
jQuery ordered map.
The ordered map is a jQuery extension for creating a collection which can be accessed both as an ordered list and as a map. This collection can be used to store various objects including entities, fields, columns, and dialogs. A test suite for this class has been added as well. Ticket #1232
Diffstat (limited to 'install/ui/ipa.js')
-rw-r--r--install/ui/ipa.js22
1 files changed, 7 insertions, 15 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index c21c16ec..f2ffcf1d 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -1,3 +1,4 @@
+/*jsl:import jquery.ordered-map.js */
/* Authors:
* Pavel Zuna <pzuna@redhat.com>
* Adam Young <ayoung@redhat.com>
@@ -21,6 +22,7 @@
*/
+/* REQUIRES: jquery.ordered-map.js */
/*global $:true, location:true */
var IPA = ( function () {
@@ -47,11 +49,9 @@ var IPA = ( function () {
that.messages = {};
that.whoami = {};
- that.entities = [];
+ that.entities = $.ordered_map();
that.entity_factories = {};
- that.entities_by_name = {};
-
that.layout = $.bbq.getState('layout');
that.layouts_dir = 'layouts';
@@ -127,27 +127,19 @@ var IPA = ( function () {
};
that.get_entities = function() {
- return that.entities;
+ return that.entities.values;
};
that.get_entity = function(name) {
- return that.entities_by_name[name];
+ return that.entities.get(name);
};
that.add_entity = function(entity) {
- that.entities.push(entity);
- that.entities_by_name[entity.name] = entity;
+ that.entities.put(entity.name, entity);
};
that.remove_entity = function(name) {
- for (var i=0; i<that.entities.length; i++) {
- var entity = that.entities[i];
- if (name == entity.name) {
- that.entities.splice(i, 1);
- break;
- }
- }
- delete that.entities_by_name[entity.name];
+ that.entities.remove(name);
};
that.start_entities = function() {