BottomSection.tsx 960 B

123456789101112131415161718192021222324252627282930
  1. import React from 'react';
  2. import _ from 'lodash';
  3. import SignIn from './SignIn';
  4. import BottomNavLinks from './BottomNavLinks';
  5. import { contextSrv } from 'app/core/services/context_srv';
  6. import config from '../../config';
  7. import { NavModelItem } from '@grafana/ui';
  8. export default function BottomSection() {
  9. const navTree: NavModelItem[] = _.cloneDeep(config.bootData.navTree);
  10. const bottomNav: NavModelItem[] = _.filter(navTree, item => item.hideFromMenu);
  11. const isSignedIn = contextSrv.isSignedIn;
  12. const user = contextSrv.user;
  13. if (user && user.orgCount > 1) {
  14. const profileNode: any = _.find(bottomNav, { id: 'profile' });
  15. if (profileNode) {
  16. profileNode.showOrgSwitcher = true;
  17. }
  18. }
  19. return (
  20. <div className="sidemenu__bottom">
  21. {!isSignedIn && <SignIn />}
  22. {bottomNav.map((link, index) => {
  23. return <BottomNavLinks link={link} user={user} key={`${link.url}-${index}`} />;
  24. })}
  25. </div>
  26. );
  27. }