Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-28733 : Admin Advisor v2 #6461

Merged
merged 25 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d608ef5
temp work
catalintomai Sep 12, 2020
cef507b
Merge branch 'master' into OCTO-6
catalintomai Sep 16, 2020
1fa0814
cleanup + make check-style fixes
catalintomai Sep 16, 2020
1f34c72
add support for 500k banner warning
catalintomai Sep 17, 2020
5a97f51
remove ContextUs texts from the StartTrial version of the modal
catalintomai Sep 17, 2020
2e04eb4
fix localization file
catalintomai Sep 17, 2020
0ccfee7
address CR comments
catalintomai Sep 17, 2020
d9cce21
address CR comments
catalintomai Sep 17, 2020
951a887
address CR comments
catalintomai Sep 17, 2020
35b3e35
addressed CR comments
catalintomai Sep 18, 2020
ecbbc9f
addressed CR comments
catalintomai Sep 18, 2020
a984fab
Merge branch 'master' into OCTO-6
catalintomai Sep 19, 2020
a5b096f
removed StartTrial from webapp following PR spec update
catalintomai Sep 20, 2020
7d70359
refactor multiple warn metric banners handling
catalintomai Sep 20, 2020
da1c74d
remove enterpriseReady references
catalintomai Sep 20, 2020
c6972b7
clean up i18n file
catalintomai Sep 20, 2020
fb5878c
updated mailto strings
catalintomai Sep 20, 2020
8c33ee5
addressed CR comments
catalintomai Sep 22, 2020
154758f
Merge branch 'master' into OCTO-6
catalintomai Sep 22, 2020
e5f1a91
updated ack banner text
catalintomai Sep 23, 2020
305c792
fix Jest test
catalintomai Sep 23, 2020
3dfbab3
address PM spec updates
catalintomai Sep 24, 2020
e89862f
make sure we don't display banner if warn metric is invalid
catalintomai Sep 24, 2020
85ca2b6
Merge branch 'master' into OCTO-6
catalintomai Sep 24, 2020
a2512d9
Merge branch 'master' into OCTO-6
catalintomai Sep 25, 2020
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
Prev Previous commit
Next Next commit
add support for 500k banner warning
  • Loading branch information
catalintomai committed Sep 17, 2020
commit 1f34c725e4fc0cfe6903d19b2521c7a9ee2a8fbb
2 changes: 1 addition & 1 deletion actions/websocket_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ function handleWarnMetricStatusReceivedEvent(msg) {
},
{
type: ActionTypes.SHOW_NOTICE,
data: [AnnouncementBarMessages.NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS],
data: [AnnouncementBarMessages.WARN_METRIC_STATUS],
},
]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class ConfigurationAnnouncementBar extends React.PureComponent {
}

dismissNumberOfActiveUsersWarnMetric = () => {
this.props.actions.dismissNotice(AnnouncementBarMessages.NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS);
this.props.actions.dismissNotice(AnnouncementBarMessages.WARN_METRIC_STATUS);
}

dismissNumberOfActiveUsersWarnMetricAck = () => {
this.props.actions.dismissNotice(AnnouncementBarMessages.NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS_ACK);
this.props.actions.dismissNotice(AnnouncementBarMessages.WARN_METRIC_STATUS_ACK);
}

