summaryrefslogtreecommitdiffstats
path: root/install/ui/add.js
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-07-25 12:15:14 -0400
committerAdam Young <ayoung@redhat.com>2011-07-28 14:17:25 -0400
commitb36df6e9b9c1104d37fe14782a7e21e57097a7c0 (patch)
tree1eca6d4b0f7127b01f2e366919981ed90090ee95 /install/ui/add.js
parent264ed38fa206537d7b160ea5d7586d071575c610 (diff)
downloadfreeipa-b36df6e9b9c1104d37fe14782a7e21e57097a7c0.tar.gz
freeipa-b36df6e9b9c1104d37fe14782a7e21e57097a7c0.tar.xz
freeipa-b36df6e9b9c1104d37fe14782a7e21e57097a7c0.zip
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name. Replacing entity_name with entity.name in most places. The one exception is columns for table_widget. Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies. cleanup entity assignment. removed template and layout, merged setup into create adder dialogs adjust height for external removed init from widget, isection, association, facet, host and service Make unit tests use factory. fix functional tests to click find link correctly. tweak to activation test, but still broken. moved initialization code to the end use --all for hbacrule find, so the type shows up now fixed dns exception code and exception handling for get_entity replace metadata look up with value from entity. fixed author lines removed duplicate columns in managed by facets. tweak to nav fix in order to initialize tab. more defensive code update metadata for true false one line init for entity_name in widget move init code to end of constructor functions moved constants to start of function for adder_dialog external fields for dialogs initialized at dialog creation sudo sections: move add fields and columns to widget definition. The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function. decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables return false at the end of click handler removed blank labels in sudo command section fix radio buttons for sudo category fixed table side for adder dialogs with external fields comments for future direction with add_columns https://fedorahosted.org/freeipa/ticket/1451 https://fedorahosted.org/freeipa/ticket/1462 https://fedorahosted.org/freeipa/ticket/1493 https://fedorahosted.org/freeipa/ticket/1497 https://fedorahosted.org/freeipa/ticket/1532 https://fedorahosted.org/freeipa/ticket/1534
Diffstat (limited to 'install/ui/add.js')
-rw-r--r--install/ui/add.js111
1 files changed, 52 insertions, 59 deletions
diff --git a/install/ui/add.js b/install/ui/add.js
index 614a20905..988ea8ff1 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -32,82 +32,30 @@ IPA.add_dialog = function (spec) {
that.method = spec.method || 'add';
that.pre_execute_hook = spec.pre_execute_hook;
- function show_edit_page(entity_name,result){
- var pkey_name = IPA.metadata.objects[entity_name].primary_key;
+ function show_edit_page(entity,result){
+ var pkey_name = entity.metadata.primary_key;
var pkey = result[pkey_name];
if (pkey instanceof Array) {
pkey = pkey[0];
}
- IPA.nav.show_page(that.entity_name, 'default', pkey);
+ IPA.nav.show_entity_page(that.entity, 'default', pkey);
}
that.show_edit_page = spec.show_edit_page || show_edit_page;
- that.init = function() {
- that.add_button(IPA.messages.buttons.add, function() {
- var record = {};
- that.save(record);
- that.add(
- record,
- function(data, text_status, xhr) {
- var facet = IPA.current_entity.get_facet();
- var table = facet.table;
- table.refresh();
- that.close();
- }
- );
- });
-
-
- that.add_button(IPA.messages.buttons.add_and_add_another, function() {
- var record = {};
- that.save(record);
- that.add(
- record,
- function(data, text_status, xhr) {
- var facet = IPA.current_entity.get_facet();
- var table = facet.table;
- table.refresh();
- that.reset();
- }
- );
- });
-
- that.add_button(IPA.messages.buttons.add_and_edit, function() {
- var record = {};
- that.save(record);
- that.add(
- record,
- function(data, text_status, xhr) {
- that.close();
-
- var entity_name = that.entity_name;
- var result = data.result.result;
- that.show_edit_page(entity_name,result);
- }
- );
- });
-
- that.add_button(IPA.messages.buttons.cancel, function() {
- that.close();
- });
-
- that.dialog_init();
- };
-
that.add = function(record, on_success, on_error) {
var field, value, pkey_prefix;
- var pkey_name = IPA.metadata.objects[that.entity_name].primary_key;
+ var pkey_name = that.entity.metadata.primary_key;
var command = IPA.command({
- entity: that.entity_name,
+ entity: that.entity.name,
method: that.method,
on_success: on_success,
on_error: on_error
});
- pkey_prefix = IPA.get_entity(that.entity_name).get_primary_key_prefix();
+ pkey_prefix = that.entity.get_primary_key_prefix();
for (var h=0; h<pkey_prefix.length; h++) {
command.add_arg(pkey_prefix[h]);
@@ -168,7 +116,52 @@ IPA.add_dialog = function (spec) {
};
- that.add_dialog_init = that.init;
+ /*dialog initialization*/
+ that.add_button(IPA.messages.buttons.add, function() {
+ var record = {};
+ that.save(record);
+ that.add(
+ record,
+ function(data, text_status, xhr) {
+ var facet = IPA.current_entity.get_facet();
+ var table = facet.table;
+ table.refresh();
+ that.close();
+ }
+ );
+ });
+
+ that.add_button(IPA.messages.buttons.add_and_add_another, function() {
+ var record = {};
+ that.save(record);
+ that.add(
+ record,
+ function(data, text_status, xhr) {
+ var facet = IPA.current_entity.get_facet();
+ var table = facet.table;
+ table.refresh();
+ that.reset();
+ }
+ );
+ });
+
+ that.add_button(IPA.messages.buttons.add_and_edit, function() {
+ var record = {};
+ that.save(record);
+ that.add(
+ record,
+ function(data, text_status, xhr) {
+ that.close();
+ var result = data.result.result;
+ that.show_edit_page(that.entity,result);
+ }
+ );
+ });
+
+ that.add_button(IPA.messages.buttons.cancel, function() {
+ that.close();
+ });
+
return that;
};