mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Chrome] Moved some things around to keep the chrome consistent
This commit is contained in:
parent
f55c978e96
commit
4119554f46
3 changed files with 9 additions and 15 deletions
9
src/ui/public/chrome/api/angular.js
vendored
9
src/ui/public/chrome/api/angular.js
vendored
|
@ -3,6 +3,8 @@ import modules from 'ui/modules';
|
|||
|
||||
module.exports = function (chrome, internals) {
|
||||
|
||||
chrome.getFirstPathSegment = _.noop;
|
||||
|
||||
chrome.setupAngular = function () {
|
||||
var kibana = modules.get('kibana');
|
||||
|
||||
|
@ -21,7 +23,12 @@ module.exports = function (chrome, internals) {
|
|||
a.href = chrome.addBasePath('/elasticsearch');
|
||||
return a.href;
|
||||
}()))
|
||||
.config(chrome.$setupXsrfRequestInterceptor);
|
||||
.config(chrome.$setupXsrfRequestInterceptor)
|
||||
.run(($location) => {
|
||||
chrome.getFirstPathSegment = () => {
|
||||
return $location.path().split('/')[1];
|
||||
}
|
||||
});
|
||||
|
||||
require('../directives')(chrome, internals);
|
||||
|
||||
|
|
|
@ -76,19 +76,6 @@ module.exports = function (chrome, internals) {
|
|||
return internals.tabs.getActive();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {any} def - the default value if there isn't any active tab
|
||||
* @return {any}
|
||||
*/
|
||||
chrome.getActiveTabId = function () {
|
||||
const activeAppObj = _.find(internals.nav, { active: true });
|
||||
const lastUrl = activeAppObj.lastSubUrl.toLowerCase();
|
||||
const numeralPos = lastUrl.indexOf('#/') + 2;
|
||||
const quesPos = lastUrl.indexOf('?');
|
||||
const dirtyUrl = lastUrl.substring(numeralPos, quesPos);
|
||||
return dirtyUrl.replace('/', '-');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {any} def - the default value if there isn't any active tab
|
||||
* @return {any}
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
</div>
|
||||
<!-- /Full navbar -->
|
||||
</nav>
|
||||
<div class="application" ng-class="'tab-' + chrome.getActiveTabId() + ' ' + chrome.getApplicationClasses()" ng-view></div>
|
||||
<div class="application" ng-class="'tab-' + chrome.getFirstPathSegment() + ' ' + chrome.getApplicationClasses()" ng-view></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue