-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: New Private apps limitations (#33316)
* feat: New empty state for upgrading private Apps * chore: Change Marketplace info modal text (#33239) * feat: New tooltips and color behavior for private apps bar (#33243) * feat: New tooltips and behavior for private apps bar * Create brown-pants-press.md * feat: new modal on Private Apps install (#33275) * feat: new modal on Private Apps install * add more variations * Create eleven-rockets-hug.md * chore: change grandfathered modal text (#33291) * chore: Use apps provider to check maxPrivateApps * fix: adds minor fixes to UI and changes requested on review * Update changeset * Replace negative boolean * Refactor `AppsUsageCard` * Add unit test for `AppsUsageCard` * Add unit test for `PrivateEmptyState` * Add unit test for `EnabledAppsCount` * Move tooltip logic away from `useAppsCountQuery` --------- Co-authored-by: Lucas Pelegrino <lucas.pelegrino@icloud.com> Co-authored-by: Tasso <tasso.evangelista@rocket.chat>
- Loading branch information
Showing
30 changed files
with
604 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rocket.chat/meteor": major | ||
"@rocket.chat/i18n": major | ||
--- | ||
|
||
Changes some displays to reflect new rules for private apps and adds a new modal before uploading a private app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
apps/meteor/client/components/GenericResourceUsage/GenericResourceUsageSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/meteor/client/views/admin/subscription/components/InfoTextIconModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 0 additions & 71 deletions
71
apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard.tsx
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
...eor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { mockAppRoot } from '@rocket.chat/mock-providers'; | ||
import { render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
|
||
import AppsUsageCard from './AppsUsageCard'; | ||
|
||
const appRoot = mockAppRoot().withTranslations('en', 'core', { | ||
Apps_InfoText_limited: | ||
'Community workspaces can enable up to {{marketplaceAppsMaxCount}} marketplace apps. Private apps can only be enabled in <1>premium plans</1>.', | ||
Apps_InfoText: | ||
'Community allows up to {{privateAppsMaxCount}} private apps and {{marketplaceAppsMaxCount}} marketplace apps to be enabled', | ||
}); | ||
|
||
it('should render a skeleton if no data', () => { | ||
render(<AppsUsageCard />, { wrapper: appRoot.build(), legacyRoot: true }); | ||
|
||
expect(screen.getByRole('heading', { name: 'Apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('presentation')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render data as progress bars', async () => { | ||
render(<AppsUsageCard privateAppsLimit={{ value: 1, max: 3 }} marketplaceAppsLimit={{ value: 2, max: 5 }} />, { | ||
wrapper: appRoot.build(), | ||
legacyRoot: true, | ||
}); | ||
|
||
expect(screen.getByRole('heading', { name: 'Apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('button', { name: 'Click_here_for_more_info' })).toBeInTheDocument(); | ||
|
||
expect(screen.getByRole('progressbar', { name: 'Marketplace_apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('progressbar', { name: 'Marketplace_apps' })).toHaveAttribute('aria-valuenow', '40'); | ||
expect(screen.getByText('2 / 5')).toBeInTheDocument(); | ||
|
||
expect(screen.getByRole('progressbar', { name: 'Private_apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('progressbar', { name: 'Private_apps' })).toHaveAttribute('aria-valuenow', '33'); | ||
expect(screen.getByText('1 / 3')).toBeInTheDocument(); | ||
|
||
await userEvent.click(screen.getByRole('button', { name: 'Click_here_for_more_info' })); | ||
|
||
expect( | ||
screen.getByText('Community workspaces can enable up to 5 marketplace apps. Private apps can only be enabled in premium plans.'), | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render an upgrade button if marketplace apps reached 80% of the limit', async () => { | ||
render(<AppsUsageCard privateAppsLimit={{ value: 1, max: 3 }} marketplaceAppsLimit={{ value: 4, max: 5 }} />, { | ||
wrapper: appRoot.build(), | ||
legacyRoot: true, | ||
}); | ||
|
||
expect(screen.getByRole('heading', { name: 'Apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('button', { name: 'Click_here_for_more_info' })).toBeInTheDocument(); | ||
|
||
expect(screen.getByRole('button', { name: 'Upgrade' })).toBeInTheDocument(); | ||
|
||
await userEvent.click(screen.getByRole('button', { name: 'Click_here_for_more_info' })); | ||
|
||
expect( | ||
screen.getByText('Community workspaces can enable up to 5 marketplace apps. Private apps can only be enabled in premium plans.'), | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render a full progress bar with private apps disabled', async () => { | ||
render(<AppsUsageCard privateAppsLimit={{ value: 0, max: 0 }} marketplaceAppsLimit={{ value: 2, max: 5 }} />, { | ||
wrapper: appRoot.build(), | ||
legacyRoot: true, | ||
}); | ||
|
||
expect(screen.getByRole('heading', { name: 'Apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('button', { name: 'Click_here_for_more_info' })).toBeInTheDocument(); | ||
|
||
expect(screen.getByRole('progressbar', { name: 'Marketplace_apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('progressbar', { name: 'Marketplace_apps' })).toHaveAttribute('aria-valuenow', '40'); | ||
expect(screen.getByText('2 / 5')).toBeInTheDocument(); | ||
|
||
expect(screen.getByRole('progressbar', { name: 'Private_apps' })).toBeInTheDocument(); | ||
expect(screen.getByRole('progressbar', { name: 'Private_apps' })).toHaveAttribute('aria-valuenow', '100'); | ||
expect(screen.getByText('0 / 0')).toBeInTheDocument(); | ||
|
||
await userEvent.click(screen.getByRole('button', { name: 'Click_here_for_more_info' })); | ||
|
||
expect(screen.getByText('Community allows up to 0 private apps and 5 marketplace apps to be enabled')).toBeInTheDocument(); | ||
}); |
Oops, something went wrong.