diff --git a/src/taxonomy/TaxonomyListPage.jsx b/src/taxonomy/TaxonomyListPage.jsx
index 79ca9982aa..44cf28029c 100644
--- a/src/taxonomy/TaxonomyListPage.jsx
+++ b/src/taxonomy/TaxonomyListPage.jsx
@@ -1,16 +1,39 @@
import React from 'react';
import {
+ Button,
CardView,
Container,
DataTable,
Spinner,
} from '@edx/paragon';
+import {
+ Add,
+} from '@edx/paragon/icons';
import { useIntl } from '@edx/frontend-platform/i18n';
import SubHeader from '../generic/sub-header/SubHeader';
+import { importTaxonomy } from './import-tags';
import messages from './messages';
import TaxonomyCard from './taxonomy-card';
import { useTaxonomyListDataResponse, useIsTaxonomyListDataLoaded } from './data/apiHooks';
+const TaxonomyListHeaderButtons = () => {
+ const intl = useIntl();
+ return (
+ <>
+
+
+ >
+ );
+};
+
const TaxonomyListPage = () => {
const intl = useIntl();
const useTaxonomyListData = () => {
@@ -21,12 +44,6 @@ const TaxonomyListPage = () => {
const { taxonomyListData, isLoaded } = useTaxonomyListData();
- const getHeaderButtons = () => (
- // Download template and import buttons.
- // TODO Add functionality to this buttons.
- undefined
- );
-
const getOrgSelect = () => (
// Organization select component
// TODO Add functionality to this component
@@ -40,7 +57,7 @@ const TaxonomyListPage = () => {
}
hideBorder
/>
diff --git a/src/taxonomy/TaxonomyListPage.test.jsx b/src/taxonomy/TaxonomyListPage.test.jsx
index 8e68347568..4bd0d6d02b 100644
--- a/src/taxonomy/TaxonomyListPage.test.jsx
+++ b/src/taxonomy/TaxonomyListPage.test.jsx
@@ -8,6 +8,7 @@ import initializeStore from '../store';
import TaxonomyListPage from './TaxonomyListPage';
import { useTaxonomyListDataResponse, useIsTaxonomyListDataLoaded } from './data/apiHooks';
+import { importTaxonomy } from './import-tags';
let store;
@@ -16,6 +17,10 @@ jest.mock('./data/apiHooks', () => ({
useIsTaxonomyListDataLoaded: jest.fn(),
}));
+jest.mock('./import-tags', () => ({
+ importTaxonomy: jest.fn(),
+}));
+
const RootWrapper = () => (
@@ -65,4 +70,22 @@ describe('', async () => {
expect(getByTestId('taxonomy-card-1')).toBeInTheDocument();
});
});
+
+ it('calls the import taxonomy action when the import button is clicked', async () => {
+ useIsTaxonomyListDataLoaded.mockReturnValue(true);
+ useTaxonomyListDataResponse.mockReturnValue({
+ results: [{
+ id: 1,
+ name: 'Taxonomy',
+ description: 'This is a description',
+ }],
+ });
+ await act(async () => {
+ const { getByTestId } = render();
+ const importButton = getByTestId('taxonomy-import-button');
+ expect(importButton).toBeInTheDocument();
+ importButton.click();
+ expect(importTaxonomy).toHaveBeenCalled();
+ });
+ });
});
diff --git a/src/taxonomy/import-tags/__mocks__/index.js b/src/taxonomy/import-tags/__mocks__/index.js
new file mode 100644
index 0000000000..ba0b48ccb9
--- /dev/null
+++ b/src/taxonomy/import-tags/__mocks__/index.js
@@ -0,0 +1,2 @@
+export { default as taxonomyImportMock } from './taxonomyImportMock';
+export { default as tagImportMock } from './tagImportMock';
diff --git a/src/taxonomy/import-tags/__mocks__/tagImportMock.js b/src/taxonomy/import-tags/__mocks__/tagImportMock.js
new file mode 100644
index 0000000000..9db45b4a5e
--- /dev/null
+++ b/src/taxonomy/import-tags/__mocks__/tagImportMock.js
@@ -0,0 +1,4 @@
+export default {
+ name: 'Taxonomy name',
+ description: 'Taxonomy description',
+};
diff --git a/src/taxonomy/import-tags/__mocks__/taxonomyImportMock.js b/src/taxonomy/import-tags/__mocks__/taxonomyImportMock.js
new file mode 100644
index 0000000000..9db45b4a5e
--- /dev/null
+++ b/src/taxonomy/import-tags/__mocks__/taxonomyImportMock.js
@@ -0,0 +1,4 @@
+export default {
+ name: 'Taxonomy name',
+ description: 'Taxonomy description',
+};
diff --git a/src/taxonomy/import-tags/data/api.js b/src/taxonomy/import-tags/data/api.js
new file mode 100644
index 0000000000..befb2e977d
--- /dev/null
+++ b/src/taxonomy/import-tags/data/api.js
@@ -0,0 +1,58 @@
+// @ts-check
+import { camelCaseObject, getConfig } from '@edx/frontend-platform';
+import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
+
+const getApiBaseUrl = () => getConfig().STUDIO_BASE_URL;
+
+export const getTaxonomyImportNewApiUrl = () => new URL(
+ 'api/content_tagging/v1/taxonomies/import/',
+ getApiBaseUrl(),
+).href;
+
+/**
+ * @param {number} taxonomyId
+ * @returns {string}
+ */
+export const getTagsImportApiUrl = (taxonomyId) => new URL(
+ `api/content_tagging/v1/taxonomies/${taxonomyId}/tags/import/`,
+ getApiBaseUrl(),
+).href;
+
+/**
+ * Import a new taxonomy
+ * @param {string} taxonomyName
+ * @param {string} taxonomyDescription
+ * @param {File} file
+ * @returns {Promise