diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-11-24 17:27:37 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2015-11-27 15:50:56 +0100 |
commit | b4aa222e426c2b3f294432be64d95750dd86bc03 (patch) | |
tree | 61871225ad2de0a71cd2b74c8171db35a2a8198f /install/ui/src/freeipa/topology.js | |
parent | 768d1965aaa79625b5c6e16d999d65dd7fd4372e (diff) | |
download | freeipa-b4aa222e426c2b3f294432be64d95750dd86bc03.tar.gz freeipa-b4aa222e426c2b3f294432be64d95750dd86bc03.tar.xz freeipa-b4aa222e426c2b3f294432be64d95750dd86bc03.zip |
webui: update topology graph after raising domain level
When topology graph was shown with domain level == 0, a view describing
that domain level needs to be at least 1 was shown.
If domain level is raised, this view is then properly replaced by the
graph when shown again.
https://fedorahosted.org/freeipa/ticket/4286
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa/topology.js')
-rw-r--r-- | install/ui/src/freeipa/topology.js | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/install/ui/src/freeipa/topology.js b/install/ui/src/freeipa/topology.js index 47f72abf0..6654a310a 100644 --- a/install/ui/src/freeipa/topology.js +++ b/install/ui/src/freeipa/topology.js @@ -337,7 +337,8 @@ topology.domainlevel_set_action = function(spec) { that.execute_action = function(facet) { var dialog = builder.build('dialog', that.dialog); - dialog.succeeded.attach(function() { + dialog.succeeded.attach(function(data) { + IPA.domain_level = data.result.result; if (that.refresh) facet.refresh(); }); dialog.open(); @@ -622,6 +623,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], { disabled_view_el: null, topology_view_el: null, + current_view_el: null, visualization_cnt_el: null, _get_servers: function() { @@ -800,6 +802,8 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], { }, update: function() { + this._update_view(); + if (IPA.domain_level < topology.required_domain_level) return; when(this._get_data()).then(lang.hitch(this, function(data) { @@ -832,13 +836,33 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], { forward('link-selected'); }, - render: function() { - this.el = $('<div/>', { 'class': this.css_class }); + _update_view: function() { + + var view; + if (IPA.domain_level < topology.required_domain_level) { - this._render_disabled_view().appendTo(this.el); + if (!this.disabled_view_el) { + view = this._render_disabled_view(); + } else { + view = this.disabled_view_el; + } } else { - this._render_topology_view().appendTo(this.el); + if (!this.topology_view_el) { + view = this._render_topology_view(); + } else { + view = this.topology_view_el; + } } + if (view !== this.current_view_el) { + this.el.empty(); + view.appendTo(this.el); + } + this.current_view_el = view; + }, + + render: function() { + this.el = $('<div/>', { 'class': this.css_class }); + this._update_view(); if (this.container_node) { this.el.appendTo(this.container_node); } |