Fix for #1001 connection tab not unfolding
Defer collapsing the connection element until the whole wrapper part is visible (it's hidden for non-admins).
This commit is contained in:
parent
94625c45b9
commit
af67d8bfb5
1 changed files with 23 additions and 9 deletions
|
|
@ -86,6 +86,15 @@ $(function() {
|
||||||
self._processStateData(data.state);
|
self._processStateData(data.state);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.openOrCloseOnStateChange = function() {
|
||||||
|
var connectionTab = $("#connection");
|
||||||
|
if (self.isOperational() && connectionTab.hasClass("in")) {
|
||||||
|
connectionTab.collapse("hide");
|
||||||
|
} else if (!self.isOperational() && !connectionTab.hasClass("in")) {
|
||||||
|
connectionTab.collapse("show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self._processStateData = function(data) {
|
self._processStateData = function(data) {
|
||||||
self.previousIsOperational = self.isOperational();
|
self.previousIsOperational = self.isOperational();
|
||||||
|
|
||||||
|
|
@ -97,15 +106,10 @@ $(function() {
|
||||||
self.isReady(data.flags.ready);
|
self.isReady(data.flags.ready);
|
||||||
self.isLoading(data.flags.loading);
|
self.isLoading(data.flags.loading);
|
||||||
|
|
||||||
var connectionTab = $("#connection");
|
if (self.loginState.isAdmin() && self.previousIsOperational != self.isOperational()) {
|
||||||
if (self.previousIsOperational != self.isOperational()) {
|
// only open or close if the panel is visible (for admins) and
|
||||||
if (self.isOperational() && connectionTab.hasClass("in")) {
|
// the state just changed to avoid thwarting manual open/close
|
||||||
// connection just got established, close connection tab for now
|
self.openOrCloseOnStateChange();
|
||||||
connectionTab.collapse("hide");
|
|
||||||
} else if (!connectionTab.hasClass("in")) {
|
|
||||||
// connection just dropped, make sure connection tab is open
|
|
||||||
connectionTab.collapse("show");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -147,6 +151,16 @@ $(function() {
|
||||||
|
|
||||||
self.onStartup = function() {
|
self.onStartup = function() {
|
||||||
self.requestData();
|
self.requestData();
|
||||||
|
|
||||||
|
// when isAdmin becomes true the first time, set the panel open or
|
||||||
|
// closed based on the connection state
|
||||||
|
var subscription = self.loginState.isAdmin.subscribe(function(newValue) {
|
||||||
|
if (newValue) {
|
||||||
|
// wait until after the isAdmin state has run through all subscriptions
|
||||||
|
setTimeout(self.openOrCloseOnStateChange, 0);
|
||||||
|
subscription.dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue