diff --git a/src/App.jsx b/src/App.jsx index 8b68aea0f6..436a841621 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -64,24 +64,22 @@ class App extends Component { } render () { - const { - isAboutModalOpen, - isNavOpen - } = this.state; + const { isAboutModalOpen, isNavOpen } = this.state; - const { - render, - routeGroups = [], - navLabel = '', - } = this.props; + const { render, routeGroups = [], navLabel = '' } = this.props; return ( - {({ ansible_version, version }) => ( + {({ ansible_version, version, me }) => ( {({ i18n }) => ( - {({ title, bodyText, variant = 'info', clearRootDialogMessage }) => ( + {({ + title, + bodyText, + variant = 'info', + clearRootDialogMessage + }) => ( {(title || bodyText) && ( {i18n._(t`Close`)} + ]} > {bodyText} @@ -105,6 +109,7 @@ class App extends Component { logo={} toolbar={( - {routeGroups.map(({ groupId, groupTitle, routes }) => ( - - ))} + {routeGroups.map( + ({ groupId, groupTitle, routes }) => ( + + ) + )} )} diff --git a/src/app.scss b/src/app.scss index 98e83ef2e5..d1dfc169aa 100644 --- a/src/app.scss +++ b/src/app.scss @@ -25,16 +25,28 @@ } .pf-c-page__header-tools .pf-c-dropdown__toggle:before { - --pf-c-dropdown__toggle--BorderBottomColor: var(--pf-global--BackgroundColor--light-100); - --pf-c-dropdown__toggle--hover--BorderBottomColor: var(--pf-global--BackgroundColor--light-100); - --pf-c-dropdown__toggle--expanded--BorderBottomColor: var(--pf-global--BackgroundColor--light-100); + --pf-c-dropdown__toggle--BorderBottomColor: var( + --pf-global--BackgroundColor--light-100 + ); + --pf-c-dropdown__toggle--hover--BorderBottomColor: var( + --pf-global--BackgroundColor--light-100 + ); + --pf-c-dropdown__toggle--expanded--BorderBottomColor: var( + --pf-global--BackgroundColor--light-100 + ); +} + +.pf-c-page__header { + .pf-c-dropdown__toggle .pf-c-dropdown__toggle-icon { + --pf-c-dropdown__toggle-icon--MarginLeft: 10px; + } } // // sidebar overrides // -.pf-c-page__sidebar{ +.pf-c-page__sidebar { --pf-c-page__sidebar--md--Width: 255px; .pf-c-nav { @@ -83,7 +95,8 @@ --pf-global--target-size--MinWidth: 32px; --pf-global--FontSize--md: 14px; - .pf-c-badge:not(:last-child), .pf-c-switch:not(:last-child) { + .pf-c-badge:not(:last-child), + .pf-c-switch:not(:last-child) { margin-right: 18px; } } diff --git a/src/components/PageHeaderToolbar.jsx b/src/components/PageHeaderToolbar.jsx index 8278cfa908..1e56aab9a7 100644 --- a/src/components/PageHeaderToolbar.jsx +++ b/src/components/PageHeaderToolbar.jsx @@ -13,10 +13,7 @@ import { ToolbarItem, Tooltip } from '@patternfly/react-core'; -import { - QuestionCircleIcon, - UserIcon, -} from '@patternfly/react-icons'; +import { QuestionCircleIcon, UserIcon } from '@patternfly/react-icons'; const DOCLINK = 'https://docs.ansible.com/ansible-tower/latest/html/userguide/index.html'; @@ -25,7 +22,7 @@ class PageHeaderToolbar extends Component { super(props); this.state = { isHelpOpen: false, - isUserOpen: false, + isUserOpen: false }; this.handleHelpSelect = this.handleHelpSelect.bind(this); @@ -56,19 +53,19 @@ class PageHeaderToolbar extends Component { render () { const { isHelpOpen, isUserOpen } = this.state; - const { isAboutDisabled, onAboutClick, onLogoutClick } = this.props; + const { + isAboutDisabled, + onAboutClick, + onLogoutClick, + loggedInUser + } = this.props; return ( {({ i18n }) => ( - Help - } - > + Help}> + )} dropdownItems={[ - + {i18n._(t`Help`)} , - User - } - > + User}> + -   User Name + {loggedInUser && ( + + {loggedInUser.username} + + )} )} dropdownItems={[ - + {i18n._(t`User Details`)} , { - const { - ansible_version, - custom_virtualenvs, - version - } = config; + updateConfig = config => { + const { ansible_version, custom_virtualenvs, version } = config; this.setState(prevState => ({ value: { @@ -46,31 +41,36 @@ class Provider extends Component { ansible_version, custom_virtualenvs, version - }, + } })); - } + }; async fetchMe () { const { api, handleHttpError } = this.props; try { - const { data: { results: [me] } } = await api.getMe(); + const { + data: { + results: [me] + } + } = await api.getMe(); this.setState(prevState => ({ value: { ...prevState.value, me - }, + } })); } catch (err) { - handleHttpError(err) || this.setState({ - value: { - ansible_version: null, - custom_virtualenvs: null, - version: null, - custom_logo: null, - custom_login_info: null, - me: {} - } - }); + handleHttpError(err) + || this.setState({ + value: { + ansible_version: null, + custom_virtualenvs: null, + version: null, + custom_logo: null, + custom_login_info: null, + me: {} + } + }); } } @@ -90,20 +90,21 @@ class Provider extends Component { version: configRes.data.version, custom_logo: rootRes.data.custom_logo, custom_login_info: rootRes.data.custom_login_info, - me: meRes.data.results + me: meRes.data.results[0] } }); } catch (err) { - handleHttpError(err) || this.setState({ - value: { - ansible_version: null, - custom_virtualenvs: null, - version: null, - custom_logo: null, - custom_login_info: null, - me: {} - } - }); + handleHttpError(err) + || this.setState({ + value: { + ansible_version: null, + custom_virtualenvs: null, + version: null, + custom_logo: null, + custom_login_info: null, + me: {} + } + }); } } @@ -129,7 +130,5 @@ class Provider extends Component { export const ConfigProvider = withNetwork(Provider); export const Config = ({ children }) => ( - - {value => children(value)} - + {value => children(value)} );