2010-10-06 16:24:58 -05:00
|
|
|
/* Authors:
|
|
|
|
* Adam Young <ayoung@redhat.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
*
|
2010-12-09 06:59:11 -06:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2010-10-06 16:24:58 -05:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2010-12-09 06:59:11 -06:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-10-06 16:24:58 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
|
|
|
|
|
|
|
/* DNS */
|
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
IPA.add_entity(function (){
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.entity({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'dnszone'
|
|
|
|
});
|
2010-10-22 08:41:34 -05:00
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
that.init = function() {
|
2011-01-12 18:51:22 -06:00
|
|
|
var search_facet = IPA.search_facet({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'search',
|
|
|
|
label: 'Search',
|
|
|
|
entity_name: that.name
|
|
|
|
});
|
|
|
|
search_facet.create_column({name:'idnsname'});
|
|
|
|
that.add_facet(search_facet);
|
|
|
|
|
|
|
|
that.add_facet(function() {
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.details_facet({name:'details',label:'Details'});
|
2010-12-03 23:29:05 -06:00
|
|
|
that.add_section(
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.stanza({name:'identity', label:'DNS Zone Details'}).
|
2010-12-03 23:29:05 -06:00
|
|
|
input({name:'idnsname'}).
|
|
|
|
input({name:'idnszoneactive'}).
|
|
|
|
input({name:'idnssoamname'}).
|
|
|
|
input({name:'idnssoarname'}).
|
|
|
|
input({name:'idnssoaserial'}).
|
|
|
|
input({name:'idnssoarefresh'}).
|
|
|
|
input({name:'idnssoaretry'}).
|
|
|
|
input({name:'idnssoaexpire'}).
|
|
|
|
input({name:'idnssoaminimum'}).
|
|
|
|
input({name:'dnsttl'}).
|
|
|
|
input({name:'dnsclass'}).
|
|
|
|
input({name:'idnsallowdynupdate'}).
|
|
|
|
input({name:'idnsupdatepolicy'}));
|
|
|
|
|
|
|
|
return that;
|
|
|
|
}());
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
that.add_facet( IPA.records_facet({
|
2010-12-03 23:29:05 -06:00
|
|
|
'name': 'records',
|
|
|
|
'label': IPA.metadata.dnsrecord.label
|
|
|
|
}));
|
2010-10-06 16:24:58 -05:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var dialog = IPA.add_dialog({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'add',
|
2010-12-06 16:30:10 -06:00
|
|
|
title: 'Add DNS Zone'
|
2010-12-03 23:29:05 -06:00
|
|
|
});
|
|
|
|
that.add_dialog(dialog);
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
dialog.add_field(IPA.text_widget({ name: 'idnsname', undo: false}));
|
|
|
|
dialog.add_field(IPA.text_widget({ name: 'idnssoamname', undo: false}));
|
|
|
|
dialog.add_field(IPA.text_widget({ name: 'idnssoarname', undo: false}));
|
2010-12-06 16:30:10 -06:00
|
|
|
dialog.init();
|
2010-12-03 23:29:05 -06:00
|
|
|
|
|
|
|
that.create_association_facets();
|
|
|
|
that.entity_init();
|
2010-12-06 16:30:10 -06:00
|
|
|
};
|
2010-10-06 16:24:58 -05:00
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
|
|
|
|
return that;
|
|
|
|
}());
|
2010-10-06 16:24:58 -05:00
|
|
|
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.records_facet = function (spec){
|
2010-10-22 08:41:34 -05:00
|
|
|
|
2010-10-27 22:32:30 -05:00
|
|
|
spec = spec || {};
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.facet(spec);
|
2010-10-27 22:32:30 -05:00
|
|
|
|
|
|
|
that.record = null;
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var record_types =[ 'a', 'aaaa', 'dname', 'cname', 'mx', 'ns', 'ptr',
|
|
|
|
'srv', 'txt', 'a6', 'afsdb', 'cert', 'ds', 'hinfo',
|
|
|
|
'key', 'kx', 'loc', 'md', 'minfo', 'naptr', 'nsec',
|
|
|
|
'nxt', 'rrsig', 'sshfp'];
|
|
|
|
|
|
|
|
function create_type_select(id,add_none) {
|
|
|
|
var type_select = $('<select/>',{
|
|
|
|
id: id
|
|
|
|
});
|
|
|
|
|
|
|
|
if (add_none){
|
|
|
|
type_select.append($('<option/>',{
|
|
|
|
text: '(any)',
|
|
|
|
value: ''
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
for (var t = 0 ; t < record_types.length ; t += 1){
|
|
|
|
var record_type = record_types[t].toUpperCase();
|
|
|
|
|
|
|
|
type_select.append($('<option/>',{
|
|
|
|
text: record_type,
|
|
|
|
value: record_type
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
return type_select;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var entry_attrs = {};
|
|
|
|
|
|
|
|
|
|
|
|
function add_click(){
|
|
|
|
|
|
|
|
var add_dialog = $('<div/>',{
|
|
|
|
id: 'add_dns_resource_record',
|
|
|
|
title: 'Add DNS Resource Record'
|
|
|
|
});
|
|
|
|
var dl = $('<dl></dl>').appendTo(add_dialog);
|
|
|
|
dl.append('<dt>Resource</dt>');
|
|
|
|
dl.append( $('<dd/>').
|
|
|
|
append($('<input type="text" id="dns-record-resource" />')));
|
|
|
|
dl.append('<dt>Type</dt>');
|
|
|
|
dl.append( $('<dd/>').append(create_type_select('dns-record-type')));
|
|
|
|
dl.append('<dt>Data</dt>');
|
|
|
|
dl.append($('<dd/>').append($('<textarea/>',{
|
|
|
|
id: 'dns-record-data',
|
|
|
|
rows:"8",
|
|
|
|
cols:"20"
|
|
|
|
})));
|
|
|
|
|
|
|
|
|
|
|
|
function add(evt, called_from_add_and_edit) {
|
|
|
|
var params = [];
|
|
|
|
var options = {};
|
|
|
|
function add_win(data, text_status, xhr) {
|
|
|
|
reload();
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
function add_fail(data, text_status, xhr) {
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
2010-12-02 13:14:59 -06:00
|
|
|
params.push( $.bbq.getState(that.entity_name+'-pkey', true));
|
2010-10-22 08:41:34 -05:00
|
|
|
params.push(add_dialog.find('#dns-record-resource').val());
|
|
|
|
|
2010-12-02 13:14:59 -06:00
|
|
|
var key = add_dialog.find('#dns-record-type').val().toLowerCase()+
|
|
|
|
"record";
|
|
|
|
var value = add_dialog.find('#dns-record-data').val();
|
|
|
|
options[key] = value;
|
|
|
|
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.cmd('dnsrecord_add', params, options, add_win, add_fail);
|
2010-10-22 08:41:34 -05:00
|
|
|
//add_dialog.dialog('close');
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
function add_and_close(evt) {
|
|
|
|
add(evt, true);
|
|
|
|
add_dialog.dialog('close');
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
function cancel() {
|
|
|
|
add_dialog.dialog('close');
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
add_dialog.dialog({
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
'Add many': add,
|
|
|
|
'Add and Close': add_and_close,
|
|
|
|
'Cancel': cancel
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function delete_records(records_table){
|
|
|
|
|
2010-12-02 13:14:59 -06:00
|
|
|
var zone = $.bbq.getState('dnszone-pkey', true);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var thead = records_table.find('thead');
|
|
|
|
thead.find("INPUT[type='checkbox']").
|
|
|
|
attr('checked', false);
|
|
|
|
|
|
|
|
var i = 0;
|
|
|
|
|
|
|
|
var tbody = records_table.find('tbody');
|
|
|
|
|
|
|
|
|
|
|
|
var delete_dialog = $('<div/>', {
|
2010-11-08 19:39:40 -06:00
|
|
|
title: IPA.messages.button.remove
|
2010-10-22 08:41:34 -05:00
|
|
|
});
|
|
|
|
var to_delete_table =
|
|
|
|
$('<table class="search-table" >'+
|
|
|
|
'<thead><tr><th>Resource</th><th>Type</th></tr></thead>'+
|
|
|
|
'<tbody></tbody></table>').appendTo(delete_dialog);
|
|
|
|
|
|
|
|
var to_delete_body = to_delete_table.find('tbody');
|
|
|
|
var delete_list = [];
|
|
|
|
tbody.find("INPUT[type='checkbox']").each(
|
|
|
|
function(index, box){
|
|
|
|
if (box.checked){
|
|
|
|
var tr = $(box).parents('tr');
|
|
|
|
var resource = $(tr).find('[title="idnsname"]').text();
|
|
|
|
var type = $(tr).find('[title="type"]').
|
2010-12-02 13:14:59 -06:00
|
|
|
text().toLowerCase();
|
2010-10-22 08:41:34 -05:00
|
|
|
var data = $(tr).find('[title="data"]').text();
|
2011-01-12 13:47:29 -06:00
|
|
|
var rectype=type+"record";
|
2010-12-02 13:14:59 -06:00
|
|
|
|
|
|
|
var options = {};
|
|
|
|
options[rectype]=data;
|
|
|
|
|
|
|
|
var command = {
|
|
|
|
"method":"dnsrecord_del",
|
|
|
|
"params":[[zone,resource], options]};
|
|
|
|
delete_list.push(command);
|
2010-10-22 08:41:34 -05:00
|
|
|
to_delete_body.append(
|
|
|
|
$('<tr></tr>').
|
|
|
|
append($('<td></td>',{html:resource}).
|
|
|
|
after($('<td></td>',{html:type}))));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
function delete_on_click() {
|
|
|
|
var delete_count = delete_list.length;
|
|
|
|
function delete_complete(){
|
|
|
|
reload();
|
|
|
|
delete_dialog.dialog('close');
|
|
|
|
}
|
2010-12-02 13:14:59 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.cmd('batch', delete_list, {},
|
2010-12-02 13:14:59 -06:00
|
|
|
delete_complete,delete_complete);
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
function cancel_on_click() {
|
|
|
|
delete_dialog.dialog('close');
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
|
2011-01-12 13:47:29 -06:00
|
|
|
if (delete_list.length === 0){
|
2010-10-22 08:41:34 -05:00
|
|
|
return;
|
2011-01-12 13:47:29 -06:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
delete_dialog.append($('<P/>',
|
2010-10-27 22:32:30 -05:00
|
|
|
{text: IPA.messages.search.delete_confirm}));
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
delete_dialog.dialog({
|
|
|
|
modal: true,
|
|
|
|
buttons: {
|
|
|
|
'Delete': delete_on_click,
|
2010-10-27 22:32:30 -05:00
|
|
|
'Cancel': cancel_on_click
|
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-27 22:32:30 -05:00
|
|
|
that.is_dirty = function() {
|
|
|
|
var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
|
|
|
var record = $.bbq.getState(that.entity_name + '-record', true) || '';
|
|
|
|
return pkey != that.pkey || record != that.record;
|
|
|
|
};
|
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
function create(container) {
|
2011-01-06 12:14:38 -06:00
|
|
|
var details = $('<div/>', {
|
|
|
|
'class': 'content'
|
|
|
|
}).appendTo(container);
|
2010-11-09 14:22:31 -06:00
|
|
|
}
|
|
|
|
|
2010-11-15 11:10:55 -06:00
|
|
|
function setup(container){
|
2010-10-27 22:32:30 -05:00
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
that.facet_setup(container);
|
|
|
|
|
2010-10-27 22:32:30 -05:00
|
|
|
that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
|
|
|
that.record = $.bbq.getState(that.entity_name + '-record', true) || '';
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
that.container.attr('title', that.entity_name);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var h2 = $('<h2></h2>',{
|
2010-10-27 22:32:30 -05:00
|
|
|
text: "Records for DNS Zone:" + that.pkey
|
2010-11-18 20:17:14 -06:00
|
|
|
}).appendTo(that.container);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
|
2011-01-12 13:47:29 -06:00
|
|
|
var div = $('<div class="search-controls"></div>').
|
|
|
|
appendTo(that.container);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var control_span =$('<span class="record-filter"></span>').appendTo(div);
|
|
|
|
|
|
|
|
control_span.append('Resource');
|
|
|
|
control_span.append($('<input />',{
|
|
|
|
type: "text",
|
|
|
|
id: 'dns-record-resource-filter',
|
2010-10-27 22:32:30 -05:00
|
|
|
name: 'search-' + that.entity_name + '-filter'
|
2010-10-22 08:41:34 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
control_span.append('Type');
|
|
|
|
|
|
|
|
create_type_select('dns-record-type-filter',true).
|
|
|
|
appendTo(control_span);
|
|
|
|
//commented out until data is searchable
|
|
|
|
//control_span.append('Data');
|
|
|
|
//control_span.append($('<input />',{
|
|
|
|
// type: "text",
|
|
|
|
// id: 'dns-record-data-filter',
|
|
|
|
// name: 'search-' + obj_name + '-filter'
|
|
|
|
//}));
|
|
|
|
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.button({
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
'label': IPA.messages.button.find,
|
|
|
|
'icon': 'ui-icon-search',
|
2011-01-12 13:47:29 -06:00
|
|
|
'click': function(){refresh();}
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
}).appendTo(control_span);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
2010-12-02 13:14:59 -06:00
|
|
|
var action_panel_ul = $('.action-panel ul', that.container);
|
|
|
|
|
|
|
|
var action_controls = $('<li/>',{
|
|
|
|
"class":"action-controls"}).appendTo(action_panel_ul);
|
|
|
|
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.button({
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
'label': IPA.messages.button.add,
|
|
|
|
'icon': 'ui-icon-plus',
|
|
|
|
'click': add_click
|
2010-12-02 13:14:59 -06:00
|
|
|
}).appendTo(action_controls);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.button({
|
2010-11-08 19:39:40 -06:00
|
|
|
'label': IPA.messages.button.remove,
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
'icon': 'ui-icon-trash',
|
|
|
|
'click': function(){delete_records(records_table);}
|
2010-12-02 13:14:59 -06:00
|
|
|
}).appendTo(action_controls);
|
|
|
|
|
2010-10-22 08:41:34 -05:00
|
|
|
div.append('<span class="records-buttons"></span>');
|
|
|
|
|
|
|
|
var records_results = $('<div/>', {
|
2010-10-27 22:32:30 -05:00
|
|
|
'class': 'records-results'
|
2010-11-18 20:17:14 -06:00
|
|
|
}).appendTo(that.container);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var records_table = $('<table/>', {
|
2010-10-27 22:32:30 -05:00
|
|
|
'class': 'search-table'
|
2010-10-22 08:41:34 -05:00
|
|
|
}).appendTo(records_results);
|
|
|
|
|
|
|
|
var thead = $('<thead><tr></tr></thead>').appendTo(records_table);
|
2010-10-27 22:32:30 -05:00
|
|
|
var tbody = $('<tbody></tbody>').appendTo(records_table);
|
|
|
|
var tfoot = $('<tfoot></tfoot>').appendTo(records_table);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var tr = thead.find('tr');
|
|
|
|
tr.append($('<th style="width: 15px" />').append(
|
|
|
|
$('<input />',{
|
|
|
|
type: 'checkbox',
|
|
|
|
click : function (evt){
|
|
|
|
tbody.find("INPUT[type='checkbox']").
|
|
|
|
attr('checked', this.checked);
|
|
|
|
}
|
2011-01-12 13:47:29 -06:00
|
|
|
})));
|
2010-12-03 23:29:05 -06:00
|
|
|
tr.append($('<th/>',{
|
2011-01-12 18:51:22 -06:00
|
|
|
text: IPA.get_param_info("dnsrecord", "idnsname").label }));
|
2010-12-03 23:29:05 -06:00
|
|
|
tr.append($('<th>Record Type</th>'));
|
2010-10-22 08:41:34 -05:00
|
|
|
tr.append($('<th>Data</th>'));
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
refresh();
|
2010-10-22 08:41:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function load_on_win(data){
|
2010-12-02 13:14:59 -06:00
|
|
|
display(that.entity_name,data);
|
2010-10-22 08:41:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function load_on_fail(data){
|
2010-12-02 13:14:59 -06:00
|
|
|
display(that.entity_name,data);
|
2010-10-22 08:41:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function reload(){
|
2010-11-18 20:17:14 -06:00
|
|
|
refresh();
|
2010-10-22 08:41:34 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
function refresh(){
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
var options = {};
|
|
|
|
|
2011-01-12 13:47:29 -06:00
|
|
|
var resource_filter = that.container.
|
|
|
|
find("#dns-record-resource-filter").val();
|
2010-10-22 08:41:34 -05:00
|
|
|
if (resource_filter){
|
|
|
|
options.idnsname = resource_filter;
|
|
|
|
}
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
var type_filter = that.container.find("#dns-record-type-filter").val();
|
2010-10-22 08:41:34 -05:00
|
|
|
if (type_filter){
|
|
|
|
options.type = type_filter;
|
|
|
|
}
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
var data_filter = that.container.find("#dns-record-data-filter").val();
|
2010-10-22 08:41:34 -05:00
|
|
|
if (data_filter){
|
|
|
|
options.data = data_filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-02 13:14:59 -06:00
|
|
|
var pkey = $.bbq.getState(that.entity_name + '-pkey', true);
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.cmd('dnsrecord_find',[pkey],options,load_on_win, load_on_fail);
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function generate_tr(thead, tbody, result){
|
|
|
|
var tr = $('<tr></tr>').appendTo(tbody);
|
|
|
|
|
|
|
|
search_generate_checkbox_td(tr, /*pkey_value*/ '');
|
|
|
|
|
|
|
|
//TODO get this fixed on the back end. For now, workaround
|
|
|
|
|
|
|
|
if (result.idnsname){
|
|
|
|
tr.append($('<td/>',{
|
|
|
|
title:'idnsname',
|
|
|
|
text: result.idnsname[0]
|
|
|
|
}));
|
|
|
|
}else{
|
|
|
|
tr.append($('<td/>',{
|
|
|
|
title:'idnsname',
|
|
|
|
text: result.dn.split(',')[0].split('=')[1]
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < record_types.length; i += 1){
|
|
|
|
var field_name = record_types[i];
|
|
|
|
var field = result[field_name+'record'];
|
|
|
|
if ( field ){
|
|
|
|
var record_type = field_name;
|
|
|
|
var record_data = field[0];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tr.append($('<td/>',{
|
|
|
|
title:'type',
|
|
|
|
text: record_type
|
|
|
|
}));
|
|
|
|
tr.append($('<td/>',{
|
|
|
|
title:'data',
|
|
|
|
text: record_data
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
//TODO this is cut and pasted from search, we need to unify
|
|
|
|
function display(obj_name, data){
|
HBAC Details Page
The UI framework has been extended to include a collection of widgets:
- ipa_widget: base class
- ipa_text_widget: text field
- ipa_radio_widget: radio button
- ipa_textarea_widget: textarea
- ipa_button_widget: button
- ipa_column_widget: column for table
- ipa_table_widget: table
These widgets can be used to create input controls. They can also be
extended to create custom controls.
The framework has also been enhanced to support custom layouts. This
can be used to change the look of the application without changing
the code. Initially this is only available in details section.
Layout consists of a collection of HTML templates. Each template is a
complete and valid HTML file representing a portion of a page. The
template will be loaded and initialized by the code, then filled with
the data from the server. The layouts are located in
install/static/layouts/<name> folder.
By default, if no templates are used, the fields in the details page
are rendered vertically using dd/dt/dd tags. For pages that require
different layout, a custom UI needs to be developed. There are two ways
to do that:
- write a custom widget to generate the UI dynamically
- create an HTML template and write the initialization code
For components that are quite complex or used frequently, it's might
be better to use the first method. For simple pages that are used only
in one location or need to support customization, the second method
might be preferable. Other benefits of templates:
- cleaner code and UI separation
- more flexibility in customization
- new pages can be developed quickly and require less coding
- multiple templates can be used with the same initialization code
- easier to maintain
The HBAC details page has been implemented using both methods. By
default it will use custom widgets to generate the page. To use a
custom layout, add the following parameter to the URL, then reload
the page:
&layout=<name>
Currently the only available layout is 'default' which produces the
same look as the custom widgets.
The HBAC details page is usable, but it still needs additional work.
The access time is not working yet. There is no undo button, hint,
or validation yet.
The table in the association facet has also been changed to use
ipa_association_widget which is derived from ipa_table_widget.
The Makefile has been updated to include the layouts. The unit tests
have been updated as well.
2010-11-02 20:16:55 -05:00
|
|
|
var selector = '.entity-container[title=' + obj_name + ']';
|
2010-10-22 08:41:34 -05:00
|
|
|
var thead = $(selector + ' thead');
|
|
|
|
var tbody = $(selector + ' tbody');
|
|
|
|
var tfoot = $(selector + ' tfoot');
|
|
|
|
|
|
|
|
tbody.find('tr').remove();
|
|
|
|
|
|
|
|
var result = data.result.result;
|
|
|
|
for (var i = 0; i < result.length; ++i){
|
|
|
|
generate_tr(thead, tbody, result[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.result.truncated) {
|
|
|
|
tfoot.text(
|
|
|
|
'Query returned results than configured size limit will show.' +
|
2011-01-12 13:47:29 -06:00
|
|
|
'First ' + data.result.count + ' results shown.' );
|
2010-10-22 08:41:34 -05:00
|
|
|
} else {
|
|
|
|
tfoot.text(data.result.summary);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-11-09 14:22:31 -06:00
|
|
|
that.create = create;
|
2010-10-22 08:41:34 -05:00
|
|
|
that.setup = setup;
|
2010-11-18 20:17:14 -06:00
|
|
|
that.refresh = refresh;
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
return that;
|
2010-10-27 22:32:30 -05:00
|
|
|
}
|
2010-10-22 08:41:34 -05:00
|
|
|
|
|
|
|
|
2010-10-06 16:24:58 -05:00
|
|
|
/**Automount*/
|
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
IPA.add_entity(function (){
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.entity({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'automountlocation'
|
|
|
|
});
|
2010-10-06 16:24:58 -05:00
|
|
|
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var search_facet = IPA.search_facet({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'search',
|
|
|
|
label: 'Search',
|
|
|
|
entity_name: that.name
|
|
|
|
});
|
|
|
|
that.init = function() {
|
|
|
|
search_facet.create_column({name:'cn'});
|
|
|
|
that.add_facet(search_facet);
|
|
|
|
|
|
|
|
|
|
|
|
that.add_facet(function() {
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.details_facet({name:'details',label:'Details'});
|
2010-12-03 23:29:05 -06:00
|
|
|
that.add_section(
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.stanza({name:'identity', label:'Automount Location Details'}).
|
2010-12-03 23:29:05 -06:00
|
|
|
input({name:'cn'}));
|
|
|
|
return that;
|
|
|
|
}());
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var dialog = IPA.add_dialog({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'add',
|
2010-12-06 16:30:10 -06:00
|
|
|
title: 'Add Automount Location'
|
2010-12-03 23:29:05 -06:00
|
|
|
});
|
|
|
|
that.add_dialog(dialog);
|
2010-12-06 16:30:10 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
2010-12-03 23:29:05 -06:00
|
|
|
dialog.init();
|
2010-12-06 16:30:10 -06:00
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
that.create_association_facets();
|
|
|
|
that.entity_init();
|
|
|
|
|
2011-01-12 13:47:29 -06:00
|
|
|
};
|
2010-12-03 23:29:05 -06:00
|
|
|
return that;
|
|
|
|
}());
|
2010-10-06 16:24:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
/**pwpolicy*/
|
|
|
|
|
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
IPA.add_entity(function (){
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.entity({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'pwpolicy'
|
|
|
|
});
|
2010-10-06 16:24:58 -05:00
|
|
|
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var search_facet = IPA.search_facet({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'search',
|
|
|
|
label: 'Search',
|
|
|
|
entity_name: that.name
|
|
|
|
});
|
|
|
|
that.init = function() {
|
|
|
|
search_facet.create_column({name:'cn'});
|
|
|
|
that.add_facet(search_facet);
|
|
|
|
|
|
|
|
|
|
|
|
that.add_facet(function() {
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.details_facet({name:'details',label:'Details'});
|
2010-12-03 23:29:05 -06:00
|
|
|
that.add_section(
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.stanza({name:'identity', label:'Password Policy'}).
|
2010-12-03 23:29:05 -06:00
|
|
|
input({name:'krbmaxpwdlife'}).
|
|
|
|
input({name:'krbminpwdlife'}).
|
|
|
|
input({name:'krbpwdhistorylength'}).
|
|
|
|
input({name:'krbpwdmindiffchars'}).
|
|
|
|
input({name:'krbpwdminlength'}));
|
|
|
|
return that;
|
|
|
|
}());
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var dialog = IPA.add_dialog({
|
2010-12-03 23:29:05 -06:00
|
|
|
name: 'add',
|
|
|
|
title: 'Add Password Policy',
|
|
|
|
entity_name:'pwpolicy'
|
|
|
|
});
|
|
|
|
that.add_dialog(dialog);
|
2010-12-06 16:30:10 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
dialog.add_field(IPA.text_widget({ name: 'cn', undo: false}));
|
2010-12-03 23:29:05 -06:00
|
|
|
dialog.init();
|
2010-12-06 16:30:10 -06:00
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
that.create_association_facets();
|
|
|
|
that.entity_init();
|
|
|
|
|
2010-12-06 16:30:10 -06:00
|
|
|
};
|
2010-12-03 23:29:05 -06:00
|
|
|
return that;
|
|
|
|
}());
|
2010-10-06 16:24:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
krbtpolicy
|
|
|
|
Does not have search
|
|
|
|
*/
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.entity_set_details_definition('krbtpolicy', [
|
|
|
|
IPA.stanza({name:'identity', label:'Kerberos ticket policy'}).
|
2011-01-05 12:31:21 -06:00
|
|
|
//input({name:'uid',label:' '}).
|
2010-12-03 23:29:05 -06:00
|
|
|
input({name:'krbmaxrenewableage'}).
|
|
|
|
input({name:'krbmaxticketlife'})
|
Certificate management for services.
This is an initial implementation of certificate management for
services. It addresses the mechanism required to view and update
certificates. The complete UI implementation will be addressed in
subsequent patches.
On the server side, the service.py has been modified to define
usercertificate in the service object's takes_params. This is
needed to generate the proper JSON metadata which is needed by
the UI. It also has been modified to accept null certificate for
deletion.
On the client side, the service details page has been modified to
display the base64-encoded certificate in a text area. When the
page is saved, the action handler will store the base64-encoded
certificate in the proper JSON structure. Also the service name
and service hostname are now displayed in separate fields.
The details configuration has been modified to support displaying
and updating certificates. The structure is changed to use maps
to define sections and fields. A section contains name, label,
and an array of fields. A field contains name, label, setup
function, load function, and save function. This is used to
implement custom interface and behavior for certificates.
All other entities, test cases, and test data have been updated
accordingly. Some functions and variables have been renamed to
improve clarity and consistency.
2010-10-07 14:02:44 -05:00
|
|
|
]);
|
2010-10-06 16:24:58 -05:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.entity_set_association_definition('krbtpolicy', {
|
2010-10-06 16:24:58 -05:00
|
|
|
});
|