diff --git a/web/client/components/contextcreator/ContextCreator.jsx b/web/client/components/contextcreator/ContextCreator.jsx index eca034740e..9a9a3d1369 100644 --- a/web/client/components/contextcreator/ContextCreator.jsx +++ b/web/client/components/contextcreator/ContextCreator.jsx @@ -246,9 +246,7 @@ export default class ContextCreator extends React.Component { editingAllowedRoles: [] } } - }, - "ContextImport", - "ContextExport" + } ], ignoreViewerPlugins: false, allAvailablePlugins: [], diff --git a/web/client/epics/__tests__/contextcreator-test.js b/web/client/epics/__tests__/contextcreator-test.js index 8b2ab5589a..e464c78b6a 100644 --- a/web/client/epics/__tests__/contextcreator-test.js +++ b/web/client/epics/__tests__/contextcreator-test.js @@ -69,6 +69,7 @@ import { import axios from "../../libs/ajax"; import MockAdapter from "axios-mock-adapter"; import {TOGGLE_CONTROL} from "../../actions/controls"; +import { EXPORT_CONTEXT } from '../../utils/ControlUtils'; describe('contextcreator epics', () => { let mockAxios; @@ -965,7 +966,7 @@ describe('contextcreator epics', () => { it('exportContextEpic, export context with plugins and themes', (done) => { testEpic(exportContextEpic, 1, onContextExport('file.json'), ([a]) => { expect(a.type).toEqual(TOGGLE_CONTROL); - expect(a.control).toEqual("export"); + expect(a.control).toEqual(EXPORT_CONTEXT); done(); }, { map: { diff --git a/web/client/epics/contextcreator.js b/web/client/epics/contextcreator.js index 2d975f6a53..d2ae4b21d1 100644 --- a/web/client/epics/contextcreator.js +++ b/web/client/epics/contextcreator.js @@ -41,6 +41,7 @@ import { upload, uninstall } from '../api/plugins'; import { download, readJson } from "../utils/FileUtils"; import { toggleControl } from "../actions/controls"; import { mapSelector } from "../selectors/map"; +import { EXPORT_CONTEXT } from '../utils/ControlUtils'; const saveContextErrorStatusToMessage = (status) => { switch (status) { @@ -922,7 +923,7 @@ export const exportContextEpic = (action$, { getState }) => "application/json" ]) .do((downloadArgs) => download(...downloadArgs)) - .map(() => toggleControl("export")) + .map(() => toggleControl(EXPORT_CONTEXT)) .catch(() => Rx.Observable.of( error({ diff --git a/web/client/plugins/ContextExport.jsx b/web/client/plugins/ContextExport.jsx index c579591058..d463691219 100644 --- a/web/client/plugins/ContextExport.jsx +++ b/web/client/plugins/ContextExport.jsx @@ -20,7 +20,9 @@ import { onContextExport } from "../actions/contextcreator"; import { toggleControl } from "../actions/controls"; import Message from "../components/I18N/Message"; import Button from "../components/misc/Button"; -const isEnabled = createControlEnabledSelector("export"); +import { EXPORT_CONTEXT } from "../utils/ControlUtils"; + +const isEnabled = createControlEnabledSelector(EXPORT_CONTEXT); const mapStateToProps = createSelector( isEnabled, @@ -32,7 +34,7 @@ const mapStateToProps = createSelector( ); const actions = { - onClose: () => toggleControl("export"), + onClose: () => toggleControl(EXPORT_CONTEXT), onExport: onContextExport }; @@ -58,7 +60,7 @@ const ExportComponent = connect(mapStateToProps, actions)(Component); const ExportButton = connect( createSelector(resourceSelector, (resource) => ({ resource })), { - onExport: () => toggleControl("export") + onExport: () => toggleControl(EXPORT_CONTEXT) } )(({ resource, onExport }) => (