On 06/28/2016 03:12 PM, Petr Spacek wrote:
On 27.6.2016 17:48, Pavel Vomacka wrote:

On 06/23/2016 04:58 PM, Petr Vobornik wrote:
On 06/23/2016 04:34 PM, Martin Basti wrote:
On 23.06.2016 09:57, Pavel Vomacka wrote:
Hello,

please review attached patch.

Part of: https://fedorahosted.org/freeipa/ticket/5905



Works for me

In this patch and also in some other(cert patches) the confirm message
has following structure:
    To confirm your intention to $action, click the $button_name button.

On other places of Web UI, more human and easier structure is used:
    Do you want to update DNS records?
    [Update] [Cancel]

IMHO we should use it here as well. And the same for(separate path):
    remove_certificate_hold_confirmation
    revoke_confirmation"


otherwise the patch is OK.
The patch works!

Nitpick: 'Update DNS records' is too generic. The button and message should
contain keyword 'system' somewhere.

E.g. 'Update system DNS records'. Feel free to push it when you add the
keyword :-)


Thank you for review.

Strings updated.

--
Pavel^3 Vomacka

From e49a9f94720d31bce2866430ad19a277cdb1cb22 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Wed, 22 Jun 2016 18:13:27 +0200
Subject: [PATCH 1/2] Add button for dns_update_system_records command

Part of: https://fedorahosted.org/freeipa/ticket/5905
---
 install/ui/src/freeipa/dns.js      | 44 +++++++++++++++++++++++++++++++++++++-
 install/ui/test/data/ipa_init.json |  5 ++++-
 ipaserver/plugins/internal.py      |  3 +++
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js
index c086251a8730abd4824609e9bc54a590dd138b14..2d424aeae8ef735d02426a0f08b6261ec2f04c19 100644
--- a/install/ui/src/freeipa/dns.js
+++ b/install/ui/src/freeipa/dns.js
@@ -100,7 +100,9 @@ return {
                     ]
                 }
             ],
-            needs_update: true
+            needs_update: true,
+            actions: [ 'update_dns_records' ],
+            header_actions: [ 'update_dns_records' ]
         }
     ]
 };};
@@ -554,6 +556,45 @@ var make_dnsserver_spec = function() {
 };
 
 
+IPA.dns.update_dns_records_action = function(spec) {
+
+    spec = spec || {};
+
+    spec.name = spec.name || 'update_dns_records';
+    spec.label = spec.label || '@i18n:objects.dnsconfig.update_dns';
+
+    var that = IPA.action(spec);
+
+    that.execute_action = function() {
+        var spec = {
+            title: '@i18n:objects.dnsconfig.update_dns',
+            message: '@i18n:objects.dnsconfig.update_dns_dialog_msg',
+            ok_label: '@i18n:buttons.update'
+        };
+
+        that.dialog = IPA.confirm_dialog(spec);
+
+        that.dialog.on_ok = function() {
+
+            var command = rpc.command({
+                entity: 'dns',
+                method: 'update_system_records',
+                on_success: function(data) {
+                    var status = data.result.value;
+                    if (status) IPA.notify_success(
+                        '@i18n:objects.dnsconfig.updated_dns');
+                }
+            });
+
+            command.execute();
+        };
+
+        that.dialog.open();
+    };
+
+    return that;
+};
+
 IPA.dnszone_details_facet = function(spec, no_init) {
 
     spec = spec || {};
@@ -2617,6 +2658,7 @@ exp.register = function() {
 
     a.register('dns_add_permission', IPA.dns.add_permission_action);
     a.register('dns_remove_permission', IPA.dns.remove_permission_action);
+    a.register('update_dns_records', IPA.dns.update_dns_records_action);
 };
 
 phases.on('registration', exp.register);
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 1d7f5d883dd923dc5ad749b592e55f23e7d4771b..a8f6e95f4900d00aebdaf5266f96259e8d156936 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -309,7 +309,10 @@
                             "forward_first": "Forward first",
                             "forward_none": "Forwarding disabled",
                             "forward_only": "Forward only",
-                            "options": "Options"
+                            "options": "Options",
+                            "update_dns": "Update System DNS Records",
+                            "update_dns_dialog_msg": "Do you want to update system DNS records?",
+                            "updated_dns": "System DNS records updated"
                         },
                         "dnsrecord": {
                             "data": "Data",
diff --git a/ipaserver/plugins/internal.py b/ipaserver/plugins/internal.py
index c0360567cbca883dda018a7a2f7f9f9536c3d118..5534bf4effacffcf1c2983349679ca3b25f8ed69 100644
--- a/ipaserver/plugins/internal.py
+++ b/ipaserver/plugins/internal.py
@@ -448,6 +448,9 @@ class i18n_messages(Command):
                 "forward_none": _("Forwarding disabled"),
                 "forward_only": _("Forward only"),
                 "options": _("Options"),
+                "update_dns": _("Update System DNS Records"),
+                "update_dns_dialog_msg": _("Do you want to update system DNS records?"),
+                "updated_dns": _("System DNS records updated"),
             },
             "dnsrecord": {
                 "data": _("Data"),
-- 
2.5.5

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to