Skip to content

Commit

Permalink
feat: update the groups dropdown filters data source to enterprise gr…
Browse files Browse the repository at this point in the history
…oups
  • Loading branch information
jajjibhai008 committed Feb 18, 2025
1 parent 32858b5 commit 5285124
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 77 deletions.
6 changes: 3 additions & 3 deletions src/components/Admin/AdminSearchForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class AdminSearchForm extends React.Component {
</option>
{groups.map(group => (
<option
value={group.enterprise_group_uuid}
key={group.enterprise_group_uuid}
value={group.uuid}
key={group.uuid}
>
{group.enterprise_group_name}
{group.name}
</option>
))}
</Form.Control>
Expand Down
84 changes: 14 additions & 70 deletions src/components/Admin/__snapshots__/Admin.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1686,11 +1686,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # cou
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -3348,11 +3344,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # of
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -5010,11 +5002,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders # of
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -6672,11 +6660,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders colla
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -8334,11 +8318,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders full
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -9996,11 +9976,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders inact
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -11658,11 +11634,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders inact
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -13320,11 +13292,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders learn
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -14982,11 +14950,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders regis
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -16644,11 +16608,7 @@ exports[`<Admin /> renders correctly with dashboard analytics data renders top a
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -18355,11 +18315,7 @@ exports[`<Admin /> renders correctly with dashboard insights data renders dashbo
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -20017,11 +19973,7 @@ exports[`<Admin /> renders correctly with enterprise budgets data renders budget
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -21679,11 +21631,7 @@ exports[`<Admin /> renders correctly with enterprise groups data renders groups
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down Expand Up @@ -25153,11 +25101,7 @@ exports[`<Admin /> renders correctly with no dashboard insights data 1`] = `
>
All Groups
</option>
<option
value="7d6503dd-e40d-42b8-442b-37dd4c5450e3"
>
Test Group
</option>
<option />
</select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { fetchPaginatedData } from '../../../../data/services/apiServiceUtils';
* @param {*} queryKey The queryKey from the associated `useQuery` call.
* @returns The enterprise group object
*/
const getAllFlexEnterpriseGroups = async ({ enterpriseId }) => {
export const getAllFlexEnterpriseGroups = async ({ enterpriseId }) => {
const { results } = await fetchPaginatedData(`${LmsApiService.enterpriseGroupListUrl}?enterprise_uuids=${enterpriseId}`);
const flexGroups = results.filter(result => result.groupType === 'flex');
return flexGroups;
Expand Down
6 changes: 3 additions & 3 deletions src/data/actions/enterpriseGroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
FETCH_ENTERPRISE_GROUPS_FAILURE,
CLEAR_ENTERPRISE_GROUPS,
} from '../constants/enterpriseGroups';
import EnterpriseDataApiService from '../services/EnterpriseDataApiService';
import { getAllFlexEnterpriseGroups } from '../../components/learner-credit-management/data/hooks/useAllFlexEnterpriseGroups';

const fetchEnterpriseGroupsRequest = () => ({ type: FETCH_ENTERPRISE_GROUPS_REQUEST });
const fetchEnterpriseGroupsSuccess = data => ({
Expand All @@ -20,9 +20,9 @@ const fetchEnterpriseGroupsFailure = error => ({
const fetchEnterpriseGroups = enterpriseId => (
(dispatch) => {
dispatch(fetchEnterpriseGroupsRequest());
return EnterpriseDataApiService.fetchEnterpriseGroups(enterpriseId)
return getAllFlexEnterpriseGroups({ enterpriseId })
.then((response) => {
dispatch(fetchEnterpriseGroupsSuccess(response.data));
dispatch(fetchEnterpriseGroupsSuccess(response));

Check warning on line 25 in src/data/actions/enterpriseGroups.js

View check run for this annotation

Codecov / codecov/patch

src/data/actions/enterpriseGroups.js#L25

Added line #L25 was not covered by tests
})
.catch((error) => {
logError(error);
Expand Down

0 comments on commit 5285124

Please sign in to comment.