PLT-5703 Update license expiry timing and text (#5602)
* Update license expiry timing and text * Updating error bar (#5632)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
3f070fe4b8
Коммит
f8aaf312c1
@@ -1,7 +1,6 @@
|
||||
// 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';
|
||||
@@ -9,7 +8,6 @@ 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;
|
||||
@@ -287,36 +285,6 @@ class SystemAnalytics extends React.Component {
|
||||
{postTypeGraph}
|
||||
</div>
|
||||
);
|
||||
|
||||
if (isLicenseExpired()) {
|
||||
banner = (
|
||||
<Banner
|
||||
description={
|
||||
<FormattedHTMLMessage
|
||||
id='analytics.system.expiredBanner'
|
||||
defaultMessage='The Enterprise license expired on {date}. You have 15 days from this date to renew the license, please contact <a href="mailto:commercial@mattermost.com">commercial@mattermost.com</a>.'
|
||||
values={{
|
||||
date: displayExpiryDate()
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
} else if (isLicenseExpiring()) {
|
||||
banner = (
|
||||
<Banner
|
||||
description={
|
||||
<FormattedHTMLMessage
|
||||
id='analytics.system.expiringBanner'
|
||||
defaultMessage='The Enterprise license is expiring on {date}. To renew your license, please contact <a href="mailto:commercial@mattermost.com">commercial@mattermost.com</a>.'
|
||||
values={{
|
||||
date: displayExpiryDate()
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const userCount = (
|
||||
|
||||
@@ -1,26 +1,37 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import AnalyticsStore from 'stores/analytics_store.jsx';
|
||||
import ErrorStore from 'stores/error_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
import {isLicenseExpiring, isLicenseExpired, isLicensePastGracePeriod, displayExpiryDate} from 'utils/license_utils.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
const StatTypes = Constants.StatTypes;
|
||||
|
||||
import React from 'react';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
||||
|
||||
const EXPIRING_ERROR = 'error_bar.expiring';
|
||||
const EXPIRED_ERROR = 'error_bar.expired';
|
||||
const PAST_GRACE_ERROR = 'error_bar.past_grace';
|
||||
const RENEWAL_LINK = 'https://licensing.mattermost.com/renew';
|
||||
|
||||
const BAR_DEVELOPER_TYPE = 'developer';
|
||||
const BAR_CRITICAL_TYPE = 'critical';
|
||||
|
||||
export default class ErrorBar extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.onErrorChange = this.onErrorChange.bind(this);
|
||||
this.onAnalyticsChange = this.onAnalyticsChange.bind(this);
|
||||
this.handleClose = this.handleClose.bind(this);
|
||||
|
||||
ErrorStore.clearNotificationError();
|
||||
|
||||
let isSystemAdmin = false;
|
||||
const user = UserStore.getCurrentUser();
|
||||
if (user) {
|
||||
@@ -29,12 +40,16 @@ export default class ErrorBar extends React.Component {
|
||||
|
||||
if (!ErrorStore.getIgnoreNotification() && global.window.mm_config.SendEmailNotifications === 'false') {
|
||||
ErrorStore.storeLastError({notification: true, message: Utils.localizeMessage('error_bar.preview_mode', 'Preview Mode: Email notifications have not been configured')});
|
||||
} else if (isLicensePastGracePeriod()) {
|
||||
if (isSystemAdmin) {
|
||||
ErrorStore.storeLastError({notification: true, message: EXPIRED_ERROR, type: BAR_CRITICAL_TYPE});
|
||||
} else {
|
||||
ErrorStore.storeLastError({notification: true, message: PAST_GRACE_ERROR, type: BAR_CRITICAL_TYPE});
|
||||
}
|
||||
} else if (isLicenseExpired() && isSystemAdmin) {
|
||||
ErrorStore.storeLastError({notification: true, message: EXPIRED_ERROR, type: BAR_CRITICAL_TYPE});
|
||||
} else if (isLicenseExpiring() && isSystemAdmin) {
|
||||
ErrorStore.storeLastError({notification: true, message: EXPIRING_ERROR});
|
||||
} else if (isLicenseExpired() && isSystemAdmin) {
|
||||
ErrorStore.storeLastError({notification: true, message: EXPIRED_ERROR, type: 'developer'});
|
||||
} else if (isLicensePastGracePeriod()) {
|
||||
ErrorStore.storeLastError({notification: true, message: PAST_GRACE_ERROR});
|
||||
}
|
||||
|
||||
this.state = ErrorStore.getLastError();
|
||||
@@ -49,27 +64,41 @@ export default class ErrorBar extends React.Component {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.message === EXPIRING_ERROR && !this.state.totalUsers) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
ErrorStore.addChangeListener(this.onErrorChange);
|
||||
AnalyticsStore.addChangeListener(this.onAnalyticsChange);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
ErrorStore.removeChangeListener(this.onErrorChange);
|
||||
AnalyticsStore.removeChangeListener(this.onAnalyticsChange);
|
||||
}
|
||||
|
||||
onErrorChange() {
|
||||
var newState = ErrorStore.getLastError();
|
||||
|
||||
if (newState) {
|
||||
if (newState.message === EXPIRING_ERROR && !this.state.totalUsers) {
|
||||
AsyncClient.getStandardAnalytics();
|
||||
}
|
||||
this.setState(newState);
|
||||
} else {
|
||||
this.setState({message: null});
|
||||
}
|
||||
}
|
||||
|
||||
onAnalyticsChange() {
|
||||
const stats = AnalyticsStore.getAllSystem();
|
||||
this.setState({totalUsers: stats[StatTypes.TOTAL_USERS]});
|
||||
}
|
||||
|
||||
handleClose(e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
@@ -91,33 +120,41 @@ export default class ErrorBar extends React.Component {
|
||||
|
||||
var errClass = 'error-bar';
|
||||
|
||||
if (this.state.type && this.state.type === 'developer') {
|
||||
if (this.state.type === BAR_DEVELOPER_TYPE) {
|
||||
errClass = 'error-bar-developer';
|
||||
} else if (this.state.type === BAR_CRITICAL_TYPE) {
|
||||
errClass = 'error-bar-critical';
|
||||
}
|
||||
|
||||
const renewalLink = RENEWAL_LINK + '?id=' + global.window.mm_license.Id + '&user_count=' + this.state.totalUsers;
|
||||
|
||||
let message = this.state.message;
|
||||
if (message === EXPIRING_ERROR) {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
<FormattedHTMLMessage
|
||||
id={EXPIRING_ERROR}
|
||||
defaultMessage='The Enterprise license is expiring on {date}. To renew your license, please contact commercial@mattermost.com'
|
||||
defaultMessage='Enterprise license expires on {date}. <a href="{link}" target="_blank">Please renew.</a>'
|
||||
values={{
|
||||
date: displayExpiryDate()
|
||||
date: displayExpiryDate(),
|
||||
link: renewalLink
|
||||
}}
|
||||
/>
|
||||
);
|
||||
} else if (message === EXPIRED_ERROR) {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
<FormattedHTMLMessage
|
||||
id={EXPIRED_ERROR}
|
||||
defaultMessage='Enterprise license has expired; you have 15 days from expiry to renew the license, please contact commercial@mattermost.com for details'
|
||||
defaultMessage='Enterprise license is expired and some features may be disabled. <a href="{link}" target="_blank">Please renew.</a>'
|
||||
values={{
|
||||
link: renewalLink
|
||||
}}
|
||||
/>
|
||||
);
|
||||
} else if (message === PAST_GRACE_ERROR) {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
id={PAST_GRACE_ERROR}
|
||||
defaultMessage='Enterprise license has expired, please contact your System Administrator for details'
|
||||
defaultMessage='Enterprise license is expired and some features may be disabled. Please contact your System Administrator for details.'
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user