mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 10:00:17 -04:00
* Prettier all the JS files * Add GitHub Action to autoformat code pushed to master * Fix eslint violation due to formatting. * Remove GitHub actions for styling * Add restyled.io config
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import React from "react";
|
|
import PropTypes from "prop-types";
|
|
import cx from "classnames";
|
|
import { clientConfig, currentUser } from "@/services/auth";
|
|
import Tooltip from "antd/lib/tooltip";
|
|
import Alert from "antd/lib/alert";
|
|
import HelpTrigger from "@/components/HelpTrigger";
|
|
|
|
export default function EmailSettingsWarning({ featureName, className, mode, adminOnly }) {
|
|
if (!clientConfig.mailSettingsMissing) {
|
|
return null;
|
|
}
|
|
|
|
if (adminOnly && !currentUser.isAdmin) {
|
|
return null;
|
|
}
|
|
|
|
const message = (
|
|
<span>
|
|
Your mail server isn't configured correctly, and is needed for {featureName} to work.{" "}
|
|
<HelpTrigger type="MAIL_CONFIG" className="f-inherit" />
|
|
</span>
|
|
);
|
|
|
|
if (mode === "icon") {
|
|
return (
|
|
<Tooltip title={message}>
|
|
<i className={cx("fa fa-exclamation-triangle", className)} />
|
|
</Tooltip>
|
|
);
|
|
}
|
|
|
|
return <Alert message={message} type="error" className={className} />;
|
|
}
|
|
|
|
EmailSettingsWarning.propTypes = {
|
|
featureName: PropTypes.string.isRequired,
|
|
className: PropTypes.string,
|
|
mode: PropTypes.oneOf(["alert", "icon"]),
|
|
adminOnly: PropTypes.bool,
|
|
};
|
|
|
|
EmailSettingsWarning.defaultProps = {
|
|
className: null,
|
|
mode: "alert",
|
|
adminOnly: false,
|
|
};
|