revert changes to overage users banner in favor of getting self hoste expansion modal pushed through faster.
Этот коммит содержится в:
@@ -22,6 +22,15 @@ import * as useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHoste
|
||||
|
||||
import EnterpriseEditionLeftPanel, {EnterpriseEditionProps} from './enterprise_edition_left_panel';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom') as typeof import('react-router-dom'),
|
||||
useLocation: () => {
|
||||
return {
|
||||
pathname: '',
|
||||
};
|
||||
},
|
||||
}));
|
||||
|
||||
describe('components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel', () => {
|
||||
const license = {
|
||||
IsLicensed: 'true',
|
||||
@@ -113,7 +122,7 @@ describe('components/admin_console/license_settings/enterprise_edition/enterpris
|
||||
return n.children().length === 2 &&
|
||||
n.childAt(0).type() === 'span' &&
|
||||
!n.childAt(0).text().includes('ACTIVE') &&
|
||||
n.childAt(0).text().includes('USERS');
|
||||
n.childAt(0).text().includes('LICENSED SEATS');
|
||||
});
|
||||
|
||||
expect(item.text()).toContain('1,000');
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import React, {useMemo} from 'react';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {useDispatch, useSelector} from 'react-redux';
|
||||
import {useHistory} from 'react-router-dom';
|
||||
|
||||
import {getCurrentUser, isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
|
||||
import {GlobalState} from 'types/store';
|
||||
@@ -17,10 +16,9 @@ import {makeGetCategory} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {PreferenceType} from '@mattermost/types/preferences';
|
||||
import {useExpandOverageUsersCheck} from 'components/common/hooks/useExpandOverageUsersCheck';
|
||||
import useOpenSalesLink from 'components/common/hooks/useOpenSalesLink';
|
||||
import {StatTypes, Preferences, AnnouncementBarTypes, ConsolePages} from 'utils/constants';
|
||||
import {StatTypes, Preferences, AnnouncementBarTypes} from 'utils/constants';
|
||||
|
||||
import './overage_users_banner.scss';
|
||||
import useCWSAvailabilityCheck from 'components/common/hooks/useCWSAvailabilityCheck';
|
||||
|
||||
type AdminHasDismissedItArgs = {
|
||||
preferenceName: string;
|
||||
@@ -58,8 +56,6 @@ const OverageUsersBanner = () => {
|
||||
const prefixPreferences = isOver10PercerntPurchasedSeats ? 'error' : 'warn';
|
||||
const prefixLicenseId = (license.Id || '').substring(0, 8);
|
||||
const preferenceName = `${prefixPreferences}_overage_seats_${prefixLicenseId}`;
|
||||
const history = useHistory();
|
||||
const isAirGapped = !useCWSAvailabilityCheck();
|
||||
|
||||
const overageByUsers = activeUsers - seatsPurchased;
|
||||
|
||||
@@ -90,14 +86,7 @@ const OverageUsersBanner = () => {
|
||||
const handleUpdateSeatsSelfServeClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||
e.preventDefault();
|
||||
trackEventFn('Self Serve');
|
||||
|
||||
if (isAirGapped) {
|
||||
window.open(expandableLink(license.Id), '_blank');
|
||||
}
|
||||
|
||||
if (isExpandable) {
|
||||
history.push(`${ConsolePages.LICENSE}?action=show_expansion_modal`);
|
||||
}
|
||||
window.open(expandableLink(license.Id), '_blank');
|
||||
};
|
||||
|
||||
const handleContactSalesClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||
|
||||
@@ -16,13 +16,10 @@ import {savePreferences} from 'mattermost-redux/actions/preferences';
|
||||
import {makeGetCategory} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {PreferenceType} from '@mattermost/types/preferences';
|
||||
import {useExpandOverageUsersCheck} from 'components/common/hooks/useExpandOverageUsersCheck';
|
||||
import {LicenseLinks, StatTypes, Preferences, ConsolePages} from 'utils/constants';
|
||||
import {LicenseLinks, StatTypes, Preferences} from 'utils/constants';
|
||||
|
||||
import './overage_users_banner_notice.scss';
|
||||
import ExternalLink from 'components/external_link';
|
||||
import useControlSelfHostedExpansionModal from 'components/common/hooks/useControlSelfHostedExpansionModal';
|
||||
import {NavLink} from 'react-router-dom';
|
||||
import useCWSAvailabilityCheck from 'components/common/hooks/useCWSAvailabilityCheck';
|
||||
|
||||
type AdminHasDismissedArgs = {
|
||||
preferenceName: string;
|
||||
@@ -56,16 +53,15 @@ const OverageUsersBannerNotice = () => {
|
||||
const prefixLicenseId = (license.Id || '').substring(0, 8);
|
||||
const preferenceName = `${prefixPreferences}_overage_seats_${prefixLicenseId}`;
|
||||
|
||||
const isAirGapped = !useCWSAvailabilityCheck();
|
||||
const overageByUsers = activeUsers - seatsPurchased;
|
||||
const isOverageState = isBetween5PercerntAnd10PercentPurchasedSeats || isOver10PercerntPurchasedSeats;
|
||||
const hasPermission = isAdmin && isOverageState && !isCloud;
|
||||
const {
|
||||
cta,
|
||||
expandableLink,
|
||||
trackEventFn,
|
||||
getRequestState,
|
||||
isExpandable,
|
||||
expandableLink,
|
||||
} = useExpandOverageUsersCheck({
|
||||
shouldRequest: hasPermission && !adminHasDismissed({overagePreferences, preferenceName}),
|
||||
licenseId: license.Id,
|
||||
@@ -73,8 +69,6 @@ const OverageUsersBannerNotice = () => {
|
||||
banner: 'invite modal',
|
||||
});
|
||||
|
||||
const selfHostedExpansionModal = useControlSelfHostedExpansionModal({trackingLocation: 'overage_user_banner_notice'});
|
||||
|
||||
if (!hasPermission || adminHasDismissed({overagePreferences, preferenceName})) {
|
||||
return null;
|
||||
}
|
||||
@@ -102,31 +96,12 @@ const OverageUsersBannerNotice = () => {
|
||||
|
||||
const handleClick = () => {
|
||||
trackEventFn(isExpandable ? 'Self Serve' : 'Contact Sales');
|
||||
if (isExpandable) {
|
||||
selfHostedExpansionModal.open();
|
||||
}
|
||||
};
|
||||
|
||||
if (isAirGapped) {
|
||||
window.open(expandableLink(license.Id), '_blank');
|
||||
}
|
||||
|
||||
if (isExpandable) {
|
||||
return (
|
||||
<NavLink
|
||||
to={`${ConsolePages.LICENSE}?action=show_expansion_modal`}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
>
|
||||
{cta}
|
||||
</NavLink>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ExternalLink
|
||||
className='overage_users_banner__button'
|
||||
href={LicenseLinks.CONTACT_SALES}
|
||||
href={isExpandable ? expandableLink(license.Id) : LicenseLinks.CONTACT_SALES}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{cta}
|
||||
|
||||
@@ -162,7 +162,6 @@ const initialState: DeepPartial<GlobalState> = {
|
||||
license: {
|
||||
SkuName: productName,
|
||||
Sku: productName,
|
||||
SkuName: productName,
|
||||
Users: '50',
|
||||
ExpiresAt: licenseExpiry.valueOf().toString(),
|
||||
},
|
||||
|
||||
Ссылка в новой задаче
Block a user