grafana/public/app/features/auth-config/ErrorContainer.tsx
Ashley Harrison 9852b24d61
Chore: Upgrade prettier to v3 (#71764)
* Update dependency prettier to v3 (#71586)

* Update dependency prettier to v3

* run prettier

* ignore prettier update in legacy select scss

* update command line arg

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>

* unplug prettier

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-17 15:58:22 +01:00

42 lines
1.1 KiB
TypeScript

import React from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { Alert } from '@grafana/ui';
import { StoreState } from 'app/types';
import { resetError, resetWarning } from './state/reducers';
function mapStateToProps(state: StoreState) {
return {
error: state.authConfig.updateError,
warning: state.authConfig.warning,
};
}
const mapDispatchToProps = {
resetError,
resetWarning,
};
const connector = connect(mapStateToProps, mapDispatchToProps);
export type Props = ConnectedProps<typeof connector>;
export const ErrorContainerUnconnected = ({ error, warning, resetError, resetWarning }: Props): JSX.Element => {
return (
<div>
{error && (
<Alert title={error.message} onRemove={() => resetError()}>
{error.errors?.map((e, i) => <div key={i}>{e}</div>)}
</Alert>
)}
{warning && (
<Alert title={warning.message} onRemove={() => resetWarning()} severity="warning">
{warning.errors?.map((e, i) => <div key={i}>{e}</div>)}
</Alert>
)}
</div>
);
};
export default connector(ErrorContainerUnconnected);