Skip to content
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

feat: add import taxonomy feature [FC-0036] #675

Merged
merged 48 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c60c37
feat: add import taxonomy feature
rpenido Nov 9, 2023
c273af1
test: add api.test.js
rpenido Nov 9, 2023
047530d
test: add import button click test
rpenido Nov 9, 2023
303e7ba
test: add action.test.js
rpenido Nov 9, 2023
3955e91
test: add more tests to action.tests.js
rpenido Nov 9, 2023
8176973
test: add more tests to action.tests.js 2
rpenido Nov 9, 2023
4f31714
Merge branch 'openedx:master' into rpenido/fal-3532-import-taxonomy
rpenido Nov 10, 2023
df441fb
fix: import
rpenido Nov 10, 2023
a0e92f0
test: simplify import test
rpenido Nov 10, 2023
dc8ed9e
fix: remove undefined var
rpenido Nov 10, 2023
120154e
refactor: rename actions.js -> utils.js
rpenido Nov 10, 2023
318bbb7
revert: change in the jest.config
rpenido Nov 10, 2023
a8c2fd5
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
pomegranited Nov 16, 2023
70ac2a7
Merge branch 'openedx:master' into rpenido/fal-3532-import-taxonomy
rpenido Nov 20, 2023
adacf23
chore: trigger CD/CI
rpenido Nov 20, 2023
5983953
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
rpenido Nov 20, 2023
7756c7f
feat: import tags to existing taxonomy
rpenido Nov 24, 2023
4202c27
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
rpenido Nov 24, 2023
6bcd924
refactor: merges TaxonomyCardMenu and TaxonomyDetailMenu (#13)
rpenido Nov 30, 2023
f318dfc
refactor: improve menu organization
rpenido Dec 4, 2023
204b2b9
fix: types
rpenido Dec 9, 2023
5e0f599
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
rpenido Dec 12, 2023
f888ecf
refactor: merging conflicts
rpenido Dec 12, 2023
3c8da66
refactor: change export syntax
rpenido Dec 12, 2023
40479c1
fix: eslint
rpenido Dec 12, 2023
46e5d1b
fix: export TaxonomyDetail
rpenido Dec 12, 2023
db8ba58
fix: eslint
rpenido Dec 12, 2023
8fe8c07
Merge branch 'openedx:master' into rpenido/fal-3532-import-taxonomy
rpenido Dec 14, 2023
1440215
fix: TaxonomyContext types
rpenido Dec 15, 2023
e5b8e58
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
rpenido Dec 19, 2023
fafcb9b
chore: rebasing
rpenido Dec 19, 2023
e80194f
fix: types
rpenido Dec 19, 2023
1e0dde3
fix: remove typo
rpenido Dec 19, 2023
7cae57b
test: cleaning test removing useMutation mock
rpenido Dec 19, 2023
1002fc6
style: cleaning code and fix lint
rpenido Dec 19, 2023
fdc74c7
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
rpenido Dec 21, 2023
e9893dc
fix: change expect getBy toThrow pattern to queryBy not.toBeInDocument
rpenido Dec 28, 2023
a8b4197
test: add jest-each
rpenido Dec 28, 2023
a3c40fd
fix: remove getTaxonomyMenuItems function
rpenido Dec 28, 2023
1a31aa9
fix: remove tests from temp code
rpenido Dec 28, 2023
c6d39e5
Merge branch 'openedx:master' into rpenido/fal-3532-import-taxonomy
rpenido Dec 28, 2023
583ab51
test: improve coverage
rpenido Dec 28, 2023
151ba9e
test: refactor import button test
rpenido Dec 29, 2023
df9f2a0
fix: eslint
rpenido Dec 29, 2023
67c42cb
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
rpenido Jan 4, 2024
793810f
fix: errors fixing merge conflicts
rpenido Jan 4, 2024
70954b3
Merge branch 'master' into rpenido/fal-3532-import-taxonomy
pomegranited Jan 7, 2024
68e820d
fixup!: remove jest-each in favour of inbuilt functionality
xitij2000 Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 204 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"glob": "7.2.3",
"husky": "7.0.4",
"jest-canvas-mock": "^2.5.2",
"jest-each": "^29.7.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"jest-each": "^29.7.0",

"react-test-renderer": "17.0.2",
"reactifex": "1.1.1",
"ts-loader": "^9.5.0"
Expand Down
32 changes: 12 additions & 20 deletions src/taxonomy/TaxonomyListPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, useState } from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import {
Button,
Expand All @@ -18,14 +18,15 @@ import {
} from '@edx/paragon/icons';
import { useIntl } from '@edx/frontend-platform/i18n';
import { Helmet } from 'react-helmet';

import { useOrganizationListData } from '../generic/data/apiHooks';
import SubHeader from '../generic/sub-header/SubHeader';
import getPageHeadTitle from '../generic/utils';
import { getTaxonomyTemplateApiUrl } from './data/api';
import { useTaxonomyListDataResponse, useIsTaxonomyListDataLoaded } from './data/apiHooks';
import { importTaxonomy } from './import-tags';
import messages from './messages';
import TaxonomyCard from './taxonomy-card';
import { getTaxonomyTemplateApiUrl } from './data/api';
import { useTaxonomyListDataResponse, useIsTaxonomyListDataLoaded, useDeleteTaxonomy } from './data/apiHooks';
import { useOrganizationListData } from '../generic/data/apiHooks';
import { TaxonomyContext } from './common/context';

const ALL_TAXONOMIES = 'All taxonomies';
const UNASSIGNED = 'Unassigned';
Expand Down Expand Up @@ -65,7 +66,11 @@ const TaxonomyListHeaderButtons = () => {
</Dropdown.Menu>
</Dropdown>
</OverlayTrigger>
<Button iconBefore={Add} disabled>
<Button
iconBefore={Add}
onClick={() => importTaxonomy(intl)}
data-testid="taxonomy-import-button"
>
{intl.formatMessage(messages.importButtonLabel)}
</Button>
</>
Expand Down Expand Up @@ -138,21 +143,8 @@ const OrganizationFilterSelector = ({

const TaxonomyListPage = () => {
const intl = useIntl();
const deleteTaxonomy = useDeleteTaxonomy();
const { setToastMessage } = useContext(TaxonomyContext);
const [selectedOrgFilter, setSelectedOrgFilter] = useState(ALL_TAXONOMIES);

const onDeleteTaxonomy = React.useCallback((id, name) => {
deleteTaxonomy({ pk: id }, {
onSuccess: async () => {
setToastMessage(intl.formatMessage(messages.taxonomyDeleteToast, { name }));
},
onError: async () => {
// TODO: display the error to the user
},
});
}, [setToastMessage]);

Comment on lines -145 to -154
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code went to taxonomy-menu feature

const {
data: organizationListData,
isSuccess: isOrganizationListLoaded,
Expand Down Expand Up @@ -221,7 +213,7 @@ const TaxonomyListPage = () => {
>
<CardView
className="bg-light-400 p-5"
CardComponent={(row) => TaxonomyCard({ ...row, onDeleteTaxonomy })}
CardComponent={(row) => TaxonomyCard(row)}
/>
</DataTable>
)}
Expand Down
Loading