summaryrefslogtreecommitdiffstats
path: root/install/static/service.js
diff options
context:
space:
mode:
Diffstat (limited to 'install/static/service.js')
-rw-r--r--install/static/service.js75
1 files changed, 69 insertions, 6 deletions
diff --git a/install/static/service.js b/install/static/service.js
index 43ef968a0..0afcb4688 100644
--- a/install/static/service.js
+++ b/install/static/service.js
@@ -29,18 +29,21 @@ ipa_entity_set_add_definition('service', [
'dialog-add-service', 'Add New Service', [
['krbprincipalname', 'Principal', service_add_krbprincipalname],
['service', 'Service', null],
- ['host', 'Host Name', null],
+ ['host', 'Host Name', null]
]
]);
ipa_entity_set_details_definition('service', [
- ['identity', 'Service Details', [
- ['krbprincipalname', 'Principal', null],
- ]]
+ {name:'identity', label:'Service Details', fields:[
+ {name:'krbprincipalname', label:'Principal', setup:service_krbprincipalname_setup, load:service_krbprincipalname_load},
+ {name:'service', label:'Service', load:service_service_load},
+ {name:'host', label:'Host Name', load:service_host_load},
+ {name:'usercertificate', label:'Certificate', load:service_usercertificate_load, save:service_usercertificate_save}
+ ]}
]);
-function service_add_krbprincipalname(add_dialog, flag) {
- if (flag == IPA_ADD_UPDATE) {
+function service_add_krbprincipalname(add_dialog, mode) {
+ if (mode == IPA_ADD_UPDATE) {
var service = add_dialog.find('input[name=service]').val();
var host = add_dialog.find('input[name=host]').val();
return service+'/'+host;
@@ -51,3 +54,63 @@ function service_add_krbprincipalname(add_dialog, flag) {
ipa_entity_set_association_definition('service', {
'host': { method: 'add_host' }
});
+
+function service_krbprincipalname_setup(container, dl, section) {
+ // skip krbprincipalname
+}
+
+function service_krbprincipalname_load(dt, result) {
+ // skip krbprincipalname
+}
+
+function service_service_load(dt, result) {
+ var krbprincipalname = result['krbprincipalname'][0];
+ var service = krbprincipalname.replace(/\/.*$/, '');
+ var dd = ipa_create_first_dd(this.name, service);
+ dt.after(dd);
+}
+
+function service_host_load(dt, result) {
+ var krbprincipalname = result['krbprincipalname'][0];
+ var host = krbprincipalname.replace(/^.*\//, '');
+ var dd = ipa_create_first_dd(this.name, host);
+ dt.after(dd);
+}
+
+function service_usercertificate_load(dt, result) {
+ var textarea = $("<textarea/>", {
+ title: 'usercertificate',
+ style: 'width: 300px; height: 200px;'
+ });
+
+ var dd = ipa_create_first_dd(this.name, textarea);
+ dt.after(dd);
+
+ var usercertificate = result['usercertificate'];
+ if (!usercertificate) return;
+
+ var value = usercertificate[0].__base64__;
+ textarea.val(value);
+}
+
+function service_usercertificate_save(container) {
+ var field = this;
+ var values = [];
+
+ var dd = $('dd[title='+field.name+']', container);
+ dd.each(function () {
+ var textarea = $('textarea', dd);
+ if (!textarea.length) return;
+
+ var value = $.trim(textarea.val());
+ if (value) {
+ value = {'__base64__': value};
+ } else {
+ value = '';
+ }
+
+ values.push(value);
+ });
+
+ return values;
+}