[Chrome] Moved some things around to keep the chrome consistent

This commit is contained in:
Khalah Jones-Golden 2016-03-09 17:08:30 -04:00
parent f55c978e96
commit 4119554f46
3 changed files with 9 additions and 15 deletions

View file

@ -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);

View file

@ -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}

View file

@ -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>