Fixed Add and Edit without primary key.

The IPA.add_dialog has been modified such that if the user clicks the
Add and Edit button it will read the primary key returned by the add
operation and use it to open the details page.

Ticket #1108
This commit is contained in:
Endi S. Dewata 2011-05-21 02:14:59 -05:00 committed by Adam Young
parent 2a4edbda4d
commit 57f9a297b6

View File

@ -40,7 +40,7 @@ IPA.add_dialog = function (spec) {
that.save(record);
that.add(
record,
function() {
function(data, text_status, xhr) {
var entity = IPA.get_entity(that.entity_name);
var facet = entity.get_facet('search');
var table = facet.table;
@ -56,7 +56,7 @@ IPA.add_dialog = function (spec) {
that.save(record);
that.add(
record,
function() {
function(data, text_status, xhr) {
var entity = IPA.get_entity(that.entity_name);
var facet = entity.get_facet('search');
var table = facet.table;
@ -71,11 +71,17 @@ IPA.add_dialog = function (spec) {
that.save(record);
that.add(
record,
function() {
function(data, text_status, xhr) {
that.close();
var pkey_name = IPA.metadata.objects[that.entity_name].primary_key;
var pkey = record[pkey_name];
var result = data.result.result;
var pkey = result[pkey_name];
if (pkey instanceof Array) {
pkey = pkey[0];
}
IPA.nav.show_page(that.entity_name, 'details', pkey);
}