Skip to content

Commit

Permalink
add focus to settings menu (#865)
Browse files Browse the repository at this point in the history
* add focus to settings menu

* lint
  • Loading branch information
ryelo authored Jul 8, 2020
1 parent abff346 commit f5a6fe3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/App/Header/Tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Tools = () => {
{/* Show tools on medium and above screens */}
<PageHeaderToolsGroup visibility={{ default: 'hidden', sm: 'visible' }}>
{ !isSettingsDisabled &&
<PageHeaderToolsItem>
<PageHeaderToolsItem isSelected={ window.insights.chrome.getBundle() === 'settings' }>
{ <SettingsButton/> }
</PageHeaderToolsItem>
}
Expand Down
7 changes: 7 additions & 0 deletions src/js/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Cookies from 'js-cookie';
const log = require('./jwt/logger')('entry.js');
const sourceOfTruth = require('./nav/sourceOfTruth');
import { fetchPermissions } from './rbac/fetchPermissions';
import { getUrl } from './utils';

// used for translating event names exposed publicly to internal event names
const PUBLIC_EVENTS = {
Expand Down Expand Up @@ -134,6 +135,12 @@ export function bootstrap(libjwt, initFunc) {
isPenTest: () => {
return Cookies.get('x-rh-insights-pentest') ? true : false;
},
getBundle: () => {
return getUrl('bundle');
},
getApp: () => {
return getUrl('app');
},
visibilityFunctions,
init: initFunc
},
Expand Down
14 changes: 14 additions & 0 deletions src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,17 @@ export function bootstrapCache(endpoint, cacheKey) {
maxAge: 10 * 60 * 1000 // 10 minutes
});
}

export function getUrl(type) {

if (window.location.pathname === ('/beta' || '/')) {
return 'landing';
}

const sections = window.location.pathname.split('/');
if (sections[1] === 'beta') {
return type === 'bundle' ? sections[2] : sections[3];
}

return type === 'bundle' ? sections[1] : sections[2];
}

0 comments on commit f5a6fe3

Please sign in to comment.