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

Make sure project bar always appears on page load #2064

Merged
merged 1 commit into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/scripts/directives/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ angular.module('openshiftConsole')
});
};

$scope.$on('$routeChangeSuccess', function() {
var onRouteChange = function() {
var currentProjectName = $routeParams.project;
if ($scope.currentProjectName === currentProjectName) {
// The project hasn't changed.
Expand Down Expand Up @@ -353,7 +353,14 @@ angular.module('openshiftConsole')
} else {
_.set($rootScope, 'view.hasProject', false);
}
});
};

// Make sure `onRouteChange` gets called on page load, even if
// `$routeChangeSuccess` doesn't fire. `onRouteChange` doesn't do any
// work if the project name hasn't changed, so there's no penalty if it
// gets called twice. This fixes a flake in our integration tests.
onRouteChange();
$scope.$on('$routeChangeSuccess', onRouteChange);

select
.selectpicker({
Expand Down
2 changes: 1 addition & 1 deletion app/views/directives/header/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<navbar-utility></navbar-utility>
</nav>

<div ng-show="currentProjectName && !chromeless" class="project-bar">
<div ng-show="view.hasProject" class="project-bar">
<div class="toggle-menu">
<button type="button" class="navbar-toggle project-action-btn" ng-click="toggleNav()">
<span class="sr-only">Toggle navigation</span>
Expand Down
6 changes: 3 additions & 3 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10142,8 +10142,7 @@ return n(e, !1);
return s.list().then(function(e) {
l = e.by("metadata.name");
});
};
r.$on("$routeChangeSuccess", function() {
}, S = function() {
var e = a.project;
r.currentProjectName !== e && (r.currentProjectName = e, r.chromeless = "chromeless" === a.view, e && !r.chromeless ? (_.set(n, "view.hasProject", !0), r.canIAddToProject = !1, o.getProjectRules(e).then(function() {
r.currentProjectName === e && (r.canIAddToProject = o.canIAddToProject(e));
Expand All @@ -10154,7 +10153,8 @@ name: r.currentProjectName
}
}), r.currentProject = l[r.currentProjectName], b());
})) : _.set(n, "view.hasProject", !1));
}), v.selectpicker({
};
S(), r.$on("$routeChangeSuccess", S), v.selectpicker({
iconBase: "fa",
tickIcon: "fa-check"
}).change(function() {
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -6945,7 +6945,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</div>\n" +
"<navbar-utility></navbar-utility>\n" +
"</nav>\n" +
"<div ng-show=\"currentProjectName && !chromeless\" class=\"project-bar\">\n" +
"<div ng-show=\"view.hasProject\" class=\"project-bar\">\n" +
"<div class=\"toggle-menu\">\n" +
"<button type=\"button\" class=\"navbar-toggle project-action-btn\" ng-click=\"toggleNav()\">\n" +
"<span class=\"sr-only\">Toggle navigation</span>\n" +
Expand Down