Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PI-1033 more under stable message to users #115

Merged
merged 5 commits into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"constants.plans.pro": "Pro plan",
"constants.plans.biz": "Business plan",
"constants.plans.ent": "Enterprise plan",
"errors.noActiveZoneSelected": "Please select a domain that is provisioned with Cloudflare.",
"errors.noActiveZoneSelected": "It looks like your domain {domain} is not provisioned with Cloudflare. Please continue to {link} to secure and speed up your website.",
"warning.usingSubdomain": "You are using a subdomain for your site, but any Cloudflare settings applied via this plugin will be applied to your original domain as well.",
"warning.developmentmode": "Development mode enabled, all traffic will bypass the Cloudflare cache.",
"utils.utils.lastmodifieddate": "This settings was last changed {date}"
Expand Down
1 change: 1 addition & 0 deletions src/constants/UrlPaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export const SUPPORT_PAGE = 'https://support.cloudflare.com/hc/en-us/';
export const TERMS_AND_CONDITIONS_PAGE = 'https://www.cloudflare.com/terms';
export const PRIVACY_POLICY_PAGE = 'https://www.cloudflare.com/security-policy';
export const CLOUDFLARE_ACCOUNT_PAGE = 'https://www.cloudflare.com/a/account/my-account';
export const CLOUDFLARE_ADD_SITE_PAGE = 'https://www.cloudflare.com/a/add-site';
39 changes: 35 additions & 4 deletions src/containers/WaitForSettings/WaitForSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,32 @@ import { getPluginSettingsForZoneId } from '../../selectors/pluginSettings';
import { FormattedMessage, injectIntl } from 'react-intl';
import { getZoneAnalyticsForZoneId } from '../../selectors/zoneAnalytics';
import { getAllZoneSettingsForZoneId } from '../../selectors/zoneSettings';
import { isDNSPageEnabled } from '../../selectors/config';
import { push } from 'react-router-redux';
import { Link } from 'react-router';
import {
CLOUDFLARE_ADD_SITE_PAGE,
DOMAINS_OVERVIEW_PAGE
} from '../../constants/UrlPaths.js';

class WaitForSettings extends Component {
handleClick(path) {
let { dispatch } = this.props;
dispatch(push(path));
}

render() {
let {
activeZone,
zoneSettings,
zonePluginSettings,
zoneAnalytics
zoneAnalytics,
settings,
pluginSettings,
analytics,
config
} = this.props;
let { settings, pluginSettings, analytics } = this.props;
const { formatMessage } = this.props.intl;

let isSettingsLoaded = true;
let isPluginSettingsLoaded = true;
Expand Down Expand Up @@ -49,6 +65,17 @@ class WaitForSettings extends Component {
isPluginSettingsLoaded &&
isAnalyticsLoaded;

var link = (
<Link href={CLOUDFLARE_ADD_SITE_PAGE} target="_blank">Cloudflare</Link>
);
if (isDNSPageEnabled(config)) {
link = (
<Link onClick={() => this.handleClick(DOMAINS_OVERVIEW_PAGE)}>
<FormattedMessage id="container.dnsManagementPage.title" />
</Link>
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do inline if case thing but prettier was complaining and couldn't figure out why. Then did this instead of ignore-prettier


return (
<div>
{!isEverythingLoaded &&
Expand All @@ -57,7 +84,10 @@ class WaitForSettings extends Component {
{!isEverythingLoaded &&
!isZoneOnCloudflare &&
<Text align="center">
<FormattedMessage id="errors.noActiveZoneSelected" />
<FormattedMessage
id="errors.noActiveZoneSelected"
values={{ link: link, domain: activeZone.name }}
Copy link
Contributor

@jwineman jwineman Mar 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add domain here too.

EDIT: NVM Im very dumb

/>
</Text>}
{isEverythingLoaded && isZoneOnCloudflare && this.props.children}
</div>
Expand All @@ -76,7 +106,8 @@ function mapStateToProps(state) {
activeZone: state.activeZone,
zoneSettings: state.zoneSettings,
zonePluginSettings: state.pluginSettings,
zoneAnalytics: state.zoneAnalytics
zoneAnalytics: state.zoneAnalytics,
config: state.config
};
}
export default injectIntl(connect(mapStateToProps)(WaitForSettings));