summaryrefslogtreecommitdiffstats
path: root/install/ui/add.js
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2011-11-18 19:47:39 -0600
committerEndi S. Dewata <edewata@redhat.com>2011-12-06 22:08:07 +0000
commitcaa9d52666e5beb7321dc6c80820eeacca356077 (patch)
tree01b91c26442e559632afbf652968c0dbd9c0291b /install/ui/add.js
parenta8ea42bda841c8773d68886614faf9efd38e33bd (diff)
downloadfreeipa-caa9d52666e5beb7321dc6c80820eeacca356077.tar.gz
freeipa-caa9d52666e5beb7321dc6c80820eeacca356077.tar.xz
freeipa-caa9d52666e5beb7321dc6c80820eeacca356077.zip
Refactored facet.load().
The load() in IPA.facet has been modified to accept the complete data returned by the server instead of just the result. This is needed by HBAC Test to access other attributes returned in the test result. Ticket #388
Diffstat (limited to 'install/ui/add.js')
-rw-r--r--install/ui/add.js32
1 files changed, 17 insertions, 15 deletions
diff --git a/install/ui/add.js b/install/ui/add.js
index 032302e30..c1031f8b3 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -30,7 +30,6 @@ IPA.entity_adder_dialog = function(spec) {
var that = IPA.dialog(spec);
that.method = spec.method || 'add';
- that.pre_execute_hook = spec.pre_execute_hook;
that.on_error = spec.on_error ;
that.retry = typeof spec.retry !== 'undefined' ? spec.retry : true;
that.command = null;
@@ -107,26 +106,18 @@ IPA.entity_adder_dialog = function(spec) {
IPA.nav.show_entity_page(that.entity, 'default', pkey);
}
- that.add = function(on_success, on_error) {
+ that.create_add_command = function(record) {
var pkey_name = that.entity.metadata.primary_key;
var command = IPA.command({
entity: that.entity.name,
method: that.method,
- retry: that.retry,
- on_success: on_success,
- on_error: on_error
+ retry: that.retry
});
- that.command = command;
command.add_args(that.entity.get_primary_key_prefix());
- if (!that.validate()) return;
-
- var record = {};
- that.save(record);
-
var fields = that.fields.get_fields();
for (var j=0; j<fields.length; j++) {
var field = fields[j];
@@ -145,11 +136,21 @@ IPA.entity_adder_dialog = function(spec) {
}
}
- if (that.pre_execute_hook) {
- that.pre_execute_hook(command);
- }
+ return command;
+ };
+
+ that.add = function(on_success, on_error) {
+
+ if (!that.validate()) return;
+
+ var record = {};
+ that.save(record);
+
+ that.command = that.create_add_command(record);
+ that.command.on_success = on_success;
+ that.command.on_error = on_error;
- command.execute();
+ that.command.execute();
};
that.create = function() {
@@ -172,6 +173,7 @@ IPA.entity_adder_dialog = function(spec) {
// methods that should be invoked by subclasses
that.entity_adder_dialog_create = that.create;
+ that.entity_adder_dialog_create_add_command = that.create_add_command;
init();