mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed problem bookmarking Policy/IPA Server tabs
When opening a bookmark, each tab level will be updated separately from top to bottom according to the URL state. The navigation code has been modified to recognize when an ancestor tab is being updated and not change the URL state. Ticket #1521
This commit is contained in:
parent
87821f2049
commit
61ff6ff107
@ -67,7 +67,7 @@ IPA.navigation = function(spec) {
|
||||
return that.tabs_by_name[name];
|
||||
};
|
||||
|
||||
that.get_current_tab = function(state) {
|
||||
that.get_active_tab = function(state) {
|
||||
var name = null;
|
||||
var next = state[that.root];
|
||||
|
||||
@ -79,6 +79,15 @@ IPA.navigation = function(spec) {
|
||||
return that.get_tab(name);
|
||||
};
|
||||
|
||||
that.is_ancestor = function(tab, ancestor) {
|
||||
var parent = tab.parent;
|
||||
while (parent) {
|
||||
if (parent == ancestor) return true;
|
||||
parent = parent.parent;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
that.get_path_state = function(name) {
|
||||
|
||||
var path_state = {};
|
||||
@ -142,7 +151,7 @@ IPA.navigation = function(spec) {
|
||||
$.extend(that.path, param_path);
|
||||
|
||||
// find the tab pointed by the path
|
||||
var tab = that.get_current_tab(that.path);
|
||||
var tab = that.get_active_tab(that.path);
|
||||
|
||||
// find the active tab at the lowest level
|
||||
while (!tab.entity) {
|
||||
@ -243,19 +252,32 @@ IPA.navigation = function(spec) {
|
||||
var tabs = $('.' + that.tab_class, that.container);
|
||||
tabs.tabs({
|
||||
select: function(event, ui) {
|
||||
|
||||
// get the selected tab
|
||||
var panel = $(ui.panel);
|
||||
var name = panel.attr('name');
|
||||
var selected_tab = that.get_tab(name);
|
||||
|
||||
// get the tab specified in the URL state
|
||||
var state = that.get_state();
|
||||
var tab = that.get_current_tab(state);
|
||||
var url_tab = that.get_active_tab(state);
|
||||
|
||||
if (tab && tab.name == name) { // hash change
|
||||
if (url_tab) {
|
||||
// if they are the same, the selection is triggered by hash change
|
||||
if (url_tab == selected_tab) {
|
||||
// use the URL state to update internal state
|
||||
return that.push_state(state);
|
||||
|
||||
} else { // mouse click
|
||||
return that.show_page(name);
|
||||
// if the selection is for the ancestor
|
||||
} else if (that.is_ancestor(url_tab, selected_tab)) {
|
||||
// let the tab be updated and don't change the state
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// selection is triggered by mouse click, update the URL state
|
||||
return that.show_page(name);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user