mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed memory leak caused by DNS record adder dialog.
Ticket 1054
This commit is contained in:
parent
6fc488e12f
commit
b4952e27ec
@ -124,68 +124,82 @@ IPA.records_facet = function (spec){
|
|||||||
|
|
||||||
function add_click(){
|
function add_click(){
|
||||||
|
|
||||||
var add_dialog = $('<div/>',{
|
var dialog = IPA.dialog({
|
||||||
id: 'add_dns_resource_record',
|
|
||||||
title: IPA.messages.objects.dnsrecord.add
|
title: IPA.messages.objects.dnsrecord.add
|
||||||
});
|
});
|
||||||
var dl = $('<dl></dl>').appendTo(add_dialog);
|
|
||||||
dl.append('<dt>'+IPA.messages.objects.dnsrecord.resource+'</dt>');
|
|
||||||
dl.append( $('<dd/>').
|
|
||||||
append($('<input type="text" id="dns-record-resource" />')));
|
|
||||||
dl.append('<dt>'+IPA.messages.objects.dnsrecord.type+'</dt>');
|
|
||||||
dl.append( $('<dd/>').append(create_type_select('dns-record-type')));
|
|
||||||
dl.append('<dt>'+IPA.messages.objects.dnsrecord.data+'</dt>');
|
|
||||||
dl.append($('<dd/>').append($('<textarea/>',{
|
|
||||||
id: 'dns-record-data',
|
|
||||||
rows:"8",
|
|
||||||
cols:"20"
|
|
||||||
})));
|
|
||||||
|
|
||||||
|
dialog.create = function() {
|
||||||
|
|
||||||
function add(evt, called_from_add_and_edit) {
|
var dl = $('<dl/>').appendTo(dialog.container);
|
||||||
var params = [];
|
|
||||||
var options = {};
|
|
||||||
function add_win(data, text_status, xhr) {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_fail(data, text_status, xhr) {
|
$('<dt/>', {
|
||||||
}
|
html: IPA.messages.objects.dnsrecord.resource
|
||||||
|
}).appendTo(dl);
|
||||||
|
|
||||||
params.push( $.bbq.getState(that.entity_name+'-pkey', true));
|
var dd = $('<dd/>').appendTo(dl);
|
||||||
params.push(add_dialog.find('#dns-record-resource').val());
|
|
||||||
|
|
||||||
var key = add_dialog.find('#dns-record-type').val().toLowerCase()+
|
dialog.resource = $('<input/>', {
|
||||||
"record";
|
type: 'text'
|
||||||
var value = add_dialog.find('#dns-record-data').val();
|
}).appendTo(dd);
|
||||||
options[key] = value;
|
|
||||||
|
|
||||||
|
$('<dt/>', {
|
||||||
|
html: IPA.messages.objects.dnsrecord.type
|
||||||
|
}).appendTo(dl);
|
||||||
|
|
||||||
IPA.cmd('dnsrecord_add', params, options, add_win, add_fail);
|
dd = $('<dd/>').appendTo(dl);
|
||||||
//add_dialog.dialog('close');
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_and_close(evt) {
|
dialog.type = create_type_select('dns-record-type').appendTo(dd);
|
||||||
add(evt, true);
|
|
||||||
add_dialog.dialog('close');
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancel() {
|
$('<dt/>', {
|
||||||
add_dialog.dialog('close');
|
html: IPA.messages.objects.dnsrecord.data
|
||||||
}
|
}).appendTo(dl);
|
||||||
|
|
||||||
var buttons = {};
|
dd = $('<dd/>').appendTo(dl);
|
||||||
|
|
||||||
buttons[IPA.messages.buttons.add_many] = add;
|
dialog.data = $('<textarea/>', {
|
||||||
buttons[IPA.messages.buttons.add_and_close] = add_and_close;
|
rows: 8,
|
||||||
buttons[IPA.messages.buttons.cancel] = cancel;
|
cols: 20
|
||||||
|
}).appendTo(dd);
|
||||||
|
};
|
||||||
|
|
||||||
add_dialog.dialog({
|
dialog.add_button(IPA.messages.buttons.add_many, function() {
|
||||||
modal: true,
|
dialog.add();
|
||||||
buttons: buttons
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
dialog.add_button(IPA.messages.buttons.add_and_close, function() {
|
||||||
|
dialog.add();
|
||||||
|
dialog.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.add_button(IPA.messages.buttons.cancel, function() {
|
||||||
|
dialog.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.add = function() {
|
||||||
|
|
||||||
|
var pkey = $.bbq.getState(that.entity_name+'-pkey', true);
|
||||||
|
var resource = dialog.resource.val();
|
||||||
|
|
||||||
|
var options = {};
|
||||||
|
var key = dialog.type.val().toLowerCase()+'record';
|
||||||
|
options[key] = dialog.data.val();
|
||||||
|
|
||||||
|
var command = IPA.command({
|
||||||
|
method: 'dnsrecord_add',
|
||||||
|
args: [pkey, resource],
|
||||||
|
options: options,
|
||||||
|
on_success: function(data, text_status, xhr) {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
command.execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
dialog.init();
|
||||||
|
|
||||||
|
dialog.open(that.container);
|
||||||
|
}
|
||||||
|
|
||||||
function delete_records(records_table){
|
function delete_records(records_table){
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user