On 03/06/2013 10:40 AM, Petr Vobornik wrote:
> On 03/05/2013 05:52 PM, Ana Krivokapic wrote:
>> On 02/27/2013 05:10 PM, Petr Vobornik wrote:
>>> On 02/27/2013 04:20 PM, Ana Krivokapic wrote:
>>>> Add support for Realm Domains to web UI.
>>>>
>>>> https://fedorahosted.org/freeipa/ticket/3407
>>>
>>> The patch looks good, but there is a issue we don't have a precedence
>>> for.
>>>
>>> The mod command is doing dns check for new domains. Currently we can't
>>> specify --force option to bypass the check.
>>>
>>> I see two possible implementations:
>>> 1) On update, when user adds or modifies the values, a dialog would
>>> pop up and ask user whether he wants to force it.
>>>
>>> 2) Another option is to disable edit on the list(deletion would be
>>> still allowed) and move the add operation to separate action in action
>>> list.
>>>
>>> I prefer the former. Latter might have issues with two modifications
>>> (delete and add) at the same time at two different places (facet and
>>> add dialog).
>>
>> Added force option to the error dialog.
>>
>> Updated patch is attached.
>>
>
> 1) I think the dialog with the force should be shown before executing
> the operation. Sometimes, DNS check can take several seconds. There is
> no point for waiting for the error if you know that it will fail.
>
> 2) Regardless of #1. I don't think that just adding 'force' button
> without explaining the user what it means is the way to go.
>
> Previously (solution #1) I had in mind to show following dialog after
> clicking on 'update':
>
>
> -------------------------------------------------------
> [Check DNS]
> -------------------------------------------------------
>
> Do you also want to perform DNS check?
>
>                             [Check DNS] [Force Update]
> -------------------------------------------------------
>
> Default button (confirm button) will be [Check DNS]
>

Thanks, fixed, and I also added a Cancel button, in case the user wants
to back out.

-- 
Regards,

Ana Krivokapic
Associate Software Engineer
FreeIPA team
Red Hat Inc.

From 7060b2082b092004826e9eb1c94c2b6fa3ed1e77 Mon Sep 17 00:00:00 2001
From: Ana Krivokapic <akriv...@redhat.com>
Date: Wed, 6 Mar 2013 20:11:19 +0100
Subject: [PATCH] Realm Domains page

Add support for Realm Domains to web UI.

https://fedorahosted.org/freeipa/ticket/3407
---
 install/ui/src/freeipa/app.js               |   1 +
 install/ui/src/freeipa/realmdomains.js      | 105 ++++++++++++++++++++++++++++
 install/ui/src/freeipa/webui.js             |   3 +-
 install/ui/test/data/ipa_init.json          |   3 +
 install/ui/test/data/ipa_init_objects.json  |  42 +++++++++++
 install/ui/test/data/realmdomains_show.json |  24 +++++++
 ipalib/plugins/internal.py                  |   3 +
 7 files changed, 180 insertions(+), 1 deletion(-)
 create mode 100644 install/ui/src/freeipa/realmdomains.js
 create mode 100644 install/ui/test/data/realmdomains_show.json

diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js
index 9d89c1aede857ddfc27ebffa306c41172ed56bca..3dcb10f493824923254636c06b715164e419cce5 100644
--- a/install/ui/src/freeipa/app.js
+++ b/install/ui/src/freeipa/app.js
@@ -41,6 +41,7 @@ define([
     './idrange',
     './netgroup',
     './policy',
+    './realmdomains',
     './rule',
     './selinux',
     './serverconfig',
diff --git a/install/ui/src/freeipa/realmdomains.js b/install/ui/src/freeipa/realmdomains.js
new file mode 100644
index 0000000000000000000000000000000000000000..73d7f39ea33cba1b09f6808413ca89ab8b4cee62
--- /dev/null
+++ b/install/ui/src/freeipa/realmdomains.js
@@ -0,0 +1,105 @@
+/*  Authors:
+ *    Ana Krivokapic <akriv...@redhat.com>
+ *
+ * Copyright (C) 2013 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * 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.
+ *
+ * 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
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+define(['./ipa', './jquery', './details', './search', './association',
+    './entity'], function (IPA, $) {
+
+    IPA.realmdomains = {};
+
+    IPA.realmdomains.entity = function (spec) {
+
+        var that = IPA.entity(spec);
+
+        that.init = function () {
+            that.entity_init();
+
+            that.builder.details_facet({
+                factory: IPA.realmdomains_details_facet,
+                title: IPA.metadata.objects.realmdomains.label,
+                sections: [
+                    {
+                        name: 'identity',
+                        label: IPA.messages.objects.realmdomains.identity,
+                        fields: [
+                            {
+                                name: 'associateddomain',
+                                type: 'multivalued'
+                            }
+                        ]
+                    }
+                ],
+                needs_update: true
+            });
+        };
+        return that;
+    };
+
+    IPA.realmdomains_details_facet = function (spec, no_init) {
+        spec = spec || {};
+        var that = IPA.details_facet(spec, true);
+
+        that.update = function (on_success, on_error) {
+            var command = that.create_update_command();
+
+            command.on_success = function (data, text_status, xhr) {
+                that.update_on_success(data, text_status, xhr);
+                if (on_success) on_success.call(this, data, text_status, xhr);
+            };
+
+            command.on_error = function (xhr, text_status, error_thrown) {
+                that.update_on_error(xhr, text_status, error_thrown);
+                if (on_error) on_error.call(this, xhr, text_status, error_thrown);
+            };
+
+            var dialog = IPA.confirm_dialog({
+                title: 'Check DNS',
+                message: 'Do you also want to perform DNS check?',
+                ok_label: 'Check DNS',
+                on_ok: function () {
+                    command.execute();
+                }
+            });
+
+            var cancel_button = dialog.get_button('cancel');
+            dialog.buttons.remove('cancel');
+
+            dialog.create_button({
+                name: 'force',
+                label: 'Force Update',
+                visible: true,
+                click: function () {
+                    command.set_option('force', true);
+                    command.execute();
+                    dialog.close();
+                }
+            });
+
+            dialog.add_button(cancel_button);
+            dialog.open();
+        };
+
+        if (!no_init) that.init_details_facet();
+        return that;
+    };
+
+    IPA.register('realmdomains', IPA.realmdomains.entity);
+
+    return {};
+});
diff --git a/install/ui/src/freeipa/webui.js b/install/ui/src/freeipa/webui.js
index f6c3339ec4b5d3fb8a4cb547407eebf2a19b45af..04b255d8e99f59a777fce6eea230d01b48f52a9f 100644
--- a/install/ui/src/freeipa/webui.js
+++ b/install/ui/src/freeipa/webui.js
@@ -42,7 +42,8 @@ IPA.admin_navigation = function(spec) {
                  {entity: 'dnsconfig'},
                  {entity: 'dnsrecord', hidden:true}
              ]
-            }
+            },
+            {entity: 'realmdomains'}
         ]},
         {name: 'policy', label: IPA.messages.tabs.policy, children: [
             {name: 'hbac', label: IPA.messages.tabs.hbac, children: [
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 73d54578b19c53de15c237472a46312fa5e30ccc..130ad64a7e8a619e3a88a49ca05a38e6c5512a44 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -380,6 +380,9 @@
                             "type_ad": "Active Directory domain",
                             "type_local": "Local domain"
                         },
+                        "realmdomains": {
+                            "identity": "Realm Domains"
+                        },
                         "role": {
                             "identity": "Role Settings"
                         },
diff --git a/install/ui/test/data/ipa_init_objects.json b/install/ui/test/data/ipa_init_objects.json
index 6458e4cdaa5c64ee0bd82df67508b002bc4446fb..0243c63d402f7de304322117e577f8a06e431d3f 100644
--- a/install/ui/test/data/ipa_init_objects.json
+++ b/install/ui/test/data/ipa_init_objects.json
@@ -6026,6 +6026,48 @@
                 ],
                 "uuid_attribute": ""
             },
+            "realmdomains": {
+                "aciattrs": [],
+                "attribute_members": {},
+                "bindable": false,
+                "container_dn": "",
+                "default_attributes": ["associateddomain"],
+                "hidden_attributes": [
+                    "objectclass",
+                    "aci"
+                ],
+                "label": "Realm Domains",
+                "label_singular": "Realm Domains",
+                "methods": [
+                    "mod",
+                    "show"
+                ],
+                "name": "realmdomains",
+                "object_class": [
+                    "domainrelatedobject",
+                    "top",
+                    "nscontainter"
+                ],
+                "object_class_config": null,
+                "object_name": "realmdomains",
+                "object_name_plural": "realmdomains",
+                "parent_object": "",
+                "rdn_attribute": "",
+                "relationships": {},
+                "takes_params": [
+                    {
+                        "class": "Str",
+                        "doc": "Domain",
+                        "flags": [],
+                        "label": "Domain",
+                        "name": "associateddomain",
+                        "required": true,
+                        "type": "unicode",
+                        "multivalued": true
+                    }
+                ],
+                "uuid_attribute": ""
+            },
             "role": {
                 "aciattrs": [
                     "businesscategory",
diff --git a/install/ui/test/data/realmdomains_show.json b/install/ui/test/data/realmdomains_show.json
new file mode 100644
index 0000000000000000000000000000000000000000..84254ba4524c0498d7e02f628d29d14c6ca6aa97
--- /dev/null
+++ b/install/ui/test/data/realmdomains_show.json
@@ -0,0 +1,24 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "result": {
+            "attributelevelrights": {
+                "aci": "rscwo",
+                "cn": "rscwo",
+                "associateddomain": "rscwo",
+                "objectclass": "rscwo"
+            },
+            "cn": ["Realm Domains"],
+            "dn": "cn=Realm Domains,cn=ipa,cn=etc,dc=example,dc=com",
+            "associateddomain": ["example.com"],
+            "objectclass": [
+                "nsContainer",
+                "top",
+                "domainRelatedObject"
+            ]
+        },
+        "summary": null,
+        "value": ""
+    }
+}
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 2ca112ee0816a23d2b341d9a79b9447da41c506b..af088a02d614fa24c4ede740079014002720ee9b 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -518,6 +518,9 @@ class i18n_messages(Command):
                 "type_ad": _("Active Directory domain"),
                 "type_local": _("Local domain"),
             },
+            "realmdomains": {
+                "identity": _("Realm Domains"),
+            },
             "role": {
                 "identity": _("Role Settings"),
             },
-- 
1.7.11.7

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to