Fix connection accordion again
Slightly different order of things caused #1001 to resurface.
This commit is contained in:
1 parent
b205e84d4b
commit
38a5da1c35
2 files changed
+8
-11
No files matched your search
@@ -629,7 +629,8 @@ $(function() {
|
||||
});
|
||||
}
|
||||
|
||||
viewModel._unbound = viewModel._bindings != undefined && viewModel._bindings.length == 0;
|
||||
viewModel._unbound = viewModel._bindings !== undefined && viewModel._bindings.length === 0;
|
||||
viewModel._bound = viewModel._bindings.length > 0;
|
||||
|
||||
if (viewModel.hasOwnProperty("onAfterBinding")) {
|
||||
viewModel.onAfterBinding();
|
||||
|
||||
@@ -81,6 +81,8 @@ $(function() {
|
||||
};
|
||||
|
||||
self.openOrCloseOnStateChange = function() {
|
||||
if (self._bound !== true) return;
|
||||
|
||||
var connectionTab = $("#connection");
|
||||
if (self.isOperational() && connectionTab.hasClass("in")) {
|
||||
connectionTab.collapse("hide");
|
||||
@@ -100,7 +102,7 @@ $(function() {
|
||||
self.isReady(data.flags.ready);
|
||||
self.isLoading(data.flags.loading);
|
||||
|
||||
if (self.loginState.isUser() && self.previousIsOperational != self.isOperational()) {
|
||||
if (self.loginState.isUser() && self.previousIsOperational !== self.isOperational()) {
|
||||
// only open or close if the panel is visible (for admins) and
|
||||
// the state just changed to avoid thwarting manual open/close
|
||||
self.openOrCloseOnStateChange();
|
||||
@@ -132,16 +134,10 @@ $(function() {
|
||||
|
||||
self.onStartup = function() {
|
||||
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();
|
||||
}
|
||||
});
|
||||
self.onAfterBinding = function() {
|
||||
self.openOrCloseOnStateChange();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user