diff --git a/src/header/messages.js b/src/header/messages.js index f9877c75ec..794d83743a 100644 --- a/src/header/messages.js +++ b/src/header/messages.js @@ -91,11 +91,16 @@ const messages = defineMessages({ defaultMessage: 'Import', description: 'Link to Studio Import page', }, - 'header.links.export': { - id: 'header.links.export', - defaultMessage: 'Export', + 'header.links.exportCourse': { + id: 'header.links.exportCourse', + defaultMessage: 'Export Course', description: 'Link to Studio Export page', }, + 'header.links.exportTags': { + id: 'header.links.exportTags', + defaultMessage: 'Export Tags', + description: 'Download course content tags as CSV', + }, 'header.links.checklists': { id: 'header.links.checklists', defaultMessage: 'Checklists', diff --git a/src/header/utils.js b/src/header/utils.js index e019b32147..c1de7e0923 100644 --- a/src/header/utils.js +++ b/src/header/utils.js @@ -65,8 +65,15 @@ export const getToolsMenuItems = ({ studioBaseUrl, courseId, intl }) => ([ }, { href: `${studioBaseUrl}/export/${courseId}`, - title: intl.formatMessage(messages['header.links.export']), - }, { + title: intl.formatMessage(messages['header.links.exportCourse']), + }, + ...(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' + ? [{ + href: `${studioBaseUrl}/api/content_tagging/v1/object_tags/${courseId}/export/`, + title: intl.formatMessage(messages['header.links.exportTags']), + }] : [] + ), + { href: `${studioBaseUrl}/checklists/${courseId}`, title: intl.formatMessage(messages['header.links.checklists']), }, diff --git a/src/header/utils.test.js b/src/header/utils.test.js index 35072db885..afcb5da24d 100644 --- a/src/header/utils.test.js +++ b/src/header/utils.test.js @@ -1,11 +1,11 @@ import { getConfig, setConfig } from '@edx/frontend-platform'; -import { getContentMenuItems } from './utils'; +import { getContentMenuItems, getToolsMenuItems } from './utils'; const props = { studioBaseUrl: 'UrLSTuiO', courseId: '123', intl: { - formatMessage: jest.fn(), + formatMessage: jest.fn(message => message.defaultMessage), }, }; @@ -28,4 +28,32 @@ describe('header utils', () => { expect(actualItems).toHaveLength(4); }); }); + + describe('getToolsMenuItems', () => { + it('should include export tags option', () => { + setConfig({ + ...getConfig(), + ENABLE_TAGGING_TAXONOMY_PAGES: 'true', + }); + const actualItemsTitle = getToolsMenuItems(props).map((item) => item.title); + expect(actualItemsTitle).toEqual([ + 'Import', + 'Export Course', + 'Export Tags', + 'Checklists', + ]); + }); + it('should not include export tags option', () => { + setConfig({ + ...getConfig(), + ENABLE_TAGGING_TAXONOMY_PAGES: 'false', + }); + const actualItemsTitle = getToolsMenuItems(props).map((item) => item.title); + expect(actualItemsTitle).toEqual([ + 'Import', + 'Export Course', + 'Checklists', + ]); + }); + }); });