The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/profile/ChangePasswordPage.tsx

46 lines
1.1 KiB

import { connect, ConnectedProps } from 'react-redux';
import { useMount } from 'react-use';
import { Page } from 'app/core/components/Page/Page';
import { StoreState } from 'app/types';
import { ChangePasswordForm } from './ChangePasswordForm';
import { changePassword, loadUser } from './state/actions';
export interface OwnProps {}
function mapStateToProps(state: StoreState) {
const userState = state.user;
const { isUpdating, user } = userState;
return {
isUpdating,
user,
};
}
const mapDispatchToProps = {
loadUser,
changePassword,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
export type Props = OwnProps & ConnectedProps<typeof connector>;
export function ChangePasswordPage({ loadUser, isUpdating, user, changePassword }: Props) {
useMount(() => loadUser());
return (
<Page navId="profile/password">
<Page.Contents isLoading={!Boolean(user)}>
{user ? (
<>
<ChangePasswordForm user={user} onChangePassword={changePassword} isSaving={isUpdating} />
</>
) : null}
</Page.Contents>
</Page>
);
}
export default connector(ChangePasswordPage);