On 7/29/2011 11:12 AM, Petr Vobornik wrote:
There was a small error in add.js:162. Fixed!

Nice job on the dialog boxes.

There's a problem though, the Retry doesn't quite work. This is because 'this' object passed to IPA.error_dialog actually points to Ajax context instead of the IPA.command, so calling execute() on it will fail.

When Ajax call returns, it passes a context via 'this' object to the callback function. The object might contain some useful information which we would not be able to get any other way. The original code tries to maintain the context by passing 'this' object along the chain using call(). Feel free to add comments in the code to clarify this.

So in dialog_open() you should pass 'that' into the 'command' parameter. You also need pass 'this' using another parameter so you can use it to call the error handler if you click Cancel.

Also these changes should be reverted back to maintain the Ajax context:

- that.on_error.call(this, xhr, text_status, error_thrown);
+ that.on_error(xhr, text_status, error_thrown);

- that.on_success.call(this, data, text_status, xhr);
+ that.on_success(data, text_status, xhr);

The IPA.add_dialog can store the command object as an instance variable so the IPA.host_adder_dialog can refer to it from the error handler.

Another thing, in the init() you can access the spec object directly, so don't really have to pass it as a parameter.

--
Endi S. Dewata

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to