-
Notifications
You must be signed in to change notification settings - Fork 562
feat(usage): show when an organisation is over its plan limit #8432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
fa6d6bb
ad90ce4
38f706c
adff61a
8f700fa
adeb660
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { isAllowedWhileBlocked } from 'web/routePaths' | ||
|
|
||
| // App renders <Blocked /> wherever this is false, so a wrong answer either | ||
| // locks a blocked organisation out, or lets it back in. | ||
| describe('isAllowedWhileBlocked', () => { | ||
| it.each` | ||
| pathname | allowed | ||
| ${'/organisation/7528/usage'} | ${true} | ||
| ${'/organisations'} | ${true} | ||
| ${'/organisation/7528/projects'} | ${false} | ||
| ${'/organisation/7528/settings'} | ${false} | ||
| ${'/organisation-settings'} | ${false} | ||
| ${'/project/1/environment/abc/features'} | ${false} | ||
| ${'/account'} | ${false} | ||
| `( | ||
| '$pathname is reachable while blocked: $allowed', | ||
| ({ allowed, pathname }) => { | ||
| expect(isAllowedWhileBlocked(pathname)).toBe(allowed) | ||
| }, | ||
| ) | ||
|
|
||
| // Allowed by pattern, not by prefix. | ||
| it('does not open anything nested under the usage page', () => { | ||
| expect(isAllowedWhileBlocked('/organisation/7528/usage/breakdown')).toBe( | ||
| false, | ||
| ) | ||
| }) | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,9 @@ import Announcement from './Announcement' | |
| import { getBuildVersion } from 'common/services/useBuildVersion' | ||
| import AccountProvider from 'common/providers/AccountProvider' | ||
| import Nav from './navigation/Nav' | ||
| import { isAllowedWhileBlocked } from 'web/routePaths' | ||
| import 'project/darkMode' | ||
|
|
||
| const App = class extends Component { | ||
| static propTypes = { | ||
| children: propTypes.element.isRequired, | ||
|
|
@@ -271,9 +273,8 @@ const App = class extends Component { | |
| const environmentId = this.getEnvironmentId(this.props) | ||
|
|
||
| if ( | ||
| AccountStore.getOrganisation() && | ||
| AccountStore.getOrganisation().block_access_to_admin && | ||
| pathname !== '/organisations' | ||
| AccountStore.getOrganisation()?.block_access_to_admin && | ||
| !isAllowedWhileBlocked(pathname) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Major · ⚡ Quick win Cover the restricted-route exception. Observed: the only added tests are pure
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not adding it here:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This remains open. The changed guard imports
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracked in #8456, which moves the route table into a module that imports no components and brings the test with it. Kept separate because it touches the file every page depends on. Not blocking this one.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not fixed. This PR still changes the blocked-route guard at
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not fixed:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't render it here:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not fixed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right and I was wrong to say it could not be rendered: the repo runs Playwright with a real e2e suite. No test there sets organisation-level flags yet, so it needs new setup rather than a new stack. Tracking it rather than doing it in this PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not fixed. |
||
| ) { | ||
| return <Blocked /> | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.