getNoticeForWarnMetric = (warnMetricStatus, isE0Edition) => {
Expand Down Expand Up @@ -118,15 +118,15 @@ class ConfigurationAnnouncementBar extends React.PureComponent {
/>
</React.Fragment>
);
} else {
} else if (warnMetricStatus.id === WarnMetricTypes.SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_500K) {
message = (
<React.Fragment>
<img
className='advisor-icon'
src={alertIcon}
/>
<FormattedMarkdownMessage
id={t('announcement_bar.number_posts_warn_metric_status.text')}
id={t('announcement_bar.number_of_posts_warn_metric_status.text')}
catalintomai marked this conversation as resolved.
Show resolved Hide resolved
defaultMessage={'You now have over {limit} posts. We strongly recommend using advanced features for large-scale servers.'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultMessage={'You now have over {limit} posts. We strongly recommend using advanced features for large-scale servers.'}
defaultMessage='You now have over {limit} posts. We strongly recommend using advanced features for large-scale servers.'

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

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'll defer to @esadur and @jasonblais on this, they review the texts.

Copy link
Contributor

Choose a reason for hiding this comment

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

These are the banners, and there's only so much space for text. We go into more detail in the modals.

values={{
limit: warnMetricStatus.limit,
Expand Down
4 changes: 2 additions & 2 deletions components/announcement_bar/configuration_bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function mapStateToProps(state) {
return {
siteURL: getSiteURL(state),
dismissedExpiringLicense: Boolean(state.views.notice.hasBeenDismissed[AnnouncementBarMessages.LICENSE_EXPIRING]),
dismissedNumberOfActiveUsersWarnMetricStatus: Boolean(state.views.notice.hasBeenDismissed[AnnouncementBarMessages.NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS]),
dismissedNumberOfActiveUsersWarnMetricStatusAck: Boolean(state.views.notice.hasBeenDismissed[AnnouncementBarMessages.NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS_ACK]),
dismissedNumberOfActiveUsersWarnMetricStatus: Boolean(state.views.notice.hasBeenDismissed[AnnouncementBarMessages.WARN_METRIC_STATUS]),
dismissedNumberOfActiveUsersWarnMetricStatusAck: Boolean(state.views.notice.hasBeenDismissed[AnnouncementBarMessages.WARN_METRIC_STATUS_ACK]),
};
}

Expand Down
98 changes: 67 additions & 31 deletions components/warn_metric_ack_modal/warn_metric_ack_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {AnalyticsRow} from 'mattermost-redux/types/admin';
import {ActionFunc} from 'mattermost-redux/types/actions';

import {getSiteURL} from 'utils/url';
import {Constants, ModalIdentifiers} from 'utils/constants';
import {Constants, ModalIdentifiers, WarnMetricTypes} from 'utils/constants';
import {t} from 'utils/i18n';

import {trackEvent} from 'actions/diagnostics_actions';
Expand Down Expand Up @@ -87,7 +87,7 @@ export default class WarnMetricAckModal extends React.PureComponent<Props, State
}
}

requestLicenseAndAckWarnMetric = async () => {
onRequestLicenseAndAckWarnMetricClick = async () => {
if (this.state.gettingTrial) {
return;
}
Expand All @@ -96,7 +96,7 @@ export default class WarnMetricAckModal extends React.PureComponent<Props, State

trackEvent('admin', 'click_warn_metric_ack_start_trial', {metric: this.props.warnMetricStatus.id});

const {error} = this.props.actions.requestTrialLicenseAndAckWarnMetric(this.props.warnMetricStatus.id);
const {error} = await this.props.actions.requestTrialLicenseAndAckWarnMetric(this.props.warnMetricStatus.id);
if (error) {
this.setState({gettingTrialError: error});
} else {
Expand Down Expand Up @@ -190,47 +190,83 @@ export default class WarnMetricAckModal extends React.PureComponent<Props, State
}

render() {
const isE0Edition = (this.props.enterpriseReady && this.props.license && this.props.license.IsLicensed === 'false');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const isE0Edition = (this.props.enterpriseReady && this.props.license && this.props.license.IsLicensed === 'false');
const isE0Edition = this.props.enterpriseReady && this.props.license?.IsLicensed === 'false';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current pattern in the code is the one being used here as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see why we can't take advantage of optional chaining regardless of the pattern? I noticed we are using license?. in other parts of code too? I'm not sure what pattern you are actually referring too.
image

I thought we were moving towards using optional chaining with the move towards typescript anyways.


const headerTitle = (
<FormattedMessage
id='warn_metric_ack_modal.header.title'
defaultMessage='Scaling with Mattermost'
/>
);
const descriptionText = (
<FormattedMessage
id='warn_metric_ack_modal.number_of_active_users.description'
defaultMessage='Mattermost strongly recommends that deployments of over {limit} users upgrade to Mattermost Enterprise Edition, which offers features such as user management, server clustering, and performance monitoring'
values={{
limit: this.props.warnMetricStatus.limit,
}}
/>
);

let descriptionText;
let subText;
const learnMoreLink = 'https://mattermost.com/pl/default-admin-advisory';
const subText = (
<div
style={{display: 'flex', opacity: '0.56', flexWrap: 'wrap'}}
className='help__format-text'
>

if (this.props.warnMetricStatus.id === WarnMetricTypes.SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_500) {
descriptionText = (
<FormattedMessage
id='warn_metric_ack_modal.number_of_active_users.subtext'
defaultMessage='By clicking Acknowledge, you will be sharing your information with Mattermost Inc., to learn more about upgrading. {link}'
id='warn_metric_ack_modal.number_of_active_users.description'
defaultMessage='Mattermost strongly recommends that deployments of over {limit} users upgrade to Mattermost Enterprise Edition, which offers features such as user management, server clustering, and performance monitoring'
values={{
link: (
<ErrorLink
url={learnMoreLink}
messageId={t('warn_metric_ack_modal.learn_more.link')}
defaultMessage={'Learn More'}
/>
),
limit: this.props.warnMetricStatus.limit,
}}
/>
</div>
);
);
subText = (
<div
style={{display: 'flex', opacity: '0.56', flexWrap: 'wrap'}}
className='help__format-text'
>
<FormattedMessage
id='warn_metric_ack_modal.number_of_active_users.subtext'
defaultMessage='By clicking Acknowledge, you will be sharing your information with Mattermost Inc., to learn more about upgrading. {link}'
values={{
link: (
<ErrorLink
url={learnMoreLink}
messageId={t('warn_metric_ack_modal.learn_more.link')}
defaultMessage={'Learn More'}
/>
),
}}
/>
</div>
);
} else if (this.props.warnMetricStatus.id === WarnMetricTypes.SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_500K) {
descriptionText = (
<FormattedMessage
id='warn_metric_ack_modal.number_of_posts.description'
defaultMessage='TODO'
values={{
limit: this.props.warnMetricStatus.limit,
}}
/>
);
subText = (
<div
style={{display: 'flex', opacity: '0.56', flexWrap: 'wrap'}}
className='help__format-text'
>
<FormattedMessage
id='warn_metric_ack_modal.number_of_posts.subtext'
defaultMessage='TODO'
values={{
link: (
<ErrorLink
url={learnMoreLink}
messageId={t('warn_metric_ack_modal.learn_more.link')}
defaultMessage={'Learn More'}
/>
),
}}
/>
</div>
);
}

let footer;
let error;
const isE0Edition = (this.props.license && this.props.license.IsLicensed === 'false' && this.props.enterpriseReady);

if (isE0Edition) {
error = this.renderStartTrialError();
Expand All @@ -240,11 +276,11 @@ export default class WarnMetricAckModal extends React.PureComponent<Props, State
data-dismiss='modal'
disabled={this.state.gettingTrial}
autoFocus={true}
onClick={this.requestLicenseAndAckWarnMetric}
onClick={this.onRequestLicenseAndAckWarnMetricClick}
>
<LoadingWrapper
loading={this.state.gettingTrial}
text={Utils.localizeMessage('admin.warn_metric.starting_trial', 'Starting trial')}
text={Utils.localizeMessage('admin.warn_metric.getting_trial', 'Getting trial')}
>
<FormattedMessage
id='warn_metric_ack_modal.start_trial'
Expand Down
13 changes: 8 additions & 5 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@
"admin.viewArchivedChannelsHelpText": "(Beta) When true, allows users to view, share and search for content of channels that have been archived. Users can only view the content in channels of which they were a member before the channel was archived.",
"admin.viewArchivedChannelsTitle": "Allow users to view archived channels:",
"admin.warn_metric.sending-email": "Sending email",
"admin.warn_metric.starting_trial": "Starting trial",
"admin.warn_metric.getting_trial": "Starting trial",
"admin.webserverModeDisabled": "Disabled",
"admin.webserverModeDisabledDescription": "The Mattermost server will not serve static files.",
"admin.webserverModeGzip": "gzip",
Expand Down Expand Up @@ -1979,8 +1979,9 @@
"announcement_bar.error.site_url.full": "Please configure your [site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) on the [System Console](/admin_console/environment/web_server).",
"announcement_bar.error.warn_metric_status.link": "Learn more",
"announcement_bar.notification.email_verified": "Email verified",
"announcement_bar.number_posts_warn_metric_status.text": "You now have over {limit} posts. We strongly recommend using advanced features for large-scale servers.",
"announcement_bar.warn_metric_status_ack.text": "Your Mattermost Enterprise trial has now started! Go to the [System Console](/admin_console/) to activate enterprise features.",
"announcement_bar.number_of_posts_warn_metric_status.text": "You now have over {limit} posts. We strongly recommend using advanced features for large-scale servers.",
"announcement_bar.warn_metric_status.text": "Announcement bar warn metric status",
"announcement_bar.warn_metric_status_ack.text": "Announcement bar warn metric status acknowledgement",
"api.channel.add_guest.added": "{addedUsername} added to the channel as a guest by {username}.",
"api.channel.add_member.added": "{addedUsername} added to the channel by {username}.",
"api.channel.delete_channel.archived": "{username} archived the channel.",
Expand Down Expand Up @@ -4120,12 +4121,14 @@
"view_image.loading": "Loading ",
"warn_metric_ack_modal.contact_support": "Acknowledge",
"warn_metric_ack_modal.error.body": "Please try again or visit https://mattermost.com/trial to request a license.",
"warn_metric_ack_modal.header.title": "Upgrade to Mattermost Enterprise Edition",
"warn_metric_ack_modal.header.title": "Scaling with Mattermost",
"warn_metric_ack_modal.learn_more.link": "Learn more",
"warn_metric_ack_modal.mailto.link": "email us",
"warn_metric_ack_modal.mailto.message": "Support could not be reached. Please {link}.",
"warn_metric_ack_modal.number_of_active_users.description": "Mattermost strongly recommends that deployments of over {limit} users take advantage of features such as user management, server clustering and performance monitoring. Contact us to learn more and let us know how we can help.",
"warn_metric_ack_modal.number_of_posts.description": "TODO",
"warn_metric_ack_modal.number_of_active_users.subtext": "By clicking Acknowledge, you will be sharing your information with Mattermost Inc., to learn more about upgrading. {link}",
"warn_metric_ack_modal.number_of_posts.subtext": "TODO",
"warn_metric_ack_modal.start_trial": "Start trial",
"web.footer.about": "About",
"web.footer.help": "Help",
Expand All @@ -4140,4 +4143,4 @@
"widgets.users_emails_input.no_user_found_matching": "No one found matching **{text}**, type email address",
"widgets.users_emails_input.valid_email": "Add **{email}**",
"yourcomputer": "Your computer"
}
}
6 changes: 3 additions & 3 deletions utils/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const WarnMetricTypes = {
SYSTEM_WARN_METRIC_NUMBER_OF_CHANNELS_5: 'warn_metric_number_of_channels_50',
SYSTEM_WARN_METRIC_MFA: 'warn_metric_mfa',
SYSTEM_WARN_METRIC_EMAIL_DOMAIN: 'warn_metric_email_domain',
SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_500K: 'warn_metric_number_of_posts_500K',
SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_500K: 'warn_metric_number_of_posts_500k',
};

export const ModalIdentifiers = {
Expand Down Expand Up @@ -567,8 +567,8 @@ export const AnnouncementBarMessages = {
LICENSE_PAST_GRACE: t('announcement_bar.error.past_grace'),
PREVIEW_MODE: t('announcement_bar.error.preview_mode'),
WEBSOCKET_PORT_ERROR: t('channel_loader.socketError'),
NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS: t('announcement_bar.error.number_active_users_warn_metric_status.text'),
NUMBER_OF_ACTIVE_USERS_WARN_METRIC_STATUS_ACK: t('announcement_bar.warn_metric_status_ack.text'),
WARN_METRIC_STATUS: t('announcement_bar.warn_metric_status.text'),
WARN_METRIC_STATUS_ACK: t('announcement_bar.warn_metric_status_ack.text'),
};

export const VerifyEmailErrors = {
Expand Down