2011-01-14 11:16:25 -06:00
|
|
|
/*jsl:import ipa.js */
|
|
|
|
/*jsl:import certificate.js */
|
|
|
|
|
2010-09-16 09:28:07 -05:00
|
|
|
/* Authors:
|
|
|
|
* Pavel Zuna <pzuna@redhat.com>
|
2010-11-18 20:59:08 -06:00
|
|
|
* Endi S. Dewata <edewata@redhat.com>
|
2010-09-16 09:28:07 -05:00
|
|
|
*
|
|
|
|
* 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-09-16 09:28:07 -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-09-16 09:28:07 -05:00
|
|
|
*/
|
2010-08-06 09:01:44 -05:00
|
|
|
|
2010-09-16 09:28:07 -05:00
|
|
|
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
|
2010-08-20 10:16:36 -05:00
|
|
|
|
2011-01-19 20:10:18 -06:00
|
|
|
IPA.entity_factories.host = function () {
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.entity({
|
2010-11-16 18:10:40 -06:00
|
|
|
'name': 'host'
|
|
|
|
});
|
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
|
|
|
that.create_association({
|
|
|
|
'name': 'hostgroup',
|
|
|
|
'associator': 'serial'
|
|
|
|
});
|
|
|
|
|
|
|
|
that.create_association({
|
|
|
|
'name': 'rolegroup',
|
|
|
|
'associator': 'serial'
|
|
|
|
});
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var facet = IPA.host_search_facet({
|
2010-11-16 18:10:40 -06:00
|
|
|
'name': 'search',
|
|
|
|
'label': 'Search'
|
|
|
|
});
|
|
|
|
that.add_facet(facet);
|
|
|
|
|
2011-02-08 15:41:24 -06:00
|
|
|
var dialog = IPA.host_add_dialog({
|
|
|
|
'name': 'add',
|
|
|
|
'title': 'Add New Host'
|
|
|
|
});
|
|
|
|
facet.dialog(dialog);
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
facet = IPA.host_details_facet({
|
2011-01-14 14:14:32 -06:00
|
|
|
'name': 'details'
|
2010-11-16 18:10:40 -06:00
|
|
|
});
|
|
|
|
that.add_facet(facet);
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
facet = IPA.host_managedby_host_facet({
|
2010-12-01 20:25:44 -06:00
|
|
|
'name': 'managedby_host',
|
2010-12-02 17:16:34 -06:00
|
|
|
'label': IPA.messages.association.managedby+' '+IPA.metadata['host'].label,
|
2010-12-01 20:25:44 -06:00
|
|
|
'other_entity': 'host'
|
|
|
|
});
|
|
|
|
that.add_facet(facet);
|
|
|
|
|
2010-11-19 23:52:33 -06:00
|
|
|
that.create_association_facets();
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
that.entity_init();
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-01-14 11:16:25 -06:00
|
|
|
};
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.host_add_dialog = function (spec) {
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.add_dialog(spec);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
that.add_field(IPA.text_widget({
|
2011-01-18 11:12:47 -06:00
|
|
|
name: 'fqdn',
|
|
|
|
size: 40,
|
|
|
|
undo: false
|
|
|
|
}));
|
|
|
|
|
|
|
|
// TODO: Replace with i18n label
|
|
|
|
that.add_field(IPA.checkbox_widget({
|
|
|
|
name: 'force',
|
|
|
|
label: 'Force',
|
|
|
|
tooltip: 'force host name even if not in DNS',
|
|
|
|
undo: false
|
2010-11-16 18:10:40 -06:00
|
|
|
}));
|
2010-12-06 16:30:10 -06:00
|
|
|
|
|
|
|
that.add_dialog_init();
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-01-14 11:16:25 -06:00
|
|
|
};
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.host_search_facet = function (spec) {
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.search_facet(spec);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
that.create_column({name:'fqdn'});
|
|
|
|
that.create_column({name:'description'});
|
|
|
|
//TODO use the value of this field to set enrollment status
|
|
|
|
that.create_column({name:'krblastpwdchange', label:'Enrolled?'});
|
|
|
|
that.create_column({name:'nshostlocation'});
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
that.search_facet_init();
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-01-14 11:16:25 -06:00
|
|
|
};
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.host_details_facet = function (spec) {
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.details_facet(spec);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var section = IPA.details_list_section({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': 'details',
|
2011-01-14 14:14:32 -06:00
|
|
|
'label': 'Host Settings'
|
2010-11-16 18:10:40 -06:00
|
|
|
});
|
|
|
|
that.add_section(section);
|
|
|
|
|
2011-01-12 21:00:38 -06:00
|
|
|
//TODO: use i18n labels
|
2011-02-03 21:42:50 -06:00
|
|
|
section.text({
|
2011-01-12 21:00:38 -06:00
|
|
|
name: 'fqdn',
|
|
|
|
label: 'Fully Qualified Host Name'
|
|
|
|
});
|
|
|
|
|
2011-02-03 21:42:50 -06:00
|
|
|
section.text({'name': 'krbprincipalname'});
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-12 21:00:38 -06:00
|
|
|
//TODO: add this to the host plugin
|
|
|
|
//TODO: use i18n labels
|
2011-02-03 21:42:50 -06:00
|
|
|
section.text({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': 'serverhostname',
|
2011-01-12 21:00:38 -06:00
|
|
|
'label': 'Host Name'
|
2010-11-16 18:10:40 -06:00
|
|
|
});
|
|
|
|
|
2011-02-03 21:42:50 -06:00
|
|
|
section.text({'name': 'description'});
|
2010-11-19 23:52:33 -06:00
|
|
|
|
2011-01-12 21:00:38 -06:00
|
|
|
//TODO: use i18n labels
|
2011-01-12 18:51:22 -06:00
|
|
|
section = IPA.details_list_section({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': 'enrollment',
|
|
|
|
'label': 'Enrollment'
|
2010-11-16 18:10:40 -06:00
|
|
|
});
|
|
|
|
that.add_section(section);
|
|
|
|
|
2010-12-03 23:29:05 -06:00
|
|
|
//TODO add label to messages
|
2010-11-16 18:10:40 -06:00
|
|
|
section.add_field(host_provisioning_status_widget({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': 'provisioning_status',
|
|
|
|
'label': 'Status',
|
|
|
|
'facet': that
|
2010-11-16 18:10:40 -06:00
|
|
|
}));
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
section = IPA.details_list_section({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': 'certificate',
|
|
|
|
'label': 'Host Certificate'
|
2010-11-16 18:10:40 -06:00
|
|
|
});
|
|
|
|
that.add_section(section);
|
|
|
|
|
|
|
|
section.add_field(host_certificate_status_widget({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': 'certificate_status',
|
|
|
|
'label': 'Status'
|
2010-11-16 18:10:40 -06:00
|
|
|
}));
|
|
|
|
|
|
|
|
that.details_facet_init();
|
|
|
|
};
|
|
|
|
|
2010-11-18 20:59:08 -06:00
|
|
|
that.refresh = function() {
|
|
|
|
|
|
|
|
var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var command = IPA.command({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': that.entity_name+'_show_'+pkey,
|
|
|
|
'method': that.entity_name+'_show',
|
|
|
|
'args': [pkey],
|
|
|
|
'options': { 'all': true, 'rights': true }
|
|
|
|
});
|
|
|
|
|
|
|
|
command.on_success = function(data, text_status, xhr) {
|
|
|
|
that.load(data.result.result);
|
|
|
|
};
|
|
|
|
|
|
|
|
command.on_error = function(xhr, text_status, error_thrown) {
|
|
|
|
var details = $('.details', that.container).empty();
|
|
|
|
details.append('<p>Error: '+error_thrown.name+'</p>');
|
|
|
|
details.append('<p>'+error_thrown.title+'</p>');
|
|
|
|
details.append('<p>'+error_thrown.message+'</p>');
|
|
|
|
};
|
|
|
|
|
|
|
|
command.execute();
|
|
|
|
};
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
return that;
|
2011-01-14 11:16:25 -06:00
|
|
|
};
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
function host_provisioning_status_widget(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.widget(spec);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2010-11-18 20:59:08 -06:00
|
|
|
that.facet = spec.facet;
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.create = function(container) {
|
|
|
|
|
|
|
|
that.widget_create(container);
|
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
var div = $('<div/>', {
|
2011-02-07 11:38:06 -06:00
|
|
|
name: 'kerberos-key-valid',
|
|
|
|
style: 'display: none;'
|
2011-02-03 21:42:50 -06:00
|
|
|
}).appendTo(container);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
$('<img/>', {
|
|
|
|
src: 'check.png',
|
|
|
|
style: 'float: left;',
|
|
|
|
'class': 'status-icon'
|
|
|
|
}).appendTo(div);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
var content_div = $('<div/>', {
|
|
|
|
style: 'float: left;'
|
|
|
|
}).appendTo(div);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div.append('<b>Kerberos Key Present, Host Provisioned:</b>');
|
|
|
|
|
|
|
|
content_div.append(' ');
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
$('<input/>', {
|
|
|
|
'type': 'button',
|
|
|
|
'name': 'unprovision',
|
|
|
|
'value': 'Delete Key, Unprovision'
|
2011-01-17 07:43:43 -06:00
|
|
|
}).appendTo(content_div);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
div = $('<div/>', {
|
2011-02-07 11:38:06 -06:00
|
|
|
name: 'kerberos-key-missing',
|
|
|
|
style: 'display: none;'
|
2011-02-03 21:42:50 -06:00
|
|
|
}).appendTo(container);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
$('<img/>', {
|
|
|
|
src: 'caution.png',
|
|
|
|
style: 'float: left;',
|
|
|
|
'class': 'status-icon'
|
|
|
|
}).appendTo(div);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div = $('<div/>', {
|
|
|
|
style: 'float: left;'
|
|
|
|
}).appendTo(div);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div.append('<b>Kerberos Key Not Present</b>');
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div.append('<br/>');
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div.append('Enroll via One-Time-Password:');
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div.append('<br/>');
|
|
|
|
content_div.append('<br/>');
|
2011-01-13 04:20:12 -06:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
$('<input/>', {
|
|
|
|
'type': 'text',
|
|
|
|
'name': 'otp',
|
2011-01-13 04:20:12 -06:00
|
|
|
'class': 'otp'
|
2011-01-17 07:43:43 -06:00
|
|
|
}).appendTo(content_div);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-17 07:43:43 -06:00
|
|
|
content_div.append(' ');
|
2011-01-13 04:20:12 -06:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
$('<input/>', {
|
|
|
|
'type': 'button',
|
|
|
|
'name': 'enroll',
|
|
|
|
'value': 'Set OTP'
|
2011-01-17 07:43:43 -06:00
|
|
|
}).appendTo(content_div);
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.setup = function(container) {
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
that.widget_setup(container);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
2011-01-22 18:41:10 -06:00
|
|
|
that.status_valid = $('div[name=kerberos-key-valid]', that.container);
|
|
|
|
that.status_missing = $('div[name=kerberos-key-missing]', that.container);
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
var button = $('input[name=unprovision]', that.container);
|
2011-01-12 18:51:22 -06:00
|
|
|
that.unprovision_button = IPA.button({
|
2010-11-16 18:10:40 -06:00
|
|
|
'label': 'Delete Key, Unprovision',
|
2010-11-18 20:59:08 -06:00
|
|
|
'click': that.show_unprovision_dialog
|
2010-11-16 18:10:40 -06:00
|
|
|
});
|
|
|
|
button.replaceWith(that.unprovision_button);
|
|
|
|
|
|
|
|
that.otp_input = $('input[name=otp]', that.container);
|
|
|
|
|
|
|
|
that.enroll_button = $('input[name=enroll]', that.container);
|
2011-01-12 18:51:22 -06:00
|
|
|
button = IPA.button({
|
2010-11-16 18:10:40 -06:00
|
|
|
'label': 'Set OTP',
|
|
|
|
'click': that.set_otp
|
|
|
|
});
|
|
|
|
|
|
|
|
that.enroll_button.replaceWith(button);
|
|
|
|
that.enroll_button = button;
|
|
|
|
};
|
|
|
|
|
2010-11-18 20:59:08 -06:00
|
|
|
that.show_unprovision_dialog = function() {
|
2010-11-16 18:10:40 -06:00
|
|
|
|
|
|
|
var label = IPA.metadata[that.entity_name].label;
|
2011-01-12 18:51:22 -06:00
|
|
|
var dialog = IPA.dialog({
|
2010-11-16 18:10:40 -06:00
|
|
|
'title': 'Unprovisioning '+label
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.create = function() {
|
|
|
|
dialog.container.append(
|
2011-01-18 01:29:59 -06:00
|
|
|
'Are you sure you want to unprovision this host?');
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
dialog.add_button('Unprovision', function() {
|
2010-11-18 20:59:08 -06:00
|
|
|
that.unprovision(
|
2010-11-16 18:10:40 -06:00
|
|
|
function(data, text_status, xhr) {
|
|
|
|
set_status('missing');
|
|
|
|
dialog.close();
|
|
|
|
},
|
|
|
|
function(xhr, text_status, error_thrown) {
|
|
|
|
dialog.close();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
dialog.init();
|
|
|
|
|
|
|
|
dialog.open(that.container);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2010-11-18 20:59:08 -06:00
|
|
|
that.unprovision = function(on_success, on_error) {
|
|
|
|
|
|
|
|
var pkey = that.facet.get_primary_key();
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var command = IPA.command({
|
2010-11-18 20:59:08 -06:00
|
|
|
'name': that.entity_name+'_disable_'+pkey,
|
|
|
|
'method': that.entity_name+'_disable',
|
|
|
|
'args': [pkey],
|
|
|
|
'options': { 'all': true, 'rights': true },
|
|
|
|
'on_success': on_success,
|
|
|
|
'on_error': on_error
|
|
|
|
});
|
|
|
|
|
|
|
|
command.execute();
|
|
|
|
};
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.set_otp = function() {
|
2010-11-18 20:59:08 -06:00
|
|
|
|
|
|
|
var pkey = that.facet.get_primary_key();
|
|
|
|
var otp = that.otp_input.val();
|
|
|
|
that.otp_input.val('');
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var command = IPA.command({
|
2010-11-18 20:59:08 -06:00
|
|
|
'method': that.entity_name+'_mod',
|
|
|
|
'args': [pkey],
|
|
|
|
'options': {
|
|
|
|
'all': true,
|
|
|
|
'rights': true,
|
|
|
|
'userpassword': otp
|
|
|
|
},
|
|
|
|
'on_success': function(data, text_status, xhr) {
|
|
|
|
alert('One-Time-Password has been set.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
command.execute();
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
2010-11-18 20:17:14 -06:00
|
|
|
that.load = function(result) {
|
2010-11-16 18:10:40 -06:00
|
|
|
that.result = result;
|
|
|
|
var krblastpwdchange = result['krblastpwdchange'];
|
|
|
|
set_status(krblastpwdchange ? 'valid' : 'missing');
|
|
|
|
};
|
|
|
|
|
|
|
|
function set_status(status) {
|
2011-01-22 18:41:10 -06:00
|
|
|
that.status_valid.css('display', status == 'valid' ? 'inline' : 'none');
|
|
|
|
that.status_missing.css('display', status == 'missing' ? 'inline' : 'none');
|
2010-11-16 18:10:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return that;
|
2010-10-15 23:40:38 -05:00
|
|
|
}
|
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
function host_certificate_status_widget(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = certificate_status_widget(spec);
|
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
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.init = function() {
|
2010-10-15 23:40:38 -05:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
that.entity_label = IPA.metadata[that.entity_name].label;
|
|
|
|
|
|
|
|
that.get_entity_pkey = function(result) {
|
2010-10-15 23:40:38 -05:00
|
|
|
var values = result['fqdn'];
|
|
|
|
return values ? values[0] : null;
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.get_entity_name = function(result) {
|
|
|
|
return that.get_entity_pkey(result);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_entity_principal = function(result) {
|
2010-10-15 23:40:38 -05:00
|
|
|
var values = result['krbprincipalname'];
|
|
|
|
return values ? values[0] : null;
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.get_entity_certificate = function(result) {
|
2010-10-15 23:40:38 -05:00
|
|
|
var values = result['usercertificate'];
|
|
|
|
return values ? values[0].__base64__ : null;
|
2011-01-12 13:47:29 -06:00
|
|
|
};
|
2010-11-16 18:10:40 -06:00
|
|
|
};
|
2010-10-15 23:40:38 -05:00
|
|
|
|
2010-11-16 18:10:40 -06:00
|
|
|
return that;
|
2010-10-15 23:40:38 -05:00
|
|
|
}
|
2010-12-01 20:25:44 -06:00
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
IPA.host_managedby_host_facet = function (spec) {
|
2010-12-01 20:25:44 -06:00
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
2011-01-12 18:51:22 -06:00
|
|
|
var that = IPA.association_facet(spec);
|
2010-12-01 20:25:44 -06:00
|
|
|
|
|
|
|
that.add_method = 'add_managedby';
|
2010-12-02 22:12:59 -06:00
|
|
|
that.remove_method = 'remove_managedby';
|
2010-12-01 20:25:44 -06:00
|
|
|
|
|
|
|
that.init = function() {
|
|
|
|
|
|
|
|
var column = that.create_column({
|
|
|
|
name: 'fqdn',
|
|
|
|
primary_key: true
|
|
|
|
});
|
|
|
|
|
|
|
|
column.setup = function(container, record) {
|
|
|
|
container.empty();
|
|
|
|
|
|
|
|
var value = record[column.name];
|
|
|
|
value = value ? value.toString() : '';
|
|
|
|
|
|
|
|
$('<a/>', {
|
|
|
|
'href': '#'+value,
|
|
|
|
'html': value,
|
|
|
|
'click': function (value) {
|
|
|
|
return function() {
|
|
|
|
var state = IPA.tab_state(that.other_entity);
|
|
|
|
state[that.other_entity + '-facet'] = 'details';
|
|
|
|
state[that.other_entity + '-pkey'] = value;
|
|
|
|
$.bbq.pushState(state);
|
|
|
|
return false;
|
2011-01-12 13:47:29 -06:00
|
|
|
};
|
2010-12-01 20:25:44 -06:00
|
|
|
}(value)
|
|
|
|
}).appendTo(container);
|
|
|
|
};
|
|
|
|
|
2010-12-06 13:51:49 -06:00
|
|
|
that.create_column({name: 'description'});
|
2010-12-01 20:25:44 -06:00
|
|
|
|
|
|
|
that.create_adder_column({
|
|
|
|
name: 'fqdn',
|
|
|
|
primary_key: true,
|
|
|
|
width: '100px'
|
|
|
|
});
|
|
|
|
|
|
|
|
that.create_adder_column({
|
|
|
|
name: 'description',
|
|
|
|
width: '100px'
|
|
|
|
});
|
|
|
|
|
|
|
|
that.association_facet_init();
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
2011-01-14 14:14:32 -06:00
|
|
|
};
|