diff --git a/src/header/messages.js b/src/header/messages.js index 075e264857..37da407941 100644 --- a/src/header/messages.js +++ b/src/header/messages.js @@ -93,6 +93,11 @@ const messages = defineMessages({ }, 'header.links.export': { id: 'header.links.export', + defaultMessage: 'Export', + description: 'Link to Studio Export page', + }, + 'header.links.exportCourse': { + id: 'header.links.exportCourse', defaultMessage: 'Export Course', description: 'Link to Studio Export page', }, diff --git a/src/header/utils.js b/src/header/utils.js index 7e62a95cf4..ede6bfbe4b 100644 --- a/src/header/utils.js +++ b/src/header/utils.js @@ -64,13 +64,19 @@ export const getToolsMenuItems = ({ studioBaseUrl, courseId, intl }) => ([ title: intl.formatMessage(messages['header.links.import']), }, { - href: `${studioBaseUrl}/export/${courseId}`, - title: intl.formatMessage(messages['header.links.export']), - }, - { - href: `${studioBaseUrl}/api/content_tagging/v1/object_tags/${courseId}/export/`, - title: intl.formatMessage(messages['header.links.exportTags']), + href: `${studioBaseUrl}/import/${courseId}`, + title: intl.formatMessage( + getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' + ? messages['header.links.exportCourse'] + : messages['header.links.export'] + ), }, + ...(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..5642522793 100644 --- a/src/header/utils.test.js +++ b/src/header/utils.test.js @@ -1,5 +1,5 @@ import { getConfig, setConfig } from '@edx/frontend-platform'; -import { getContentMenuItems } from './utils'; +import { getContentMenuItems, getToolsMenuItems } from './utils'; const props = { studioBaseUrl: 'UrLSTuiO', @@ -28,4 +28,22 @@ describe('header utils', () => { expect(actualItems).toHaveLength(4); }); }); + describe('getToolsMenuItems', () => { + it('should include export tags option', () => { + setConfig({ + ...getConfig(), + ENABLE_TAGGING_TAXONOMY_PAGES: 'true', + }); + const actualItems = getToolsMenuItems(props); + expect(actualItems).toHaveLength(4); + }); + it('should not include export tags option', () => { + setConfig({ + ...getConfig(), + ENABLE_TAGGING_TAXONOMY_PAGES: 'false', + }); + const actualItems = getToolsMenuItems(props); + expect(actualItems).toHaveLength(3); + }); + }); });