On 04/21/2015 04:09 PM, Petr Vobornik wrote:
First iteration of Topology plugin Web UI.

It reflects current state of topology plugin python part which is
implemented in "[PATCH] manage replication topology in the shared tree"
and my wip patch.

I expect that the server API part will change a bit therefore this will
as well.

Graphical visualization/management (ticket 4286)  will be implemented in
separate patch.

https://fedorahosted.org/freeipa/ticket/4997
http://www.freeipa.org/page/V4/Manage_replication_topology



New version attached. It requires stage user web ui patches in order to apply (I expect that user life cycle backend will be pushed sooner than topology)

Changes:
- Left host and Right host fields are now host comboboxes
- Connectivity are radio buttons with "both, left-right, right-left, none" options
- segment name is not a required field in its adder dialog

IMHO "Attributes to strip", "Attributes to replicate", "Attributes for total update", "Initialize replica", "Session timeout", "Replication agreement enabled" fields should not be just free-form textboxes, but they should be more specific, e.g. a checkbox for "Replication agreement enabled" or integer for "Session timeout", but that should be modified first in the backend python plugin.
--
Petr Vobornik
From 135fbc6ce866a29194557c0d9a1a1027423fb57d Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 21 Apr 2015 15:50:54 +0200
Subject: [PATCH] webui: topology plugin

https://fedorahosted.org/freeipa/ticket/4997
---
 install/ui/doc/categories.json                 |   1 +
 install/ui/src/freeipa/app.js                  |   1 +
 install/ui/src/freeipa/navigation/menu_spec.js |   1 +
 install/ui/src/freeipa/topology.js             | 193 +++++++++++++++++++++++++
 install/ui/test/data/ipa_init.json             |   5 +
 ipalib/plugins/internal.py                     |   5 +
 6 files changed, 206 insertions(+)
 create mode 100644 install/ui/src/freeipa/topology.js

diff --git a/install/ui/doc/categories.json b/install/ui/doc/categories.json
index aa5e6f5db3d17aa02e2f1694239e635f40161b12..ee02e45d958845b52b714065ddc5119d73e3920c 100644
--- a/install/ui/doc/categories.json
+++ b/install/ui/doc/categories.json
@@ -253,6 +253,7 @@
                     "otptoken",
                     "radiusproxy",
                     "stageuser",
+                    "topology",
                     "user",
                     "plugins.load",
                     "plugins.login",
diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js
index 140fe938f68975310175fb9fadf0ec36db048b72..9b290ab0eee216f8b8adb3181a1b3e7ac22fb351 100644
--- a/install/ui/src/freeipa/app.js
+++ b/install/ui/src/freeipa/app.js
@@ -47,6 +47,7 @@ define([
     './service',
     './sudo',
     './trust',
+    './topology',
     './user',
     './stageuser',
     'dojo/domReady!'
diff --git a/install/ui/src/freeipa/navigation/menu_spec.js b/install/ui/src/freeipa/navigation/menu_spec.js
index 13f533d1a6fbb21c73e1f0e5fe1df2836c99f832..0cdc1d557d00c78f5ffc5304627363ae3bc3102a 100644
--- a/install/ui/src/freeipa/navigation/menu_spec.js
+++ b/install/ui/src/freeipa/navigation/menu_spec.js
@@ -184,6 +184,7 @@ var nav = {};
                         { entity: 'trustconfig' }
                     ]
                 },
+                { entity: 'topologysuffix', label: '@i18n:tabs.topology' },
                 { entity: 'config' }
             ]
         }
