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/auth-config/ErrorContainer.tsx

45 lines
1.2 KiB

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);