Skip to content

Commit

Permalink
feat: display warning when plan is expiring
Browse files Browse the repository at this point in the history
  • Loading branch information
zwidekalanga committed Mar 25, 2024
1 parent 135cb6e commit 5750f0d
Show file tree
Hide file tree
Showing 19 changed files with 639 additions and 153 deletions.
11 changes: 11 additions & 0 deletions src/components/Admin/Admin.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ jest.mock('@edx/frontend-enterprise-utils', () => {
});
});

jest.mock('../EnterpriseSubsidiesContext/data/hooks', () => ({
...jest.requireActual('../EnterpriseSubsidiesContext/data/hooks'),
useEnterpriseBudgets: jest.fn().mockReturnValue({
data: [],
}),
}));

const mockStore = configureMockStore([thunk]);
const store = mockStore({
portalConfiguration: {
enterpriseId: 'test-enterprise-id',
enterpriseFeatures: {
topDownAssignmentRealTimeLcm: true,
},
},
table: {},
csv: {},
Expand Down Expand Up @@ -472,6 +482,7 @@ describe('<Admin />', () => {
});
});
});

describe('reset form button', () => {
it('should not be present if there is no query', () => {
const wrapper = mount((
Expand Down
69 changes: 57 additions & 12 deletions src/components/Admin/__snapshots__/Admin.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ exports[`<Admin /> renders correctly calls fetchDashboardAnalytics prop 1`] = `
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -190,6 +193,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # cou
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -825,7 +831,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # cou
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -1057,6 +1063,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # of
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -1692,7 +1701,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # of
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -1924,6 +1933,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # of
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -2559,7 +2571,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # of
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -2791,6 +2803,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders colla
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -3426,7 +3441,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders colla
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -3658,6 +3673,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders full
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -4293,7 +4311,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders full
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -4525,6 +4543,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders inact
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -5160,7 +5181,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders inact
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -5392,6 +5413,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders inact
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -6027,7 +6051,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders inact
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -6259,6 +6283,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders learn
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -6894,7 +6921,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders learn
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -7126,6 +7153,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders regis
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -7761,7 +7791,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders regis
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -7993,6 +8023,9 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders top a
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -8628,7 +8661,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders top a
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -8860,6 +8893,9 @@ exports[`<Admin /> renders correctly with dashboard insights data renders dashbo
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -9544,7 +9580,7 @@ exports[`<Admin /> renders correctly with dashboard insights data renders dashbo
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down Expand Up @@ -9776,6 +9812,9 @@ exports[`<Admin /> renders correctly with error state 1`] = `
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -9930,6 +9969,9 @@ exports[`<Admin /> renders correctly with loading state 1`] = `
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -10145,6 +10187,9 @@ exports[`<Admin /> renders correctly with no dashboard insights data 1`] = `
/>
</div>
</div>
<div
className="mt-4"
/>
<div
className="container-fluid"
>
Expand Down Expand Up @@ -10780,7 +10825,7 @@ exports[`<Admin /> renders correctly with no dashboard insights data 1`] = `
className="col-12 col-md-6 col-xl-4 pt-1 pb-3"
>
Showing data as of
July 31, 2018
August 1, 2018
</div>
<div
className="col-12 col-md-6 col-xl-8"
Expand Down
21 changes: 12 additions & 9 deletions src/components/Admin/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import EmbeddedSubscription from './EmbeddedSubscription';
import { withLocation, withParams } from '../../hoc';
import AIAnalyticsSummary from './AIAnalyticsSummary';
import AIAnalyticsSummarySkeleton from './AIAnalyticsSummarySkeleton';
import BudgetExpiryAlertAndModal from '../BudgetExpiryAlertAndModal/index';

class Admin extends React.Component {
componentDidMount() {
Expand Down Expand Up @@ -308,6 +309,9 @@ class Admin extends React.Component {
<>
<Helmet title="Learner Progress Report" />
<Hero title="Learner Progress Report" />
<div className="mt-4">
<BudgetExpiryAlertAndModal />
</div>
<div className="container-fluid">
<div className="row mt-4">
<div className="col">
Expand Down Expand Up @@ -367,22 +371,21 @@ class Admin extends React.Component {
<div className="col-12 col-md-6 col-xl-4 pt-1 pb-3">
{lastUpdatedDate
&& (
<>
Showing data as of {formatTimestamp({ timestamp: lastUpdatedDate })}
</>
<>
Showing data as of {formatTimestamp({ timestamp: lastUpdatedDate })}
</>
)}

</div>
<div className="col-12 col-md-6 col-xl-8">
{this.renderDownloadButton()}
</div>
</div>
{this.displaySearchBar() && (
<AdminSearchForm
searchParams={searchParams}
searchEnrollmentsList={() => this.props.searchEnrollmentsList()}
tableData={this.getTableData() ? this.getTableData().results : []}
/>
<AdminSearchForm
searchParams={searchParams}
searchEnrollmentsList={() => this.props.searchEnrollmentsList()}
tableData={this.getTableData() ? this.getTableData().results : []}
/>
)}
</>
)}
Expand Down
3 changes: 3 additions & 0 deletions src/components/BudgetExpiryAlertAndModal/data/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const PLAN_EXPIRY_MODAL_TITLE = 'Plan expiry model';

export const SEEN_ENTERPRISE_EXPIRATION_MODAL_COOKIE_PREFIX = 'seen-enterprise-expiration-modal-';
Loading

0 comments on commit 5750f0d

Please sign in to comment.