From 0dfac9875ef6f5f20318a3ef542b11592da8480e Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 30 May 2016 09:59:53 -0400 Subject: Add license expiry messages (#3153) --- webapp/components/admin_console/banner.jsx | 40 ++++++++++++++ webapp/components/admin_console/ldap_settings.jsx | 37 ++++++------- webapp/components/analytics/system_analytics.jsx | 36 ++++++++++++- webapp/components/error_bar.jsx | 64 +++++++++++++++++++---- 4 files changed, 144 insertions(+), 33 deletions(-) create mode 100644 webapp/components/admin_console/banner.jsx (limited to 'webapp/components') diff --git a/webapp/components/admin_console/banner.jsx b/webapp/components/admin_console/banner.jsx new file mode 100644 index 000000000..2071fff93 --- /dev/null +++ b/webapp/components/admin_console/banner.jsx @@ -0,0 +1,40 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; +import {FormattedMessage} from 'react-intl'; + +export default class Banner extends React.Component { + render() { + let title = ( + + ); + + if (this.props.title) { + title = this.props.title; + } + + return ( +
+
+

+ {title} +

+

+ {this.props.description} +

+
+
+ ); + } +} + +Banner.defaultProps = { +}; +Banner.propTypes = { + title: React.PropTypes.node, + description: React.PropTypes.node.isRequired +}; diff --git a/webapp/components/admin_console/ldap_settings.jsx b/webapp/components/admin_console/ldap_settings.jsx index d47a1f8c2..80c1a7867 100644 --- a/webapp/components/admin_console/ldap_settings.jsx +++ b/webapp/components/admin_console/ldap_settings.jsx @@ -1,17 +1,18 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import React from 'react'; - -import * as Utils from 'utils/utils.jsx'; - import AdminSettings from './admin_settings.jsx'; +import Banner from './banner.jsx'; import BooleanSetting from './boolean_setting.jsx'; import ConnectionSecurityDropdownSetting from './connection_security_dropdown_setting.jsx'; -import {FormattedMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; +import * as Utils from 'utils/utils.jsx'; + +import React from 'react'; +import {FormattedMessage} from 'react-intl'; + export default class LdapSettings extends AdminSettings { constructor(props) { super(props); @@ -90,22 +91,14 @@ export default class LdapSettings extends AdminSettings { } > -
-
-

- -

-

- -

-
-
+ + } + /> ); } -} \ No newline at end of file +} diff --git a/webapp/components/analytics/system_analytics.jsx b/webapp/components/analytics/system_analytics.jsx index 8decf523d..5bd8b1d28 100644 --- a/webapp/components/analytics/system_analytics.jsx +++ b/webapp/components/analytics/system_analytics.jsx @@ -1,6 +1,7 @@ // Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import Banner from 'components/admin_console/banner.jsx'; import LineChart from './line_chart.jsx'; import DoughnutChart from './doughnut_chart.jsx'; import StatisticCount from './statistic_count.jsx'; @@ -8,11 +9,12 @@ import StatisticCount from './statistic_count.jsx'; import AnalyticsStore from 'stores/analytics_store.jsx'; import * as Utils from 'utils/utils.jsx'; +import {isLicenseExpired, isLicenseExpiring, displayExpiryDate} from 'utils/license_utils.jsx'; import * as AsyncClient from 'utils/async_client.jsx'; import Constants from 'utils/constants.jsx'; const StatTypes = Constants.StatTypes; -import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; +import {injectIntl, intlShape, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'react-intl'; const holders = defineMessages({ analyticsPublicChannels: { @@ -81,6 +83,7 @@ class SystemAnalytics extends React.Component { let advancedCounts; let advancedGraphs; + let banner; if (global.window.mm_license.IsLicensed === 'true') { advancedCounts = (
@@ -156,6 +159,36 @@ class SystemAnalytics extends React.Component { />
); + + if (isLicenseExpired()) { + banner = ( + + } + /> + ); + } else if (isLicenseExpiring()) { + banner = ( + + } + /> + ); + } } const postCountsDay = formatPostsPerDayData(stats[StatTypes.POST_PER_DAY]); @@ -169,6 +202,7 @@ class SystemAnalytics extends React.Component { defaultMessage='System Statistics' /> + {banner}
+ ); + } else if (message === EXPIRED_ERROR) { + message = ( + + ); + } else if (message === PAST_GRACE_ERROR) { + message = ( + + ); + } + return (
- {this.state.message} + {message}