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
--
Petr Vobornik
From 0a817ca07d4e199859e1bd19aa36181869c05c22 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/src/freeipa/app.js                  |   1 +
 install/ui/src/freeipa/navigation/menu_spec.js |   1 +
 install/ui/src/freeipa/topology.js             | 152 +++++++++++++++++++++++++
 install/ui/test/data/ipa_init.json             |   5 +
 ipalib/plugins/internal.py                     |   5 +
 5 files changed, 164 insertions(+)
 create mode 100644 install/ui/src/freeipa/topology.js

diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js
index 46752fa09e47be9e14e5fa37ce1bd1cbd0b0afdf..ba23a9cf71ae673585ebd782b94d956e614aa655 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',
     'dojo/domReady!'
 ],function(app_container) {
diff --git a/install/ui/src/freeipa/navigation/menu_spec.js b/install/ui/src/freeipa/navigation/menu_spec.js
index ca1a290f479fd0cc6a399e6bc93bd3e8ed1fca40..3e74997099ca495571c97eb64be99fa1a0e640e4 100644
--- a/install/ui/src/freeipa/navigation/menu_spec.js
+++ b/install/ui/src/freeipa/navigation/menu_spec.js
@@ -169,6 +169,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..f7a3749f62e5061b61e3b89e0d1fae8748d0758c
--- /dev/null
+++ b/install/ui/src/freeipa/topology.js
@@ -0,0 +1,152 @@
+//
+// 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',
+                        'iparepltoposegmentleftnode',
+                        'iparepltoposegmentrightnode',
+                        'iparepltoposegmentdirection'
+                    ]
+                },
+                {
+                    name: 'replication_config',
+                    label: '@i18n:objects.topology.replication_config',
+                    fields: [
+                        'nsds5replicastripattrs',
+                        'nsds5replicatedattributelist',
+                        'nsds5replicatedattributelisttotal',
+                        'nsds5beginreplicarefresh',
+                        'nsds5replicatimeout',
+                        'nsds5replicaenabled'
+                    ]
+                }
+            ]
+        }
+    ],
+    adder_dialog: {
+        fields: [
+            'cn',
+            'iparepltoposegmentleftnode',
+            'iparepltoposegmentrightnode',
+            'iparepltoposegmentdirection'
+        ]
+    }
+};};
+
+
+/**
+ * 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 03654312998af6ee868caf8f74e9ce33ac5f94a7..8be8effc0da57c36225d8260ed41a26baf8d43d0 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -533,6 +533,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",
@@ -627,6 +631,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 e04e843400015edfaeac5bdc94300ab600b97a9d..cf9bc5d4f924f8b820b44741dc6728d2309c2876 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -678,6 +678,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"),
@@ -772,6 +776,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