Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1001 connection tab not unfolding #1002

Merged
merged 1 commit into from Jul 30, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -86,6 +86,15 @@ $(function() {
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.previousIsOperational = self.isOperational();

@@ -97,15 +106,10 @@ $(function() {
self.isReady(data.flags.ready);
self.isLoading(data.flags.loading);

var connectionTab = $("#connection");
if (self.previousIsOperational != self.isOperational()) {
if (self.isOperational() && connectionTab.hasClass("in")) {
// connection just got established, close connection tab for now
connectionTab.collapse("hide");
} else if (!connectionTab.hasClass("in")) {
// connection just dropped, make sure connection tab is open
connectionTab.collapse("show");
}
if (self.loginState.isAdmin() && 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();
}
};

@@ -147,6 +151,16 @@ $(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();
}
});
};
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.