-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chrome/appSwitcher] when navigating to an app, ensure the page reloads
- Loading branch information
spalger
committed
Sep 21, 2015
1 parent
dfe8dcc
commit 4d20063
Showing
3 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var parse = require('url').parse; | ||
|
||
require('../appSwitcher/appSwitcher.less'); | ||
|
||
require('ui/modules') | ||
.get('kibana') | ||
.directive('appSwitcher', function () { | ||
return { | ||
restrict: 'A', | ||
controllerAs: 'switcher', | ||
controller: function () { | ||
|
||
// links don't cause full-navigation events in certain scenarios | ||
// so we force them when needed | ||
this.ensureNavigation = function (event, app) { | ||
if (event.isDefaultPrevented() || event.altKey || event.metaKey || event.ctrlKey) { | ||
return; | ||
} | ||
|
||
var toParsed = parse(app.url); | ||
var fromParsed = parse(window.location.href); | ||
var sameProto = toParsed.protocol === fromParsed.protocol; | ||
var sameHost = toParsed.host === fromParsed.host; | ||
var samePath = toParsed.path === fromParsed.path; | ||
|
||
if (sameProto && sameHost && samePath) { | ||
window.location.reload(true); | ||
} | ||
}; | ||
|
||
} | ||
}; | ||
}); |