Skip to content

Commit

Permalink
Merge pull request #2064 from spadgett/fix-nav-test-flake
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Sep 13, 2017
2 parents f3fcba9 + 60e5805 commit 22e371a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
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 @@ -6958,7 +6958,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

0 comments on commit 22e371a

Please sign in to comment.