diff --git a/install/ui/src/freeipa/topology.js b/install/ui/src/freeipa/topology.js
new file mode 100644
index 0000000000000000000000000000000000000000..2c098d92470749b6f52a360494b59b1fe0f6c714
--- /dev/null
+++ b/install/ui/src/freeipa/topology.js
@@ -0,0 +1,193 @@
+//
+// Copyright (C) 2015  FreeIPA Contributors see COPYING for license
+//
+
+define([
+        'dojo/on',
+        './ipa',
+        './jquery',
+        './menu',
+        './phases',
+        './reg',
+        './rpc',
+        './text',
+        './details',
+        './facet',
+        './search',
+        './entity'],
+            function(on, IPA, $, menu, phases, reg, rpc, text, mod_details, mod_facet) {
+/**
+ * Topology module
+ * @class
+ * @singleton
+ */
+var topology = IPA.topology = {
+};
+
+var make_suffix_spec = function() {
+return {
+    name: 'topologysuffix',
+    enable_test: function() {
+        return true;
+    },
+    facet_groups: [ 'segments', 'settings' ],
+    facets: [
+        {
+            $type: 'search',
+            columns: [
+                'cn',
+                'iparepltopoconfroot'
+            ]
+        },
+        {
+            $type: 'nested_search',
+            facet_group: 'segments',
+            nested_entity: 'topologysegment',
+            search_all_entries: true,
+            label: '@mo:topologysegment.label',
+            tab_label: '@mo:topologysegment.label',
+            name: 'topologysegment',
+            columns: [
+                'cn',
+                'iparepltoposegmentleftnode',
+                'iparepltoposegmentrightnode',
+                'iparepltoposegmentdirection'
+            ]
+        },
+        {
+            $type: 'details',
+            sections: [
+                {
+                    name: 'details',
+                    fields: [
+                        'cn',
+                        'iparepltopoconfroot'
+                    ]
+                }
+            ]
+        }
+    ],
+    adder_dialog: {
+        fields: [
+            'cn',
+            'iparepltopoconfroot'
+        ]
+    }
+};};
+
+
+var make_segment_spec = function() {
+return {
+    name: 'topologysegment',
+    containing_entity: 'topologysuffix',
+    enable_test: function() {
+        return true;
+    },
+    facets: [
+        {
+            $type: 'details',
+            disable_breadcrumb: false,
+            sections: [
+                {
+                    name: 'details',
+                    label: '@i18n:objects.topology.segment_details',
+                    fields: [
+                        'cn',
+                        {
+                            $type: 'entity_select',
+                            name: 'iparepltoposegmentleftnode',
+                            other_entity: 'host',
+                            other_field: 'fqdn',
+                            z_index: 2
+                        },
+                        {
+                            $type: 'entity_select',
+                            name: 'iparepltoposegmentrightnode',
+                            other_entity: 'host',
+                            other_field: 'fqdn',
+                            z_index: 1
+                        },
+                        {
+                            $type: 'radio',
+                            name: 'iparepltoposegmentdirection',
+                            options: IPA.create_options([
+                                'both', 'left-right', 'right-left', 'none'
+                            ]),
+                            default_value: 'both'
+                        }
+                    ]
+                },
+                {
+                    name: 'replication_config',
+                    label: '@i18n:objects.topology.replication_config',
+                    fields: [
+                        'nsds5replicastripattrs',
+                        'nsds5replicatedattributelist',
+                        'nsds5replicatedattributelisttotal',
+                        'nsds5beginreplicarefresh',
+                        'nsds5replicatimeout',
+                        'nsds5replicaenabled'
+                    ]
+                }
+            ]
+        }
+    ],
+    adder_dialog: {
+        fields: [
+            {
+                name: 'cn',
+                required: false
+            },
+            {
+                $type: 'entity_select',
+                name: 'iparepltoposegmentleftnode',
+                other_entity: 'host',
+                other_field: 'fqdn',
+                z_index: 2
+            },
+            {
+                $type: 'entity_select',
+                name: 'iparepltoposegmentrightnode',
+                other_entity: 'host',
+                other_field: 'fqdn',
+                z_index: 1
+            },
+            {
+                $type: 'radio',
+                name: 'iparepltoposegmentdirection',
+                options: IPA.create_options([
+                    'both', 'left-right', 'right-left', 'none'
+                ]),
+                default_value: 'both'
+            }
+        ]
+    }
+};};
+
+
+/**
+ * Topology suffix entity specification object
+ * @member topology
+ */
+topology.suffix_spec = make_suffix_spec();
+
+/**
+ * Topology segment entity specification object
+ * @member topology
+ */
+topology.segment_spec = make_segment_spec();
+
+/**
+ * Register entity
+ * @member topology
+ */
+topology.register = function() {
+    var e = reg.entity;
+    e.register({type: 'topologysuffix', spec: topology.suffix_spec});
+    e.register({type: 'topologysegment', spec: topology.segment_spec});
+};
+
+phases.on('registration', topology.register);
+
+return topology;
+});
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index b17bf777fb665a77b31505f79149902ba7fd3ede..611aa35a913052c05e5b10acf9a12f63dd7ab6fc 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -544,6 +544,10 @@
                             "specified_users": "Specified Users and Groups",
                             "user": "Who"
                         },
+                        "topology": {
+                            "segment_details": "Segment details",
+                            "replication_config": "Replication configuration",
+                        },
                         "trust": {
                             "account": "Account",
                             "admin_account": "Administrative account",
@@ -639,6 +643,7 @@
                         "policy": "Policy",
                         "role": "Role Based Access Control",
                         "sudo": "Sudo",
+                        "topology": "Topology",
                         "trust": "Trusts"
                     },
                     "true": "True",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 56d271b4a7a9f3abe9167f7a273b48df7979c552..ab2b54377f2bd01bb7d195713e45a6b203d1fd6f 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -690,6 +690,10 @@ class i18n_messages(Command):
                 "specified_users": _("Specified Users and Groups"),
                 "user": _("Who"),
             },
+            "topology": {
+                "segment_details": _("Segment details"),
+                "replication_config": _("Replication configuration"),
+            },
             "trust": {
                 "account": _("Account"),
                 "admin_account": _("Administrative account"),
@@ -785,6 +789,7 @@ class i18n_messages(Command):
             "policy": _("Policy"),
             "role": _("Role Based Access Control"),
             "sudo": _("Sudo"),
+            "topology": _("Topology"),
             "trust": _("Trusts"),
         },
         "true": _("True"),
-- 
2.1.0

-- 
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