From 7767a6befe2cc461cd6b8aadff1626108e3101b0 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Tue, 16 Aug 2016 10:03:36 +0200 Subject: [PATCH] Add warning about only one existing CA server It is not safe to have only one CA server in topology. Therefore there is a check and in case that there is only one CA server a warning is shown. The warning is shown after each refreshing of servers facet. https://fedorahosted.org/freeipa/ticket/5828 Reviewed-By: Tomas Krizek --- install/ui/src/freeipa/topology.js | 73 +++++++++++++++++++++++++++++++++++++- install/ui/test/data/ipa_init.json | 2 ++ ipaserver/plugins/internal.py | 2 ++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/topology.js b/install/ui/src/freeipa/topology.js index 7e501eb3506587ea653497d2806938890066e4f0..c33adba9a3c704b66b85689dd18e927ab975d2fe 100644 --- a/install/ui/src/freeipa/topology.js +++ b/install/ui/src/freeipa/topology.js @@ -28,13 +28,14 @@ define([ './facets/Facet', './topology_graph', './navigation', + './widget', // plain imports './search', './entity'], function(lang, declare, Evented, Stateful, Deferred, on, all, when, builder, IPA, $, menu, metadata_provider, phases, reg, rpc, text, mod_details, mod_facet, mod_field, ActionMixin, - HeaderMixin, Facet, topology_graph, navigation) { + HeaderMixin, Facet, topology_graph, navigation, widget_mod) { /** * Topology module * @class @@ -206,6 +207,7 @@ return { facets: [ { $type: 'search', + $factory: topology.servers_search_facet, no_update: true, disable_facet_tabs: false, tabs_in_sidebar: true, @@ -483,6 +485,75 @@ topology.location_adapter = declare([mod_field.Adapter], { } }); +topology.servers_search_facet = function(spec, no_init) { + spec = spec || {}; + + var that = IPA.search_facet(spec); + + that.create_get_records_command = function(pkeys, on_success, on_error) { + + var on_success_extended = function(data, text_status, xhr) { + // Call original on_success handler + on_success(data, text_status, xhr); + + var result = data.result.results; + var counter = 0; + + for (var i=0, l=result.length; i