mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
* 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>
42 lines
1.1 KiB
TypeScript
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);
|