import React from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { useMount } from 'react-use'; import { NavModel } from '@grafana/data'; import { VerticalGroup } from '@grafana/ui'; import Page from 'app/core/components/Page/Page'; import SharedPreferences from 'app/core/components/SharedPreferences/SharedPreferences'; import { getNavModel } from 'app/core/selectors/navModel'; import { StoreState } from 'app/types'; import UserOrganizations from './UserOrganizations'; import UserProfileEditForm from './UserProfileEditForm'; import UserSessions from './UserSessions'; import { UserTeams } from './UserTeams'; import { changeUserOrg, initUserProfilePage, revokeUserSession, updateUserProfile } from './state/actions'; export interface OwnProps { navModel: NavModel; } function mapStateToProps(state: StoreState) { const userState = state.user; const { user, teams, orgs, sessions, teamsAreLoading, orgsAreLoading, sessionsAreLoading, isUpdating } = userState; return { navModel: getNavModel(state.navIndex, 'profile-settings'), orgsAreLoading, sessionsAreLoading, teamsAreLoading, orgs, sessions, teams, isUpdating, user, }; } const mapDispatchToProps = { initUserProfilePage, revokeUserSession, changeUserOrg, updateUserProfile, }; const connector = connect(mapStateToProps, mapDispatchToProps); export type Props = OwnProps & ConnectedProps; export function UserProfileEditPage({ navModel, orgsAreLoading, sessionsAreLoading, teamsAreLoading, initUserProfilePage, orgs, sessions, teams, isUpdating, user, revokeUserSession, changeUserOrg, updateUserProfile, }: Props) { useMount(() => initUserProfilePage()); return ( ); } export default connector(UserProfileEditPage);